Simple programa to print a char on the screen

Home › Forums › Emulator › Assembler › Simple programa to print a char on the screen

  • Creator
    Topic
  • #3895
    rcmolina
    Participant
    • Topics: 3
    • Replies: 6
    • Total posts: 9
      Up
      0
      Down
      ::

      Hi,

      Need some help for  assembler code to print a character on the screen using the built-in assembler on the emulator.

      _

      Rafa

       

    Viewing 1 reply thread
    • Author
      Replies
      • #3896
        CDesp
        Keymaster
        • Topics: 15
        • Replies: 32
        • Total posts: 47
          Up
          0
          Down
          ::

          Hi,

          Org 6000h

          WPTCHAR EQU $3CDF

          ld a,’A’
          DEFW WPTCHAR
          ret

           

          this uses the newbrain OS to print a char on the screen

          if you want to print at a specified location use this

          Org 6000h

          WPTCHAR EQU $3CDF

          ld a,22
          DEFW WPTCHAR
          ld a,10    ;X = Column
          DEFW WPTCHAR
          ld a,15   ; Y= Row
          DEFW WPTCHAR

          ld a,’A’
          DEFW WPTCHAR
          ret

          Usefull screen codes

          22,x,y

          31 ;Clear screen

           

          For built in assembler write the code to source. Click Compile then next to this button the RAM button will put the object code to ram. Next call 24576 to run.

          if you click put object in file then a file names <youfilename>.txt will be created that will have the basic code to run the code like this

          10 Reserve top-24576
          20 For i=0 to 16
          30 Read a:poke 24576+i,a
          40 next i
          50 ?”type CALL TOP to run your code.”
          100 END
          10000 DATA 62,22,223,60,62,10,223,60,62,15

          also a <filename>.blst like this

          5) 6000 3E 16 ld a,22 ;
          6) 6002 DF 3C DEFW WPTCHAR ;
          7) 6004 3E 0A ld a,10 ;
          8) 6006 DF 3C DEFW WPTCHAR ;
          9) 6008 3E 0F ld a,15 ;
          10) 600A DF 3C DEFW WPTCHAR ;
          12) 600C 3E 41 ld a,’A’ ;
          13) 600E DF 3C DEFW WPTCHAR ;
          14) 6010 C9 ret ;

          and ofcourse the <filename>.bin that have the raw bytes.

          The <filename>.GSYM contains the global symbols if you declared any, so you can include it to another source file if you want.

          you can declare globals at the start of the source file usually for projects

          GLOBAL <name>

          GLOBAL test

          test equ 45 or

          test: xor a

          ret

          OR


          @test
          equ 45


          @test
          : xor a

           

           

          • This reply was modified 8 hours, 24 minutes ago by CDesp.
          • This reply was modified 8 hours, 23 minutes ago by CDesp.
        • #3899
          rcmolina
          Participant
          Topic Author
          • Topics: 3
          • Replies: 6
          • Total posts: 9
            Up
            0
            Down
            ::

            Hi CDesp,

            Many thanks for your complete answer 😉

            –

            Rafa

        Viewing 1 reply thread
        • You must be logged in to reply to this topic.