LIST 1 7.TXT

From Atari Wiki
Revision as of 23:36, 16 December 2023 by Olivier.jan (talk | contribs) (Replacing content of with translated version)
Jump to navigation Jump to search
  ******************************************************************
  *                                                                *
  *              68000 ASSEMBLER COURSE ON ATARI ST                *
  *                                                                *
  *                     by The Fierce Rabbit (from 44E)            *
  *                                                                *
  *                  Listing number 1 / Course number 7            *
  *                                                                *
  ******************************************************************

  START         MOVE.L    #MENU,-(SP)    pass address of sentence
                MOVE.W    #9,-(SP)       function number
                TRAP      #1             Gemdos call
                ADDQ.L    #6,SP          stack correction

  * wait for key press
                MOVE.W    #7,-(SP)       function number 7
                TRAP      #1             Gemdos call
                ADDQ.L    #2,SP          stack correction

  * test the result
                CMP.W     #"Q",D0        capital Q?
                BEQ       QUIT           yes, bye bye
                CMP.W     #"q",D0        lowercase q?
                BEQ       QUIT           yes, bye bye
                CMP.W     #"V",D0        capital V?
                BEQ       DISPLAY        yes -> display the message
                CMP.W     #"v",D0        lowercase v?
                BNE       START          no. So we have another letter
  * as a response. It's not valid, so we start again from the beginning

  DISPLAY       MOVE.L    #MESSAGE,-(SP) address of 'hello'
                MOVE.W    #9,-(SP)       function number
                TRAP      #1             Gemdos call
                ADDQ.L    #6,SP          stack correction
  * We wait for a key press to contemplate
                MOVE.W    #7,-(SP)
                TRAP      #1
                ADDQ.L    #2,SP
                BRA       START          return to the beginning

  QUIT          MOVE.W    #0,-(SP)
                TRAP      #1

      SECTION DATA

  MENU          DC.B 27,"E",27,"p"
                DC.B "QUIT (Q) OR SEE THE MESSAGE (V)?"
                DC.B 27,"q",13,10,0
                EVEN
  MESSAGE       DC.B "HELLO",0

Back to ASM_Tutorial