mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-04 10:51:10 +00:00
12a0b19398
- added some error control - added initial jump table - fixed a few minor bugs - separated common library into separate subroutine files
168 lines
3.5 KiB
Plaintext
168 lines
3.5 KiB
Plaintext
********************************
|
|
* *
|
|
********************************
|
|
*
|
|
*``````````````````````````````*
|
|
* REQUIRED.MAC *
|
|
*- -*
|
|
* MACROS USED FOR CORE UTILS *
|
|
* AND LIBRARY ROUTINES. NOTE *
|
|
* THAT THE LIBRARIES DO NOT *
|
|
* USE THESE MACROS, BUT MAY *
|
|
* USE THE ROUTINES. THESE ARE *
|
|
* MERELY PROVIDED FOR THE SAKE *
|
|
* OF CONVENIENCE. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
*``````````````````````````````*
|
|
* _ISLIT: DETERMINES WHETHER A *
|
|
* PARAM IS LITERAL OR *
|
|
* NOT, AND CHANGES *
|
|
* APPROPRIATELY. FOR *
|
|
* MACRO USE ONLY. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_ISLIT MAC
|
|
IF #=]1 ; IF ]1 IS A LITERAL
|
|
LDA ]1/$100 ; GET HI
|
|
PHA
|
|
LDA ]1 ; GET LO
|
|
PHA
|
|
ELSE ; ]1 IS ADDRESS
|
|
LDA ]1+1 ; SO GET HIGH VAL FROM ADDR
|
|
PHA
|
|
LDA ]1 ; THEN LO VAL
|
|
PHA
|
|
FIN
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _ISSTR: DETERMINES WHETHER A *
|
|
* PARAM IS A STRING OR *
|
|
* NOT, AND CHANGES *
|
|
* APPROPRIATELY. FOR *
|
|
* MACRO USE ONLY. *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_ISSTR MAC
|
|
IF "=]1 ; IF ]1 IS A STRING
|
|
*
|
|
** STORE STRING AT TEMP ADDRESS, THEN
|
|
** PUSH TEMP ADDRESS
|
|
*
|
|
JMP STRCONT
|
|
]STRTMP STR ]1
|
|
STRCONT
|
|
LDY #0
|
|
LDA ]STRTMP
|
|
STA PARLEN
|
|
STA PARAM
|
|
]STRLP1
|
|
INY
|
|
LDA ]STRTMP,Y
|
|
STA PARAM,Y
|
|
CPY PARLEN
|
|
BNE ]STRLP1
|
|
*
|
|
LDA #>PARAM ; GET HI
|
|
PHA
|
|
LDA #<PARAM ; GET LO
|
|
PHA
|
|
ELSE ; ]1 IS ADDRESS
|
|
LDA #>]1 ; SO GET HIBYTE OF ADDR
|
|
PHA
|
|
LDA #<]1 ; THEN LOBYTE
|
|
PHA
|
|
FIN
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _GRET: GET RETURN VALUE *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_GRET MAC
|
|
LDA #>]1
|
|
PHA
|
|
LDA #<]1
|
|
PHA
|
|
JSR __GETRET
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _SPAR: SET PARAMETER *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_SPAR MAC
|
|
LDA #>]1
|
|
PHA
|
|
LDA #<]1
|
|
PHA
|
|
JSR __SETPARM
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _DUMP: DUMP DATA *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_DUMP MAC
|
|
LDA #>]1
|
|
PHA
|
|
LDA #<]1
|
|
PHA
|
|
LDA ]2
|
|
PHA
|
|
JSR __DUMP
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _PRNT: PRINT STRING *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_PRNT MAC
|
|
JSR __P
|
|
ASC ]1
|
|
HEX 00
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _WAIT: WAIT FOR KEYPRESS *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_WAIT MAC
|
|
JSR __W
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _RDUMP: DUMP REGISTERS *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_RDUMP MAC
|
|
JSR __RDMP
|
|
<<<
|
|
*
|
|
*``````````````````````````````*
|
|
* _ERR: ERROR-HANDLING ROUTINE *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
_ERR MAC
|
|
LDA #>]1
|
|
PHA
|
|
LDA #<]1
|
|
PHA
|
|
LDA #>]2
|
|
PHA
|
|
LDA #<]2
|
|
PHA
|
|
LDA #>]3
|
|
PHA
|
|
LDA #<]3
|
|
PHA
|
|
LDA #>]4
|
|
PHA
|
|
LDA #<]4
|
|
PHA
|
|
LDA ]5
|
|
PHA
|
|
JSR __ERR
|
|
<<<
|