AppleIIAsm-Collection/disks/disk2_common/T.REQUIRED.LIB.MIN
nathanriggs 1cca2ca580 various additions
mostly updated the required and common libraries, as well as created a minify program in applesoft basic that automatically creates a .min file from fully-commented source.
2019-01-09 23:12:28 -05:00

273 lines
5.3 KiB
Plaintext

__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
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
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 :RET+1
PHA
LDA :RET
PHA
RTS
:RET DS 2
:RIGHT DS 1
:LEFT DS 1
:LENGTH DS 1
__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
JSR $FD0C
RTS
__RDMP
STA :A
STX :X
STY :Y
:C BCC :C0
BCS :C1
:Z BEQ :Z1
BNE :Z0
:N BMI :N1
BPL :N0
:O BVC :O0
BVS :O1
JMP :RDUMP
:C0 LDA #0
STA :CARRY
JMP :Z
:C1 LDA #1
STA :CARRY
JMP :Z
:Z1 LDA #1
STA :ZERO
JMP :N
:Z0 LDA #0
STA :ZERO
JMP :N
:N1 LDA #1
STA :NEGATIVE
JMP :O
:N0 LDA #0
STA :NEGATIVE
JMP :O
:O0 LDA #0
STA :OVERFLOW
JMP :RDUMP
:O1 LDA #1
STA :OVERFLOW
:RDUMP
_PRNT " ",8D8D
_PRNT "REGISTRY DUMP",8D
_PRNT "=============",8D
_PRNT "A: "
LDA :A
AND #$F0 ; MASK RIGHT
LSR
LSR
LSR
LSR
STA :LEFT
LDA :A
AND #$0F ; MASK LEFT
STA :RIGHT
LDX :LEFT
LDA HEXTAB,X
JSR $FDF0
LDX :RIGHT
LDA HEXTAB,X
JSR $FDF0
_PRNT " ",8D
_PRNT "X: "
LDA :X
AND #$F0 ; MASK RIGHT
LSR
LSR
LSR
LSR
STA :LEFT
LDA :X
AND #$0F ; MASK LEFT
STA :RIGHT
LDX :LEFT
LDA HEXTAB,X
JSR $FDF0
LDX :RIGHT
LDA HEXTAB,X
JSR $FDF0
_PRNT " ",8D
_PRNT "Y: "
LDA :Y
AND #$F0 ; MASK RIGHT
LSR
LSR
LSR
LSR
STA :LEFT
LDA :Y
AND #$0F ; MASK LEFT
STA :RIGHT
LDX :LEFT
LDA HEXTAB,X
JSR $FDF0
LDX :RIGHT
LDA HEXTAB,X
JSR $FDF0
_PRNT " ",8D8D
_PRNT "STATUS FLAGS",8D
_PRNT "============",8D8D
LDA #0
CMP :CARRY
BEQ :CARCLR
_PRNT "CARRY: SET",8D
JMP :TESTN
:CARCLR _PRNT "CARRY: CLEAR",8D
:TESTN LDA #0
CMP :NEGATIVE
BEQ :NEGCLR
_PRNT "NEGATIVE: SET",8D
JMP :TESTZ
:NEGCLR _PRNT "NEGATIVE: CLEAR",8D
:TESTZ LDA #0
CMP :ZERO
BEQ :ZCLR
_PRNT "ZERO: SET",8D
JMP :TESTO
:ZCLR _PRNT "ZERO: CLEAR",8D
:TESTO
LDA #0
CMP :OVERFLOW
BEQ :OCLR
_PRNT "OVERFLOW: SET",8D
JMP :FIN
:OCLR _PRNT "OVERFLOW: CLEAR",8D8D8D
:FIN
RTS
:A DS 1
:X DS 1
:Y DS 1
:LEFT DS 1
:RIGHT DS 1
:OVERFLOW DS 1
:NEGATIVE DS 1
:CARRY DS 1
:ZERO DS 1
HEXTAB ASC "0123456789ABCDEF"
RETLEN DS 1 ; RETURN VALUE BYTE LENGTH
RETURN DS 256
PARLEN DS 1
PARAM DS 256