created disks folder

items in disk folder will be updated automatically, whereas items in the source folder will be updated periodically due to having to manually sort through files to copy and paste
This commit is contained in:
nathanriggs 2018-11-03 14:59:24 -04:00
parent 958fd855cc
commit 9849dbb5ea
25 changed files with 8277 additions and 0 deletions

View File

@ -0,0 +1,339 @@
6000- A9 03 LDA #$03
6002- 48 PHA
6003- A9 00 LDA #$00
6005- 48 PHA
6006- A9 00 LDA #$00
6008- 48 PHA
6009- A9 0A LDA #$0A
600B- 48 PHA
600C- A9 00 LDA #$00
600E- 48 PHA
600F- 20 63 60 JSR $6063
6012- A9 03 LDA #$03
6014- 48 PHA
6015- A9 00 LDA #$00
6017- 48 PHA
6018- A9 03 LDA #$03
601A- 48 PHA
601B- A9 20 LDA #$20
601D- 48 PHA
601E- A9 00 LDA #$00
6020- 48 PHA
6021- A9 0A LDA #$0A
6023- 48 PHA
6024- 20 AC 60 JSR $60AC
6027- A0 FA LDY #$FA
6029- 20 4E 61 JSR $614E
602C- A0 FA LDY #$FA
602E- 20 4E 61 JSR $614E
6031- A0 FA LDY #$FA
6033- 20 4E 61 JSR $614E
6036- A0 FA LDY #$FA
6038- 20 4E 61 JSR $614E
603B- A9 01 LDA #$01
603D- 85 06 STA $06
603F- A9 02 LDA #$02
6041- 85 07 STA $07
6043- A9 03 LDA #$03
6045- 85 08 STA $08
6047- A9 04 LDA #$04
6049- 85 09 STA $09
604B- A9 6D LDA #$6D
604D- 48 PHA
604E- A9 00 LDA #$00
6050- 48 PHA
6051- 20 6B 61 JSR $616B
6054- A9 6D LDA #$6D
6056- 48 PHA
6057- A9 00 LDA #$00
6059- 48 PHA
605A- 20 E3 61 JSR $61E3
605D- 4C D0 03 JMP $03D0
6060- 4C 59 62 JMP $6259
6063- 68 PLA
6064- 8D AA 60 STA $60AA
6067- 68 PLA
6068- 8D AB 60 STA $60AB
606B- 68 PLA
606C- 8D A7 60 STA $60A7
606F- 68 PLA
6070- 8D A8 60 STA $60A8
6073- 68 PLA
6074- 8D A9 60 STA $60A9
6077- 68 PLA
6078- 85 06 STA $06
607A- 68 PLA
607B- 85 07 STA $07
607D- AD A7 60 LDA $60A7
6080- AE A9 60 LDX $60A9
6083- F0 0C BEQ $6091
6085- A0 00 LDY #$00
6087- 91 06 STA ($06),Y
6089- C8 INY
608A- D0 FB BNE $6087
608C- E6 07 INC $07
608E- CA DEX
608F- D0 F6 BNE $6087
6091- AE A8 60 LDX $60A8
6094- F0 08 BEQ $609E
6096- A0 00 LDY #$00
6098- 91 06 STA ($06),Y
609A- C8 INY
609B- CA DEX
609C- D0 FA BNE $6098
609E- AD AB 60 LDA $60AB
60A1- 48 PHA
60A2- AD AA 60 LDA $60AA
60A5- 48 PHA
60A6- 60 RTS
60A7- 00 BRK
60A8- 00 BRK
60A9- 00 BRK
60AA- 00 BRK
60AB- 00 BRK
60AC- 68 PLA
60AD- 8D 4A 61 STA $614A
60B0- 68 PLA
60B1- 8D 4B 61 STA $614B
60B4- 68 PLA
60B5- 8D 4C 61 STA $614C
60B8- 68 PLA
60B9- 8D 4D 61 STA $614D
60BC- 68 PLA
60BD- 85 08 STA $08
60BF- 68 PLA
60C0- 85 09 STA $09
60C2- 68 PLA
60C3- 85 06 STA $06
60C5- 68 PLA
60C6- 85 07 STA $07
60C8- A5 08 LDA $08
60CA- 38 SEC
60CB- E5 06 SBC $06
60CD- AA TAX
60CE- A5 09 LDA $09
60D0- E5 07 SBC $07
60D2- A8 TAY
60D3- 8A TXA
60D4- CD 4C 61 CMP $614C
60D7- 98 TYA
60D8- ED 4D 61 SBC $614D
60DB- B0 06 BCS $60E3
60DD- 20 0E 61 JSR $610E
60E0- 4C E6 60 JMP $60E6
60E3- 20 E9 60 JSR $60E9
60E6- 4C 41 61 JMP $6141
60E9- A0 00 LDY #$00
60EB- AE 4D 61 LDX $614D
60EE- F0 0E BEQ $60FE
60F0- B1 06 LDA ($06),Y
60F2- 91 08 STA ($08),Y
60F4- C8 INY
60F5- D0 F9 BNE $60F0
60F7- E6 07 INC $07
60F9- E6 09 INC $09
60FB- CA DEX
60FC- D0 F2 BNE $60F0
60FE- AE 4C 61 LDX $614C
6101- F0 08 BEQ $610B
6103- B1 06 LDA ($06),Y
6105- 91 08 STA ($08),Y
6107- C8 INY
6108- CA DEX
6109- D0 F8 BNE $6103
610B- 4C 41 61 JMP $6141
610E- AD 4D 61 LDA $614D
6111- 18 CLC
6112- 65 07 ADC $07
6114- 85 07 STA $07
6116- AD 4D 61 LDA $614D
6119- 18 CLC
611A- 65 09 ADC $09
611C- 85 09 STA $09
611E- AC 4C 61 LDY $614C
6121- F0 09 BEQ $612C
6123- 88 DEY
6124- B1 06 LDA ($06),Y
6126- 91 08 STA ($08),Y
6128- C0 00 CPY #$00
612A- D0 F7 BNE $6123
612C- AE 4D 61 LDX $614D
612F- F0 10 BEQ $6141
6131- C6 07 DEC $07
6133- C6 09 DEC $09
6135- 88 DEY
6136- B1 06 LDA ($06),Y
6138- 91 08 STA ($08),Y
613A- C0 00 CPY #$00
613C- D0 F7 BNE $6135
613E- CA DEX
613F- D0 F0 BNE $6131
6141- AD 4B 61 LDA $614B
6144- 48 PHA
6145- AD 4A 61 LDA $614A
6148- 48 PHA
6149- 60 RTS
614A- 00 BRK
614B- 00 BRK
614C- 00 BRK
614D- 00 BRK
614E- C0 00 CPY #$00
6150- F0 18 BEQ $616A
6152- EA NOP
6153- C0 01 CPY #$01
6155- D0 03 BNE $615A
6157- 4C 65 61 JMP $6165
615A- 88 DEY
615B- A2 CA LDX #$CA
615D- CA DEX
615E- D0 FD BNE $615D
6160- EA NOP
6161- EA NOP
6162- 88 DEY
6163- D0 F6 BNE $615B
6165- A2 C7 LDX #$C7
6167- CA DEX
6168- D0 FD BNE $6167
616A- 60 RTS
616B- A6 06 LDX $06
616D- A4 07 LDY $07
616F- 68 PLA
6170- 8D E1 61 STA $61E1
6173- 68 PLA
6174- 8D E2 61 STA $61E2
6177- 68 PLA
6178- 85 06 STA $06
617A- 68 PLA
617B- 85 07 STA $07
617D- 98 TYA
617E- A0 01 LDY #$01
6180- 91 06 STA ($06),Y
6182- A0 00 LDY #$00
6184- 8A TXA
6185- 91 06 STA ($06),Y
6187- A0 02 LDY #$02
6189- A5 08 LDA $08
618B- 91 06 STA ($06),Y
618D- C8 INY
618E- A5 09 LDA $09
6190- 91 06 STA ($06),Y
6192- C8 INY
6193- A5 19 LDA $19
6195- 91 06 STA ($06),Y
6197- C8 INY
6198- A5 1E LDA $1E
619A- 91 06 STA ($06),Y
619C- C8 INY
619D- A5 E3 LDA $E3
619F- 91 06 STA ($06),Y
61A1- C8 INY
61A2- A5 EB LDA $EB
61A4- 91 06 STA ($06),Y
61A6- C8 INY
61A7- A5 EC LDA $EC
61A9- 91 06 STA ($06),Y
61AB- C8 INY
61AC- A5 ED LDA $ED
61AE- 91 06 STA ($06),Y
61B0- C8 INY
61B1- A5 EE LDA $EE
61B3- 91 06 STA ($06),Y
61B5- C8 INY
61B6- A5 EF LDA $EF
61B8- 91 06 STA ($06),Y
61BA- C8 INY
61BB- A5 FA LDA $FA
61BD- 91 06 STA ($06),Y
61BF- C8 INY
61C0- A5 FB LDA $FB
61C2- 91 06 STA ($06),Y
61C4- C8 INY
61C5- A5 FC LDA $FC
61C7- 91 06 STA ($06),Y
61C9- C8 INY
61CA- A5 FD LDA $FD
61CC- 91 06 STA ($06),Y
61CE- C8 INY
61CF- A5 FE LDA $FE
61D1- 91 06 STA ($06),Y
61D3- C8 INY
61D4- A5 FF LDA $FF
61D6- 91 06 STA ($06),Y
61D8- AD E2 61 LDA $61E2
61DB- 48 PHA
61DC- AD E1 61 LDA $61E1
61DF- 48 PHA
61E0- 60 RTS
61E1- 00 BRK
61E2- 00 BRK
61E3- 68 PLA
61E4- 8D 57 62 STA $6257
61E7- 68 PLA
61E8- 8D 58 62 STA $6258
61EB- 68 PLA
61EC- 85 06 STA $06
61EE- 68 PLA
61EF- 85 07 STA $07
61F1- A0 02 LDY #$02
61F3- B1 06 LDA ($06),Y
61F5- 85 08 STA $08
61F7- C8 INY
61F8- B1 06 LDA ($06),Y
61FA- 85 09 STA $09
61FC- C8 INY
61FD- B1 06 LDA ($06),Y
61FF- 85 19 STA $19
6201- C8 INY
6202- B1 06 LDA ($06),Y
6204- 85 1E STA $1E
6206- C8 INY
6207- B1 06 LDA ($06),Y
6209- 85 E3 STA $E3
620B- C8 INY
620C- B1 06 LDA ($06),Y
620E- 85 EB STA $EB
6210- C8 INY
6211- B1 06 LDA ($06),Y
6213- 85 EC STA $EC
6215- C8 INY
6216- B1 06 LDA ($06),Y
6218- 85 ED STA $ED
621A- C8 INY
621B- B1 06 LDA ($06),Y
621D- 85 EE STA $EE
621F- C8 INY
6220- B1 06 LDA ($06),Y
6222- 85 EF STA $EF
6224- C8 INY
6225- B1 06 LDA ($06),Y
6227- 85 FA STA $FA
6229- C8 INY
622A- B1 06 LDA ($06),Y
622C- 85 FB STA $FB
622E- C8 INY
622F- B1 06 LDA ($06),Y
6231- 85 FC STA $FC
6233- C8 INY
6234- B1 06 LDA ($06),Y
6236- 85 FD STA $FD
6238- C8 INY
6239- B1 06 LDA ($06),Y
623B- 85 FE STA $FE
623D- C8 INY
623E- B1 06 LDA ($06),Y
6240- 85 FF STA $FF
6242- A0 00 LDY #$00
6244- B1 06 LDA ($06),Y
6246- AA TAX
6247- B1 07 LDA ($07),Y
6249- A8 TAY
624A- 86 06 STX $06
624C- 84 07 STY $07
624E- AD 58 62 LDA $6258
6251- 48 PHA
6252- AD 57 62 LDA $6257
6255- 48 PHA
6256- 60 RTS
6257- 00 BRK
6258- 00 BRK
6259- 60 RTS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,338 @@
6000- 20 58 FC JSR $FC58 F8ROM:HOME
6003- 20 BF 60 JSR $60BF
6006- D7 ???
6007- D4 ???
6008- C6 A0 DEC $A0
600A- D7 ???
600B- CF ???
600C- D2 CC CMP ($CC)
600E- C4 8D CPY $8D
6010- 00 BRK
6011- A9 18 LDA #$18
6013- 8D 00 03 STA $0300
6016- 8D 01 03 STA $0301
6019- 8D 02 03 STA $0302
601C- A9 00 LDA #$00
601E- 8D 03 03 STA $0303
6021- A9 03 LDA #$03
6023- 48 PHA
6024- A9 00 LDA #$00
6026- 48 PHA
6027- 20 E0 60 JSR $60E0
602A- A9 00 LDA #$00
602C- 48 PHA
602D- A9 0F LDA #$0F
602F- 48 PHA
6030- A9 0A LDA #$0A
6032- 48 PHA
6033- A9 18 LDA #$18
6035- 48 PHA
6036- 20 05 61 JSR $6105
6039- A9 00 LDA #$00
603B- 48 PHA
603C- A9 0F LDA #$0F
603E- 48 PHA
603F- A9 0A LDA #$0A
6041- 48 PHA
6042- A9 18 LDA #$18
6044- 48 PHA
6045- 20 48 61 JSR $6148
6048- A9 0A LDA #$0A
604A- 48 PHA
604B- A9 1E LDA #$1E
604D- 48 PHA
604E- A9 05 LDA #$05
6050- 48 PHA
6051- A9 0F LDA #$0F
6053- 48 PHA
6054- A9 1A LDA #$1A
6056- 48 PHA
6057- 20 C4 61 JSR $61C4
605A- A9 03 LDA #$03
605C- 48 PHA
605D- A9 00 LDA #$00
605F- 48 PHA
6060- 20 13 62 JSR $6213
6063- 20 58 FC JSR $FC58 F8ROM:HOME
6066- 20 BF 60 JSR $60BF
6069- D7 ???
606A- D4 ???
606B- C6 AC DEC $AC
606D- A0 D7 LDY #$D7
606F- CF ???
6070- D2 CC CMP ($CC)
6072- C4 BF CPY $BF
6074- 00 BRK
6075- A2 0A LDX #$0A
6077- A0 0A LDY #$0A
6079- 86 24 STX $24
607B- 84 25 STY $25
607D- 20 22 FC JSR $FC22 F8ROM:VTAB
6080- A9 05 LDA #$05
6082- 48 PHA
6083- A9 14 LDA #$14
6085- 48 PHA
6086- A9 1E LDA #$1E
6088- 48 PHA
6089- A9 18 LDA #$18
608B- 48 PHA
608C- 20 48 61 JSR $6148
608F- A9 05 LDA #$05
6091- 48 PHA
6092- A9 1E LDA #$1E
6094- 48 PHA
6095- A9 14 LDA #$14
6097- 48 PHA
6098- A9 1A LDA #$1A
609A- 48 PHA
609B- 20 05 61 JSR $6105
609E- A9 03 LDA #$03
60A0- 48 PHA
60A1- A9 00 LDA #$00
60A3- 48 PHA
60A4- 20 13 62 JSR $6213
60A7- A9 00 LDA #$00
60A9- 48 PHA
60AA- A9 27 LDA #$27
60AC- 48 PHA
60AD- A9 00 LDA #$00
60AF- 48 PHA
60B0- A9 15 LDA #$15
60B2- 48 PHA
60B3- A9 19 LDA #$19
60B5- 48 PHA
60B6- 20 C4 61 JSR $61C4
60B9- 4C D0 03 JMP $03D0
60BC- 4C 75 62 JMP $6275
60BF- 68 PLA
60C0- 85 06 STA $06
60C2- 68 PLA
60C3- 85 07 STA $07
60C5- A0 01 LDY #$01
60C7- B1 06 LDA ($06),Y
60C9- F0 06 BEQ $60D1
60CB- 20 F0 FD JSR $FDF0 F8ROM:COUT1
60CE- C8 INY
60CF- D0 F6 BNE $60C7
60D1- 18 CLC
60D2- 98 TYA
60D3- 65 06 ADC $06
60D5- 85 06 STA $06
60D7- A5 07 LDA $07
60D9- 69 00 ADC #$00
60DB- 48 PHA
60DC- A5 06 LDA $06
60DE- 48 PHA
60DF- 60 RTS
60E0- 68 PLA
60E1- 8D 03 61 STA $6103
60E4- 68 PLA
60E5- 8D 04 61 STA $6104
60E8- 68 PLA
60E9- 85 06 STA $06
60EB- 68 PLA
60EC- 85 07 STA $07
60EE- A0 00 LDY #$00
60F0- B1 06 LDA ($06),Y
60F2- F0 06 BEQ $60FA
60F4- 20 F0 FD JSR $FDF0 F8ROM:COUT1
60F7- C8 INY
60F8- D0 F6 BNE $60F0
60FA- AD 04 61 LDA $6104
60FD- 48 PHA
60FE- AD 03 61 LDA $6103
6101- 48 PHA
6102- 60 RTS
6103- 00 BRK
6104- 00 BRK
6105- 68 PLA
6106- 8D 46 61 STA $6146
6109- 68 PLA
610A- 8D 47 61 STA $6147
610D- 68 PLA
610E- 8D 45 61 STA $6145
6111- 68 PLA
6112- 8D 44 61 STA $6144
6115- 68 PLA
6116- 8D 43 61 STA $6143
6119- 68 PLA
611A- 8D 42 61 STA $6142
611D- AE 42 61 LDX $6142
6120- 86 24 STX $24
6122- AC 44 61 LDY $6144
6125- 84 25 STY $25
6127- 20 22 FC JSR $FC22 F8ROM:VTAB
612A- AD 45 61 LDA $6145
612D- AC 42 61 LDY $6142
6130- 20 F0 FD JSR $FDF0 F8ROM:COUT1
6133- C8 INY
6134- CC 43 61 CPY $6143
6137- D0 F7 BNE $6130
6139- AD 47 61 LDA $6147
613C- 48 PHA
613D- AD 46 61 LDA $6146
6140- 48 PHA
6141- 60 RTS
6142- 00 BRK
6143- 00 BRK
6144- 00 BRK
6145- 00 BRK
6146- 00 BRK
6147- 00 BRK
6148- 68 PLA
6149- 8D 8C 61 STA $618C
614C- 68 PLA
614D- 8D 8D 61 STA $618D
6150- 68 PLA
6151- 8D 91 61 STA $6191
6154- 68 PLA
6155- 8D 8E 61 STA $618E
6158- 68 PLA
6159- 8D 90 61 STA $6190
615C- 68 PLA
615D- 8D 8F 61 STA $618F
6160- AE 8E 61 LDX $618E
6163- AC 8F 61 LDY $618F
6166- 84 25 STY $25
6168- 86 24 STX $24
616A- 20 22 FC JSR $FC22 F8ROM:VTAB
616D- 20 F0 FD JSR $FDF0 F8ROM:COUT1
6170- AE 8E 61 LDX $618E
6173- 86 24 STX $24
6175- 84 25 STY $25
6177- 20 22 FC JSR $FC22 F8ROM:VTAB
617A- AD 91 61 LDA $6191
617D- C8 INY
617E- CC 90 61 CPY $6190
6181- D0 EA BNE $616D
6183- AD 8D 61 LDA $618D
6186- 48 PHA
6187- AD 8C 61 LDA $618C
618A- 48 PHA
618B- 60 RTS
618C- 00 BRK
618D- 00 BRK
618E- 00 BRK
618F- 00 BRK
6190- 00 BRK
6191- 00 BRK
6192- 18 CLC
6193- 65 24 ADC $24
6195- 85 24 STA $24
6197- 20 22 FC JSR $FC22 F8ROM:VTAB
619A- 60 RTS
619B- 38 SEC
619C- 8D AA 61 STA $61AA
619F- A5 24 LDA $24
61A1- ED AA 61 SBC $61AA
61A4- 85 24 STA $24
61A6- 20 22 FC JSR $FC22 F8ROM:VTAB
61A9- 60 RTS
61AA- 00 BRK
61AB- 18 CLC
61AC- 65 25 ADC $25
61AE- 85 25 STA $25
61B0- 20 22 FC JSR $FC22 F8ROM:VTAB
61B3- 60 RTS
61B4- 38 SEC
61B5- 8D C3 61 STA $61C3
61B8- A5 25 LDA $25
61BA- ED C3 61 SBC $61C3
61BD- 85 25 STA $25
61BF- 20 22 FC JSR $FC22 F8ROM:VTAB
61C2- 60 RTS
61C3- 00 BRK
61C4- 68 PLA
61C5- 8D 11 62 STA $6211
61C8- 68 PLA
61C9- 8D 12 62 STA $6212
61CC- 68 PLA
61CD- 8D 10 62 STA $6210
61D0- 68 PLA
61D1- 8D 0E 62 STA $620E
61D4- 68 PLA
61D5- 8D 0F 62 STA $620F
61D8- 68 PLA
61D9- 8D 0D 62 STA $620D
61DC- 68 PLA
61DD- 8D 0C 62 STA $620C
61E0- AC 0F 62 LDY $620F
61E3- 84 25 STY $25
61E5- 20 22 FC JSR $FC22 F8ROM:VTAB
61E8- AE 0C 62 LDX $620C
61EB- CA DEX
61EC- E8 INX
61ED- 86 24 STX $24
61EF- 20 22 FC JSR $FC22 F8ROM:VTAB
61F2- AD 10 62 LDA $6210
61F5- 20 F0 FD JSR $FDF0 F8ROM:COUT1
61F8- EC 0D 62 CPX $620D
61FB- D0 EF BNE $61EC
61FD- C8 INY
61FE- CC 0E 62 CPY $620E
6201- D0 E0 BNE $61E3
6203- AD 12 62 LDA $6212
6206- 48 PHA
6207- AD 11 62 LDA $6211
620A- 48 PHA
620B- 60 RTS
620C- 00 BRK
620D- 00 BRK
620E- 00 BRK
620F- 00 BRK
6210- 00 BRK
6211- 00 BRK
6212- 00 BRK
6213- 68 PLA
6214- 8D 49 62 STA $6249
6217- 68 PLA
6218- 8D 4A 62 STA $624A
621B- 68 PLA
621C- 85 06 STA $06
621E- 68 PLA
621F- 85 07 STA $07
6221- A2 00 LDX #$00
6223- 20 6F FD JSR $FD6F F8ROM:GETLN1
6226- 8E 48 62 STX $6248
6229- E0 00 CPX #$00
622B- F0 12 BEQ $623F
622D- A0 00 LDY #$00
622F- AD 48 62 LDA $6248
6232- 91 06 STA ($06),Y
6234- B9 00 02 LDA $0200,Y
6237- C8 INY
6238- 91 06 STA ($06),Y
623A- CC 48 62 CPY $6248
623D- D0 F5 BNE $6234
623F- AD 4A 62 LDA $624A
6242- 48 PHA
6243- AD 49 62 LDA $6249
6246- 48 PHA
6247- 60 RTS
6248- 00 BRK
6249- 00 BRK
624A- 00 BRK
624B- 68 PLA
624C- 8D 73 62 STA $6273
624F- 68 PLA
6250- 8D 74 62 STA $6274
6253- 68 PLA
6254- 85 06 STA $06
6256- 68 PLA
6257- 85 07 STA $07
6259- A0 00 LDY #$00
625B- B1 06 LDA ($06),Y
625D- 30 03 BMI $6262
625F- 4C 67 62 JMP $6267
6262- A0 01 LDY #$01
6264- 4C 69 62 JMP $6269
6267- A0 00 LDY #$00
6269- AD 74 62 LDA $6274
626C- 48 PHA
626D- AD 73 62 LDA $6273
6270- 48 PHA
6271- 98 TYA
6272- 60 RTS
6273- 00 BRK
6274- 00 BRK
6275- 60 RTS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,92 @@
*``````````````````````````````*
* DELAYMS :: DELAY X MILLISECS *
*- -*
* DELAYS FOR X NUMBER OF *
* MILLISECONDS BY LOOPING *
* THROUGH PRECISELY CALCULATED *
* NUMBER OF CYCLES. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: -XY- *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDY #250 ;1/4 SEC *
* JSR DELAYMS *
*- -*
* ENTRY *
* *
* Y = NUMBER OF MILLISECONDS *
*- -*
* EXIT *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = UNCHANGED *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAYMS
*
MSCNT EQU $0CA ; 202 TIMES THROUGH DELAY1
; SPECIFIC TO 1.23 MHZ
; SPEED OF APPLE II
:DELAY
CPY #0 ; 2 CYCLES
BEQ :EXIT ; 2C (EXIT IF DEL=0)
NOP ; 2 CYCLES (MAKE OVERHEAD=25C)
*
** IF DELAY IS 1MS THEN GOTO LAST1
** THIS LOGIC IS DESIGNED TO BE
** 5 CYCLES THROUGH EITHER ATH
*
CPY #1 ; 2 CYCLES
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
JMP :LAST1 ; 3C
*
** DELAY 1 MILLISENCOND TIMES (Y-1)
*
:DELAYA
DEY ; 2C (PREDEC Y)
:DELAY0
LDX #MSCNT ; 2C
:DELAY1
DEX ; 2C
BNE :DELAY1 ; 3C
NOP ; 2C
NOP ; 2C
DEY ; 2C
BNE :DELAY0 ; 3C
:LAST1
*
** DELAY THE LAST TIME 25 CYCLES
** LESS TO TAKE THE CALL, RETURN,
** AND ROUTINE OVERHEAD INTO
** ACCOUNT.
*
LDX #MSCNT-3 ; 2C
:DELAY2
DEX ; 2C
BNE :DELAY2 ; 3C
:EXIT
RTS ; 6C
*

