* Ex_Long_Delay.ASM *12456789012345678901245678901234567890124567890123456789 #INCLUDE 'A:\VAR_DEF.ASM' * Define program variables ORG DATA DELAY RMB 1 * Start main program ORG PROGRAM START LDX #REGBAS JSR DLAY_SR SWI * Delay subroutine * This subroutine performs a delay action using TOC1 * The $XX length of the delay is put in the higher part * of AccD, while the lower part is filled with 00. * When the number of cycles $XX00 have elapsed, the S/R * returns. DLAY_SR LDAA #%10000000 ; Clear OC1F ORAA TFLG1,X ; Preserve other bits in TFLG1 STAA TFLG1,X LDAA DELAY ; put DELAY in higher D LDAB #$00 ; put 00 in lower D ADDD TCNT,X ; STD TOC1,X LABEL5 LDAA TFLG1,X ; Check OC1F and step in place ANDA #%10000000 BEQ LABEL5 RTS ORG RESET ; reset vector FDB START ; set to start of program