LISTING2.TXT

From Atari Wiki
Revision as of 23:51, 16 December 2023 by Olivier.jan (talk | contribs) (Replacing content of with translated version)
Jump to navigation Jump to search
   ******************************************************************
   *                                                                *
   *             ASSEMBLER COURSE 68000 ON ATARI ST                 *
   *                                                                *
   *                 by The Ferocious Rabbit (from 44E)             *
   *                                                                *
   *                        Second series                           *
   *                                                                *
   *                        Listing number 2                        *
   *                                                                *
   ******************************************************************
         INCLUDE   "D:\START.S"

         MOVE.L    #MESSAGE,-(SP)    introductory message
         MOVE.W    #9,-(SP)
         TRAP      #1
         ADDQ.L    #6,SP 

TOUCHE   MOVE.W    #7,-(SP)          waiting for a key press
         TRAP      #1
         ADDQ.L    #2,SP
         SWAP      D0                to get the scan code

         CMP.W     #1,D0             escape?
         BEQ       END               yes so bye bye
         CMP.W     #$3B,D0           compared to F1
         BCS       TOUCHE            below so not valid
         CMP.W     #$44,D0           compared to F10
         BHI       TOUCHE            above so not valid

* The key is valid
         ADD.W     #6,D0             to get ASCII of A,B,C...
         MOVE.W    D0,-(SP)          display
         MOVE.W    #2,-(SP)
         TRAP      #1
         ADDQ.L    #4,SP
         BRA       TOUCHE            and we start over
         
END      CLR.W     -(SP)
         TRAP      #1
*--------------------------------------------------*
         SECTION DATA
MESSAGE  DC.B      27,"E","PRESS A FUNCTION KEY",13,10
         DC.B      "ESCAPE TO EXIT",13,10,0
         SECTION BSS
         DS.L      256
STACK    DS.L      1
         END

Back to ASM_Tutorial