View File

@ -0,0 +1,168 @@
*
********************************
* *
* -< COMMON DEMO )- *
* *
* VERSION 00.00.01 *
* *
* 03/04/1980 *
* *
********************************
* *
* NATHAN D. RIGGS *
* NATHAN.RIGGS@OUTLOOK.COM *
* *
********************************
*
** ASSEMBLER DIRECTIVES
*
CYC AVE
EXP ONLY
DSK COMMON.DEMO
*
*``````````````````````````````*
* TOP INCLUDES (PUTS, MACROS) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT DECS
USE COMMON.MAC
*
PUT COMMON.HOOKS
*
ORG $6000
*
*``````````````````````````````*
* PROGRAM MAIN BODY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
*
** BIG LUMPS -- HIGH LEVEL CODE
*
*
** MEMFILL DOES ABOUT WHAT ITS NAME
** IMPLIES: IT FILLS A BLOCK OF MEMORY
** WITH A PARTICULAR CHARACTER. TO SEE
** THIS IN ACTION, HEAD OVER TO THE
** MONITOR BEFORE AND AFTER THIS RUNS
** AND TYPE 300L.
*
** THE SAME AS BELOW CAN BE ACCOMPLISHED
** WITH THE FOLLOWING MACRO:
*
** _MFIL $300;#10;#0
*
LDA #>$300 ; AREA TO FILL; HIGH
PHA
LDA #<$300 ; LOW
PHA
LDA #>10
PHA
LDA #<10
PHA
LDA #0 ; FILL CHARACTER
PHA
JSR MEMFILL
*
** MEMMOVE ALSO DOES WHAT IT SAYS: IT MOVES
** A BLOCK OF MEMORY FROM A SOURCE LOCATION
** TO A DESTINATION LOCATION. WE'LL NOW MOVE
** THOSE ZEROES PLACED BY MEMFILL TO ANOTHER
** LOCATION. AGAIN, YOU'LL ONLY SEE THIS
** CHANGE VIA THE MONITOR (CALL-151).
*
*
** THIS CAN ALSO BE DONE WITH THE MACRO:
*
** _MMOV $300;$320;#10
*
LDA #>$300 ; SRC HIGH
PHA
LDA #<$300 ; SRC LOW
PHA
LDA #>$320 ; DEST HIGH
PHA
LDA #<$320 ; DEST LOW
PHA
LDA #>10 ; # OF BYTES TO MOVE
PHA
LDA #<10 ; LOW BYTE
PHA
JSR MEMMOVE
*
** DELAYMS RUNS THROUGH CYCLES OF THE
** 6502 UNTIL A CERTAIN AMOUNT OF TIME
** HAS PASSED.
*
** IN MACRO FORM:
*
** _DLAY #250
** _DLAY #250
** _DLAY #250
** _DLAY #250
*
LDY #250 ; TIME IN MILLISECONDS
; IS PASSED VIA Y
; 250 = 1/4 SECOND
JSR DELAYMS
LDY #250
JSR DELAYMS
LDY #250
JSR DELAYMS
LDY #250
JSR DELAYMS ; = 1 SECOND DELAY
*
** ZSAVE BACKS UP THE "FREE" AREAS OF
** THE ZERO PAGE TO AN ALTERNATE MEMORY
** LOCATION. THIS IS MOSTLY USEFUL WHEN
** YOU KNOW A ROUTINE USES THE ZERO PAGE,
** BUT YOU WANT TO KEEP THE VALUES CURRENTLY
** STORED THERE AFTER CALLING THE ROUTINE.
*
** IN MACRO FORM:
*
** _ZSV $6D00
*
LDA #01
STA $06
LDA #02
STA $07
LDA #03
STA $08
LDA #04
STA $09
LDA #>$6D00
PHA
LDA #<$6D00 ; LOW DEST
PHA
JSR ZSAVE
*
** YOU CAN RESTORE THE ZERO PAGE TO ITS
** PRIOR STATE BY THEN CALLING ZLOAD.
*
** MACRO:
*
** _ZLD $6D00
*
LDA #>$6D00 ; HIGH; SOURCE
PHA
LDA #<$6D00 ; LOW
PHA
JSR ZLOAD
*
*
** LITTLE LUMPS -- MID/LOW LEVEL
*
*
JMP REENTRY
*
*``````````````````````````````*
* BOTTOM INCLUDES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
** BOTTOM INCLUDES
*
PUT COMMON.LIB
*
*

