mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-11-26 21:51:26 +00:00
added disk3: Array Routines
- 16bit array subroutines will be added here at a later date. - Strings library separated from arrays on its own disk in anticipation of larger libraries.
This commit is contained in:
parent
ddeb2e706b
commit
eb2b7deea0
16
README.md
16
README.md
@ -18,19 +18,20 @@ MATH DISK
|
||||
|
||||
IO DISK
|
||||
* fileio.lib: File Input/Output Library.
|
||||
* 80colstdio.lib: stdio library for 80-column display.
|
||||
|
||||
DATA DISK
|
||||
* strings.lib: Library for managing strings.
|
||||
* arrays.lib: library for managing arrays.
|
||||
ARRAYS DISK
|
||||
* arrays81.lib: library for managing 1-dimensional 8-bit arrays.
|
||||
* arrays82.lib: library for managing 2-dimensional 8-bit arrays.
|
||||
* 16-bit array libraries will also be on this disk in the future
|
||||
|
||||
STRINGS DISK
|
||||
* strings.lib: Library for managing strings.
|
||||
|
||||
LORES DISK
|
||||
* lores.lib: Library for fast(er) graphics in low resolution mode.
|
||||
* dublores.lib: Library for double-low-resolution graphics.
|
||||
|
||||
HIRES DISK
|
||||
* hires.lib: Library for fast(er) graphics in high resolution mode.
|
||||
* dubhires.lib: Library for handling graphics in double-high-resolution mode.
|
||||
|
||||
HIRES DISK 2
|
||||
* hireschar.lib: High Resolution mode text character library.
|
||||
@ -46,3 +47,6 @@ UTIL DISK
|
||||
FPMATH DISK 1 (and maybe a second one)
|
||||
* fpmath.lib: Floating-point math library
|
||||
|
||||
80COL DISK
|
||||
* stdio library and some routines for double lores and double hires
|
||||
|
||||
|
@ -13,8 +13,8 @@ CORE DISK
|
||||
* common.lib: Common, useful subroutines: memory swaps, etc.
|
||||
|
||||
MATH DISK
|
||||
* math.lib: Integer Math Library.
|
||||
* fpmath.lib: Floating-point Math Library.
|
||||
* math8.lib: 8-bit Integer Math Library.
|
||||
* math16.lib: 16-bit Integer Math Library.
|
||||
|
||||
IO DISK
|
||||
* fileio.lib: File Input/Output Library.
|
||||
@ -43,6 +43,6 @@ MISC DISK
|
||||
UTIL DISK
|
||||
* various useful utilities
|
||||
|
||||
COMPACT DISK 1 (and maybe a second one)
|
||||
* every routine, separately packaged, without comments.
|
||||
FPMATH DISK 1 (and maybe a second one)
|
||||
* fpmath.lib: Floating-point math library
|
||||
|
||||
|
476
disks/disk3_arrays/ARRAYS.DEMO
Normal file
476
disks/disk3_arrays/ARRAYS.DEMO
Normal file
@ -0,0 +1,476 @@
|
||||
6000- A9 03 LDA #$03
|
||||
6002- 48 PHA
|
||||
6003- A9 00 LDA #$00
|
||||
6005- 48 PHA
|
||||
6006- A9 0A LDA #$0A
|
||||
6008- 48 PHA
|
||||
6009- A9 02 LDA #$02
|
||||
600B- 48 PHA
|
||||
600C- 20 6A 60 JSR $606A
|
||||
600F- A9 03 LDA #$03
|
||||
6011- 48 PHA
|
||||
6012- A9 00 LDA #$00
|
||||
6014- 48 PHA
|
||||
6015- A9 05 LDA #$05
|
||||
6017- 48 PHA
|
||||
6018- 20 EE 60 JSR $60EE
|
||||
601B- A9 03 LDA #$03
|
||||
601D- 48 PHA
|
||||
601E- A9 00 LDA #$00
|
||||
6020- 48 PHA
|
||||
6021- A9 03 LDA #$03
|
||||
6023- 48 PHA
|
||||
6024- A9 00 LDA #$00
|
||||
6026- 48 PHA
|
||||
6027- A9 05 LDA #$05
|
||||
6029- 48 PHA
|
||||
602A- 20 5E 61 JSR $615E
|
||||
602D- A9 03 LDA #$03
|
||||
602F- 48 PHA
|
||||
6030- A9 00 LDA #$00
|
||||
6032- 48 PHA
|
||||
6033- A9 04 LDA #$04
|
||||
6035- 48 PHA
|
||||
6036- A9 04 LDA #$04
|
||||
6038- 48 PHA
|
||||
6039- A9 01 LDA #$01
|
||||
603B- 48 PHA
|
||||
603C- 20 B2 61 JSR $61B2
|
||||
603F- A9 03 LDA #$03
|
||||
6041- 48 PHA
|
||||
6042- A9 00 LDA #$00
|
||||
6044- 48 PHA
|
||||
6045- A9 02 LDA #$02
|
||||
6047- 48 PHA
|
||||
6048- A9 03 LDA #$03
|
||||
604A- 48 PHA
|
||||
604B- 20 7E 62 JSR $627E
|
||||
604E- A9 03 LDA #$03
|
||||
6050- 48 PHA
|
||||
6051- A9 00 LDA #$00
|
||||
6053- 48 PHA
|
||||
6054- A9 03 LDA #$03
|
||||
6056- 48 PHA
|
||||
6057- A9 00 LDA #$00
|
||||
6059- 48 PHA
|
||||
605A- A9 02 LDA #$02
|
||||
605C- 48 PHA
|
||||
605D- A9 03 LDA #$03
|
||||
605F- 48 PHA
|
||||
6060- 20 21 63 JSR $6321
|
||||
6063- 00 BRK
|
||||
6064- 4C D0 03 JMP $03D0
|
||||
6067- 4C AF 61 JMP $61AF
|
||||
606A- 68 PLA
|
||||
606B- 85 FE STA $FE
|
||||
606D- 68 PLA
|
||||
606E- 85 FF STA $FF
|
||||
6070- 68 PLA
|
||||
6071- 8D EB 60 STA $60EB
|
||||
6074- 8D ED 60 STA $60ED
|
||||
6077- 68 PLA
|
||||
6078- 8D EA 60 STA $60EA
|
||||
607B- 8D EC 60 STA $60EC
|
||||
607E- 68 PLA
|
||||
607F- 85 06 STA $06
|
||||
6081- 68 PLA
|
||||
6082- 85 07 STA $07
|
||||
6084- A0 00 LDY #$00
|
||||
6086- A2 00 LDX #$00
|
||||
6088- A9 00 LDA #$00
|
||||
608A- 84 19 STY $19
|
||||
608C- F0 0F BEQ $609D
|
||||
608E- 18 CLC
|
||||
608F- 6D EA 60 ADC $60EA
|
||||
6092- AA TAX
|
||||
6093- 98 TYA
|
||||
6094- 65 19 ADC $19
|
||||
6096- A8 TAY
|
||||
6097- 8A TXA
|
||||
6098- 0E EA 60 ASL $60EA
|
||||
609B- 26 19 ROL $19
|
||||
609D- 4E EB 60 LSR $60EB
|
||||
60A0- B0 EC BCS $608E
|
||||
60A2- D0 F4 BNE $6098
|
||||
60A4- 18 CLC
|
||||
60A5- E8 INX
|
||||
60A6- E8 INX
|
||||
60A7- 90 01 BCC $60AA
|
||||
60A9- C8 INY
|
||||
60AA- 8E E8 60 STX $60E8
|
||||
60AD- 8C E9 60 STY $60E9
|
||||
60B0- A9 00 LDA #$00
|
||||
60B2- AE E9 60 LDX $60E9
|
||||
60B5- F0 0C BEQ $60C3
|
||||
60B7- A0 00 LDY #$00
|
||||
60B9- 91 06 STA ($06),Y
|
||||
60BB- C8 INY
|
||||
60BC- D0 FB BNE $60B9
|
||||
60BE- E6 07 INC $07
|
||||
60C0- CA DEX
|
||||
60C1- D0 F6 BNE $60B9
|
||||
60C3- AE E8 60 LDX $60E8
|
||||
60C6- F0 08 BEQ $60D0
|
||||
60C8- A0 00 LDY #$00
|
||||
60CA- 91 06 STA ($06),Y
|
||||
60CC- C8 INY
|
||||
60CD- CA DEX
|
||||
60CE- D0 FA BNE $60CA
|
||||
60D0- A0 00 LDY #$00
|
||||
60D2- AD EC 60 LDA $60EC
|
||||
60D5- 91 06 STA ($06),Y
|
||||
60D7- C8 INY
|
||||
60D8- AD ED 60 LDA $60ED
|
||||
60DB- 91 06 STA ($06),Y
|
||||
60DD- A5 FF LDA $FF
|
||||
60DF- 48 PHA
|
||||
60E0- A5 FE LDA $FE
|
||||
60E2- 48 PHA
|
||||
60E3- A4 06 LDY $06
|
||||
60E5- A6 07 LDX $07
|
||||
60E7- 60 RTS
|
||||
60E8- 00 BRK
|
||||
60E9- 00 BRK
|
||||
60EA- 00 BRK
|
||||
60EB- 00 BRK
|
||||
60EC- 00 BRK
|
||||
60ED- 00 BRK
|
||||
60EE- 68 PLA
|
||||
60EF- 85 FE STA $FE
|
||||
60F1- 68 PLA
|
||||
60F2- 85 FF STA $FF
|
||||
60F4- 68 PLA
|
||||
60F5- 8D 5B 61 STA $615B
|
||||
60F8- 68 PLA
|
||||
60F9- 85 06 STA $06
|
||||
60FB- 68 PLA
|
||||
60FC- 85 07 STA $07
|
||||
60FE- A0 01 LDY #$01
|
||||
6100- B1 06 LDA ($06),Y
|
||||
6102- 8D 5D 61 STA $615D
|
||||
6105- A0 00 LDY #$00
|
||||
6107- A9 00 LDA #$00
|
||||
6109- A8 TAY
|
||||
610A- 84 19 STY $19
|
||||
610C- F0 0F BEQ $611D
|
||||
610E- 18 CLC
|
||||
610F- 6D 5B 61 ADC $615B
|
||||
6112- AA TAX
|
||||
6113- 98 TYA
|
||||
6114- 65 19 ADC $19
|
||||
6116- A8 TAY
|
||||
6117- 8A TXA
|
||||
6118- 0E 5B 61 ASL $615B
|
||||
611B- 26 19 ROL $19
|
||||
611D- 4E 5D 61 LSR $615D
|
||||
6120- B0 EC BCS $610E
|
||||
6122- D0 F4 BNE $6118
|
||||
6124- 8E 5B 61 STX $615B
|
||||
6127- 8C 5C 61 STY $615C
|
||||
612A- 18 CLC
|
||||
612B- A9 02 LDA #$02
|
||||
612D- 6D 5B 61 ADC $615B
|
||||
6130- 8D 59 61 STA $6159
|
||||
6133- A9 00 LDA #$00
|
||||
6135- 6D 5C 61 ADC $615C
|
||||
6138- 8D 5A 61 STA $615A
|
||||
613B- 18 CLC
|
||||
613C- AD 59 61 LDA $6159
|
||||
613F- 65 06 ADC $06
|
||||
6141- 8D 59 61 STA $6159
|
||||
6144- AD 5A 61 LDA $615A
|
||||
6147- 65 07 ADC $07
|
||||
6149- 8D 5A 61 STA $615A
|
||||
614C- AC 59 61 LDY $6159
|
||||
614F- AE 5A 61 LDX $615A
|
||||
6152- A5 FF LDA $FF
|
||||
6154- 48 PHA
|
||||
6155- A5 FE LDA $FE
|
||||
6157- 48 PHA
|
||||
6158- 60 RTS
|
||||
6159- 00 BRK
|
||||
615A- 00 BRK
|
||||
615B- 00 BRK
|
||||
615C- 00 BRK
|
||||
615D- 00 BRK
|
||||
615E- 68 PLA
|
||||
615F- 8D AA 61 STA $61AA
|
||||
6162- 68 PLA
|
||||
6163- 8D AB 61 STA $61AB
|
||||
6166- 68 PLA
|
||||
6167- 8D AE 61 STA $61AE
|
||||
616A- 68 PLA
|
||||
616B- 85 ED STA $ED
|
||||
616D- 68 PLA
|
||||
616E- 85 EE STA $EE
|
||||
6170- 68 PLA
|
||||
6171- 85 EB STA $EB
|
||||
6173- 68 PLA
|
||||
6174- 85 EC STA $EC
|
||||
6176- A5 EE LDA $EE
|
||||
6178- 48 PHA
|
||||
6179- A5 ED LDA $ED
|
||||
617B- 48 PHA
|
||||
617C- AD AE 61 LDA $61AE
|
||||
617F- 48 PHA
|
||||
6180- 20 EE 60 JSR $60EE
|
||||
6183- 84 08 STY $08
|
||||
6185- 86 09 STX $09
|
||||
6187- A0 01 LDY #$01
|
||||
6189- B1 ED LDA ($ED),Y
|
||||
618B- 8D AC 61 STA $61AC
|
||||
618E- A0 00 LDY #$00
|
||||
6190- B1 EB LDA ($EB),Y
|
||||
6192- 91 08 STA ($08),Y
|
||||
6194- C8 INY
|
||||
6195- CC AC 61 CPY $61AC
|
||||
6198- D0 F6 BNE $6190
|
||||
619A- AD AB 61 LDA $61AB
|
||||
619D- 48 PHA
|
||||
619E- AD AA 61 LDA $61AA
|
||||
61A1- 48 PHA
|
||||
61A2- A6 09 LDX $09
|
||||
61A4- A4 08 LDY $08
|
||||
61A6- AD AC 61 LDA $61AC
|
||||
61A9- 60 RTS
|
||||
61AA- 00 BRK
|
||||
61AB- 00 BRK
|
||||
61AC- 00 BRK
|
||||
61AD- 00 BRK
|
||||
61AE- 00 BRK
|
||||
61AF- 4C 7A 63 JMP $637A
|
||||
61B2- 68 PLA
|
||||
61B3- 85 FE STA $FE
|
||||
61B5- 68 PLA
|
||||
61B6- 85 FF STA $FF
|
||||
61B8- 68 PLA
|
||||
61B9- 8D 7C 62 STA $627C
|
||||
61BC- 68 PLA
|
||||
61BD- 8D 77 62 STA $6277
|
||||
61C0- 8D 79 62 STA $6279
|
||||
61C3- 68 PLA
|
||||
61C4- 8D 76 62 STA $6276
|
||||
61C7- 8D 78 62 STA $6278
|
||||
61CA- 68 PLA
|
||||
61CB- 85 06 STA $06
|
||||
61CD- 68 PLA
|
||||
61CE- 85 07 STA $07
|
||||
61D0- A9 00 LDA #$00
|
||||
61D2- A8 TAY
|
||||
61D3- 84 19 STY $19
|
||||
61D5- F0 0F BEQ $61E6
|
||||
61D7- 18 CLC
|
||||
61D8- 6D 76 62 ADC $6276
|
||||
61DB- AA TAX
|
||||
61DC- 98 TYA
|
||||
61DD- 65 19 ADC $19
|
||||
61DF- A8 TAY
|
||||
61E0- 8A TXA
|
||||
61E1- 0E 76 62 ASL $6276
|
||||
61E4- 26 19 ROL $19
|
||||
61E6- 4E 77 62 LSR $6277
|
||||
61E9- B0 EC BCS $61D7
|
||||
61EB- D0 F4 BNE $61E1
|
||||
61ED- 8E 7A 62 STX $627A
|
||||
61F0- 8C 7B 62 STY $627B
|
||||
61F3- A9 00 LDA #$00
|
||||
61F5- 8D 74 62 STA $6274
|
||||
61F8- 8D 75 62 STA $6275
|
||||
61FB- A2 10 LDX #$10
|
||||
61FD- 4E 7B 62 LSR $627B
|
||||
6200- 6E 7A 62 ROR $627A
|
||||
6203- 90 10 BCC $6215
|
||||
6205- AD 74 62 LDA $6274
|
||||
6208- 18 CLC
|
||||
6209- 6D 7C 62 ADC $627C
|
||||
620C- 8D 74 62 STA $6274
|
||||
620F- AD 75 62 LDA $6275
|
||||
6212- 6D 7D 62 ADC $627D
|
||||
6215- 6A ROR
|
||||
6216- 8D 75 62 STA $6275
|
||||
6219- 6E 74 62 ROR $6274
|
||||
621C- 6E 73 62 ROR $6273
|
||||
621F- 6E 72 62 ROR $6272
|
||||
6222- CA DEX
|
||||
6223- D0 D8 BNE $61FD
|
||||
6225- EE 72 62 INC $6272
|
||||
6228- EE 72 62 INC $6272
|
||||
622B- EE 72 62 INC $6272
|
||||
622E- AE 72 62 LDX $6272
|
||||
6231- AC 73 62 LDY $6273
|
||||
6234- A9 00 LDA #$00
|
||||
6236- AE 73 62 LDX $6273
|
||||
6239- F0 0C BEQ $6247
|
||||
623B- A0 00 LDY #$00
|
||||
623D- 91 06 STA ($06),Y
|
||||
623F- C8 INY
|
||||
6240- D0 FB BNE $623D
|
||||
6242- E6 07 INC $07
|
||||
6244- CA DEX
|
||||
6245- D0 F6 BNE $623D
|
||||
6247- AE 72 62 LDX $6272
|
||||
624A- F0 08 BEQ $6254
|
||||
624C- A0 00 LDY #$00
|
||||
624E- 91 06 STA ($06),Y
|
||||
6250- C8 INY
|
||||
6251- CA DEX
|
||||
6252- D0 FA BNE $624E
|
||||
6254- A0 00 LDY #$00
|
||||
6256- AD 78 62 LDA $6278
|
||||
6259- 91 06 STA ($06),Y
|
||||
625B- C8 INY
|
||||
625C- AD 79 62 LDA $6279
|
||||
625F- 91 06 STA ($06),Y
|
||||
6261- C8 INY
|
||||
6262- AD 7C 62 LDA $627C
|
||||
6265- 91 06 STA ($06),Y
|
||||
6267- A5 FF LDA $FF
|
||||
6269- 48 PHA
|
||||
626A- A5 FE LDA $FE
|
||||
626C- 48 PHA
|
||||
626D- A4 06 LDY $06
|
||||
626F- A6 07 LDX $07
|
||||
6271- 60 RTS
|
||||
6272- 00 BRK
|
||||
6273- 00 BRK
|
||||
6274- 00 BRK
|
||||
6275- 00 BRK
|
||||
6276- 00 BRK
|
||||
6277- 00 BRK
|
||||
6278- 00 BRK
|
||||
6279- 00 BRK
|
||||
627A- 00 BRK
|
||||
627B- 00 BRK
|
||||
627C- 00 BRK
|
||||
627D- 00 BRK
|
||||
627E- 68 PLA
|
||||
627F- 85 FE STA $FE
|
||||
6281- 68 PLA
|
||||
6282- 85 FF STA $FF
|
||||
6284- 68 PLA
|
||||
6285- 8D 17 63 STA $6317
|
||||
6288- 68 PLA
|
||||
6289- 8D 15 63 STA $6315
|
||||
628C- 68 PLA
|
||||
628D- 85 06 STA $06
|
||||
628F- 68 PLA
|
||||
6290- 85 07 STA $07
|
||||
6292- A0 02 LDY #$02
|
||||
6294- B1 06 LDA ($06),Y
|
||||
6296- 8D 1F 63 STA $631F
|
||||
6299- A9 00 LDA #$00
|
||||
629B- A8 TAY
|
||||
629C- 84 19 STY $19
|
||||
629E- F0 0F BEQ $62AF
|
||||
62A0- 18 CLC
|
||||
62A1- 6D 15 63 ADC $6315
|
||||
62A4- AA TAX
|
||||
62A5- 98 TYA
|
||||
62A6- 65 19 ADC $19
|
||||
62A8- A8 TAY
|
||||
62A9- 8A TXA
|
||||
62AA- 0E 15 63 ASL $6315
|
||||
62AD- 26 19 ROL $19
|
||||
62AF- 4E 17 63 LSR $6317
|
||||
62B2- B0 EC BCS $62A0
|
||||
62B4- D0 F4 BNE $62AA
|
||||
62B6- 8E 1D 63 STX $631D
|
||||
62B9- 8C 1E 63 STY $631E
|
||||
62BC- A9 00 LDA #$00
|
||||
62BE- 8D 1B 63 STA $631B
|
||||
62C1- 8D 1C 63 STA $631C
|
||||
62C4- A2 10 LDX #$10
|
||||
62C6- 4E 1E 63 LSR $631E
|
||||
62C9- 6E 1D 63 ROR $631D
|
||||
62CC- 90 10 BCC $62DE
|
||||
62CE- AD 1B 63 LDA $631B
|
||||
62D1- 18 CLC
|
||||
62D2- 6D 1F 63 ADC $631F
|
||||
62D5- 8D 1B 63 STA $631B
|
||||
62D8- AD 1C 63 LDA $631C
|
||||
62DB- 6D 20 63 ADC $6320
|
||||
62DE- 6A ROR
|
||||
62DF- 8D 1C 63 STA $631C
|
||||
62E2- 6E 1B 63 ROR $631B
|
||||
62E5- 6E 1A 63 ROR $631A
|
||||
62E8- 6E 19 63 ROR $6319
|
||||
62EB- CA DEX
|
||||
62EC- D0 D8 BNE $62C6
|
||||
62EE- EE 19 63 INC $6319
|
||||
62F1- EE 19 63 INC $6319
|
||||
62F4- EE 19 63 INC $6319
|
||||
62F7- 18 CLC
|
||||
62F8- AD 19 63 LDA $6319
|
||||
62FB- 65 06 ADC $06
|
||||
62FD- 8D 19 63 STA $6319
|
||||
6300- AD 1A 63 LDA $631A
|
||||
6303- 65 07 ADC $07
|
||||
6305- 8D 1A 63 STA $631A
|
||||
6308- AC 19 63 LDY $6319
|
||||
630B- AE 1A 63 LDX $631A
|
||||
630E- A5 FF LDA $FF
|
||||
6310- 48 PHA
|
||||
6311- A5 FE LDA $FE
|
||||
6313- 48 PHA
|
||||
6314- 60 RTS
|
||||
6315- 00 BRK
|
||||
6316- 00 BRK
|
||||
6317- 00 BRK
|
||||
6318- 00 BRK
|
||||
6319- 00 BRK
|
||||
631A- 00 BRK
|
||||
631B- 00 BRK
|
||||
631C- 00 BRK
|
||||
631D- 00 BRK
|
||||
631E- 00 BRK
|
||||
631F- 00 BRK
|
||||
6320- 00 BRK
|
||||
6321- 68 PLA
|
||||
6322- 8D 75 63 STA $6375
|
||||
6325- 68 PLA
|
||||
6326- 8D 76 63 STA $6376
|
||||
6329- 68 PLA
|
||||
632A- 8D 79 63 STA $6379
|
||||
632D- 68 PLA
|
||||
632E- 8D 78 63 STA $6378
|
||||
6331- 68 PLA
|
||||
6332- 85 ED STA $ED
|
||||
6334- 68 PLA
|
||||
6335- 85 EE STA $EE
|
||||
6337- 68 PLA
|
||||
6338- 85 EB STA $EB
|
||||
633A- 68 PLA
|
||||
633B- 85 EC STA $EC
|
||||
633D- A5 EE LDA $EE
|
||||
633F- 48 PHA
|
||||
6340- A5 ED LDA $ED
|
||||
6342- 48 PHA
|
||||
6343- AD 78 63 LDA $6378
|
||||
6346- 48 PHA
|
||||
6347- AD 79 63 LDA $6379
|
||||
634A- 48 PHA
|
||||
634B- 20 7E 62 JSR $627E
|
||||
634E- 84 08 STY $08
|
||||
6350- 86 09 STX $09
|
||||
6352- A0 02 LDY #$02
|
||||
6354- B1 ED LDA ($ED),Y
|
||||
6356- 8D 77 63 STA $6377
|
||||
6359- A0 00 LDY #$00
|
||||
635B- B1 EB LDA ($EB),Y
|
||||
635D- 91 08 STA ($08),Y
|
||||
635F- C8 INY
|
||||
6360- CC 77 63 CPY $6377
|
||||
6363- D0 F6 BNE $635B
|
||||
6365- AD 76 63 LDA $6376
|
||||
6368- 48 PHA
|
||||
6369- AD 75 63 LDA $6375
|
||||
636C- 48 PHA
|
||||
636D- A6 09 LDX $09
|
||||
636F- A4 08 LDY $08
|
||||
6371- AD 77 63 LDA $6377
|
||||
6374- 60 RTS
|
||||
6375- 00 BRK
|
||||
6376- 00 BRK
|
||||
6377- 00 BRK
|
||||
6378- 00 BRK
|
||||
6379- 00 BRK
|
1600
disks/disk3_arrays/ARRAYS.DEMO.S
Normal file
1600
disks/disk3_arrays/ARRAYS.DEMO.S
Normal file
File diff suppressed because it is too large
Load Diff
187
disks/disk3_arrays/T.ARRAYS.DEMO
Normal file
187
disks/disk3_arrays/T.ARRAYS.DEMO
Normal file
@ -0,0 +1,187 @@
|
||||
*
|
||||
********************************
|
||||
* *
|
||||
* -< ARRAYS DEMO >- *
|
||||
* *
|
||||
* VERSION 00.00.01 *
|
||||
* *
|
||||
* 03/04/1980 *
|
||||
* *
|
||||
********************************
|
||||
* *
|
||||
* NATHAN D. RIGGS *
|
||||
* NATHAN.RIGGS@OUTLOOK.COM *
|
||||
* *
|
||||
********************************
|
||||
*
|
||||
** ASSEMBLER DIRECTIVES
|
||||
*
|
||||
CYC AVE
|
||||
EXP ONLY
|
||||
DSK ARRAYS.DEMO
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* TOP INCLUDES (PUTS, MACROS) *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
PUT DECS
|
||||
USE ARRAYS.MAC
|
||||
*
|
||||
PUT ARRAYS.HOOKS
|
||||
*
|
||||
OBJ $BFE0
|
||||
ORG $6000
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* PROGRAM MAIN BODY *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
*
|
||||
** BIG LUMPS -- HIGH LEVEL CODE
|
||||
*
|
||||
*
|
||||
** DIM81 CLEARS THE MEMORY AT THE SPECIFIED
|
||||
** LOCATION AND SETS UP THE DATA CONFIGURATION
|
||||
** FOR AN ARRAY (ARRAY LENGTH, ELEMENT LENGTH, DATA)
|
||||
*
|
||||
** MACRO: _DIM81 $300;#10;#2
|
||||
*
|
||||
LDA #>$300 ; HIGH LOCATION FOR ARRAY
|
||||
PHA
|
||||
LDA #<$300 ; LOW LOCATION
|
||||
PHA
|
||||
LDA #10 ; ARRAY LENGTH
|
||||
PHA
|
||||
LDA #2 ; ELEMENT LENGTH
|
||||
PHA
|
||||
JSR DIM81
|
||||
*
|
||||
** NOW CHECK $300 TO SEE RESULT
|
||||
*
|
||||
*
|
||||
** AGET81 RETURNS THE MEMORY ADDRESS WHERE
|
||||
** AN ELEMENT AT THE SPECIFIED INDEX IN THE
|
||||
** ARRAY AT THE SPECIFIED ADDRESS IS LOCATED
|
||||
*
|
||||
*** MACRO: _GET81 $300;#5
|
||||
*
|
||||
LDA #>$300
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #05 ; INDEX
|
||||
PHA
|
||||
JSR AGET81
|
||||
*
|
||||
*BRK ; X=03 (HI), Y=0C (LOW)
|
||||
*
|
||||
** NOTE THAT INDEXING STARTS AT 0, SO AN ARRAY
|
||||
** OF TEN ELEMENTS WOULD BE LISTED AS 0..9
|
||||
** SO HERE WE ARE ACTUALLY ASKING FOR THE
|
||||
** ADDRESS OF THE SIXTH ELEMENT!
|
||||
*
|
||||
*
|
||||
** APUT81 COPIES DATA FROM ONE SPECIFIED LOCATION
|
||||
** TO THE ELEMENT INDEXED IN AN ARRAY AT ANOTHER
|
||||
** LOCATION.
|
||||
*
|
||||
*** MACRO: _PUT81 $300;$300;#5 (SRC,ARRAY,INDEX)
|
||||
*
|
||||
LDA #>$300 ; ADDRESS TO COPY
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #>$300 ; ARRAY ADDRESS
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #5
|
||||
PHA ; INDEX
|
||||
JSR APUT81
|
||||
*BRK
|
||||
*
|
||||
** NOTE THAT THIS JUST COPIED THE INDEXING DATA
|
||||
** OF THE ARRAY TO ITS SIXTH ELEMENT (#5), SO
|
||||
** THAT NOW 030C CONTAINS A002 (ARRAY LENGTH,
|
||||
** ELEMENT LENGTH).
|
||||
*
|
||||
*
|
||||
** DIM82 CREATES AN 8BIT, 2D ARRAY AT THE
|
||||
** SPECIFIED LOCATION WITH THE LENGTH AND
|
||||
** HEIGHT PASSED VIA THE STACK
|
||||
*
|
||||
** MACRO: _DIM82 $300;#4;#4;#1
|
||||
*
|
||||
LDA #>$300
|
||||
PHA
|
||||
LDA #<$300 ; ARRAY ADDRESS
|
||||
PHA
|
||||
LDA #4 ; X-DIMENSION
|
||||
PHA
|
||||
LDA #4 ; Y-DIMESION
|
||||
PHA
|
||||
LDA #1 ; ELEMENT SIZE
|
||||
PHA
|
||||
JSR DIM82
|
||||
*BRK
|
||||
*
|
||||
*
|
||||
** AGET82 GETS THE MEMORY LOCATION OF THE ELEMENT
|
||||
** STORED AT INDEX X,Y IN THE GIVEN ARRAYS AND
|
||||
** RETURNS IT IN Y (LOW) AND X (HIGH)
|
||||
*
|
||||
** MACRO: _GET82 $300;#2;#3
|
||||
*
|
||||
LDA #>$300
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #2 ; X INDEX
|
||||
PHA
|
||||
LDA #3 ; Y INDEX
|
||||
PHA
|
||||
JSR AGET82
|
||||
*BRK ; X=03; Y=09
|
||||
*
|
||||
*
|
||||
** APUT82 PUTS THE DATA STORED IN ONE LOCATION
|
||||
** INTO THE ARRAY AT THE SPECIFIED INDEX X,Y.
|
||||
*
|
||||
** MACRO: _PUT82 $300;$300;#2;#3
|
||||
*
|
||||
LDA #>$300 ; SRC
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #>$300 ; DEST
|
||||
PHA
|
||||
LDA #<$300
|
||||
PHA
|
||||
LDA #2 ; X INDEX
|
||||
PHA
|
||||
LDA #3
|
||||
PHA ; Y INDEX
|
||||
JSR APUT82
|
||||
*
|
||||
*BRK ; NOW $0309 WILL HOLD 04, THE X-BOUNDARY
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
** LITTLE LUMPS -- MID/LOW LEVEL
|
||||
*
|
||||
*
|
||||
JMP REENTRY
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* BOTTOM INCLUDES *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*
|
||||
** BOTTOM INCLUDES
|
||||
*
|
||||
PUT ARRAYS81.LIB
|
||||
PUT ARRAYS82.LIB
|
||||
*
|
9
disks/disk3_arrays/T.ARRAYS.HOOKS
Normal file
9
disks/disk3_arrays/T.ARRAYS.HOOKS
Normal file
@ -0,0 +1,9 @@
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* ARRAYS.HOOKS.PUT *
|
||||
* *
|
||||
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
|
||||
*
|
||||
* WELL I GOT NOTHIN
|
||||
*
|
234
disks/disk3_arrays/T.ARRAYS.MAC
Normal file
234
disks/disk3_arrays/T.ARRAYS.MAC
Normal file
@ -0,0 +1,234 @@
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* ARRAYS.MAC *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.1.2 *
|
||||
* DATE: 30-OCT-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* *
|
||||
* LICENSE: APACHE 2.0 LICENSE, *
|
||||
* WHERE APPLICABLE. CODE *
|
||||
* INSPIRED BY OR COPIED FROM *
|
||||
* OTHERS MAY FALL UNDER A *
|
||||
* DIFFERENT LICENSE. I WILL *
|
||||
* DO MY BEST TO NOTIFY SUCH *
|
||||
* CASES. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* THIS IS A MACRO LIBRARY FOR *
|
||||
* THE 8BIT ARRAY LIBRARIES, *
|
||||
* ARRAYS81.LIB & ARRAYS82.LIB. *
|
||||
* THESE ARE 8BIT 1D AND 2D *
|
||||
* ARRAY LIBS, RESPECTIVELY. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF MACROS *
|
||||
* *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _DIM81 : INIT 1D, 8BIT ARRAY *
|
||||
*- -*
|
||||
* INITS A 1-DIMENSIONAL ARRAY *
|
||||
* BY CLEARING MEMORY IT WILL *
|
||||
* SPAN ACROSS AND PUTTING THE *
|
||||
* INDEXING INFORMATION AS THE *
|
||||
* ARRAY HEADER (0 = ARRAY *
|
||||
* LENGTH, 1 = ELEMEN LENGTH). *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = ARRAY ADDRESS *
|
||||
* PARAM2 = ARRAY BYTE LENGTH *
|
||||
* PARAM3 = ELEMENT BYTE LENGTH *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _DIM81 $300;#10;#2 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_DIM81 MAC
|
||||
LDA #>]1 ; ARRAY ADDR
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2 ; ARRAY LENGTH
|
||||
PHA
|
||||
LDA ]3 ; ELEMENT LENGTH
|
||||
PHA
|
||||
JSR DIM1D
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _GET81 : GET ARRAY ELEMENT *
|
||||
* FROM 1D, 8BIT ARRAY *
|
||||
*- -*
|
||||
* CALCULATES THE ADDRESS OF AN *
|
||||
* ELEMENT IN THE GIVEN ARRAY *
|
||||
* AND RETURNS THE ADDRESS IN *
|
||||
* Y (LOW) AND X (HIGH), WITH *
|
||||
* THE ELEMENT LENGTH IN A. *
|
||||
* THEN, DATA CAN BE READ VIA *
|
||||
* REGULAR STATEMENTS WITH THAT *
|
||||
* ADDRESS. *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = ARRAY ADDRESS *
|
||||
* PARAM2 = ELEMENT INDEX *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _GET81 $300;#5 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_GET81 MAC
|
||||
LDA #>]1 ; ARRAY ADDR
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2 ; ELEM INDEX
|
||||
PHA
|
||||
JSR AGET81
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PUT81 : PUT ARRAY ELEMENT *
|
||||
* IN 1D, 8BIT ARRAY *
|
||||
*- -*
|
||||
* COPIES DATA FROM ONE MEMORY *
|
||||
* LOCATION (P1) AND PUTS IT *
|
||||
* IN THE SPECIFIED ARRAY (P2) *
|
||||
* AT THE SPECIFIED INDEX (P3). *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = SOURCE ADDRESS *
|
||||
* PARAM2 = ARRAY ADDRESS *
|
||||
* PARAM3 = ELEMENT INDEX *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _PUT81 $300;$3A0;#5 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PUT81 MAC
|
||||
LDA #>]1
|
||||
PHA ; SRC ADDR
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2 ; DEST ARRAY
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
LDA ]3 ; DEST INDEX
|
||||
PHA
|
||||
JSR APUT81
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _DIM82 : INIT 12, 8BIT ARRAY *
|
||||
*- -*
|
||||
* INITS AN 8BIT 2D ARRAY AT *
|
||||
* SPECIFIED LOCATION WITH THE *
|
||||
* DIMENSIONS OF X,Y. ARRAY *
|
||||
* BEGINS WITH A 4 BYTE HEADER *
|
||||
* WITH THE ARRAY LENGTH, X *
|
||||
* DIM, Y DIM, AND ELEM LENGTH. *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = ARRAY ADDRESS *
|
||||
* PARAM2 = X DIMENSION *
|
||||
* PARAM3 = Y DIMENSION *
|
||||
* PARAM4 = ELEMENT SIZE *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _DIM82 $300;#4;#4;#1 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_DIM82 MAC
|
||||
LDA #>]1 ; ARRAY ADDR
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2 ; X DIM
|
||||
PHA
|
||||
LDA ]3 ; Y DIM
|
||||
PHA
|
||||
LDA ]4 ; ELEMENT LENGTH
|
||||
PHA
|
||||
JSR DIM82
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _GET82 : GET ARRAY ELEMENT *
|
||||
* FROM 2D, 8BIT ARRAY *
|
||||
*- -*
|
||||
* RETURNS THE MEMORY LOCATION *
|
||||
* OF AN X,Y INDEX IN THE ARRAY *
|
||||
* VIA THE REGISTERS: Y (LOW), *
|
||||
* X (HIGH), A (ELEMENT LENGTH) *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = ARRAY ADDRESS *
|
||||
* PARAM2 = X INDEX *
|
||||
* PARAM3 = Y INDEX *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _GET82 $300;#2;#3 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_GET82 MAC
|
||||
LDA #>]1 ; ARRAY ADDR
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA ]2 ; X INDEX
|
||||
PHA
|
||||
LDA ]3 ; Y INDEX
|
||||
PHA
|
||||
JSR AGET82
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _PUT82 : PUT ARRAY ELEMENT *
|
||||
* IN 2D, 8BIT ARRAY *
|
||||
*- -*
|
||||
* COPIES DATA FROM SOURCE LOC *
|
||||
* TO THE MEMLOC OF INDEX X,Y *
|
||||
* IN THE SPECIFIED ARRAY. *
|
||||
*- -*
|
||||
* PARAMETERS: *
|
||||
* *
|
||||
* PARAM1 = SOURCE ADDRESS *
|
||||
* PARAM2 = DEST ARRAY ADDRESS *
|
||||
* PARAM3 = ELEMENT X INDEX *
|
||||
* PARAM4 = Y INDEX *
|
||||
*- -*
|
||||
* SAMPLE USAGE: *
|
||||
* _PUT82 $300;$3A0;#2;#3 *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PUT82 MAC
|
||||
LDA #>]1 ; SRC ADDR
|
||||
PHA
|
||||
LDA #<]1
|
||||
PHA
|
||||
LDA #>]2 ; ARRAY ADDR
|
||||
PHA
|
||||
LDA #<]2
|
||||
PHA
|
||||
LDA ]3 ; X INDEX
|
||||
PHA
|
||||
LDA ]4 ; Y INDEX
|
||||
PHA
|
||||
JSR APUT82
|
||||
<<<
|
||||
*
|
145
disks/disk3_arrays/T.ARRAYS81.AGET
Normal file
145
disks/disk3_arrays/T.ARRAYS81.AGET
Normal file
@ -0,0 +1,145 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* AGET81 :: GET ARRAY ELEMENT *
|
||||
* ADDRESS *
|
||||
*- -*
|
||||
* GETS THE ADDRESS LOCATION OF *
|
||||
* AN ELEMENT IN THE SPECIFIED *
|
||||
* ARRAY AT THE SPECIFIED INDEX *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ;HI ARADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 ; LOW *
|
||||
* PHA *
|
||||
* LDA #5 ; INDEX *
|
||||
* PHA *
|
||||
* JSR AGET81 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* INDEX OF ELEMENT TO GET *
|
||||
* ADDRESS OF ARRAY LO BYTE *
|
||||
* ADDRESS OF ARRAY HI BYTE *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE OF ELEMENT ADDR *
|
||||
* X = HIBYTE OF ELEMENT ADDR *
|
||||
* A = TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
AGET81
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :IDX
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
** GET ELEMENT SIZE
|
||||
*
|
||||
LDY #1 ; ELEMENT SIZE LOC
|
||||
LDA (ADDR1),Y
|
||||
STA :ESIZE
|
||||
*
|
||||
*
|
||||
** FIRST, MUL INDEX BY ELEMENT SIZE,
|
||||
** THEN ADD TWO TO GET THE PROPER ADDRESS.
|
||||
*
|
||||
LDY #0
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :IDX
|
||||
TAX
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
:LP
|
||||
ASL :IDX
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :ESIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
** ARRAY INDEX STORED IN X (LOW) AND Y (HIGH)
|
||||
*
|
||||
STX :IDX
|
||||
STY :IDX+1
|
||||
*
|
||||
** ADD 2 TO INDEX
|
||||
*
|
||||
CLC
|
||||
LDA #2
|
||||
ADC :IDX
|
||||
STA :RES
|
||||
LDA #0
|
||||
ADC :IDX+1
|
||||
STA :RES+1
|
||||
*
|
||||
** NOW ADD THAT TO BASE ARRAY ADDRESS
|
||||
** TO GET ADDRESS OF INDEX VALUE
|
||||
*
|
||||
CLC
|
||||
LDA :RES
|
||||
ADC ADDR1 ; LOW OF ARRAY ADDRESS
|
||||
STA :RES
|
||||
LDA :RES+1
|
||||
ADC ADDR1+1
|
||||
STA :RES+1
|
||||
*
|
||||
** ADDRESS TO ARRAY ELEMENT IS STORED
|
||||
** IN Y (LOW BYTE), X (HIGH BYTE)
|
||||
*
|
||||
LDY :RES
|
||||
LDX :RES+1
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RES DS 2
|
||||
:IDX DS 2
|
||||
:ESIZE DS 1
|
||||
*
|
134
disks/disk3_arrays/T.ARRAYS81.APUT
Normal file
134
disks/disk3_arrays/T.ARRAYS81.APUT
Normal file
@ -0,0 +1,134 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* APUT81 :: PUT TO ARR ELEMNT *
|
||||
*- -*
|
||||
* COPIES FROM SOURCE LOCATION *
|
||||
* AND PUTS IT IN MEMLOC FOR *
|
||||
* DESIRED ELEMENT. DIRECT *
|
||||
* PUTTING OF ELEMENT DATA *
|
||||
* CAN BE DONE VIA SIMPLE *
|
||||
* LDA/STA OPERATIONS. *
|
||||
*- -*
|
||||
* NOTE THAT THIS DOES NOT *
|
||||
* CHECK FOR OUT OF BOUNDS *
|
||||
* SO THAT CYCLES ARE NOT *
|
||||
* WASTED. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; SRC ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #>$300 ;DEST ADDR *
|
||||
* PHA *
|
||||
* STA #<$300 *
|
||||
* PHA *
|
||||
* LDA #5 ; INDEX *
|
||||
* PHA *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* INDEX OF PUT ELEMENT *
|
||||
* LOW BYTE OF DESTINATION ADDR *
|
||||
* HI BYTE OF DESTINATION ADDR *
|
||||
* LO BYTE OF SOURCE ADDRESS *
|
||||
* HI BYTE OF SOURCE ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE OF ELEMENT ADDR *
|
||||
* X = HIBYTE OF ELEMENT ADDR *
|
||||
* A = BYTE LENGTH OF ELEMENT *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
APUT81
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR ; LOCAL RETURN ADDRESS STORAGE
|
||||
PLA ; BECAUSE OF CALLING AGET81
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :AIDX
|
||||
PLA
|
||||
STA ADDR4 ; ARRAY ADDRESS; USES ADDR4
|
||||
; BECAUSE CALL TO AGET81 USES
|
||||
; ADDR1
|
||||
PLA
|
||||
STA ADDR4+1
|
||||
PLA
|
||||
STA ADDR3 ; ADDRESS OF DATA TO BE
|
||||
; COPIED TO ELEMENT
|
||||
PLA
|
||||
STA ADDR3+1
|
||||
*
|
||||
LDA ADDR4+1
|
||||
PHA
|
||||
LDA ADDR4
|
||||
PHA
|
||||
LDA :AIDX
|
||||
PHA
|
||||
JSR AGET81 ; GET MEMORY POS OF ELEM
|
||||
STY ADDR2
|
||||
STX ADDR2+1
|
||||
*
|
||||
** GET ARRAY'S ELEMENT SIZE
|
||||
*
|
||||
LDY #1
|
||||
LDA (ADDR4),Y
|
||||
STA :ESIZE
|
||||
LDY #0
|
||||
*
|
||||
** COPY FROM ADDR1 TO ADDR2
|
||||
*
|
||||
:LP
|
||||
LDA (ADDR3),Y
|
||||
STA (ADDR2),Y
|
||||
INY
|
||||
CPY :ESIZE
|
||||
BNE :LP
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN ELEMENT ADDRESS AND SIZE
|
||||
** IN REGISTERS
|
||||
*
|
||||
LDX ADDR2+1
|
||||
LDY ADDR2
|
||||
LDA :ESIZE
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
:ESIZE DS 1
|
||||
:ASIZE DS 1
|
||||
:AIDX DS 1
|
||||
*
|
181
disks/disk3_arrays/T.ARRAYS81.DIM
Normal file
181
disks/disk3_arrays/T.ARRAYS81.DIM
Normal file
@ -0,0 +1,181 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DIM81 :: INIT 1D ARRAY *
|
||||
*- -*
|
||||
* CREATES AN ARRAY OF LENGTH *
|
||||
* :ASIZE WITH ELEMENTS OF *
|
||||
* LENGTH :ESIZE AT MEMORY *
|
||||
* LOCATION POINTED TO BY *
|
||||
* :ALOC. RETURNS ARRAY START *
|
||||
* LOCATION IF SUCCESSFUL IN A, *
|
||||
* OR 0FF IF UNSUCCESSFUL. *
|
||||
*- -*
|
||||
* FIRST BYTE OF MEMORY USED *
|
||||
* HOLDS LENGTH OF ARRAY; *
|
||||
* SECOND BYTE HOLDS LENGTH OF *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAYLOC *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #10 ; ARRAY SIZE *
|
||||
* PHA *
|
||||
* LDA #2 ; ELEMENT SIZE *
|
||||
* PHA *
|
||||
* JSR DIM81 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT SIZE *
|
||||
* ARRAY SIZE *
|
||||
* LOW BYTE OF ARRAY ADDRESS *
|
||||
* HIGH BYTE OF ARRAY ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LO BYTE OF ARRAY ADDR *
|
||||
* X = HI BYTE OF ARRAY ADDR *
|
||||
* A = TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DIM81
|
||||
*
|
||||
** FIRST, CLEAR BLOCK OF MEM TO BE USED
|
||||
** THEN MUL ASIZE BY ESIZE, AND ADD 2 TO
|
||||
** GET TOTAL MEMORY USED BY ARRAY
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :ESIZE ; ELEMENT SIZE
|
||||
STA :ESZBAK
|
||||
PLA
|
||||
STA :ASIZE ; ARRAY SIZE
|
||||
STA :ASZBAK
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDY #0
|
||||
LDX #0
|
||||
LDA #0
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
** MULTIPLY ASIZE AND ESIZE TO GET TOTAL SIZE
|
||||
** OF MEMORY TO CLEAR AND USE
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :ASIZE
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :ASIZE
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :ESIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
CLC
|
||||
INX
|
||||
INX ; INCREASE BY TWO
|
||||
; TO MAKE ROOM FOR SIZES
|
||||
BCC :NOINY ; IF X ROLLS OVER, INC Y
|
||||
INY
|
||||
:NOINY
|
||||
STX :MSIZE ; LOW BYTE
|
||||
STY :MSIZE+1 ; HIGH BYTE
|
||||
*
|
||||
** NOW CLEAR MEMORY BLOCKS
|
||||
*
|
||||
** FILL WHOLE PAGES FIRST
|
||||
*
|
||||
LDA #0 ; FILL VALUE
|
||||
LDX :MSIZE+1
|
||||
BEQ :PART ; IF NO WHOLE PAGES, JUST PART
|
||||
LDY #0
|
||||
:FULL
|
||||
STA (ADDR1),Y
|
||||
INY ; NEXT BYTE
|
||||
BNE :FULL ; LOOP UNTIL PAGE DONE
|
||||
INC ADDR1+1 ; GO TO NEXT PAGE
|
||||
DEX
|
||||
BNE :FULL ; LOOP IF PAGES LEFT
|
||||
*
|
||||
** NOW DO REMAINING PARTIAL PAGES
|
||||
*
|
||||
:PART
|
||||
LDX :MSIZE ; PARTIAL PAGE BYTES
|
||||
BEQ :MFEXIT ; EXIT IF = 0
|
||||
LDY #0
|
||||
:PARTLP
|
||||
STA (ADDR1),Y ; STORE VAL
|
||||
INY ; INC INDEX
|
||||
DEX ; DEC COUNTER
|
||||
BNE :PARTLP ; LOOP UNTIL DONE
|
||||
:MFEXIT
|
||||
*
|
||||
** MEMORY FILL IS DONE
|
||||
*
|
||||
** THEN, SET SIZES
|
||||
*
|
||||
LDY #0
|
||||
LDA :ASZBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :ESZBAK
|
||||
STA (ADDR1),Y
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN POINTER TO STARTING ADDR OF ARRAY
|
||||
*
|
||||
LDY ADDR1 ; LOW
|
||||
LDX ADDR1+1 ; HIGH
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:MSIZE DS 2
|
||||
:ASIZE DS 1
|
||||
:ESIZE DS 1
|
||||
:ASZBAK DS 1
|
||||
:ESZBAK DS 1
|
498
disks/disk3_arrays/T.ARRAYS81.LIB
Normal file
498
disks/disk3_arrays/T.ARRAYS81.LIB
Normal file
@ -0,0 +1,498 @@
|
||||
JMP ARRAYS81X
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* ARRAYS81.LIB *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.1.2 *
|
||||
* DATE: 30-OCT-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* *
|
||||
* LICENSE: APACHE 2.0, WHERE *
|
||||
* APPLICABLE. CODE INSPIRED *
|
||||
* BY THE WORKS OF OTHERS MAY *
|
||||
* FALL UNDER A DIFFERENT *
|
||||
* LICENSE (NOTED IN ROUTINE). *
|
||||
* *
|
||||
* THIS IS A STANDARD LIBRARY *
|
||||
* FOR 1-DIMENSIONAL 8-BIT *
|
||||
* ARRAY MANIPUALTION. ARRAYS *
|
||||
* ARE PRECEDED BY LENGTH AND *
|
||||
* INDEXING INFORMATION. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF ROUTINES *
|
||||
* *
|
||||
* DIM81 : DIM 8BIT,1D ARRAY *
|
||||
* AGET81 : GET ADDR OF ELEMENT *
|
||||
* APUT81 : COPY DATA FROM MEM *
|
||||
* INTO ELEMENT AT *
|
||||
* SPECIFIED LOCATION *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DIM81D :: INIT 1D ARRAY *
|
||||
*- -*
|
||||
* CREATES AN ARRAY OF LENGTH *
|
||||
* :ASIZE WITH ELEMENTS OF *
|
||||
* LENGTH :ESIZE AT MEMORY *
|
||||
* LOCATION POINTED TO BY *
|
||||
* :ALOC. RETURNS ARRAY START *
|
||||
* LOCATION IF SUCCESSFUL IN A, *
|
||||
* OR 0FF IF UNSUCCESSFUL. *
|
||||
*- -*
|
||||
* FIRST BYTE OF MEMORY USED *
|
||||
* HOLDS LENGTH OF ARRAY; *
|
||||
* SECOND BYTE HOLDS LENGTH OF *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAYLOC *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #10 ; ARRAY SIZE *
|
||||
* PHA *
|
||||
* LDA #2 ; ELEMENT SIZE *
|
||||
* PHA *
|
||||
* JSR DIM81 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT SIZE *
|
||||
* ARRAY SIZE *
|
||||
* LOW BYTE OF ARRAY ADDRESS *
|
||||
* HIGH BYTE OF ARRAY ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LO BYTE OF ARRAY ADDR *
|
||||
* X = HI BYTE OF ARRAY ADDR *
|
||||
* A = TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DIM81
|
||||
*
|
||||
** FIRST, CLEAR BLOCK OF MEM TO BE USED
|
||||
** THEN MUL ASIZE BY ESIZE, AND ADD 2 TO
|
||||
** GET TOTAL MEMORY USED BY ARRAY
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :ESIZE ; ELEMENT SIZE
|
||||
STA :ESZBAK
|
||||
PLA
|
||||
STA :ASIZE ; ARRAY SIZE
|
||||
STA :ASZBAK
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
LDY #0
|
||||
LDX #0
|
||||
LDA #0
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
** MULTIPLY ASIZE AND ESIZE TO GET TOTAL SIZE
|
||||
** OF MEMORY TO CLEAR AND USE
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :ASIZE
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :ASIZE
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :ESIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
CLC
|
||||
INX
|
||||
INX ; INCREASE BY TWO
|
||||
; TO MAKE ROOM FOR SIZES
|
||||
BCC :NOINY ; IF X ROLLS OVER, INC Y
|
||||
INY
|
||||
:NOINY
|
||||
STX :MSIZE ; LOW BYTE
|
||||
STY :MSIZE+1 ; HIGH BYTE
|
||||
*
|
||||
** NOW CLEAR MEMORY BLOCKS
|
||||
*
|
||||
** FILL WHOLE PAGES FIRST
|
||||
*
|
||||
LDA #0 ; FILL VALUE
|
||||
LDX :MSIZE+1
|
||||
BEQ :PART ; IF NO WHOLE PAGES, JUST PART
|
||||
LDY #0
|
||||
:FULL
|
||||
STA (ADDR1),Y
|
||||
INY ; NEXT BYTE
|
||||
BNE :FULL ; LOOP UNTIL PAGE DONE
|
||||
INC ADDR1+1 ; GO TO NEXT PAGE
|
||||
DEX
|
||||
BNE :FULL ; LOOP IF PAGES LEFT
|
||||
*
|
||||
** NOW DO REMAINING PARTIAL PAGES
|
||||
*
|
||||
:PART
|
||||
LDX :MSIZE ; PARTIAL PAGE BYTES
|
||||
BEQ :MFEXIT ; EXIT IF = 0
|
||||
LDY #0
|
||||
:PARTLP
|
||||
STA (ADDR1),Y ; STORE VAL
|
||||
INY ; INC INDEX
|
||||
DEX ; DEC COUNTER
|
||||
BNE :PARTLP ; LOOP UNTIL DONE
|
||||
:MFEXIT
|
||||
*
|
||||
** MEMORY FILL IS DONE
|
||||
*
|
||||
** THEN, SET SIZES
|
||||
*
|
||||
LDY #0
|
||||
LDA :ASZBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :ESZBAK
|
||||
STA (ADDR1),Y
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN POINTER TO STARTING ADDR OF ARRAY
|
||||
*
|
||||
LDY ADDR1 ; LOW
|
||||
LDX ADDR1+1 ; HIGH
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:MSIZE DS 2
|
||||
:ASIZE DS 1
|
||||
:ESIZE DS 1
|
||||
:ASZBAK DS 1
|
||||
:ESZBAK DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* AGET81 :: GET ARRAY ELEMENT *
|
||||
* ADDRESS *
|
||||
*- -*
|
||||
* GETS THE ADDRESS LOCATION OF *
|
||||
* AN ELEMENT IN THE SPECIFIED *
|
||||
* ARRAY AT THE SPECIFIED INDEX *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ;HI ARADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 ; LOW *
|
||||
* PHA *
|
||||
* LDA #5 ; INDEX *
|
||||
* PHA *
|
||||
* JSR AGET81 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* INDEX OF ELEMENT TO GET *
|
||||
* ADDRESS OF ARRAY LO BYTE *
|
||||
* ADDRESS OF ARRAY HI BYTE *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE OF ELEMENT ADDR *
|
||||
* X = HIBYTE OF ELEMENT ADDR *
|
||||
* A = TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
AGET81
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :IDX
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
** GET ELEMENT SIZE
|
||||
*
|
||||
LDY #1 ; ELEMENT SIZE LOC
|
||||
LDA (ADDR1),Y
|
||||
STA :ESIZE
|
||||
*
|
||||
*
|
||||
** FIRST, MUL INDEX BY ELEMENT SIZE,
|
||||
** THEN ADD TWO TO GET THE PROPER ADDRESS.
|
||||
*
|
||||
LDY #0
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :IDX
|
||||
TAX
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
:LP
|
||||
ASL :IDX
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :ESIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
** ARRAY INDEX STORED IN X (LOW) AND Y (HIGH)
|
||||
*
|
||||
STX :IDX
|
||||
STY :IDX+1
|
||||
*
|
||||
** ADD 2 TO INDEX
|
||||
*
|
||||
CLC
|
||||
LDA #2
|
||||
ADC :IDX
|
||||
STA :RES
|
||||
LDA #0
|
||||
ADC :IDX+1
|
||||
STA :RES+1
|
||||
*
|
||||
** NOW ADD THAT TO BASE ARRAY ADDRESS
|
||||
** TO GET ADDRESS OF INDEX VALUE
|
||||
*
|
||||
CLC
|
||||
LDA :RES
|
||||
ADC ADDR1 ; LOW OF ARRAY ADDRESS
|
||||
STA :RES
|
||||
LDA :RES+1
|
||||
ADC ADDR1+1
|
||||
STA :RES+1
|
||||
*
|
||||
** ADDRESS TO ARRAY ELEMENT IS STORED
|
||||
** IN Y (LOW BYTE), X (HIGH BYTE)
|
||||
*
|
||||
LDY :RES
|
||||
LDX :RES+1
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RES DS 2
|
||||
:IDX DS 2
|
||||
:ESIZE DS 1
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* APUT81 :: PUT TO ARR ELEMNT *
|
||||
*- -*
|
||||
* COPIES FROM SOURCE LOCATION *
|
||||
* AND PUTS IT IN MEMLOC FOR *
|
||||
* DESIRED ELEMENT. DIRECT *
|
||||
* PUTTING OF ELEMENT DATA *
|
||||
* CAN BE DONE VIA SIMPLE *
|
||||
* LDA/STA OPERATIONS. *
|
||||
*- -*
|
||||
* NOTE THAT THIS DOES NOT *
|
||||
* CHECK FOR OUT OF BOUNDS *
|
||||
* SO THAT CYCLES ARE NOT *
|
||||
* WASTED. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; SRC ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #>$300 ;DEST ADDR *
|
||||
* PHA *
|
||||
* STA #<$300 *
|
||||
* PHA *
|
||||
* LDA #5 ; INDEX *
|
||||
* PHA *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* INDEX OF PUT ELEMENT *
|
||||
* LOW BYTE OF DESTINATION ADDR *
|
||||
* HI BYTE OF DESTINATION ADDR *
|
||||
* LO BYTE OF SOURCE ADDRESS *
|
||||
* HI BYTE OF SOURCE ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE OF ELEMENT ADDR *
|
||||
* X = HIBYTE OF ELEMENT ADDR *
|
||||
* A = BYTE LENGTH OF ELEMENT *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
APUT81
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR ; LOCAL RETURN ADDRESS STORAGE
|
||||
PLA ; BECAUSE OF CALLING AGET81
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :AIDX
|
||||
PLA
|
||||
STA ADDR4 ; ARRAY ADDRESS; USES ADDR4
|
||||
; BECAUSE CALL TO AGET81 USES
|
||||
; ADDR1
|
||||
PLA
|
||||
STA ADDR4+1
|
||||
PLA
|
||||
STA ADDR3 ; ADDRESS OF DATA TO BE
|
||||
; COPIED TO ELEMENT
|
||||
PLA
|
||||
STA ADDR3+1
|
||||
*
|
||||
LDA ADDR4+1
|
||||
PHA
|
||||
LDA ADDR4
|
||||
PHA
|
||||
LDA :AIDX
|
||||
PHA
|
||||
JSR AGET81 ; GET MEMORY POS OF ELEM
|
||||
STY ADDR2
|
||||
STX ADDR2+1
|
||||
*
|
||||
** GET ARRAY'S ELEMENT SIZE
|
||||
*
|
||||
LDY #1
|
||||
LDA (ADDR4),Y
|
||||
STA :ESIZE
|
||||
LDY #0
|
||||
*
|
||||
** COPY FROM ADDR1 TO ADDR2
|
||||
*
|
||||
:LP
|
||||
LDA (ADDR3),Y
|
||||
STA (ADDR2),Y
|
||||
INY
|
||||
CPY :ESIZE
|
||||
BNE :LP
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN ELEMENT ADDRESS AND SIZE
|
||||
** IN REGISTERS
|
||||
*
|
||||
LDX ADDR2+1
|
||||
LDY ADDR2
|
||||
LDA :ESIZE
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
:ESIZE DS 1
|
||||
:ASIZE DS 1
|
||||
:AIDX DS 1
|
||||
*
|
||||
ARRAYS81X
|
||||
*
|
163
disks/disk3_arrays/T.ARRAYS82.AGET
Normal file
163
disks/disk3_arrays/T.ARRAYS82.AGET
Normal file
@ -0,0 +1,163 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* AGET82 :: INIT 2D ARRAY *
|
||||
*- -*
|
||||
* THIS GETS THE ADDRESS OF AN *
|
||||
* ELEMENT AT THE INDEX X,Y IN *
|
||||
* THE SPECIFIED ARRAY. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAY ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #2 ; X INDEX *
|
||||
* PHA *
|
||||
* LDA #3 ; Y INDEX *
|
||||
* PHA *
|
||||
* JSR AGET82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* Y INDEX OF ELEMENT *
|
||||
* X INDEX OF ELEMENT *
|
||||
* LOW BYTE OF ARRAY ADDRESS *
|
||||
* HIGH BYTE OF ARRAY ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LO BYTE OF ELEM ADDR *
|
||||
* X = HI BYTE OF ELEM ADDR *
|
||||
* A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
AGET82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :YIDX
|
||||
PLA
|
||||
STA :XIDX
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #2
|
||||
LDA (ADDR1),Y ; ELEMENT LENGTH
|
||||
STA :MCAND ; ELEMENT LENGTH
|
||||
*
|
||||
** MULTIPLY X AND Y
|
||||
*
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :XIDX
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :XIDX
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :YIDX
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
STX :MLIER
|
||||
STY :MLIER+1
|
||||
*
|
||||
** NOW MULTIPLY BY LENGTH OF ELEMENTS
|
||||
*
|
||||
LDA #0
|
||||
STA :PROD+2
|
||||
STA :PROD+3
|
||||
LDX #$10
|
||||
:SHIFTR LSR :MLIER+1
|
||||
ROR :MLIER
|
||||
BCC :ROTR
|
||||
LDA :PROD+2
|
||||
CLC
|
||||
ADC :MCAND
|
||||
STA :PROD+2
|
||||
LDA :PROD+3
|
||||
ADC :MCAND+1
|
||||
:ROTR
|
||||
ROR
|
||||
STA :PROD+3
|
||||
ROR :PROD+2
|
||||
ROR :PROD+1
|
||||
ROR :PROD
|
||||
DEX
|
||||
BNE :SHIFTR
|
||||
*
|
||||
INC :PROD ; INCREASE BY 3
|
||||
INC :PROD
|
||||
INC :PROD
|
||||
*
|
||||
** NOW ADD BASE ADDRESS OF ARRAY TO GET
|
||||
** THE ADDRESS OF THE INDEX VALUE
|
||||
*
|
||||
CLC
|
||||
LDA :PROD
|
||||
ADC ADDR1
|
||||
STA :PROD
|
||||
LDA :PROD+1
|
||||
ADC ADDR1+1
|
||||
STA :PROD+1
|
||||
*
|
||||
** RETURN ADDRESS IN Y(LOW) AND X(HIGH)
|
||||
*
|
||||
LDY :PROD
|
||||
LDX :PROD+1
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:XIDX DS 2
|
||||
:YIDX DS 2
|
||||
:PROD DS 4
|
||||
:MLIER DS 2
|
||||
:MCAND DS 2
|
||||
*
|
132
disks/disk3_arrays/T.ARRAYS82.APUT
Normal file
132
disks/disk3_arrays/T.ARRAYS82.APUT
Normal file
@ -0,0 +1,132 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* APUT82 :: PUT DATA INTO ELEM *
|
||||
*- -*
|
||||
* THIS PUTS DATA FROM ONE ADDR *
|
||||
* INTO THE ADDRESS OF AN ARRAY *
|
||||
* WITH THE INDEX OF X,Y. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; SOURCE DATA *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #>$3A0 ; DEST ARRAY *
|
||||
* PHA *
|
||||
* LDA #<$3A0 *
|
||||
* PHA *
|
||||
* LDA #2 ; ELEM X INDEX *
|
||||
* PHA *
|
||||
* LDA #3 ; ELEM Y INDEX *
|
||||
* PHA *
|
||||
* JSR APUT82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT Y INDEX *
|
||||
* ELEMENT X INDEX *
|
||||
* LOW BYTE OF DESTINATION ADDR *
|
||||
* HI BYTE OF DESTINATION ADDR *
|
||||
* LO BYTE OF SOURCE ADDRESS *
|
||||
* HI BYTE OF SOURCE ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE ELEMENT ADDRESS *
|
||||
* X = HIBYTE ELEMENT ADDRESS *
|
||||
* A = ELEMENT BYTE LENGTH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
APUT82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR ; LOCAL BECAUSE OF
|
||||
PLA ; CALLING AGET82
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :YIDX ; Y INDEX
|
||||
PLA
|
||||
STA :XIDX ; X INDEX
|
||||
PLA
|
||||
STA ADDR4 ; ADDRESS OF ARRAY
|
||||
PLA
|
||||
STA ADDR4+1
|
||||
PLA
|
||||
STA ADDR3 ; ADDRESS OF DATA
|
||||
PLA ; TO BE COPIED
|
||||
STA ADDR3+1
|
||||
*
|
||||
** NOW RUN AGET82 TO GET PROPER ADDRESS
|
||||
*
|
||||
LDA ADDR4+1 ; ARRAY ADDRESS
|
||||
PHA
|
||||
LDA ADDR4
|
||||
PHA
|
||||
LDA :XIDX ; X INDEX
|
||||
PHA
|
||||
LDA :YIDX ; Y INDEX
|
||||
PHA
|
||||
JSR AGET82
|
||||
STY ADDR2 ; STORE ADDRESS OF INDEX
|
||||
STX ADDR2+1 ; IN ZERO PAGE
|
||||
*
|
||||
** GET ARRAY ELEMENT SIZE
|
||||
*
|
||||
LDY #2
|
||||
LDA (ADDR4),Y
|
||||
STA :ESIZE
|
||||
LDY #0
|
||||
*
|
||||
** COPY FROM SRC ADDR TO DEST ADDR
|
||||
*
|
||||
:CLP
|
||||
LDA (ADDR3),Y
|
||||
STA (ADDR2),Y
|
||||
INY
|
||||
CPY :ESIZE
|
||||
BNE :CLP
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN ELEMENT ADDRESS AND SIZE
|
||||
*
|
||||
LDX ADDR2+1
|
||||
LDY ADDR2
|
||||
LDA :ESIZE
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
:ESIZE DS 1
|
||||
:XIDX DS 1
|
||||
:YIDX DS 1
|
||||
*
|
214
disks/disk3_arrays/T.ARRAYS82.DIM
Normal file
214
disks/disk3_arrays/T.ARRAYS82.DIM
Normal file
@ -0,0 +1,214 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DIM82 :: INIT 2D ARRAY *
|
||||
*- -*
|
||||
* THIS SIMPLY CREATES A 1D *
|
||||
* ARRAY WITH THE DIM OF *
|
||||
* ARRAYX BY ARRAYY. *
|
||||
*- -*
|
||||
* FIRST BYTE OF MEMORY USED *
|
||||
* HOLDS LENGTH OF X (ROWS); *
|
||||
* SECOND BYTE HOLDS LENGTH OF *
|
||||
* Y (COLUMNS); THIRD BYTE *
|
||||
* HOLDS LENGTH OF EACH ELEMENT *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAY ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #4 ; X DIMENSION BOUND *
|
||||
* PHA *
|
||||
* LDA #4 ; Y DIMENSION BOUND *
|
||||
* PHA *
|
||||
* LDA #1 ; ELEMENT BYTESIZE *
|
||||
* PHA *
|
||||
* JSR DIM82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT SIZE IN BYTES *
|
||||
* Y DIMENSION BOUNDARY *
|
||||
* X DIMENSION BOUNDARY *
|
||||
* ARRAY ADDRESS, LOW BYTE *
|
||||
* ARRAY ADDRESS, HIGH BYTE *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = ARRAY ADDRESS LO BYTE *
|
||||
* X = ARRAY ADDRESS HI BYTE *
|
||||
* A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DIM82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :MCAND ; ELEMENT LENGTH
|
||||
PLA
|
||||
STA :AYSIZE
|
||||
STA :AYBAK
|
||||
PLA
|
||||
STA :AXSIZE
|
||||
STA :AXBAK
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
** LOOP THROUGH Y, CLEARING MEMORY
|
||||
** FOR X BYTES TIMES ELEMENT SIZE,
|
||||
** MOVING TO END OF LAST CLEAR
|
||||
** UNTIL FINISHED
|
||||
*
|
||||
** MULTIPLY X AND Y
|
||||
*
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :AXSIZE
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :AXSIZE
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :AYSIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
STX :MLIER
|
||||
STY :MLIER+1
|
||||
*
|
||||
** NOW MULTIPLY BY LENGTH OF ELEMENTS
|
||||
*
|
||||
LDA #0
|
||||
STA :PROD+2
|
||||
STA :PROD+3
|
||||
LDX #$10
|
||||
:SHIFTR LSR :MLIER+1
|
||||
ROR :MLIER
|
||||
BCC :ROTR
|
||||
LDA :PROD+2
|
||||
CLC
|
||||
ADC :MCAND
|
||||
STA :PROD+2
|
||||
LDA :PROD+3
|
||||
ADC :MCAND+1
|
||||
:ROTR
|
||||
ROR
|
||||
STA :PROD+3
|
||||
ROR :PROD+2
|
||||
ROR :PROD+1
|
||||
ROR :PROD
|
||||
DEX
|
||||
BNE :SHIFTR
|
||||
*
|
||||
INC :PROD ; INCREASE BY 3
|
||||
INC :PROD
|
||||
INC :PROD
|
||||
LDX :PROD
|
||||
LDY :PROD+1
|
||||
*
|
||||
** NOW CLEAR MEMORY BLOCKS, WHOLE PAGES FIRST
|
||||
*
|
||||
LDA #$00 ; FILL VALUE
|
||||
LDX :PROD+1 ; NOTE THAT THIS WON'T
|
||||
; GO BEYOND A 16BIT VALUE;
|
||||
; ANYTHING HIGHER THAN
|
||||
; 16BITS IS MORE THAN
|
||||
; THERE IS MEMORY IN A
|
||||
; STANDARD APPLE ][
|
||||
BEQ :PART
|
||||
LDY #0
|
||||
:FULL
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
BNE :FULL
|
||||
INC ADDR1+1
|
||||
DEX
|
||||
BNE :FULL ; LOOP UNTIL PAGES DONE
|
||||
*
|
||||
** NOW DO REMAINING BYTES
|
||||
*
|
||||
:PART
|
||||
LDX :PROD
|
||||
BEQ :MFEXIT
|
||||
LDY #0
|
||||
:PARTLP
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
DEX
|
||||
BNE :PARTLP ; LOOP UNTIL DONE
|
||||
:MFEXIT
|
||||
*
|
||||
** NOW SET SIZES
|
||||
*
|
||||
LDY #0
|
||||
LDA :AXBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :AYBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :MCAND
|
||||
STA (ADDR1),Y
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN POINTER TO STARTING ADDRESS OF ARRAY
|
||||
*
|
||||
LDY ADDR1
|
||||
LDX ADDR1+1
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:PROD DS 4
|
||||
:AXSIZE DS 1
|
||||
:AYSIZE DS 1
|
||||
:AXBAK DS 1
|
||||
:AYBAK DS 1
|
||||
:MLIER DS 2
|
||||
:MCAND DS 2
|
||||
*
|
547
disks/disk3_arrays/T.ARRAYS82.LIB
Normal file
547
disks/disk3_arrays/T.ARRAYS82.LIB
Normal file
@ -0,0 +1,547 @@
|
||||
JMP ARRAYS82X
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* ARRAYS82.LIB *
|
||||
* *
|
||||
* AUTHOR: NATHAN RIGGS *
|
||||
* CONTACT: NATHAN.RIGGS@ *
|
||||
* OUTLOOK.COM *
|
||||
* *
|
||||
* VERSION: 0.1.2 *
|
||||
* DATE: 30-OCT-2018 *
|
||||
* ASSEMBLER: MERLIN 8 PRO *
|
||||
* *
|
||||
* LICENSE: APACHE 2.0, WHERE *
|
||||
* APPLICABLE. CODE INSPIRED *
|
||||
* BY THE WORKS OF OTHERS MAY *
|
||||
* FALL UNDER A DIFFERENT *
|
||||
* LICENSE (NOTED IN ROUTINE). *
|
||||
* *
|
||||
* THIS IS A STANDARD LIBRARY *
|
||||
* FOR 8BIT, 2 DIMENSIONAL *
|
||||
* ARRAY MANIPULATION. ARRAYS *
|
||||
* ARE PRECEDED BY LENGTH AND *
|
||||
* INDEXING INFORMATION. *
|
||||
* *
|
||||
*------------------------------*
|
||||
* *
|
||||
* LIST OF ROUTINES *
|
||||
* *
|
||||
* DIM82 : DIM A 2D, 8BIT ARRAY *
|
||||
* AGET82: GET ADDRESS OF ELEM *
|
||||
* IN ARRAY AT X,Y *
|
||||
* APUT82: PUT CONTENTS OF ONE *
|
||||
* ADDRESS INTO ARRAY *
|
||||
* AT INDEX X,Y *
|
||||
* *
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DIM82 :: INIT 2D ARRAY *
|
||||
*- -*
|
||||
* THIS SIMPLY CREATES A 1D *
|
||||
* ARRAY WITH THE DIM OF *
|
||||
* ARRAYX BY ARRAYY. *
|
||||
*- -*
|
||||
* FIRST BYTE OF MEMORY USED *
|
||||
* HOLDS LENGTH OF X (ROWS); *
|
||||
* SECOND BYTE HOLDS LENGTH OF *
|
||||
* Y (COLUMNS); THIRD BYTE *
|
||||
* HOLDS LENGTH OF EACH ELEMENT *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAY ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #4 ; X DIMENSION BOUND *
|
||||
* PHA *
|
||||
* LDA #4 ; Y DIMENSION BOUND *
|
||||
* PHA *
|
||||
* LDA #1 ; ELEMENT BYTESIZE *
|
||||
* PHA *
|
||||
* JSR DIM82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT SIZE IN BYTES *
|
||||
* Y DIMENSION BOUNDARY *
|
||||
* X DIMENSION BOUNDARY *
|
||||
* ARRAY ADDRESS, LOW BYTE *
|
||||
* ARRAY ADDRESS, HIGH BYTE *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = ARRAY ADDRESS LO BYTE *
|
||||
* X = ARRAY ADDRESS HI BYTE *
|
||||
* A = CLOBBERED *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
DIM82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :MCAND ; ELEMENT LENGTH
|
||||
PLA
|
||||
STA :AYSIZE
|
||||
STA :AYBAK
|
||||
PLA
|
||||
STA :AXSIZE
|
||||
STA :AXBAK
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
** LOOP THROUGH Y, CLEARING MEMORY
|
||||
** FOR X BYTES TIMES ELEMENT SIZE,
|
||||
** MOVING TO END OF LAST CLEAR
|
||||
** UNTIL FINISHED
|
||||
*
|
||||
** MULTIPLY X AND Y
|
||||
*
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :AXSIZE
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :AXSIZE
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :AYSIZE
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
STX :MLIER
|
||||
STY :MLIER+1
|
||||
*
|
||||
** NOW MULTIPLY BY LENGTH OF ELEMENTS
|
||||
*
|
||||
LDA #0
|
||||
STA :PROD+2
|
||||
STA :PROD+3
|
||||
LDX #$10
|
||||
:SHIFTR LSR :MLIER+1
|
||||
ROR :MLIER
|
||||
BCC :ROTR
|
||||
LDA :PROD+2
|
||||
CLC
|
||||
ADC :MCAND
|
||||
STA :PROD+2
|
||||
LDA :PROD+3
|
||||
ADC :MCAND+1
|
||||
:ROTR
|
||||
ROR
|
||||
STA :PROD+3
|
||||
ROR :PROD+2
|
||||
ROR :PROD+1
|
||||
ROR :PROD
|
||||
DEX
|
||||
BNE :SHIFTR
|
||||
*
|
||||
INC :PROD ; INCREASE BY 3
|
||||
INC :PROD
|
||||
INC :PROD
|
||||
LDX :PROD
|
||||
LDY :PROD+1
|
||||
*
|
||||
** NOW CLEAR MEMORY BLOCKS, WHOLE PAGES FIRST
|
||||
*
|
||||
LDA #$00 ; FILL VALUE
|
||||
LDX :PROD+1 ; NOTE THAT THIS WON'T
|
||||
; GO BEYOND A 16BIT VALUE;
|
||||
; ANYTHING HIGHER THAN
|
||||
; 16BITS IS MORE THAN
|
||||
; THERE IS MEMORY IN A
|
||||
; STANDARD APPLE ][
|
||||
BEQ :PART
|
||||
LDY #0
|
||||
:FULL
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
BNE :FULL
|
||||
INC ADDR1+1
|
||||
DEX
|
||||
BNE :FULL ; LOOP UNTIL PAGES DONE
|
||||
*
|
||||
** NOW DO REMAINING BYTES
|
||||
*
|
||||
:PART
|
||||
LDX :PROD
|
||||
BEQ :MFEXIT
|
||||
LDY #0
|
||||
:PARTLP
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
DEX
|
||||
BNE :PARTLP ; LOOP UNTIL DONE
|
||||
:MFEXIT
|
||||
*
|
||||
** NOW SET SIZES
|
||||
*
|
||||
LDY #0
|
||||
LDA :AXBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :AYBAK
|
||||
STA (ADDR1),Y
|
||||
INY
|
||||
LDA :MCAND
|
||||
STA (ADDR1),Y
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN POINTER TO STARTING ADDRESS OF ARRAY
|
||||
*
|
||||
LDY ADDR1
|
||||
LDX ADDR1+1
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:PROD DS 4
|
||||
:AXSIZE DS 1
|
||||
:AYSIZE DS 1
|
||||
:AXBAK DS 1
|
||||
:AYBAK DS 1
|
||||
:MLIER DS 2
|
||||
:MCAND DS 2
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* AGET82 :: INIT 2D ARRAY *
|
||||
*- -*
|
||||
* THIS GETS THE ADDRESS OF AN *
|
||||
* ELEMENT AT THE INDEX X,Y IN *
|
||||
* THE SPECIFIED ARRAY. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; ARRAY ADDR *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #2 ; X INDEX *
|
||||
* PHA *
|
||||
* LDA #3 ; Y INDEX *
|
||||
* PHA *
|
||||
* JSR AGET82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* Y INDEX OF ELEMENT *
|
||||
* X INDEX OF ELEMENT *
|
||||
* LOW BYTE OF ARRAY ADDRESS *
|
||||
* HIGH BYTE OF ARRAY ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LO BYTE OF ELEM ADDR *
|
||||
* X = HI BYTE OF ELEM ADDR *
|
||||
* A = CLOBBERED; TRASH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
AGET82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA RETADR
|
||||
PLA
|
||||
STA RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :YIDX
|
||||
PLA
|
||||
STA :XIDX
|
||||
PLA
|
||||
STA ADDR1
|
||||
PLA
|
||||
STA ADDR1+1
|
||||
*
|
||||
LDY #2
|
||||
LDA (ADDR1),Y ; ELEMENT LENGTH
|
||||
STA :MCAND ; ELEMENT LENGTH
|
||||
*
|
||||
** MULTIPLY X AND Y
|
||||
*
|
||||
LDA #0
|
||||
TAY
|
||||
STY SCRATCH
|
||||
BEQ :ENTLP
|
||||
*
|
||||
:DOADD
|
||||
CLC
|
||||
ADC :XIDX
|
||||
TAX
|
||||
*
|
||||
TYA
|
||||
ADC SCRATCH
|
||||
TAY
|
||||
TXA
|
||||
*
|
||||
:LP
|
||||
ASL :XIDX
|
||||
ROL SCRATCH
|
||||
:ENTLP
|
||||
LSR :YIDX
|
||||
BCS :DOADD
|
||||
BNE :LP
|
||||
*
|
||||
STX :MLIER
|
||||
STY :MLIER+1
|
||||
*
|
||||
** NOW MULTIPLY BY LENGTH OF ELEMENTS
|
||||
*
|
||||
LDA #0
|
||||
STA :PROD+2
|
||||
STA :PROD+3
|
||||
LDX #$10
|
||||
:SHIFTR LSR :MLIER+1
|
||||
ROR :MLIER
|
||||
BCC :ROTR
|
||||
LDA :PROD+2
|
||||
CLC
|
||||
ADC :MCAND
|
||||
STA :PROD+2
|
||||
LDA :PROD+3
|
||||
ADC :MCAND+1
|
||||
:ROTR
|
||||
ROR
|
||||
STA :PROD+3
|
||||
ROR :PROD+2
|
||||
ROR :PROD+1
|
||||
ROR :PROD
|
||||
DEX
|
||||
BNE :SHIFTR
|
||||
*
|
||||
INC :PROD ; INCREASE BY 3
|
||||
INC :PROD
|
||||
INC :PROD
|
||||
*
|
||||
** NOW ADD BASE ADDRESS OF ARRAY TO GET
|
||||
** THE ADDRESS OF THE INDEX VALUE
|
||||
*
|
||||
CLC
|
||||
LDA :PROD
|
||||
ADC ADDR1
|
||||
STA :PROD
|
||||
LDA :PROD+1
|
||||
ADC ADDR1+1
|
||||
STA :PROD+1
|
||||
*
|
||||
** RETURN ADDRESS IN Y(LOW) AND X(HIGH)
|
||||
*
|
||||
LDY :PROD
|
||||
LDX :PROD+1
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA RETADR+1
|
||||
PHA
|
||||
LDA RETADR
|
||||
PHA
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:XIDX DS 2
|
||||
:YIDX DS 2
|
||||
:PROD DS 4
|
||||
:MLIER DS 2
|
||||
:MCAND DS 2
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* APUT82 :: PUT DATA INTO ELEM *
|
||||
*- -*
|
||||
* THIS PUTS DATA FROM ONE ADDR *
|
||||
* INTO THE ADDRESS OF AN ARRAY *
|
||||
* WITH THE INDEX OF X,Y. *
|
||||
*- -*
|
||||
* CLOBBERS: *
|
||||
* *
|
||||
* FLAGS: ????---- REG: AXYM *
|
||||
*- -*
|
||||
* CYCLES: ??? *
|
||||
* SIZE: *
|
||||
*- -*
|
||||
* USAGE: *
|
||||
* *
|
||||
* LDA #>$300 ; SOURCE DATA *
|
||||
* PHA *
|
||||
* LDA #<$300 *
|
||||
* PHA *
|
||||
* LDA #>$3A0 ; DEST ARRAY *
|
||||
* PHA *
|
||||
* LDA #<$3A0 *
|
||||
* PHA *
|
||||
* LDA #2 ; ELEM X INDEX *
|
||||
* PHA *
|
||||
* LDA #3 ; ELEM Y INDEX *
|
||||
* PHA *
|
||||
* JSR APUT82 *
|
||||
*- -*
|
||||
* ENTRY *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* ELEMENT Y INDEX *
|
||||
* ELEMENT X INDEX *
|
||||
* LOW BYTE OF DESTINATION ADDR *
|
||||
* HI BYTE OF DESTINATION ADDR *
|
||||
* LO BYTE OF SOURCE ADDRESS *
|
||||
* HI BYTE OF SOURCE ADDRESS *
|
||||
*- -*
|
||||
* EXIT *
|
||||
* *
|
||||
* TOP OF STACK *
|
||||
* *
|
||||
* LOW BYTE OF RETURN ADDRESS *
|
||||
* HI BYTE OF RETURN ADDRESS *
|
||||
* *
|
||||
* Y = LOBYTE ELEMENT ADDRESS *
|
||||
* X = HIBYTE ELEMENT ADDRESS *
|
||||
* A = ELEMENT BYTE LENGTH *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
APUT82
|
||||
*
|
||||
** SAVE RETURN ADDRESS
|
||||
*
|
||||
PLA
|
||||
STA :RETADR ; LOCAL BECAUSE OF
|
||||
PLA ; CALLING AGET82
|
||||
STA :RETADR+1
|
||||
*
|
||||
** GET PARAMETERS
|
||||
*
|
||||
PLA
|
||||
STA :YIDX ; Y INDEX
|
||||
PLA
|
||||
STA :XIDX ; X INDEX
|
||||
PLA
|
||||
STA ADDR4 ; ADDRESS OF ARRAY
|
||||
PLA
|
||||
STA ADDR4+1
|
||||
PLA
|
||||
STA ADDR3 ; ADDRESS OF DATA
|
||||
PLA ; TO BE COPIED
|
||||
STA ADDR3+1
|
||||
*
|
||||
** NOW RUN AGET82 TO GET PROPER ADDRESS
|
||||
*
|
||||
LDA ADDR4+1 ; ARRAY ADDRESS
|
||||
PHA
|
||||
LDA ADDR4
|
||||
PHA
|
||||
LDA :XIDX ; X INDEX
|
||||
PHA
|
||||
LDA :YIDX ; Y INDEX
|
||||
PHA
|
||||
JSR AGET82
|
||||
STY ADDR2 ; STORE ADDRESS OF INDEX
|
||||
STX ADDR2+1 ; IN ZERO PAGE
|
||||
*
|
||||
** GET ARRAY ELEMENT SIZE
|
||||
*
|
||||
LDY #2
|
||||
LDA (ADDR4),Y
|
||||
STA :ESIZE
|
||||
LDY #0
|
||||
*
|
||||
** COPY FROM SRC ADDR TO DEST ADDR
|
||||
*
|
||||
:CLP
|
||||
LDA (ADDR3),Y
|
||||
STA (ADDR2),Y
|
||||
INY
|
||||
CPY :ESIZE
|
||||
BNE :CLP
|
||||
*
|
||||
** RESTORE RETURN ADDRESS
|
||||
*
|
||||
LDA :RETADR+1
|
||||
PHA
|
||||
LDA :RETADR
|
||||
PHA
|
||||
*
|
||||
** RETURN ELEMENT ADDRESS AND SIZE
|
||||
*
|
||||
LDX ADDR2+1
|
||||
LDY ADDR2
|
||||
LDA :ESIZE
|
||||
*
|
||||
RTS
|
||||
*
|
||||
** DATA
|
||||
*
|
||||
:RETADR DS 2
|
||||
:ESIZE DS 1
|
||||
:XIDX DS 1
|
||||
:YIDX DS 1
|
||||
*
|
||||
ARRAYS82X
|
||||
*
|
46
disks/disk3_arrays/T.DECS
Normal file
46
disks/disk3_arrays/T.DECS
Normal file
@ -0,0 +1,46 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* DECLARATIONS.PUT *
|
||||
*- -*
|
||||
* USED IN CONJUNCTION WITH *
|
||||
* OTHER PUT FILES. DEFINES *
|
||||
* BASIC DECLARATIONS USED *
|
||||
* ACROSS DIFFERENT ROUTINES *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
** ADDRESS STORAGE LOCATIONS FOR
|
||||
** INDIRECT ADDRESSING.
|
||||
*
|
||||
ADDR1 EQU $06
|
||||
ADDR2 EQU $08
|
||||
ADDR3 EQU $EB
|
||||
ADDR4 EQU $ED
|
||||
*
|
||||
** SCRATCHPAD ZERO PAGE LOCATIONS AND
|
||||
** DEDICATED ZERO PAGE ADDRESS TO HOLD
|
||||
** A RETURN ADDRESS PASSED VIA THE STACK
|
||||
*
|
||||
SCRATCH EQU $19
|
||||
SCRATCH2 EQU $1E
|
||||
RETADR EQU $FE
|
||||
*
|
||||
** ZERO PAGE ADDRESSES DEDICATED TO PASSING
|
||||
** BACK RESULTS WHEN THERE ARE MORE THAN
|
||||
** THREE BYTES BEING PASSED (AXY) AND THE
|
||||
** USE OF THE STACK IS IMPRACTICAL OR TOO SLOW
|
||||
*
|
||||
RESULT EQU $FA
|
||||
RESULT2 EQU $FC
|
||||
*
|
||||
** VARIOUS HOOKS USED BY ALL ROUTINES
|
||||
*
|
||||
REENTRY EQU $3D0
|
||||
*
|
||||
** ERROR HANDLING MEMORY LOCATIONS
|
||||
*
|
||||
** THIS DESIGNATES A 16-BYTE BLOCK OF MEMORY
|
||||
** THAT HOLDS DATA RELATED TO IDENTIFYING
|
||||
** RUNTIME VALUES FOR DEBUGGING.
|
||||
*
|
||||
ERRLOC EQU $0C00
|
||||
*
|
122
disks/disk3_arrays/T.STRINGS.MAC
Normal file
122
disks/disk3_arrays/T.STRINGS.MAC
Normal file
@ -0,0 +1,122 @@
|
||||
*
|
||||
*``````````````````````````````*
|
||||
*- -*
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* PRINT INDEXED STRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_PRS MAC
|
||||
LDA #<]1
|
||||
STA RESULT2
|
||||
LDA #>]1
|
||||
STA RESULT2+1
|
||||
JSR PRNSTR
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* CONCATENATE STRINGS *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SCAT MAC
|
||||
LDA #<]1
|
||||
STA __S1A
|
||||
LDA #>]1
|
||||
STA __S1A+1
|
||||
LDA #<]2
|
||||
STA __S2A
|
||||
LDA #>]2
|
||||
STA __S2A+1
|
||||
LDA ]3
|
||||
STA __MLEN
|
||||
JSR STRCAT
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* FIND SUBSTRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SPOS MAC
|
||||
LDA #<]1
|
||||
STA __SUB
|
||||
LDA #>]1
|
||||
STA __SUB+1
|
||||
LDA #<]2
|
||||
STA __STR
|
||||
LDA #>]2
|
||||
STA __STR+1
|
||||
JSR SUBPOS
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _SCPY :: SUBSTRING COPY *
|
||||
*- -*
|
||||
* USAGE: _SCPY ]1;]2;]3;]4;]5 *
|
||||
* *
|
||||
* ]1 SRC STRING ADDR *
|
||||
* ]2 DEST STRING ADDRESS *
|
||||
* ]3 STARTING SUBSTRING INDEX *
|
||||
* ]4 SUBSTRING LENGTH *
|
||||
* ]5 MAX LENGTH OF DEST STR *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SCPY MAC
|
||||
LDA #<]1
|
||||
STA __S1A
|
||||
LDA #>]1
|
||||
STA __S1A+1
|
||||
LDA #<]2
|
||||
STA __S2A
|
||||
LDA #>]2
|
||||
STA __S2A+1
|
||||
LDA ]3
|
||||
STA __SINDEX
|
||||
LDA ]4
|
||||
STA __SCNT
|
||||
LDA ]5
|
||||
STA __MLEN
|
||||
JSR SUBCOPY
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _SDEL :: DELETE SUBSTRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SDEL MAC
|
||||
LDA #<]1
|
||||
STA __S1A
|
||||
LDA #>]1
|
||||
STA __S1A+1
|
||||
LDA ]2
|
||||
STA __SINDEX
|
||||
LDA ]3
|
||||
STA __SCNT
|
||||
JSR SUBDEL
|
||||
<<<
|
||||
*
|
||||
*``````````````````````````````*
|
||||
* _SINS :: INSERT SUBSTRING *
|
||||
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
||||
*
|
||||
_SINS MAC
|
||||
LDA #<]1
|
||||
STA __S1A
|
||||
LDA #>]1
|
||||
STA __S1A+1
|
||||
LDA #<]2
|
||||
STA __S2A
|
||||
LDA #>]2
|
||||
STA __S2A+1
|
||||
LDA ]3
|
||||
STA __SINDEX
|
||||
LDA ]4
|
||||
STA __MLEN
|
||||
JSR SUBINS
|
||||
<<<
|
Loading…
Reference in New Issue
Block a user