LIST 3 7.TXT

From Atari Wiki
Revision as of 23:56, 16 December 2023 by Olivier.jan (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  **********************************************************************
  *                                                                    *
  *               68000 ASSEMBLER COURSE ON ATARI ST                   *
  *                                                                    *
  *                   by The Fierce Rabbit (from 44E)                  *
  *                                                                    *
  *                  Listing number 3 / Course number                  *
  *                                                                    *
  **********************************************************************

  * Clears the screen by displaying escape+E with GEMDOS 9
   MOVE.L   #CLS,-(SP)
   MOVE.W   #9,-(SP)
   TRAP   #1
   ADDQ.L   #6,SP
   
   MOVEA.L   #TXT_FINAL,A6   address of txt_final in A6
PROCHAINE   MOVE.B   #255,LETTRE     initializes the letter
   ADD.B   #1,COLONE       and changes column
   MOVE.B   (A6)+,D6   retrieves a letter and points to the next one
   CMP.B   #0,D6      end of text to display?
   BEQ   FIN        yes -> end
   
DISPLAY   MOVE.L   #TXT,-(SP) displays the letter
   MOVE.W   #9,-(SP)   gemdos 9 since the letter is included
   TRAP   #1     in a sentence (escape+Y...)
   ADDQ.L   #6,SP
   
   CMP.B   LETTRE,D6  was this letter the right one?
   BEQ   PROCHAINE  yes so move on to the next one
   
   SUB.B   #1,LETTRE   no so start over
   BRA   DISPLAY
   
END   MOVE.W   #7,-(SP)    waits for a key press
   TRAP   #1
   ADDQ.L   #2,SP
   
   MOVE.W   #0,-(SP)   and bye bye!
   TRAP   #1
*----------------------------------------------*
   SECTION DATA
CLS   DC.B   27,"E",0     
   EVEN
TXT   DC.B   27,"Y",42
COLUMN   DC.B   42
LETTER   DC.B   0,0
TXT_FINAL   DC.B   "FEROCIOUS RABBIT",0

Back to ASM_Tutorial