mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-27 12:49:27 +00:00
03636aa196
- various bugfixes - integrated required library - created minified sources - made macros slightly more flexible
236 lines
4.6 KiB
Plaintext
236 lines
4.6 KiB
Plaintext
*
|
|
JMP ENDVARS
|
|
*
|
|
*``````````````````````````````*
|
|
* REQUIRED.LIB *
|
|
*- -*
|
|
* GLOBAL ROUTINES AND *
|
|
* VARIABLES EITHER USED BY THE *
|
|
* LIBRARY OR PROVIDED FOR DEMO *
|
|
* USE OR DEBUGGING PURPOSES. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
********************************
|
|
* *
|
|
* GLOBAL ROUTINES *
|
|
* *
|
|
********************************
|
|
*
|
|
*``````````````````````````````*
|
|
* __GETRET: GET RETURN *
|
|
*- -*
|
|
* COPIES THE DATA IN [RETURN] *
|
|
* TO THE SPECIFIED LOCATION. *
|
|
* LENGTH IS DETERMINED BY *
|
|
* VALUE OF RETLEN. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
__GETRET
|
|
*
|
|
LDY #255
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
*
|
|
:LP
|
|
INY
|
|
LDA RETURN,Y
|
|
STA (ADDR1),Y
|
|
CPY RETLEN
|
|
BNE :LP
|
|
LDA ADDR1+1
|
|
PHA
|
|
LDA ADDR1
|
|
PHA
|
|
RTS
|
|
*
|
|
*``````````````````````````````*
|
|
* __SETPARM: SET PARAMETER *
|
|
*- -*
|
|
* COPIES DATA FROM SPECIFIED *
|
|
* ADDRESS TO THE [PARAM] *
|
|
* LOCATION FOR PASSING TO *
|
|
* A ROUTINE. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
__SETPARM
|
|
*
|
|
LDY #255
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
*
|
|
:LP
|
|
INY
|
|
LDA (ADDR1),Y
|
|
STA PARAM,Y
|
|
CPY PARLEN
|
|
BNE :LP
|
|
LDA ADDR1+1
|
|
PHA
|
|
LDA ADDR1
|
|
PHA
|
|
RTS
|
|
*
|
|
*``````````````````````````````*
|
|
* __DUMP: DUMP DATA *
|
|
*- -*
|
|
* OUTPUTS DATA LOCATED AT THE *
|
|
* SPECIFIED ADDRESS IN HEX *
|
|
* FORMAT FOR SPECIFIED NUMBER *
|
|
* OF BYTES. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
__DUMP
|
|
*
|
|
PLA
|
|
STA :RET
|
|
PLA
|
|
STA :RET+1
|
|
PLA
|
|
STA :LENGTH
|
|
PLA
|
|
STA ADDR3
|
|
PLA
|
|
STA ADDR3+1
|
|
*
|
|
LDA #$8D
|
|
JSR $FDF0
|
|
LDA ADDR3+1
|
|
AND #$F0
|
|
LSR
|
|
LSR
|
|
LSR
|
|
LSR
|
|
TAX
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDA ADDR3+1
|
|
AND #$0F
|
|
TAX
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDA ADDR3
|
|
AND #$F0
|
|
LSR
|
|
LSR
|
|
LSR
|
|
LSR
|
|
TAX
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDA ADDR3
|
|
AND #$0F
|
|
TAX
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDA #186 ; :
|
|
JSR $FDF0
|
|
LDA #160 ; SPC
|
|
JSR $FDF0
|
|
*
|
|
LDY #0
|
|
:LP
|
|
LDA (ADDR3),Y
|
|
AND #$F0 ; MASK RIGHT
|
|
LSR
|
|
LSR
|
|
LSR
|
|
LSR
|
|
STA :LEFT
|
|
LDA (ADDR3),Y
|
|
AND #$0F ; MASK LEFT
|
|
STA :RIGHT
|
|
LDX :LEFT
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDX :RIGHT
|
|
LDA :HEXTAB,X
|
|
JSR $FDF0
|
|
LDA #160
|
|
JSR $FDF0
|
|
INY
|
|
CPY :LENGTH
|
|
BNE :LP
|
|
*
|
|
*LDA #$8D
|
|
*JSR $FDF0
|
|
LDA :RET+1
|
|
PHA
|
|
LDA :RET
|
|
PHA
|
|
*
|
|
RTS
|
|
*
|
|
:RET DS 2
|
|
:RIGHT DS 1
|
|
:LEFT DS 1
|
|
:LENGTH DS 1
|
|
:HEXTAB ASC "0123456789ABCDEF"
|
|
*
|
|
*``````````````````````````````*
|
|
* __P: PRINT FOLLOWING ASC *
|
|
*- -*
|
|
* THIS IS THE XPRINT ROUTINE *
|
|
* FROM STDIO.LIB, BUT STRIPPED *
|
|
* OF COMMENTS. FOR DEBUG. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
__P
|
|
PLA
|
|
STA ADDR1
|
|
PLA
|
|
STA ADDR1+1
|
|
LDY #1
|
|
:LP LDA (ADDR1),Y
|
|
BEQ :DONE
|
|
JSR $FDF0
|
|
INY
|
|
BNE :LP
|
|
:DONE CLC
|
|
TYA
|
|
ADC ADDR1
|
|
STA ADDR1
|
|
LDA ADDR1+1
|
|
ADC #0
|
|
PHA
|
|
LDA ADDR1
|
|
PHA
|
|
RTS
|
|
*
|
|
*``````````````````````````````*
|
|
* __W: WAIT FOR KEYPRESS *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
__W
|
|
JSR $FD0C
|
|
RTS
|
|
*
|
|
********************************
|
|
* *
|
|
* GLOBAL VARIABLES *
|
|
* *
|
|
********************************
|
|
*
|
|
** 256 BYTES DEDICATED TO RETURN
|
|
** VALUES OF VARIABLE LENGTH; CAN BE
|
|
** MODIFIED TO SUIT SMALLER OR LARGER
|
|
** NEEDS.
|
|
*
|
|
*
|
|
RETLEN DS 1 ; RETURN VALUE BYTE LENGTH
|
|
RETURN DS 256
|
|
*
|
|
** 256 BYTE VALUE DEDICATED TO LARGE
|
|
** OR VARIABLE LENGTH PARAMETERS. THIS
|
|
** CAN ALSO BE CHANGED TO FIT SMALLER OR
|
|
** LARGER BOUNDS.
|
|
*
|
|
PARLEN DS 1
|
|
PARAM DS 256
|
|
*
|
|
ENDVARS
|
|
*
|