Newbas assembler help

Home › Forums › Emulator › Assembler › Newbas assembler help

  • Creator
    Topic
  • #3883
    rcmolina
    Participant
    • Topics: 2
    • Replies: 2
    • Total posts: 4
      Up
      0
      Down
      ::

      Hi my Friends,

      I’ve been playing a little bit, and finally I could assembler this Code

      10 ORG 16384

      20 LD A,1

      30 XOR A

      40 END

      ASSEMBLE

      ¿Any help for commands, in particular for loading/saving binary and source code?

      _

      Rafa

    Viewing 2 reply threads
    • Author
      Replies
      • #3884
        CDesp
        Keymaster
        • Topics: 15
        • Replies: 31
        • Total posts: 46
          Up
          0
          Down
          ::

          Hi,

          you can use the built in assembler of the emulator to put the code straight to memory.
          That is good for testing and fast development.
          For Newbas from what i remember you have to save the object file to disk or tape and then make a small
          basic loader to put the bytes to memory.
          Something like this ( i am doing this from memory so some mistakes my exist):
          tape must be at the start of the file, usually the loader precedes the object file, filename is optional
          10 Openin#1,1,”Filename.o”
          15 k=16384:n=<your filesize>
          20 for i=1 to n
          30 get#1,a:poke k,a:k=k+1
          40 next i
          45 close#1
          50 call 16384: Rem if you want to execute the code
          100 end

          for disk change line 10 to
          10 openin#9,9,”filename.o”
          filename is required

        • #3885
          rcmolina
          Participant
          Topic Author
          • Topics: 2
          • Replies: 2
          • Total posts: 4
            Up
            0
            Down
            ::

            Thanks CDesp,

            Very helpful. After assemblig I get a message showing tape is ready.

            First I’ll have to struggle to check how to save,  I suppose then there is not a guide / list of commands for Newbas assembler.

            _

            Rafa

          • #3888
            CDesp
            Keymaster
            • Topics: 15
            • Replies: 31
            • Total posts: 46
              Up
              0
              Down
              ::

              From gemini so …

              Type ASM to assemble the code.

              Save the source listing: SAVE “MYSRC”

              Save the compiled binary output (6 bytes starting at 8000H): BSAVE “MYBIN”, &H8000, 6

              1. Saving & Loading Commands
              NEWBAS handles saving depending on whether you are saving raw memory (compiled Z80 machine code), the assembler source code, or saving within BASIC.

              Saving Compiled Machine Code (Binary)
              To save assembled machine code directly from RAM to cassette tape or disk:

              BSAVE “filename”, start_address, length

              Description: Saves a binary block of RAM.

              Example: BSAVE “MYCODE”, &H8000, &H0100 (Saves 256 bytes starting at hexadecimal address 8000).

              Saving Assembler Source Code
              If your assembly listing was written line-by-line within NEWBAS or as text lines:

              SAVE “filename”

              Description: Saves the source program currently in memory to cassette tape or the default drive.

              SAVE “filename”, D1

              Description: Saves the source program specifically to disk drive 1 (D1).

              Loading Code & Source
              BLOAD “filename”, [start_address]

              Description: Loads a binary machine-code file into memory at its original address (or optionally at an offset starting address).

              LOAD “filename”

              Description: Loads a source code assembly/NEWBAS listing back into memory.

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.