View File

@ -0,0 +1,14 @@
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.LIB HOOKS *
* *
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*
*
PROMPT EQU $33
COLDENT EQU $03D3 ; COLD ENTRY TO DOS
SRESET EQU $03F2 ; SOFT RESET
PRNTAX EQU $F941 ; PRINT HEX VALS OF A,X REGISTERS
BELL EQU $FBE4 ; RING MY BELL
IOSAVE EQU $FF4A ; SAVE CURRENT STATE OF REGISTERS
IOREST EQU $FF3F ; RESTORE OLD STATE OF REGISTERS
*

View File

@ -0,0 +1,780 @@
JMP COMMONX
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.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 LICENSE *
* WHEN APPLICABLE. CODE *
* INSPIRED BY THE WORKS OF *
* OTHERS MAY FALL UNDER A *
* DIFFERENT LICENSE. *
* *
* COMMON ASM ROUTINES *
* LIBRARY FOR FUNCTIONS SUCH *
* AS MEMORY SWAPPING. *
* *
*------------------------------*
* *
* LIST OF ROUTINES *
* *
* MEMFILL : FILL LOCATION WITH *
* A SINGLE VALUE. *
* *
* MEMMOVE : MOVE A BLOCK OF *
* MEMORY FROM ONE *
* LOC TO ANOTHER. *
* *
* DELAYMS : DELAY FOR A NUMBER *
* OF MILLISECONDS. *
* THIS DEPENDS ON *
* THE ACTUAL SYSTEM *
* BEING USED, SO *
* ISN'T AS EASILY *
* PORTED TO OTHER *
* 6502 SIBLINGS. *
* *
* ZSAVE : SAVE STATE OF FREE *
* ZERO PAGE LOCATIONS *
* AT MEM LOC SPECIFIED *
* *
* ZLOAD : LOAD PREVIOUS SAVED *
* ZERO PAGE VALUES *
* BACK INTO PROPER *
* LOCATION. *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* MEMFILL :: FILL MEMORY LOC *
*- -*
* FILLS A BLOCK OF MEMORY WITH *
* THE SPECIFIED VALUE; USED *
* OFTEN TO CLEAR LARGE BLOCKS. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* LDA #0 *
* PHA *
* JSR MEMFILL *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL VALUE FOR MEMORY *
* ARRAY SIZE *
* LOW BYTE OF STARTING POINT *
* HIGH BYTE OF STARTING POINT *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMFILL
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1 ; ZERO PAGE POINTER
PLA ; DEFINED IN
STA ADDR1+1 ; DECS
*
** FILL WHOLE PAGES FIRST
*
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
*
** DO THE REMAINING PARTIAL PAGE
** REGISTER A STILL CONTAINS VALUE
*
: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
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:VALUE DS 1 ; FILL VALUE
:ARYSZ DS 2 ; ARRAY SIZE
:RETADR DS 2
*
*``````````````````````````````*
* MEMMOVE :: MOVE MEM BLOCK *
*- -*
* MOVES A SPECIFIED BLOCK OF *
* MEMORY FROM A SOURCE ADDRESS *
* TO A DESTINATION ADDRESS *
* RANGE. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>$7000 ; DEST *
* PHA *
* LDA #<$7000 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* JSR MEMMOVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* NUMBER OF BYTES TO MOVE *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
* LOW BYTE OF SOURCE ADDRESS *
* HIGH BYTE OF SOURCE ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMMOVE
*
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :MVELEN
PLA
STA :MVELEN+1
PLA
STA ADDR2 ; ZERO PAGE POINTER
PLA
STA ADDR2+1
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** DETERMINE IF DEST AREA IS
** ABOVE SRC AREA BUT OVERLAPS
** IT. REMEMBER, OVERLAP CAN BE
** MOD 64K. OVERLAP OCCURS IF
** STARTING DEST ADDRESS MINUS
** STARTING SRC ADDRESS (MOD
** 64K) IS LESS THAN NUMBER
** OF BYTES TO MOVE.
*
LDA ADDR2 ;CALC DEST-SRC
SEC
SBC ADDR1
TAX
LDA ADDR2+1
SBC ADDR1+1 ; MOD 64K AUTOMATIC
; -- DISCARD CARRY
TAY
TXA ; CMP WITH # OF BYTES TO MOVE
CMP :MVELEN
TYA
SBC :MVELEN+1
BCS :DOLEFT ; BRANCH IF NO OVERLAP
*
** DEST AREA IS ABOVE SRC AREA
** BUT OVERLAPS IT.
** MOVE FROM HIGHEST ADDR TO
** AVOID DESTROYING DATA
*
JSR :MVERHT
JMP :EXIT
*
** NO PROB DOING ORDINARY MOVE
** STARTING AT LOWEST ADDR
*
:DOLEFT
JSR :MVELEFT
:EXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVELEFT *
********************************
*
:MVELEFT
LDY #0 ; ZERO INDEX
LDX :MVELEN+1 ; X=# OF FULL PP TO MOVE
BEQ :MLPART ; IF X=0, DO PARTIAL PAGE
:MLPAGE
LDA (ADDR1),Y
STA (ADDR2),Y ;MOVE ONE BYTE
INY ; NEXT BYTE
BNE :MLPAGE ; CONT UNTIL 256B MOVED
INC ADDR1+1 ; ADV TO NEXT SRC PAGE
INC ADDR2+1 ; ADV NEXT DEST PAGE
DEX ; DEC PAGE COUNT
BNE :MLPAGE ; CONT UNTIL ALL FULL
; PAGES ARE MOVED
:MLPART
LDX :MVELEN ; GET LENGTH OF LAST PAGE
BEQ :MLEXIT ; BR IF LENGTH OF LAST
; PAGE = 0
; REG Y IS 0
:MLLAST
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
INY ; NEXT BYTE
DEX ; DEC COUNTER
BNE :MLLAST ; CONT UNTIL LAST P DONE
:MLEXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVERHT *
********************************
*
:MVERHT
*
** MOVE THE PARTIAL PAGE FIRST
*
LDA :MVELEN+1
CLC
ADC ADDR1+1
STA ADDR1+1 ;POINT TO LAST P OF SRC
LDA :MVELEN+1
CLC
ADC ADDR2+1
STA ADDR2+1 ; POINT TO LAST P OF DEST
*
** MOVE THE LAST PARTIAL PAGE FIRST
*
LDY :MVELEN ;GET LENGTH OF LAST PAGE
BEQ :MRPAGE ; IF Y=0 DO THE FULL PAGES
:MR0
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR0 ; BR IF NOT DONE W LAST P
:MRPAGE
LDX :MVELEN+1 ; GET BYTE OF COUNT AS P CT
BEQ :MREXIT ; BR IF HYBYTE = 0 (NO FULL P)
:MR1
DEC ADDR1+1 ; BACK UP TO PREV SRC PAGE
DEC ADDR2+1 ; AND DEST
:MR2
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR2 ; BR IF NOT DONE W THIS PAGE
DEX
BNE :MR1 BR IF NOT ALL PAGES MOVED
:MREXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:RETADR DS 2
:MVELEN DS 2
*
*``````````````````````````````*
* DELAYMS :: DELAY X MILLISECS *
*- -*
* DELAYS FOR X NUMBER OF *
* MILLISECONDS BY LOOPING *
* THROUGH PRECISELY CALCULATED *
* NUMBER OF CYCLES. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: -XY- *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDY #250 ;1/4 SEC *
* JSR DELAYMS *
*- -*
* ENTRY *
* *
* Y = NUMBER OF MILLISECONDS *
*- -*
* EXIT *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = UNCHANGED *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DELAYMS
*
MSCNT EQU $0CA ; 202 TIMES THROUGH DELAY1
; SPECIFIC TO 1.23 MHZ
; SPEED OF APPLE II
:DELAY
CPY #0 ; 2 CYCLES
BEQ :EXIT ; 2C (EXIT IF DEL=0)
NOP ; 2 CYCLES (MAKE OVERHEAD=25C)
*
** IF DELAY IS 1MS THEN GOTO LAST1
** THIS LOGIC IS DESIGNED TO BE
** 5 CYCLES THROUGH EITHER ATH
*
CPY #1 ; 2 CYCLES
BNE :DELAYA ; 3C IF TAKEN, ELSE 2C
JMP :LAST1 ; 3C
*
** DELAY 1 MILLISENCOND TIMES (Y-1)
*
:DELAYA
DEY ; 2C (PREDEC Y)
:DELAY0
LDX #MSCNT ; 2C
:DELAY1
DEX ; 2C
BNE :DELAY1 ; 3C
NOP ; 2C
NOP ; 2C
DEY ; 2C
BNE :DELAY0 ; 3C
:LAST1
*
** DELAY THE LAST TIME 25 CYCLES
** LESS TO TAKE THE CALL, RETURN,
** AND ROUTINE OVERHEAD INTO
** ACCOUNT.
*
LDX #MSCNT-3 ; 2C
:DELAY2
DEX ; 2C
BNE :DELAY2 ; 3C
:EXIT
RTS ; 6C
*
*
*``````````````````````````````*
* ZSAVE :: SAVE 0-PAGE FREE *
*- -*
* STORES THE VALUES IN THE *
* LITTLE FREE SPACE ON THE *
* ZERO PAGE AT AN ALTERNATE *
* MEMORY LOCATION TO BE *
* RETRIEVED AND RESTORED AT A *
* LATER POINT. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZSAVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = TRASH *
* X = TRASH *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE
*
** LOAD ADDR1 ZERO PAGE AREA FIRST,
** SINCE WE'LL BE USING THAT
*
** NOTE THAT THIS SHOULD ALWAYS BE
** $06 AND $07, OR ELSE CODE WILL
** HAVE TO CHANGE.
*
LDX ADDR1
LDY ADDR1+1
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
TYA ; STORE ADDR1 VALS
LDY #1 ; FIRST
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
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*``````````````````````````````*
* ZLOAD :: RESTORE 0-PAGE FREE *
*- -*
* RESTORES PREVIOUSLY SAVED *
* ZERO PAGE VALUES FROM *
* HIGHER MEMORY LOCATION. *
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZLOAD *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF SOURCE *
* HIGH BYTE OF SOURCE *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
LDY #2 ; START 2 AHEAD
LDA (ADDR1),Y ; AND PUT ADDR1
STA $08 ; AREA LAST
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
*
** NOW GET ZERO PAGE VALUES
** FOR SPACE OCCUPIED BY ADDR; RETURN IN X,Y
*
LDY #0
LDA (ADDR1),Y
TAX
LDA (ADDR1+1),Y
TAY
STX ADDR1
STY ADDR1+1
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*
COMMONX RTS

