AppleIIAsm-Collection/disks/disk2_common/T.COMMON.MIN
nathanriggs 875dd80998 stdio 0.2.0 updates
- fixed a bunch of bugs
- separated common and stdio libraries
- commenting upgrades
- created min versions of each library
2018-12-14 21:23:32 -05:00

321 lines
5.5 KiB
Plaintext

JMP COMMONX
*
MEMFILL
*
PLA
STA RETADR
PLA
STA RETADR+1
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1
PLA
STA ADDR1+1
LDA :VALUE
LDX :ARYSZ+1
BEQ :PARTPG
LDY #0
:FULLPG
STA (ADDR1),Y
INY
BNE :FULLPG
INC ADDR1+1
DEX
BNE :FULLPG
:PARTPG
LDX :ARYSZ
BEQ :EXIT
LDY #0
:PARTLP
STA (ADDR1),Y
INY
DEX
BNE :PARTLP
:EXIT
LDA RETADR+1
PHA
LDA RETADR
PHA
RTS
:VALUE DS 1
:ARYSZ DS 2
*
MEMMOVE
*
PLA
STA RETADR
PLA
STA RETADR+1
PLA
STA :MVELEN
PLA
STA :MVELEN+1
PLA
STA ADDR2
PLA
STA ADDR2+1
PLA
STA ADDR1
PLA
STA ADDR1+1
LDA ADDR2
SEC
SBC ADDR1
TAX
LDA ADDR2+1
SBC ADDR1+1
TAY
TXA
CMP :MVELEN
TYA
SBC :MVELEN+1
BCS :DOLEFT
JSR :MVERHT
JMP :EXIT
:DOLEFT
JSR :MVELEFT
:EXIT
JMP :MREXIT
:MVELEFT
LDY #0
LDX :MVELEN+1
BEQ :MLPART
:MLPAGE
LDA (ADDR1),Y
STA (ADDR2),Y
INY
BNE :MLPAGE
INC ADDR1+1
INC ADDR2+1
DEX
BNE :MLPAGE
:MLPART
LDX :MVELEN
BEQ :MLEXIT
:MLLAST
LDA (ADDR1),Y
STA (ADDR2),Y
INY
DEX
BNE :MLLAST
:MLEXIT
JMP :MREXIT
:MVERHT
LDA :MVELEN+1
CLC
ADC ADDR1+1
STA ADDR1+1
LDA :MVELEN+1
CLC
ADC ADDR2+1
STA ADDR2+1
LDY :MVELEN
BEQ :MRPAGE
:MR0
DEY
LDA (ADDR1),Y
STA (ADDR2),Y
CPY #0
BNE :MR0
:MRPAGE
LDX :MVELEN+1
BEQ :MREXIT
:MR1
DEC ADDR1+1
DEC ADDR2+1
:MR2
DEY
LDA (ADDR1),Y
STA (ADDR2),Y
CPY #0
BNE :MR2
DEX
BNE :MR
:MREXIT
LDA RETADR+1
PHA
LDA RETADR
PHA
RTS
:MVELEN DS 2
*
DELAYMS
*
MSCNT EQU $0CA
:DELAY
CPY #0
BEQ :EXIT
NOP
CPY #1
BNE :DELAYA
JMP :LAST1
:DELAYA
DEY
:DELAY0
LDX #MSCNT
:DELAY1
DEX
BNE :DELAY1
NOP
NOP
DEY
BNE :DELAY0
:LAST1
LDX #MSCNT-3
:DELAY2
DEX
BNE :DELAY2
:EXIT
RTS
*
ZMSAVE
*
LDX ADDR1
LDY ADDR1+1
PLA
STA :RETADR
PLA
STA :RETADR+1
PLA
STA ADDR1
PLA
STA ADDR1+1
TYA
LDY #1
STA (ADDR1),Y
LDY #0
TXA
STA (ADDR1),Y
LDY #2
LDA $08
STA (ADDR1),Y
INY
LDA $09
STA (ADDR1),Y
INY
LDA $19
STA (ADDR1),Y
INY
LDA $1E
STA (ADDR1),Y
INY
LDA $E3
STA (ADDR1),Y
INY
LDA $EB
STA (ADDR1),Y
INY
LDA $EC
STA (ADDR1),Y
INY
LDA $ED
STA (ADDR1),Y
INY
LDA $EE
STA (ADDR1),Y
INY
LDA $EF
STA (ADDR1),Y
INY
LDA $FA
STA (ADDR1),Y
INY
LDA $FB
STA (ADDR1),Y
INY
LDA $FC
STA (ADDR1),Y
INY
LDA $FD
STA (ADDR1),Y
INY
LDA $FE
STA (ADDR1),Y
INY
LDA $FF
STA (ADDR1),Y
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
:RETADR DS 2
*
ZMLOAD
*
PLA
STA :RETADR
PLA
STA :RETADR+1
PLA
STA ADDR1
PLA
STA ADDR1+1
LDY #2
LDA (ADDR1),Y
STA $08
INY
LDA (ADDR1),Y
STA $09
INY
LDA (ADDR1),Y
STA $19
INY
LDA (ADDR1),Y
STA $1E
INY
LDA (ADDR1),Y
STA $E3
INY
LDA (ADDR1),Y
STA $EB
INY
LDA (ADDR1),Y
STA $EC
INY
LDA (ADDR1),Y
STA $ED
INY
LDA (ADDR1),Y
STA $EE
INY
LDA (ADDR1),Y
STA $EF
INY
LDA (ADDR1),Y
STA $FA
INY
LDA (ADDR1),Y
STA $FB
INY
LDA (ADDR1),Y
STA $FC
INY
LDA (ADDR1),Y
STA $FD
INY
LDA (ADDR1),Y
STA $FE
INY
LDA (ADDR1),Y
STA $FF
LDY #0
LDA (ADDR1),Y
TAX
LDA (ADDR1+1),Y
TAY
STX ADDR1
STY ADDR1+1
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
:RETADR DS 2
COMMONX RTS