AppleIIAsm-Collection/disks/disk2_common/T.MEMFILL.SUB.MIN
nathanriggs 12a0b19398 Disk 2 COMMON library 0.3.0 updates
- added some error control
- added initial jump table
- fixed a few minor bugs
- separated common library into separate subroutine files
2019-01-14 10:57:05 -05:00

44 lines
1.2 KiB
Plaintext

MEMFILL
PLA
STA RETADR
PLA
STA RETADR+1
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1 ; ZERO PAGE POINTER
PLA ; DEFINED IN
STA ADDR1+1 ; DECS
LDA :VALUE ; GET VAL FOR FILL
LDX :ARYSZ+1 ; X=# OF PAGES TO DO
BEQ :PARTPG ; BRANCH IF HIGHBYTE OF SZ = 0
LDY #0
:FULLPG
STA (ADDR1),Y
INY ; INC TO NEXT BYTE
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGE
INC ADDR1+1 ; ADVANCE TO NEXT PAGE
DEX
BNE :FULLPG ; BRANCH IF NOT DONE W/ PAGES
:PARTPG
LDX :ARYSZ ;GET # OF BYTES IN FINAL PAGE
BEQ :EXIT ; BRANCH IF LOW BYTE = 0
LDY #0
:PARTLP
STA (ADDR1),Y ; STORE VAL
INY ; INCREMENT INDEX
DEX ; DECREMENT COUNTER
BNE :PARTLP ; BRANCH IF NOT DONE
:EXIT
LDA RETADR+1
PHA
LDA RETADR
PHA
RTS
:VALUE DS 1 ; FILL VALUE
:ARYSZ DS 2 ; ARRAY SIZE