View File

@ -0,0 +1,180 @@
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* COMMON.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 *
* COMMON.LIB, AND CAN BE USED *
* REGARDLESS OF WHETHER A *
* SPECIFIC FUNCTION IS *
* INCLUDED AS A PUT IN THE *
* MAIN SOURCE. *
* *
*------------------------------*
* *
* LIST OF MACROS *
* *
* _MFIL :: FILL MEMORY BLOCK *
* _MMOV :: MOVE MEMORY BLOCK *
* _BELL :: RING MY BELL *
* _DLAY :: DELAY IN MILLISECS *
* _ZSV :: SAVE FREE ZERO PAGE *
* _ZLD :: LOAD SAVE ZERO PAGE *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* _MFIL :: FILL MEMORY BLOCK *
*- -*
* FILL BLOCK OF MEMORY WITH *
* SPECIFIED VALUE. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = STARTING ADDRESS *
* PARAM2 = LENGTH IN BYTES *
* PARAM3 = FILL VALUE *
*- -*
* SAMPLE USAGE: *
* _MFIL $300;#256;#0 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_MFIL MAC
LDA #>]1 ; STARTING POINT
PHA
LDA #<]1
PHA
LDA #>]2 ; # OF BYTES
PHA
LDA #<]2
PHA
LDA ]3 ; FILL VALUE
PHA
JSR MEMFILL
<<<
*
*``````````````````````````````*
* _BELL :: RING BELL X TIMES -*
*- -*
* RING THE STANDARD BELL. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = NUMBER OF RINGS *
*- -*
* SAMPLE USAGE: _BELL *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_BELL MAC
LUP ]1
JSR BELL
--^
<<<
*
*``````````````````````````````*
* _MMOV :: MOVE MEMORY BLOCK -*
*- -*
* MOVE A BLOCK OF MEMORY FROM *
* A SOURCE TO DESTINATION. *
*- -*
* PARAMETERS: *
* PARAM1 = SOURCE ADDRESS *
* PARAM2 = DESTINATION ADDRESS *
* PARAM3 = NUMBER OF BYTES *
*- -*
* SAMPLE USAGE: *
* *
* _MMOV $6A00;$7B00;#1024 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_MMOV MAC
LDA #>]1 ; SRC ADDR
PHA
LDA #<]1
PHA
LDA #>]2 ; DEST ADDR
PHA
LDA #<]2
PHA
LDA #>]3 ; # OF BYTES
PHA
LDA #<]3
PHA
JSR MEMMOVE
<<<
*
*``````````````````````````````*
* _DLAY :: DELAY X MILLISECS *
*- -*
* DELAY FOR PASSED MILLISECS *
*- -*
* PARAMETERS: *
* *
* PARAM1 = NUM OF MILLISECONDS *
*- -*
* SAMPLE USAGE: _DLAY #250 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_DLAY MAC
LDY ]1
JSR DELAYMS
<<<
*
*``````````````````````````````*
* _ZSV :: SAVE ZERO PAGE *
*- -*
* SAVE ZERO PAGE FREE AREAS *
* FOR LATER RESTORE. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = ADDRESS TO STORE AT *
*- -*
* SAMPLE USAGE: _ZSV $300 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_ZSV MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR ZSAVE
<<<
*
*``````````````````````````````*
* _ZLD :: LOAD ZERO PAGE *
*- -*
* RESTORE PREVIOUSLY SAVED *
* FREE ZERO PAGE VALUES. *
*- -*
* PARAMETERS: *
* *
* PARAM1 = ADDR TO LOAD FROM *
*- -*
* SAMPLE USAGE: _ZLD $300 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_ZLD MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR ZLOAD
<<<

View File

@ -0,0 +1,130 @@
*``````````````````````````````*
* MEMFILL :: FILL MEMORY LOC *
*- -*
* FILLS A BLOCK OF MEMORY WITH *
* THE SPECIFIED VALUE; USED *
* OFTEN TO CLEAR LARGE BLOCKS. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* LDA #0 *
* PHA *
* JSR MEMFILL *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL VALUE FOR MEMORY *
* ARRAY SIZE *
* LOW BYTE OF STARTING POINT *
* HIGH BYTE OF STARTING POINT *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMFILL
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :VALUE
PLA
STA :ARYSZ
PLA
STA :ARYSZ+1
PLA
STA ADDR1 ; ZERO PAGE POINTER
PLA ; DEFINED IN
STA ADDR1+1 ; DECS
*
** FILL WHOLE PAGES FIRST
*
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
*
** DO THE REMAINING PARTIAL PAGE
** REGISTER A STILL CONTAINS VALUE
*
: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
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:VALUE DS 1 ; FILL VALUE
:ARYSZ DS 2 ; ARRAY SIZE
:RETADR DS 2

View File

@ -0,0 +1,222 @@
*``````````````````````````````*
* MEMMOVE :: MOVE MEM BLOCK *
*- -*
* MOVES A SPECIFIED BLOCK OF *
* MEMORY FROM A SOURCE ADDRESS *
* TO A DESTINATION ADDRESS *
* RANGE. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* LDA #>$7000 ; DEST *
* PHA *
* LDA #<$7000 *
* PHA *
* LDA #>1024 *
* PHA *
* LDA #<1024 *
* PHA *
* JSR MEMMOVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* NUMBER OF BYTES TO MOVE *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
* LOW BYTE OF SOURCE ADDRESS *
* HIGH BYTE OF SOURCE ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = COUNTER; TRASH *
* X = COUNTER; TRASH *
* A = LOW BYTE OF RET ADDR *
*- -*
* ADAPTED FROM LEVANTHAL AND *
* WINTHROP'S /6502 ASSEMBLY *
* LANGUAGE ROUTINES/. *
* AS SUCH, THIS MAY NOT FALL *
* UNDER THE APACHE 2.0 LICENSE *
* AGREEMENT, SINCE THE BOOK *
* WAS WRITTEN BEFORE THE *
* LICENSE! *
* *
* THAT SAID, LEVENTHAL WROTE *
* THAT THE PURPOSE OF THE BOOK *
* WAS TO COPY THE SOURCE CODE, *
* AS REINVENTING THE WHEEL IS *
* TEDIOUS, AND HE PLACED NO *
* RESTRICTIONS ON ITS USE. *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
MEMMOVE
*
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :MVELEN
PLA
STA :MVELEN+1
PLA
STA ADDR2 ; ZERO PAGE POINTER
PLA
STA ADDR2+1
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** DETERMINE IF DEST AREA IS
** ABOVE SRC AREA BUT OVERLAPS
** IT. REMEMBER, OVERLAP CAN BE
** MOD 64K. OVERLAP OCCURS IF
** STARTING DEST ADDRESS MINUS
** STARTING SRC ADDRESS (MOD
** 64K) IS LESS THAN NUMBER
** OF BYTES TO MOVE.
*
LDA ADDR2 ;CALC DEST-SRC
SEC
SBC ADDR1
TAX
LDA ADDR2+1
SBC ADDR1+1 ; MOD 64K AUTOMATIC
; -- DISCARD CARRY
TAY
TXA ; CMP WITH # OF BYTES TO MOVE
CMP :MVELEN
TYA
SBC :MVELEN+1
BCS :DOLEFT ; BRANCH IF NO OVERLAP
*
** DEST AREA IS ABOVE SRC AREA
** BUT OVERLAPS IT.
** MOVE FROM HIGHEST ADDR TO
** AVOID DESTROYING DATA
*
JSR :MVERHT
JMP :EXIT
*
** NO PROB DOING ORDINARY MOVE
** STARTING AT LOWEST ADDR
*
:DOLEFT
JSR :MVELEFT
:EXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVELEFT *
********************************
*
:MVELEFT
LDY #0 ; ZERO INDEX
LDX :MVELEN+1 ; X=# OF FULL PP TO MOVE
BEQ :MLPART ; IF X=0, DO PARTIAL PAGE
:MLPAGE
LDA (ADDR1),Y
STA (ADDR2),Y ;MOVE ONE BYTE
INY ; NEXT BYTE
BNE :MLPAGE ; CONT UNTIL 256B MOVED
INC ADDR1+1 ; ADV TO NEXT SRC PAGE
INC ADDR2+1 ; ADV NEXT DEST PAGE
DEX ; DEC PAGE COUNT
BNE :MLPAGE ; CONT UNTIL ALL FULL
; PAGES ARE MOVED
:MLPART
LDX :MVELEN ; GET LENGTH OF LAST PAGE
BEQ :MLEXIT ; BR IF LENGTH OF LAST
; PAGE = 0
; REG Y IS 0
:MLLAST
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
INY ; NEXT BYTE
DEX ; DEC COUNTER
BNE :MLLAST ; CONT UNTIL LAST P DONE
:MLEXIT
JMP :MREXIT
*
********************************
* SUBROUTINE: MVERHT *
********************************
*
:MVERHT
*
** MOVE THE PARTIAL PAGE FIRST
*
LDA :MVELEN+1
CLC
ADC ADDR1+1
STA ADDR1+1 ;POINT TO LAST P OF SRC
LDA :MVELEN+1
CLC
ADC ADDR2+1
STA ADDR2+1 ; POINT TO LAST P OF DEST
*
** MOVE THE LAST PARTIAL PAGE FIRST
*
LDY :MVELEN ;GET LENGTH OF LAST PAGE
BEQ :MRPAGE ; IF Y=0 DO THE FULL PAGES
:MR0
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR0 ; BR IF NOT DONE W LAST P
:MRPAGE
LDX :MVELEN+1 ; GET BYTE OF COUNT AS P CT
BEQ :MREXIT ; BR IF HYBYTE = 0 (NO FULL P)
:MR1
DEC ADDR1+1 ; BACK UP TO PREV SRC PAGE
DEC ADDR2+1 ; AND DEST
:MR2
DEY ; BACK UP Y TO NEXT BYTE
LDA (ADDR1),Y
STA (ADDR2),Y ; MOVE BYTE
CPY #0
BNE :MR2 ; BR IF NOT DONE W THIS PAGE
DEX
BNE :MR1 BR IF NOT ALL PAGES MOVED
:MREXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:RETADR DS 2
:MVELEN DS 2

