mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-27 12:49:27 +00:00
9849dbb5ea
items in disk folder will be updated automatically, whereas items in the source folder will be updated periodically due to having to manually sort through files to copy and paste
93 lines
2.6 KiB
Plaintext
93 lines
2.6 KiB
Plaintext
*``````````````````````````````*
|
|
* DELAYMS :: DELAY X MILLISECS *
|
|
*- -*
|
|
* DELAYS FOR X NUMBER OF *
|
|
* MILLISECONDS BY LOOPING *
|
|
* THROUGH PRECISELY CALCULATED *
|
|
* NUMBER OF CYCLES. *
|
|
*- -*
|
|
* CLOBBERS: *
|
|
* *
|
|
* FLAGS: ????---- REG: -XY- *
|
|
*- -*
|
|
* CYCLES: ??? *
|
|
* SIZE: *
|
|
*- -*
|
|
* USAGE: *
|
|
* *
|
|
* LDY #250 ;1/4 SEC *
|
|
* JSR DELAYMS *
|
|
*- -*
|
|
* ENTRY *
|
|
* *
|
|
* Y = NUMBER OF MILLISECONDS *
|
|
*- -*
|
|
* EXIT *
|
|
* *
|
|
* Y = COUNTER; TRASH *
|
|
* X = COUNTER; TRASH *
|
|
* A = UNCHANGED *
|
|
*- -*
|
|
* ADAPTED FROM LEVANTHAL AND *
|
|
* WINTHROP'S /6502 ASSEMBLY *
|
|
* LANGUAGE ROUTINES/. *
|
|
* AS SUCH, THIS MAY NOT FALL *
|
|
* UNDER THE APACHE 2.0 LICENSE *
|
|
* AGREEMENT, SINCE THE BOOK *
|
|
* WAS WRITTEN BEFORE THE *
|
|
* LICENSE! *
|
|
* *
|
|
* THAT SAID, LEVENTHAL WROTE *
|
|
* THAT THE PURPOSE OF THE BOOK *
|
|
* WAS TO COPY THE SOURCE CODE, *
|
|
* AS REINVENTING THE WHEEL IS *
|
|
* TEDIOUS, AND HE PLACED NO *
|
|
* RESTRICTIONS ON ITS USE. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
DELAYMS
|
|
*
|
|
MSCNT EQU $0CA ; 202 TIMES THROUGH DELAY1
|
|
; SPECIFIC TO 1.23 MHZ
|
|
; SPEED OF APPLE II
|
|
:DELAY
|
|
CPY #0 ; 2 CYCLES
|
|
BEQ :EXIT ; 2C (EXIT IF DEL=0)
|
|
NOP ; 2 CYCLES (MAKE OVERHEAD=25C)
|
|
*
|
|
** IF DELAY IS 1MS THEN GOTO LAST1
|
|
** THIS LOGIC IS DESIGNED TO BE
|
|
** 5 CYCLES THROUGH EITHER ATH
|
|
*
|
|
CPY #1 ; 2 CYCLES
|
|
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
|
|
JMP :LAST1 ; 3C
|
|
*
|
|
** DELAY 1 MILLISENCOND TIMES (Y-1)
|
|
*
|
|
:DELAYA
|
|
DEY ; 2C (PREDEC Y)
|
|
:DELAY0
|
|
LDX #MSCNT ; 2C
|
|
:DELAY1
|
|
DEX ; 2C
|
|
BNE :DELAY1 ; 3C
|
|
NOP ; 2C
|
|
NOP ; 2C
|
|
DEY ; 2C
|
|
BNE :DELAY0 ; 3C
|
|
:LAST1
|
|
*
|
|
** DELAY THE LAST TIME 25 CYCLES
|
|
** LESS TO TAKE THE CALL, RETURN,
|
|
** AND ROUTINE OVERHEAD INTO
|
|
** ACCOUNT.
|
|
*
|
|
LDX #MSCNT-3 ; 2C
|
|
:DELAY2
|
|
DEX ; 2C
|
|
BNE :DELAY2 ; 3C
|
|
:EXIT
|
|
RTS ; 6C
|
|
*
|