View File

@ -0,0 +1,278 @@
*``````````````````````````````*
* ZSAVE :: SAVE 0-PAGE FREE *
*- -*
* STORES THE VALUES IN THE *
* LITTLE FREE SPACE ON THE *
* ZERO PAGE AT AN ALTERNATE *
* MEMORY LOCATION TO BE *
* RETRIEVED AND RESTORED AT A *
* LATER POINT. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZSAVE *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF DESTINATION *
* HIGH BYTE OF DESTINATION *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = TRASH *
* X = TRASH *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZSAVE
*
** LOAD ADDR1 ZERO PAGE AREA FIRST,
** SINCE WE'LL BE USING THAT
*
** NOTE THAT THIS SHOULD ALWAYS BE
** $06 AND $07, OR ELSE CODE WILL
** HAVE TO CHANGE.
*
LDX ADDR1
LDY ADDR1+1
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
TYA ; STORE ADDR1 VALS
LDY #1 ; FIRST
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
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*``````````````````````````````*
* ZLOAD :: RESTORE 0-PAGE FREE *
*- -*
* RESTORES PREVIOUSLY SAVED *
* ZERO PAGE VALUES FROM *
* HIGHER MEMORY LOCATION. *
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* *
* LDA #>$6A00 *
* PHA *
* LDA #<$6A00 *
* PHA *
* JSR ZLOAD *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF SOURCE *
* HIGH BYTE OF SOURCE *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ZLOAD
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
** COPY ZERO PAGE TO SPECIFIED
** NON-ZERO LOCATION (ONLY THE
** FREE ONES..)
*
LDY #2 ; START 2 AHEAD
LDA (ADDR1),Y ; AND PUT ADDR1
STA $08 ; AREA LAST
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
*
** NOW GET ZERO PAGE VALUES
** FOR SPACE OCCUPIED BY ADDR; RETURN IN X,Y
*
LDY #0
LDA (ADDR1),Y
TAX
LDA (ADDR1+1),Y
TAY
STX ADDR1
STY ADDR1+1
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*
COMMONX RTS

View File

@ -0,0 +1,20 @@
*``````````````````````````````*
* DECLARATIONS.PUT *
*- -*
* USED IN CONJUNCTION WITH *
* OTHER PUT FILES. DEFINES *
* BASIC DECLARATIONS USED *
* ACROSS DIFFERENT ROUTINES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
REENTRY EQU $03D0
SMALLASM EQU $300 ; STADDR FOR SMALL PROGRAMS
*
ADDR1 EQU $06
ADDR2 EQU $08
ADDR3 EQU $EB
ADDR4 EQU $ED
ADDR5 EQU $FA
ADDR6 EQU $FC
ADDR7 EQU $FE
*

View File

@ -0,0 +1,89 @@
*
*``````````````````````````````*
*CURSFOR :: MOVE CURSOR FORWD *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 20 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSFOR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSFOR
CLC
ADC CURSH
STA CURSH
JSR VTAB
RTS
*
*``````````````````````````````*
*CURSBAK :: MOVE CURSOR BACKWD *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 26 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSBAK *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSBAK
SEC
STA :SCRATCH
LDA CURSH
SBC :SCRATCH
STA CURSH
JSR VTAB
RTS
*
** DATA
*
:SCRATCH DS 1
*
*``````````````````````````````*
* CURSDN :: MOVE CURSOR DOWN *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 20 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSDN *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSDN
CLC
ADC CURSV
STA CURSV
JSR VTAB
RTS
*
*``````````````````````````````*
* CURSUP :: MOVE CURSOR UP *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 26 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSUP *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSUP
SEC
STA :SCRATCH
LDA CURSV
SBC :SCRATCH
STA CURSV
JSR VTAB
RTS
*
** DATA
*
:SCRATCH DS 1
*

View File

@ -0,0 +1,188 @@
*
********************************
* *
* -< STDIO DEMO >- *
* *
* VERSION 00.00.01 *
* *
* 03/04/1980 *
* *
********************************
* *
* NATHAN D. RIGGS *
* NATHAN.RIGGS@OUTLOOK.COM *
* *
********************************
*
** ASSEMBLER DIRECTIVES
*
CYC AVE
EXP ONLY
DSK STDIO.DEMO
*
*``````````````````````````````*
* TOP INCLUDES (PUTS, MACROS) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT DECS
USE STDIO.MAC
*
PUT STDIO.HOOKS
PUT COMMON.HOOKS
*
ORG $6000
*
*``````````````````````````````*
* PROGRAM MAIN BODY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
*
** BIG LUMPS -- HIGH LEVEL CODE
*
*
JSR HOME ; CLEAR SCREEN
*
***
*** USE XPRINT TO PRINT A STRING OF CHARACTERS
*** TO THE SCREEN. THE STRING COMES AFTER
*** THE JSR STATEMENT IN AN ASC/HEX.
***
JSR XPRINT
ASC "WTF WORLD"
HEX 8D00 ; THIS TELLS THE
; ROUTINE TO STOP
; PRINTING THE STRING
*
*** USE DPRINT TO PRINT THE TEXT AT A SPECIFIC
*** MEMORY LOCATION. NOTE THAT THIS IS NOT
*** TYPICALLY USED TO PRINT STRINGS, AND LIKE
*** XPRINT USES THE NULL TERMINATOR TO ALERT
*** THE ROUTINE TO STOP PRINTING. TO PRINT
*** STRINGS, WHICH HAVE THE LENGTH OF THE STRING
*** AS THEIR FIRST BYTE VALUE, USE SPRINT.
*
*
LDA #$18 ; PUT 'XXX' INTO
STA $300 ; LOCATION $300
STA $301
STA $302
LDA #00
STA $303
LDA #>$300 ; PUSH HIBYTE
PHA
LDA #<$300 ; PUSH LOBYTE
PHA
JSR DPRINT ; NOW PRINT IT
*
* ^^^ NOTE ABOVE THAT THE HIGH BYTE
* IS PUSHED BEFORE THE LOW BYTE BECAUSE
* 6502 CONVENTION IS TO READ THE LOW BYTE
* FIRST, THEN THE HIGH BYTE. THIS IS THE
* ORDER IT WILL POP OFF THE STACK.
*
***
*** USE THLIN TO CREATE A LINE OF HORIZONTAL
*** TEXT CONSISTING OF A SINGLE CHARACTER.
*** LIKE MANY OTHER SUBROUTINES, THIS USES
*** THE STACK TO PASS VARIABLES.
***
*
LDA #0 ; START OF LINE
PHA
LDA #15 ; END OF LINE
PHA
LDA #10 ; Y POSITION
PHA
LDA #$18 ; "X" CHARACTER, INVERSE
PHA
JSR THLIN
*
*** TVLIN WORKS LIKE THLIN, BUT CREATES A VERTICAL
*** LINE INSTEAD OF A HORIZONTAL ONE.
*
LDA #0 ; STARTING Y POS OF LINE
PHA
LDA #15 ; END YPOS OF LINE
PHA
LDA #10 ; X POSITION
PHA
LDA #$18 ; "X" CHARACTER, INVERSE
PHA
JSR TVLIN
*
*
*** THE TFILLA ROUTINE ACTS LIKE A COMBINATION OF
*** THLIN AND TVLIN. IT FILLS A GIVEN RECTANGULAR
*** AREA OF THE SCREEN WITH THE DESIGNATED
*** CHARACTER AT X1,Y1:X2,Y2.
*
LDA #10 ; LEFT BOUNDARY
PHA
LDA #30 ; RIGHT BOUNDARY
PHA
LDA #5 ; TOP BOUNDARY
PHA
LDA #15 ; BOTTOM BOUNDARY
PHA
LDA #$1A ; "Z" CHARACTER
PHA
JSR TFILLA
*
*
*** THE SINPUT ROUTINE (SPECIAL INPUT) PROMPTS
*** THE USER FOR A STRING OF TEXT FOLLOWED BY
*** A <RETURN> PRESS, THEN STORES THE INPUTTED
*** STRING AT THE SPECIFIED LOCATION, WITH ITS
*** LENGTH AS THE FIRST BYTE (MAX: 255)
*
LDA #>$300 ; PUSH HIGH BYTE FIRST
PHA
LDA #<$300 ; THEN LOW BYTE, SO
; THAT THE ROUTINE
; READS LOW, HIGH
PHA
JSR SINPUT ; STORES IN $300
*
*
*** THE PADDLE BUTTON ROUTINE CHECKS
*** WHETHER THE DESIGNATED PADDLE BUTTON
*** IS CURRENTLY BEING PRESSED.
*
*
*
*
*
*
********************************
********************************
* NOW LET'S DO IT AGAIN! *
* (BUT WITH MACROS) *
********************************
********************************
*
JSR HOME
_PRN "WTF, WORLD?"
_CXY #10;#10
_TVLN #5;#20;#30;#$18
_THLN #5;#30;#20;#$1A
_INP $300
_TFIL #0;#39;#0;#21;#$19
*
*
*
** LITTLE LUMPS -- MID/LOW LEVEL
*
*
JMP REENTRY
*
*``````````````````````````````*
* BOTTOM INCLUDES *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
*
** BOTTOM INCLUDES
*
PUT STDIO.LIB
*
*

View File

@ -0,0 +1,82 @@
*
*``````````````````````````````*
* DPRINT :: PRINT FROM MEMORY *
*- -*
* PRINTS DATA FROM SPECIFIED *
* MEMORY LOCATION UNTIL *
* REACHING 00 (STRING TERM). *
*- -*
* CLOBBERS: *
* *
* FLAGS: -------- REG: A-YM *
*- -*
* CYCLES: 25+ *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR DPRINT *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF PRINT ADDRESS *
* HI BYTE OF PRINT ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = UNCHANGED *
* Y = LENGTH OF PRINTED *
* STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DPRINT
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET ADDRESS, STORE IN ZERO PAGE
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
LDY #$00
:LOOP
LDA (ADDR1),Y
BEQ :EXIT
JSR COUT1
INY
BNE :LOOP
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*

View File

@ -0,0 +1,94 @@
*
*``````````````````````````````*
* GPBX :: GET PADDLE BUTTON X *
* *
* GETS STATE OF PADDLE BUTTON *
* SPECIFIED AND RET 0, 1 IN A *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: A-YM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR GPBX *
* *
* --- WHERE: *
* *
* BUTTON 0 = $C061 (PB0) *
* BUTTON 1 = $CO62 (PB1) *
* BUTTON 2 - $C063 (PB2) *
* BUTTON 3 = $C060 (PB3) *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF PDL BTN ADDRESS *
* HI BYTE OF PDL BTN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = 1 IF PRESSED, 0 IF NOT *
* X = UNCHANGED *
* Y = GARBAGE *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
* CHANGE THIS LATER TO ACCEPT ALL BUTTONS, 0-4
*
GBPX
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETER
*
PLA
STA ADDR1 ; ZERO PAGE
PLA
STA ADDR1+1
*
*
LDY #$00
LDA (ADDR1),Y ; IF BTN = PUSHED
BMI :1
JMP :0
:1
LDY #$01 ; BTN PUSHED;A=1
JMP :EXIT
:0
LDY #$00 ; BTN NOT PUSHED;A=0
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
TYA ; BTN FLAG MOVE TO A
RTS
*
** DATA
*
:RETADR DS 2
*

View File

@ -0,0 +1,53 @@
*
*``````````````````````````````*
* STDIO.HOOKS.PUT *
*- -*
* HOOKS TO INPUT/OUTPUT *
* ROUTINES IN MONITOR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
* OUTPUT HOOKS
*
COUT1 EQU $FDF0 ; FASTER SCREEN OUTPUT
COUT EQU $FDED ; MONITOR STD OUTPUT
HOME EQU $FC58 ; CLEAR SCREEN, HOME CURSOR
VTAB EQU $FC22 ; MONITOR CURSOR POS ROUTINE
CURSH EQU $24 ; HPOS OF COUT CURSOR
CURSV EQU $25 ; VPOS OF COUT CURSOR
WNDLEFT EQU $20 ; SCROLL WINDOW LEFT
WNDWIDTH EQU $21 ; SCROLL WINDOW WIDTH
WNDTOP EQU $22 ; SCROLL WINDOW TOP
WNDBOT EQU $23 ; SCROLL WINDOW BOTTOM
TEXTP1 EQU $0400 ; START OF TEXT PAGE 1
TEXTP2 EQU $0800 ; START OF TEXT PAGE 2
PAGE1 EQU $C054 ; SOFT SWITCH USE PAGE 1
PAGE2 EQU $C055 ; SOFT SWITCH USE PAGE 2
S80COL EQU $C01F ; READ ONLY; CHECK IF 80C
KEYBUFF EQU $0200 ; KEYBUFFER START
GSTROBE EQU $C040 ; GAME CONNECTOR STROBE
TXTSET EQU $C051 ; TEXT ON SOFT SWITCH
SETWND EQU $FB4B ; SET NORMAL WINDOW MODE
CURADV EQU $FBF4 ; ADVANCE CURSOR RIGHT
CURBS EQU $FC10 ; CURSOR LEFT
CURUP EQU $FC1A ; CURSOR UP
CR EQU $FC62 ; CARRIAGE RETURN TO SCREEN
LF EQU $FC66 ; LINE FEED ONLY TO SCREEN
CLEOL EQU $FC9C ; CLEAR TEXT TO END OF LINE
*
* INPUT HOOKS
*
KYBD EQU $C000 ; LDA SINGLE KEYPRESS
STROBE EQU $C010 ; CLEAR KYBD BUFFER
GETLN EQU $FD6F ; MONITOR GET LINE OF KB INPUT
GETKEY EQU $FD0C ; MONITOR GET SINGLE KEY INPUT
OPAPP EQU $C061
CLAPP EQU $C062
*
* PADDLE HOOKS
*
PREAD EQU $FB1E ; READ STATE OF PADDLE
PB0 EQU $C061 ; PADDLE BUTTON 0
PB1 EQU $C062
PB2 EQU $C063
PB3 EQU $C060
*

View File

@ -0,0 +1,788 @@
*
JMP STDIOX
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* STDIO.PUT *
* *
* AUTHOR: NATHAN RIGGS *
* CONTACT: NATHAN.RIGGS@ *
* OUTLOOK.COM *
* *
* VERSION: 0.1.2 *
* DATE: 30-OCT-2018 *
* ASSEMBLER: MERLIN 8 PRO *
* *
**** SEE CHANGELOG FOR ****
**** HISTORY OF CHANGES ****
* *
* LICENSE: MIT LICENSE, WHERE *
* APPLICABLE. CODE INSPIRED *
* BY THE WORKS OF OTHERS MAY *
* FALL UNDER A DIFFERENT *
* LICENSE (NOTED IN ROUTINE). *
* *
* STANDARD INPUT / OUTPUT *
* LIBRARY. PRIMARILY FOR THE *
* APPLE II FAMILY, BUT COULD *
* BE PORTED TO OTHER 6502- *
* BASED SYSTEMS FAIRLY *
* EASILY. *
* *
*------------------------------*
* *
* LIST OF ROUTINES *
* *
* XPRINT : SPECIAL PRINT *
* DPRINT : PRINT FROM MEMORY *
* THLIN : TEXT LINE HORIZONTAL *
* TVLIN : TEXT LINE VERTICAL *
* CURSFOR : CURSOR FORWARD *
* CURSBAK : CURSOR BACKWARD *
* CURSDN : CURSOR DOWN *
* CURSUP : CURSOR UP *
* TFILLA : TEXT FILL AREA *
* SINPUT : STRING INPUT *
* GPBX : GET PADDLE BUTTON X *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* XPRINT :: SPECIAL PRINT *
*- -*
* PRINTS DATA IMMEDIATELY *
* FOLLOWING THE JSR TO SPRINT *
*- -*
* CLOBBERS: *
* *
* FLAGS: NZC----- REG: AYM- *
*- -*
* CYCLES: 53+ *
* SIZE: *
*- -*
* USAGE: *
* JSR SPRINT *
* ASC "HELLO, WORLD!" *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A,Y = LOW BYTE OF ADDRESS *
* X = UNCHANGED *
*- -*
* NOTE: PARTIALLY ADOPTED FROM *
* ROGER WAGNER'S AND CHRIS *
* TORRENCE'S /ASSEMBLY LINES/ *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
XPRINT
*
** GET CURRENT EXEC ADDRESS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
LDY #$01 ; POINT TO NEXT
; INSTRUCTION
:LOOP
LDA (ADDR1),Y
BEQ :DONE
JSR COUT1
INY
BNE :LOOP
:DONE ; RESTORE STACK
CLC ; EXEC POINTER
TYA ; TO RESUME
ADC ADDR1
STA ADDR1
LDA ADDR1+1
ADC #$00
PHA
LDA ADDR1
PHA
RTS
:EXIT
*
*``````````````````````````````*
* DPRINT :: PRINT FROM MEMORY *
*- -*
* PRINTS DATA FROM SPECIFIED *
* MEMORY LOCATION UNTIL *
* REACHING 00 (STRING TERM). *
*- -*
* CLOBBERS: *
* *
* FLAGS: -------- REG: A-YM *
*- -*
* CYCLES: 25+ *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR DPRINT *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF PRINT ADDRESS *
* HI BYTE OF PRINT ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = UNCHANGED *
* Y = LENGTH OF PRINTED *
* STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
DPRINT
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET ADDRESS, STORE IN ZERO PAGE
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
LDY #$00
:LOOP
LDA (ADDR1),Y
BEQ :EXIT
JSR COUT1
INY
BNE :LOOP
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
*
*
*``````````````````````````````*
* THLIN :: TEXT HORIZ LINE *
*- -*
* CREATES A HORIZONTAL LINE OF *
* TEXT COMPOSED OF THE FILL *
* CHARACTER SPECIFIED AT Y. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (X-START) *
* PHA *
* LDA (X-END) *
* PHA *
* LDA (Y-POS) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR THLIN *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* XPOS START OF LINE (:X1) *
* XPOS END OF LINE (:X2) *
* YPOS OF LINE (:Y) *
* FILL CHARACTER (:F) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* X,Y = START,END OF LINE *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
THLIN
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :F
PLA
STA :Y
PLA
STA :X2
PLA
STA :X1
*
*
LDX :X1 ; LOAD X START POS
STX CURSH ; STORE IN CURSH
LDY :Y ; LDY Y POS
STY CURSV ; STORE IN CURSV
JSR VTAB ; MOVE CURSOR
LDA :F ; LOAD FILL CHAR
LDY :X1 ; LOAD X START POS
:LOOP
JSR COUT1 ; PRINT FILL CHAR
INY ; INCREASE X POS
CPY :X2 ; IF LESS THAN X END POS
BNE :LOOP ; REPEAT UNTIL DONE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:X1 DS 1
:X2 DS 1
:Y DS 1
:F DS 1 ; FILL CHAR
:RETADR DS 2
*
*``````````````````````````````*
* TVLIN :: TEXT VERTICAL LINE *
*- -*
* CREATES A VERTICAL LINE OF *
* TEXT COMPOSED OF THE FILL *
* CHARACTER SPECIFIED AT X. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (Y-START) *
* PHA *
* LDA (Y-END) *
* PHA *
* LDA (X-POS) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TVLIN *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* XPOS START OF LINE (:Y1) *
* XPOS END OF LINE (:Y2) *
* YPOS OF LINE (:X) *
* FILL CHARACTER (:F) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = END OF LINE *
* X = HORIZONTAL POSITION *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TVLIN
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :F ; FILL CHAR
PLA
STA :X ; X POS
PLA
STA :Y2 ; END
PLA
STA :Y1 ; START
*
LDX :X
LDY :Y1
STY CURSV
STX CURSH
JSR VTAB ; SET CURSOR POS
:LOOP
JSR COUT1 ; PRINT CHAR
LDX :X
STX CURSH
STY CURSV
JSR VTAB ; SET NEW CURSOR POS
LDA :F ; RELOAD FILL CHAR
INY ; INCREASE COUNTER
CPY :Y2 ; IF Y1 < Y2
BNE :LOOP ; LOOP; ELSE, CONTINUE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
:X DS 1
:Y1 DS 1
:Y2 DS 1
:F DS 1
*
*
*``````````````````````````````*
*CURSFOR :: MOVE CURSOR FORWD *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 20 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSFOR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSFOR
CLC
ADC CURSH
STA CURSH
JSR VTAB
RTS
*
*``````````````````````````````*
*CURSBAK :: MOVE CURSOR BACKWD *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 26 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSBAK *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSBAK
SEC
STA :SCRATCH
LDA CURSH
SBC :SCRATCH
STA CURSH
JSR VTAB
RTS
*
** DATA
*
:SCRATCH DS 1
*
*``````````````````````````````*
* CURSDN :: MOVE CURSOR DOWN *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 20 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSDN *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSDN
CLC
ADC CURSV
STA CURSV
JSR VTAB
RTS
*
*``````````````````````````````*
* CURSUP :: MOVE CURSOR UP *
* *
*- -*
* FLAGS: NZC----- REG: AYM- *
* CYCLES: 26 *
*- -*
* USAGE: *
* LDA (AMT TO MOVE) *
* JSR CURSUP *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURSUP
SEC
STA :SCRATCH
LDA CURSV
SBC :SCRATCH
STA CURSV
JSR VTAB
RTS
*
** DATA
*
:SCRATCH DS 1
*
*``````````````````````````````*
* TFILLA :: TEXT FILL AREA *
*- -*
* FILLS A RECTANGULAR AREA OF *
* THE SCREEN WITH THE DESIRED *
* CHARACTER. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (LEFT BOUND) *
* PHA *
* LDA (RIGHT BOUND) *
* PHA *
* LDA (TOP BOUND) *
* PHA *
* LDA (BOTTOM BOUND) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TFILLA *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL CHAR (:FILL) *
* BOTTOM BOUND (:BOTTOM) *
* TOP BOUND (:TOP) *
* RIGHT BOUND (:RIGHT) *
* LEFT BOUND (:LEFT) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = COUNTER DATA; TRASH *
* Y = COUNTER DATA; TRASH *
* STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TFILLA
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** LOAD PARAMETERS
*
PLA
STA :FILL
PLA
STA :BOTTOM
PLA
STA :TOP
PLA
STA :RIGHT
PLA
STA :LEFT
*
LDY :TOP ; LOAD STARTING Y
:LOOPY
STY CURSV
JSR VTAB ; SET VERTICAL
LDX :LEFT ; CURSOR POSITION
DEX
:LOOPX
INX
STX CURSH
JSR VTAB ; SET HORIZONTAL
LDA :FILL
JSR COUT1 ; PRINT FILL CHAR
CPX :RIGHT ; IF X < RIGHT MAX
BNE :LOOPX ; LOOP; ELSE, CONTINUE
* ; END X LOOP
INY
CPY :BOTTOM ; IF Y < BOTTOM MAX
BNE :LOOPY ; LOOP; ELSE, CONTINUE
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:LEFT DS 1
:RIGHT DS 1
:BOTTOM DS 1
:TOP DS 1
:FILL DS 1
:RETADR DS 2
*
*``````````````````````````````*
* SINPUT :: SPECIAL INPUT *
* *
* INPUTS A STRING OF TEXT VIA *
* MONITOR HOOKS. MAC 255 CHARS *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR SINPUT *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF INPUT ADDRESS *
* HI BYTE OF INPUT ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = LENGTH OF STRING *
* Y = LENGTH OF STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
SINPUT
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1 ; STORE IN ZERO
PLA ; PAGE
STA ADDR1+1
*
LDX #$00
JSR GETLN
STX :STRLEN ; STORE STR LENGTH
CPX #0
BEQ :EXIT
*
:INP_CLR
LDY #0
LDA :STRLEN ; LENGTH OF STRING
STA (ADDR1),Y ; PUT LENGTH AT START OF LOC
:LOOP
LDA KEYBUFF,Y ; PUT STR INTO NEW LOC
INY
STA (ADDR1),Y
CPY :STRLEN ; IF Y < STR LENGTH
BNE :LOOP ; LOOP; ELSE, CONTINUE
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:STRLEN DS 1
:RETADR DS 2
*
*
*``````````````````````````````*
* GPBX :: GET PADDLE BUTTON X *
* *
* GETS STATE OF PADDLE BUTTON *
* SPECIFIED AND RET 0, 1 IN A *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: A-YM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR GPBX *
* *
* --- WHERE: *
* *
* BUTTON 0 = $C061 (PB0) *
* BUTTON 1 = $CO62 (PB1) *
* BUTTON 2 - $C063 (PB2) *
* BUTTON 3 = $C060 (PB3) *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF PDL BTN ADDRESS *
* HI BYTE OF PDL BTN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = 1 IF PRESSED, 0 IF NOT *
* X = UNCHANGED *
* Y = GARBAGE *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
* CHANGE THIS LATER TO ACCEPT ALL BUTTONS, 0-4
*
GBPX
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETER
*
PLA
STA ADDR1 ; ZERO PAGE
PLA
STA ADDR1+1
*
*
LDY #$00
LDA (ADDR1),Y ; IF BTN = PUSHED
BMI :1
JMP :0
:1
LDY #$01 ; BTN PUSHED;A=1
JMP :EXIT
:0
LDY #$00 ; BTN NOT PUSHED;A=0
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
TYA ; BTN FLAG MOVE TO A
RTS
*
** DATA
*
:RETADR DS 2
*
STDIOX RTS

View File

@ -0,0 +1,583 @@
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* STDIO.MAC *
* *
* AUTHOR: NATHAN RIGGS *
* CONTACT: NATHAN.RIGGS@ *
* OUTLOOK.COM *
* *
* VERSION: 0.1.2 *
* DATE: 30-OCT-2018 *
* ASSEMBLER: MERLIN 8 PRO *
* *
**** SEE CHANGELOG FOR ****
**** HISTORY OF CHANGES ****
* *
* LICENSE: MIT LICENSE, WHERE *
* APPLICABLE. CODE INSPIRED *
* BY THE WORKS OF OTHERS MAY *
* FALL UNDER A DIFFERENT *
* LICENSE (NOTED IN ROUTINE). *
* *
*------------------------------*
* *
* THIS IS A MACRO LIBRARY FOR *
* STDIO.LIB, AND CAN BE USED *
* REGARDLESS OF WHETHER A *
* SPECIFIC FUNCTION IS *
* INCLUDED AS A PUT IN THE *
* MAIN SOURCE. IT IS INTENDED *
* TO SERVE AS A USEFUL SHORT- *
* CUT FOR CALLING THE VARIOUS *
* ROUTINES. SO, YOU KNOW. LIKE *
* A MACRO LIBRARY. *
* *
*------------------------------*
* *
* LIST OF MACROS *
* *
* _TPG1 : SET TEXT PAGE 1 *
* _TPG2 : SET TEXT PAGE 2 *
* _PRN : FLEXIBLE PRINT *
* _PCR : PRINT CARRIAGE RET *
* _PLN : PRINT LINE *
* _INP : SPECIAL INPUT *
* _GKEY : GET SINGLE KEY *
* _WKEY : WAIT FOR KEY *
* _CXY : SET CURS POS AT X,Y *
* _CX : SET CURSOR X *
* _CY : SET CURSOR Y *
* _CURF : CURSOR FORWARD *
* _CURB : CURSOR BACKWARD *
* _CURU : CURSOR UP *
* _CURD : CURSOR DOWN *
* _RCXY : READ CURSOR POSITION *
* _PDL : READ PADDLE STATE *
* _PBX : READ PDL BTN X *
* _TVLN : TEXT VERTICAL LINE *
* _THLN : TEXT HORIZ LINE *
* _TFIL : TEXT FILL AREA *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*``````````````````````````````*
* _TPG1 : SET TEXT PAGE 1 *
* *
* SIMPLY SETS TEXT PAGE 1. *
* BARELY WORTH BEING A MACRO, *
* BUT KEEPING FOR NOW. *
*- -*
* PARAMETERS: NONE *
*- -*
* SAMPLE USAGE: _TPG1 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_TPG1 MAC ;SET P1
LDA PAGE1
<<<
*
*``````````````````````````````*
* _TPG2 : SET TEXT PAGE 2 *
* *
* SIMPLY SETS TEXT PAGE 2. *
* BARELY WORTH BEING A MACRO, *
* BUT KEEPING FOR NOW. *
*- -*
* PARAMETERS: NONE *
*- -*
* SAMPLE USAGE: _TPG2 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_TPG2 MAC ;SET P2
LDA PAGE2
<<<
*
*``````````````````````````````*
* _PRN :: PRINT (NO <CR> ) *
*- -*
* EITHER PRINTS A STRING OF *
* TEXT PROVIDED, OR PRINTS THE *
* DATA FOUND AT THE SPECIFIED *
* MEMORY LOCATION. *
*- -*
* PARAMETERS *
* *
* IF FIRST LETTER OF VAR1 IS *
* A QUOTATION MARK, THEN PASS *
* CONTROL TO XPRINT. *
* *
* IF FIRST LETTER OF VAR1 IS *
* A DOLLAR SIGN, THEN IT IS A *
* MEMORY LOCATION, SO PASS TO *
* DPRINT. *
* *
* IF FIRST LETTER OF VAR1 IS *
* AN 'S', THEN A STRING PRINT *
* IS BEING INDICATED. VAR2 *
* (]2) HOLDS THE ADDRESS TO *
* THE STRING; TRANSFER CONTROL *
* TO SPRINT. *
*- -*
* SAMPLE USAGE: *
* *
* _PRN "HELLO!" *
* _PRN $300 *
* _PRN S;$310 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_PRN MAC
*
IF ",]1 ; --- IF PARAM=STRING
*
JSR XPRINT ; SPECIAL PRINT
ASC ]1 ; PUT STRING HERE
HEX 00 ; STRING TERMINATE
*
ELSE ; ELSE, PARAM IS
; MEMORY LOCATION
*
LDA #>]1 ; PUSH HIGH BYTE
PHA ; TO STACK
LDA #<]1 ; PUSH LOW BYTE
PHA
JSR DPRINT
*
FIN
<<<
*
*``````````````````````````````*
* _PCR: PRINT CARRAIGE RETURN *
* *
* SIMPLY SENDS A CR AND LINE *
* FEED TO COUT (OR THE *
* EQUIVALENT, ANYHOW). *
*- -*
* PARAMETERS: NONE *
*- -*
* SAMPLE USAGE: _PCR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_PCR MAC
LDA #$8D
JSR COUT1
LDA #$00
JSR COUT1
<<<
*
*``````````````````````````````*
* _PLN: PRINT LINE *
* *
* PRINTS A STRING OF TEXT FROM *
* PARAMETER, PRINTS IT AND *
* THEN PRINTS A NEWLINE. *
* CURRENTLY, THIS WILL ONLY *
* SUPPORT DIRECT PRINTS, NOT *
* MEMORY CALLS OR STRINGS. *
*- -*
* PARAMETERS *
* *
* VAR1 SHOULD CONTAIN THE *
* STRING OF CHARACTERS TO BE *
* PRINTED (]1). *
*- -*
* SAMPLE USAGE: *
* *
* _PLN "HELLO!" *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_PLN MAC
JSR XPRINT
ASC ]1
HEX 8D00
<<<
*
*``````````````````````````````*
* _INP: INPUT MACRO *
* *
* INPUTS A STRING FROM KEYBRD *
* AND STORES IT AT SPECIFIED *
* LOCATION. *
*- -*
* PARAMETERS *
* *
* VAR1 (]1) SHOULD CONTAIN THE *
* ADDRESS WHERE THE INPUTTED *
* STRING WILL BE STORED. *
*- -*
* SAMPLE USAGE: *
* *
* _INP $6A00 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_INP MAC
LDA #>]1 ; HIGH ORDER
PHA
LDA #<]1 ; LOW ORDER
PHA
JSR SINPUT
<<<
*
*``````````````````````````````*
* _GKEY [LOC] : GETKEY *
* *
* WAITS FOR USER TO PRESS A *
* KEY, THEN STORES THAT IN *
* THE SPECIFIED LOCATION. *
*- -*
* PARAMETERS *
* *
* THE FIRST PARAMETER SHOULD *
* HOLD THE ADDRESS WHERE THE *
* CHARACTER IS TO BE STORED. *
*- -*
* SAMPLE USAGE: *
* *
* _GKEY $6A00 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_GKEY MAC
LDA #<]1
LDX #>]1
STX ADDR1+1
STA ADDR1
JSR GETKEY
LDY #$00
STA (ADDR1),Y
LDA #$00
STA STROBE
<<<
*
*``````````````````````````````*
* WKEY : WAIT FOR KEYPRESS *
* *
* SIMPLY LOOPS UNTIL A KEY IS *
* PRESSED. KEY VALUE STORED *
* IN ACCUMULATOR. *
*- -*
* PARAMETERS: NONE *
*- -*
* SAMPLE USAGE: _WKEY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_WKEY MAC
_LOOP LDA KYBD
CMP #$80
BCC _LOOP
STA STROBE
<<<
*
*``````````````````````````````*
* _CXY: POSITION CURSOR X,Y *
*- -*
* SETS THE CURSOR POSITION. *
*- -*
* PARAMETERS *
* *
* THE FIRST PARAMETER SHOULD *
* HOLD THE X POSITION; THE *
* SECOND SHOULD HOLD Y. *
*- -*
* SAMPLE USAGE: *
* *
* _CXY #10;#10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CXY MAC
LDX ]1
LDY ]2
STX CURSH
STY CURSV
JSR VTAB
<<<
*
*``````````````````````````````*
*- _CX: POSITION CURSOR HORIZ -*
*- -*
* SETS THE HORIZONTAL POSITION *
* OF THE TEXT CURSOR. *
* NUMBER Y TO MOVE UPWARD. *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER HOLDS X. *
*- -*
* SAMPLE USAGE: _CX #10 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CX MAC
LDX ]1
STX CURSH
JSR VTAB
<<<
*
*``````````````````````````````*
* _CY: POSITION CURSOR VERT *
*- -*
* SET CURSOR VERTICAL POSITION *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER HOLDS Y. *
*- -*
* SAMPLE USAGE: _CY #10 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CY MAC
LDY ]1
STY CURSV
JSR VTAB
<<<
*
*``````````````````````````````*
* _CURF : TEXT CURSOR FORWRD *
*- -*
* MOVES THE CURSOR FORWARD BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER SHOULD HOLD *
* NUMBER X TO MOVE FORWARD. *
*- -*
* SAMPLE USAGE: _CURF #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CURF MAC
LDA ]1
JSR CURSFOR
<<<
*
*``````````````````````````````*
* _CURB : TEXT CURSOR BACKWD *
*- -*
* MOVES THE CURSOR BACKWARD BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER SHOULD HOLD *
* NUMBER X TO MOVE BACKWARD. *
*- -*
* SAMPLE USAGE: _CURB #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CURB MAC
LDA ]1
JSR CURSBAK
<<<
*
*``````````````````````````````*
* _CURU : TEXT CURSOR UP *
*- -*
* MOVES THE CURSOR UP BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER SHOULD HOLD *
* NUMBER Y TO MOVE UPWARD. *
*- -*
* SAMPLE USAGE: _CURU #10 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CURU MAC
LDA ]1
JSR CURSUP
<<<
*
*``````````````````````````````*
* _CURD : TEXT CURSOR DOWN *
*- -*
* MOVES THE CURSOR DOWN BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* FIRST PARAMETER SHOULD HOLD *
* THE AMOUNT TO MOVE DOWN IN Y *
*- -*
* SAMPLE USAGE: #10 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_CURD MAC
LDA ]1
JSR CURSDN
<<<
*
*``````````````````````````````*
* _RCXY : READ SCREEN AT XY *
*- -*
* READ THE CHARACTER AT POS *
* X,Y AND LOADS INTO ACCUM *
*- -*
* PARAMETERS *
* *
* PARAMETER 1 SHOULD HOLD THE *
* X POSITION ON SCREEN TO BE *
* READ, PARAMETER 2 HOLDS Y. *
*- -*
* SAMPLE USAGE: _RCXY #3;#9 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_RCXY MAC
LDA ]1 ; ROW
LDY ]2 ; COLUMN
JSR $F847 ; NOT SURE ABOUT THIS MAGIC NUM
LDA ($26),Y ; LOAD CHAR INTO ACCUM
*
* THANKS GO TO ERIC JACOBS
* IN THE APPLE II ENTHUSIASTS
* FACEBOOK GROUP FOR THIS
*
<<<
*
*``````````````````````````````*
* PADDLE / MOUSE INPUT *
*- -*
* SIMPLY READS STATE OF PADDLE *
* NUMBER [NUM] AND STORES IT *
* IN THE Y REGISTER. *
*- -*
* PARAMETERS *
* *
* PARAMETER 1 SHOULD HOLD THE *
* NUMBER THAT CORRESPONDS TO *
* THE PADDLE TO READ. *
*- -*
* SAMPLE USAGE: _PDL #0 *
* *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_PDL MAC ; GET PADDLE VALUE
LDX #]1 ; READ PADDLE # ]1 (USUALLY 0)
JSR PREAD ; PADDLE READING STORED IN Y
<<<
*
*``````````````````````````````*
* _PBX : PADDLE BUTTON X *
* *
* STORE 1 IN ACCUMULATOR IF *
* PADDLE BUTTON X IS PRESSED, *
* OTHERWISE STORE 0 IN ACCUM. *
*- -*
* PARAMETERS *
* *
* PARAMETER1 SHOULD HOLD THE *
* ADDRESS OF THE PADDLE BUTTON *
* READ. THEY ARE AS FOLLOWS: *
* *
* PB0: $C061 PB1: $C062 *
* PB2: $C063 PB4: $C060 *
*- -*
* SAMPLE USAGE: _PBX $C061 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_PBX MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR GPBX
<<<
*
*``````````````````````````````*
* _TVLN : TEXT VERTICAL LINE *
*- -*
* CREATES A VERTICAL LINE OF *
* TEXT AT THE CURRENT CURSOR *
* COLUMN CONSISTING OF THE *
* SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* PARAM1 = START OF VLINE, *
* PARAM2 = END POS OF VLINE, *
* PARAM3 = X POSITION OF LINE, *
* PARAM4 = FILL CHARACTER. *
*- -*
* SAMPLE USAGE: *
* *
* _TVLN #0;#10;#3;#$18 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_TVLN MAC
LDA ]1 ; Y START
PHA
LDA ]2 ; Y END
PHA
LDA ]3 ; X POSITION
PHA
LDA ]4 ; CHARACTER
PHA
JSR TVLIN
<<<
*
*``````````````````````````````*
* _THLN : TEXT HORIZONTAL LINE *
* *
* CREATES A HORIZONTAL LINE OF *
* TEXT FROM X1,Y TO X2,Y WITH *
* THE SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* PARAM1 = START OF HLINE, *
* PARAM2 = END POS OF HLINE, *
* PARAM3 = Y POSITION OF LINE, *
* PARAM4 = FILL CHARACTER. *
*- -*
* SAMPLE USAGE: *
* *
* _THLN #0;#10;#12;#$18 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_THLN MAC
LDA ]1 ; X START
PHA
LDA ]2 ; X END
PHA
LDA ]3 ; Y POS
PHA
LDA ]4 ; FILL CHAR
PHA
JSR THLIN
<<<
*
*``````````````````````````````*
* _TFIL : TEXT FILL (A) -*
*- -*
* FILL X1,Y1 TO X2,Y2 WITH *
* SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* PARAM1 = LEFT BOUNDARY *
* PARAM2 = RIGHT BOUNDARY *
* PARAM3 = TOP BOUNDARY *
* PARAM4 = BOTTOM BOUNDARY *
*- -*
* SAMPLE USAGE: *
* *
* _TFIL #0;#10;#0;#10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
_TFIL MAC
LDA ]1 ; LEFT BOUNDARY
PHA
LDA ]2 ; RIGHT BOUNDARY
PHA
LDA ]3 ; TOP BOUNDARY
PHA
LDA ]4 ; BOTTOM BOUNDARY
PHA
LDA ]5 ; FILL CHAR
PHA
JSR TFILLA
<<<
*

View File

@ -0,0 +1,91 @@
*
*``````````````````````````````*
* SINPUT :: SPECIAL INPUT *
* *
* INPUTS A STRING OF TEXT VIA *
* MONITOR HOOKS. MAC 255 CHARS *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR SINPUT *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF INPUT ADDRESS *
* HI BYTE OF INPUT ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = LENGTH OF STRING *
* Y = LENGTH OF STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
SINPUT
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA ADDR1 ; STORE IN ZERO
PLA ; PAGE
STA ADDR1+1
*
LDX #$00
JSR GETLN
STX :STRLEN ; STORE STR LENGTH
CPX #0
BEQ :EXIT
*
:INP_CLR
LDY #0
LDA :STRLEN ; LENGTH OF STRING
STA (ADDR1),Y ; PUT LENGTH AT START OF LOC
:LOOP
LDA KEYBUFF,Y ; PUT STR INTO NEW LOC
INY
STA (ADDR1),Y
CPY :STRLEN ; IF Y < STR LENGTH
BNE :LOOP ; LOOP; ELSE, CONTINUE
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:STRLEN DS 1
:RETADR DS 2
*

View File

@ -0,0 +1,114 @@
*
*``````````````````````````````*
* TFILLA :: TEXT FILL AREA *
*- -*
* FILLS A RECTANGULAR AREA OF *
* THE SCREEN WITH THE DESIRED *
* CHARACTER. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (LEFT BOUND) *
* PHA *
* LDA (RIGHT BOUND) *
* PHA *
* LDA (TOP BOUND) *
* PHA *
* LDA (BOTTOM BOUND) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TFILLA *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* FILL CHAR (:FILL) *
* BOTTOM BOUND (:BOTTOM) *
* TOP BOUND (:TOP) *
* RIGHT BOUND (:RIGHT) *
* LEFT BOUND (:LEFT) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = LOW BYTE OF ADDRESS *
* X = COUNTER DATA; TRASH *
* Y = COUNTER DATA; TRASH *
* STRING *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TFILLA
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** LOAD PARAMETERS
*
PLA
STA :FILL
PLA
STA :BOTTOM
PLA
STA :TOP
PLA
STA :RIGHT
PLA
STA :LEFT
*
LDY :TOP ; LOAD STARTING Y
:LOOPY
STY CURSV
JSR VTAB ; SET VERTICAL
LDX :LEFT ; CURSOR POSITION
DEX
:LOOPX
INX
STX CURSH
JSR VTAB ; SET HORIZONTAL
LDA :FILL
JSR COUT1 ; PRINT FILL CHAR
CPX :RIGHT ; IF X < RIGHT MAX
BNE :LOOPX ; LOOP; ELSE, CONTINUE
* ; END X LOOP
INY
CPY :BOTTOM ; IF Y < BOTTOM MAX
BNE :LOOPY ; LOOP; ELSE, CONTINUE
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:LEFT DS 1
:RIGHT DS 1
:BOTTOM DS 1
:TOP DS 1
:FILL DS 1
:RETADR DS 2

View File

@ -0,0 +1,98 @@
*
*``````````````````````````````*
* THLIN :: TEXT HORIZ LINE *
*- -*
* CREATES A HORIZONTAL LINE OF *
* TEXT COMPOSED OF THE FILL *
* CHARACTER SPECIFIED AT Y. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (X-START) *
* PHA *
* LDA (X-END) *
* PHA *
* LDA (Y-POS) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR THLIN *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* XPOS START OF LINE (:X1) *
* XPOS END OF LINE (:X2) *
* YPOS OF LINE (:Y) *
* FILL CHARACTER (:F) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* X,Y = START,END OF LINE *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
THLIN
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :F
PLA
STA :Y
PLA
STA :X2
PLA
STA :X1
*
*
LDX :X1 ; LOAD X START POS
STX CURSH ; STORE IN CURSH
LDY :Y ; LDY Y POS
STY CURSV ; STORE IN CURSV
JSR VTAB ; MOVE CURSOR
LDA :F ; LOAD FILL CHAR
LDY :X1 ; LOAD X START POS
:LOOP
JSR COUT1 ; PRINT FILL CHAR
INY ; INCREASE X POS
CPY :X2 ; IF LESS THAN X END POS
BNE :LOOP ; REPEAT UNTIL DONE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
RTS
*
** DATA
*
:X1 DS 1
:X2 DS 1
:Y DS 1
:F DS 1 ; FILL CHAR
:RETADR DS 2

View File

@ -0,0 +1,103 @@
*
*``````````````````````````````*
* TVLIN :: TEXT VERTICAL LINE *
*- -*
* CREATES A VERTICAL LINE OF *
* TEXT COMPOSED OF THE FILL *
* CHARACTER SPECIFIED AT X. *
*- -*
* CLOBBERS: *
* *
* FLAGS: ????---- REG: AXYM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA (Y-START) *
* PHA *
* LDA (Y-END) *
* PHA *
* LDA (X-POS) *
* PHA *
* LDA (FILL CHAR) *
* PHA *
* JSR TVLIN *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* XPOS START OF LINE (:Y1) *
* XPOS END OF LINE (:Y2) *
* YPOS OF LINE (:X) *
* FILL CHARACTER (:F) *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* Y = END OF LINE *
* X = HORIZONTAL POSITION *
* A = LOW BYTE OF RET ADDR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TVLIN
*
** SAVE RETURN ADDRESS
*
PLA
STA :RETADR
PLA
STA :RETADR+1
*
** GET PARAMETERS
*
PLA
STA :F ; FILL CHAR
PLA
STA :X ; X POS
PLA
STA :Y2 ; END
PLA
STA :Y1 ; START
*
LDX :X
LDY :Y1
STY CURSV
STX CURSH
JSR VTAB ; SET CURSOR POS
:LOOP
JSR COUT1 ; PRINT CHAR
LDX :X
STX CURSH
STY CURSV
JSR VTAB ; SET NEW CURSOR POS
LDA :F ; RELOAD FILL CHAR
INY ; INCREASE COUNTER
CPY :Y2 ; IF Y1 < Y2
BNE :LOOP ; LOOP; ELSE, CONTINUE
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA :RETADR+1
PHA
LDA :RETADR
PHA
*
RTS
*
** DATA
*
:RETADR DS 2
:X DS 1
:Y1 DS 1
:Y2 DS 1
:F DS 1

View File

@ -0,0 +1,70 @@
*
*``````````````````````````````*
* XPRINT :: SPECIAL PRINT *
*- -*
* PRINTS DATA IMMEDIATELY *
* FOLLOWING THE JSR TO SPRINT *
*- -*
* CLOBBERS: *
* *
* FLAGS: NZC----- REG: AYM- *
*- -*
* CYCLES: 53+ *
* SIZE: *
*- -*
* USAGE: *
* JSR SPRINT *
* ASC "HELLO, WORLD!" *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A,Y = LOW BYTE OF ADDRESS *
* X = UNCHANGED *
*- -*
* NOTE: PARTIALLY ADOPTED FROM *
* ROGER WAGNER'S AND CHRIS *
* TORRENCE'S /ASSEMBLY LINES/ *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
XPRINT
*
** GET CURRENT EXEC ADDRESS
*
PLA
STA ADDR1
PLA
STA ADDR1+1
*
LDY #$01 ; POINT TO NEXT
; INSTRUCTION
:LOOP
LDA (ADDR1),Y
BEQ :DONE
JSR COUT1
INY
BNE :LOOP
:DONE ; RESTORE STACK
CLC ; EXEC POINTER
TYA ; TO RESUME
ADC ADDR1
STA ADDR1
LDA ADDR1+1
ADC #$00
PHA
LDA ADDR1
PHA
RTS
:EXIT
*