Compare commits
110 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dbb9351f9 | ||
|
|
6abcb00859 | ||
|
|
8818175fc7 | ||
|
|
4ee7cc89d5 | ||
|
|
64336000b1 | ||
|
|
9163f4eefa | ||
|
|
843a841bf9 | ||
|
|
888545ccad | ||
|
|
92e064318f | ||
|
|
608f89f40c | ||
|
|
313207ee97 | ||
|
|
61841d1230 | ||
|
|
3bfb10c708 | ||
|
|
334186359f | ||
|
|
1296d353b9 | ||
|
|
ed28bceae9 | ||
|
|
d93b1eaa21 | ||
|
|
2875440702 | ||
|
|
fc9bff2c60 | ||
|
|
59c5690b25 | ||
|
|
86a8af1056 | ||
|
|
ac95d09055 | ||
|
|
cd8f21fa13 | ||
|
|
d2bb0ac067 | ||
|
|
db9538ce31 | ||
|
|
1a209b14ea | ||
|
|
5871a51d0c | ||
|
|
0c474026b2 | ||
|
|
6ac374f042 | ||
|
|
59e788e37f | ||
|
|
de8be81ea4 | ||
|
|
34a2b4cad6 | ||
|
|
e3591bc8fa | ||
|
|
87f9d4044c | ||
|
|
d8f7967087 | ||
|
|
a180572b2d | ||
|
|
70a50cf07f | ||
|
|
9f8ae9be80 | ||
|
|
ed311b3332 | ||
|
|
2157add169 | ||
|
|
86b69776c6 | ||
|
|
a314dfe48f | ||
|
|
6005aa79c1 | ||
|
|
8cb9f8d106 | ||
|
|
d47baff1f1 | ||
|
|
c4f8f9cb1f | ||
|
|
e661fe37eb | ||
|
|
2e9cf0ad5a | ||
|
|
905b043486 | ||
|
|
b33d9cdc95 | ||
|
|
66e720c2f0 | ||
|
|
40226e4075 | ||
|
|
cd6317501b | ||
|
|
b78dcaae41 | ||
|
|
3d33d57eb3 | ||
|
|
443f26183f | ||
|
|
aeb0867d7b | ||
|
|
008cf6e21d | ||
|
|
df59cf4089 | ||
|
|
4a083ef4e9 | ||
|
|
24918b2308 | ||
|
|
5821170bce | ||
|
|
a27657c98f | ||
|
|
1beeb3902a | ||
|
|
e80e3af69d | ||
|
|
b2ee31c109 | ||
|
|
5b07d1900a | ||
|
|
bcf7efb0f4 | ||
|
|
aba2aa0f1c | ||
|
|
7cc89a1822 | ||
|
|
32e104ff7e | ||
|
|
1ebd10c7cc | ||
|
|
250b487c2c | ||
|
|
954989a538 | ||
|
|
cd05becde7 | ||
|
|
0736e6f9ca | ||
|
|
7c63dd8b68 | ||
|
|
1f9f870ed8 | ||
|
|
f6afe96eb6 | ||
|
|
4fda35ad03 | ||
|
|
8811a5c42c | ||
|
|
1d9cd05bf5 | ||
|
|
074e704a31 | ||
|
|
85b24bf02f | ||
|
|
575d656681 | ||
|
|
69f34eb4d6 | ||
|
|
b6c26244df | ||
|
|
604d7d1537 | ||
|
|
a8abc94701 | ||
|
|
951d5a9a07 | ||
|
|
ee11db0942 | ||
|
|
e41b402403 | ||
|
|
9fa85482f7 | ||
|
|
affe148b7e | ||
|
|
3a1799fc02 | ||
|
|
8d577073d2 | ||
|
|
3f0d905c9a | ||
|
|
3d17491ef3 | ||
|
|
9b5f8ee9ab | ||
|
|
c9e75532cb | ||
|
|
92fbd30074 | ||
|
|
8e98527f38 | ||
|
|
9e551557fa | ||
|
|
49e9085211 | ||
|
|
14f50c99cb | ||
|
|
651f8ca39a | ||
|
|
fb9fd17779 | ||
|
|
bb46b8adfc | ||
|
|
b3f3b58390 | ||
|
|
75717e0279 |
26 changed files with 17425 additions and 566 deletions
86
README.md
86
README.md
|
|
@ -1,71 +1,31 @@
|
|||
# Ultimate Commodore 64 BASIC & KERNAL ROM Disassembly
|
||||
# Ultimate Commodore 64 Reference
|
||||
|
||||
This project maintains six commented disassemblies of the C64 ROM (BASIC and KERNAL), five in English and one in German.
|
||||
This project collects C64 reference material in a machine readable format and maintains a set of scripts to present these on the web.
|
||||
|
||||
The txt files are the parsable master versions that can be used to create more rich representations.
|
||||
The most current web version can be found at [pagetable.com/c64disasm](http://pagetable.com/c64disasm).
|
||||
|
||||
## c64disasm_ms.txt
|
||||
* KERNAL & BASIC ROM Disassembly
|
||||
* [original Microsoft BASIC source](c64disasm/c64disasm_ms.txt)
|
||||
* [original Commodore KERNAL source](c64disasm/c64disasm_cbm.txt)
|
||||
* [disassembly by Lee Davison](c64disasm/c64disasm_en.txt)
|
||||
* [BASIC disassembly by Bob Sander-Cederlof](c64disasm/c64disasm_sc.txt)
|
||||
* [disassembly from Commodore-64-intern-Buch](c64disasm/c64disasm_de.txt) (German)
|
||||
* [disassembly by Magnus Nyman](c64disasm/c64disasm_mn.txt)
|
||||
* [disassembly by Marko Mäkelä](c64disasm/c64disasm_mm.txt)
|
||||
* Memory Map
|
||||
* ["Mapping the Commodore 64" by Sheldon Leemon](c64mem/c64mem_mapc64.txt)
|
||||
* ["Memory Map mit Wandervorschlägen" by Dr. H. Hauck](c64mem/c64mem_64er.txt) (German)
|
||||
* ["Commodore-64-intern-Buch"](c64mem/c64mem_64intern.txt) (German)
|
||||
* [reference by Joe Forster/STA](c64mem/c64mem_sta.txt)
|
||||
* [comments in the original Microsoft & Commodore Source](c64mem/c64mem_src.txt)
|
||||
* ["C64 Programmer's Reference Guide"](c64mem/c64mem_prg.txt)
|
||||
* ["64map"](c64mem/c64mem_64map.txt)
|
||||
* [reference by Jim Butterfield](c64mem/c64mem_jb.txt)
|
||||
|
||||
This is CBMBASIC only. The comments have been taken from
|
||||
## Credits
|
||||
|
||||
*Microsoft's original BASIC for M6502 source, [pagetable.com/?p=774](http://www.pagetable.com/?p=774)*
|
||||
|
||||
Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_cbm.txt
|
||||
|
||||
This is KERNAL only. The comments have been taken from
|
||||
|
||||
*The original C64 KERNAL source by Commodore (901227-03), [pagetable.com/?p=894](http://www.pagetable.com/?p=894), [github.com/mist64/cbmsrc](https://github.com/mist64/cbmsrc)*
|
||||
|
||||
Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_en.txt
|
||||
|
||||
The comments have been taken from
|
||||
|
||||
*The almost completely commented C64 ROM disassembly. V1.01 Lee Davison 2012*
|
||||
|
||||
Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_sc.txt
|
||||
|
||||
This is CBMBASIC only. The comments have been taken from
|
||||
|
||||
*Bob Sander-Cederlof: S-C DocuMentor for Applesoft, [txbobsc.com/scsc/scdocumentor](http://www.txbobsc.com/scsc/scdocumentor/)*
|
||||
|
||||
Converted and adapted from Applesoft to CBMBASIC, as well as formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_de.txt
|
||||
|
||||
The comments have been taken from
|
||||
|
||||
*Baloui, Said. Das neue Commodore-64-intern-Buch. Düsseldorf: Data-Becker, 1990. ISBN 3890113079*
|
||||
|
||||
OCRed and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_mn.txt
|
||||
|
||||
The comments have been taken from
|
||||
|
||||
*JIFFYDOS version 6.01/version 6.02 by Magnus Nyman (Harlekin/FairLight)*
|
||||
|
||||
Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## c64disasm_mm.txt
|
||||
|
||||
The comments have been taken from
|
||||
|
||||
*Commodore 64 BASIC/KERNAL ROM Disassembly Version 1.0 (June 1994), by Marko Mäkelä*
|
||||
|
||||
Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
|
||||
## Side-by-side HTML version
|
||||
|
||||
combine.py creates a cross-referenced HTML from all commentaries.
|
||||
|
||||
The most current version can be found at [pagetable.com/c64disasm](http://pagetable.com/c64disasm)
|
||||
The files have been collected, converted, formatted and edited by [Michael Steil](mailto:mist64@mac.com).
|
||||
|
||||
## Contributing
|
||||
|
||||
Corrections (typos as well as content), translations etc. welcome.
|
||||
Extensions, corrections (typos as well as content), translations etc. welcome.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
- CBMBASIC and KERNAL
|
||||
-
|
||||
- The comments have been taken from
|
||||
- Baloui, Said.
|
||||
- Baloui, Brückmann, Englisch, Felt, Gelfand, Gerits, Krsnik:
|
||||
- Das neue Commodore-64-intern-Buch.
|
||||
- Düsseldorf: Data-Becker, 1990.
|
||||
- ISBN 3890113079
|
||||
|
|
@ -11,6 +11,10 @@
|
|||
- up perfectly, so make sure the machine code matches the assembly
|
||||
- code in the respective lines your looking at.
|
||||
-
|
||||
- The range $E0F9-$E261 was taken from
|
||||
- The original C64 BASIC source by Commodore
|
||||
- https://github.com/mist64/cbmsrc
|
||||
-
|
||||
- Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
-
|
||||
- Corrections (formatting, lining up) welcome at:
|
||||
|
|
@ -6750,167 +6754,239 @@
|
|||
.,E0F4 A0 00 LDY #$00
|
||||
.,E0F6 4C D4 BB JMP $BBD4 GMOVMF: JMP MOVMF ;PUT NEW ONE INTO MEMORY.
|
||||
|
||||
.,E0F9 C9 F0 CMP #$F0
|
||||
.,E0FB D0 07 BNE $E104
|
||||
.,E0FD 84 38 STY $38
|
||||
.,E0FF 86 37 STX $37
|
||||
.,E101 4C 63 A6 JMP $A663
|
||||
.,E104 AA TAX
|
||||
.,E105 D0 02 BNE $E109
|
||||
.,E107 A2 1E LDX #$1E
|
||||
.,E109 4C 37 A4 JMP $A437
|
||||
.,E10C 20 D2 FF JSR $FFD2
|
||||
.,E10F B0 E8 BCS $E0F9
|
||||
.,E111 60 RTS
|
||||
.,E112 20 CF FF JSR $FFCF
|
||||
.,E115 B0 E2 BCS $E0F9
|
||||
.,E117 60 RTS
|
||||
.,E118 20 AD E4 JSR $E4AD
|
||||
.,E11B B0 DC BCS $E0F9
|
||||
.,E11D 60 RTS
|
||||
.,E11E 20 C6 FF JSR $FFC6
|
||||
.,E121 B0 D6 BCS $E0F9
|
||||
.,E123 60 RTS
|
||||
.,E124 20 E4 FF JSR $FFE4
|
||||
.,E127 B0 D0 BCS $E0F9
|
||||
.,E129 60 RTS
|
||||
.,E12A 20 8A AD JSR $AD8A
|
||||
.,E12D 20 F7 B7 JSR $B7F7
|
||||
.,E130 A9 E1 LDA #$E1
|
||||
.,E132 48 PHA
|
||||
.,E133 A9 46 LDA #$46
|
||||
.,E135 48 PHA
|
||||
.,E136 AD 0F 03 LDA $030F
|
||||
.,E139 48 PHA
|
||||
.,E13A AD 0C 03 LDA $030C
|
||||
.,E13D AE 0D 03 LDX $030D
|
||||
.,E140 AC 0E 03 LDY $030E
|
||||
.,E143 28 PLP
|
||||
.,E144 6C 14 00 JMP ($0014)
|
||||
.,E147 08 PHP
|
||||
.,E148 8D 0C 03 STA $030C
|
||||
.,E14B 8E 0D 03 STX $030D
|
||||
.,E14E 8C 0E 03 STY $030E
|
||||
.,E151 68 PLA
|
||||
.,E152 8D 0F 03 STA $030F
|
||||
.,E155 60 RTS
|
||||
.,E156 20 D4 E1 JSR $E1D4
|
||||
.,E159 A6 2D LDX $2D
|
||||
.,E15B A4 2E LDY $2E
|
||||
.,E15D A9 2B LDA #$2B
|
||||
.,E15F 20 D8 FF JSR $FFD8
|
||||
.,E162 B0 95 BCS $E0F9
|
||||
.,E164 60 RTS
|
||||
.,E165 A9 01 LDA #$01
|
||||
.:E167 2C .BYTE $2C
|
||||
.,E168 A9 00 LDA #$00
|
||||
.,E16A 85 0A STA $0A
|
||||
.,E16C 20 D4 E1 JSR $E1D4
|
||||
.,E16F A5 0A LDA $0A
|
||||
.,E171 A6 2B LDX $2B
|
||||
.,E173 A4 2C LDY $2C
|
||||
.,E175 20 D5 FF JSR $FFD5
|
||||
.,E178 B0 57 BCS $E1D1
|
||||
.,E17A A5 0A LDA $0A
|
||||
.,E17C F0 17 BEQ $E195
|
||||
.,E17E A2 1C LDX #$1C
|
||||
.,E180 20 B7 FF JSR $FFB7
|
||||
.,E183 29 10 AND #$10
|
||||
.,E185 D0 17 BNE $E19E
|
||||
.,E187 A5 7A LDA $7A
|
||||
.,E189 C9 02 CMP #$02
|
||||
.,E18B F0 07 BEQ $E194
|
||||
.,E18D A9 64 LDA #$64
|
||||
.,E18F A0 A3 LDY #$A3
|
||||
.,E191 4C 1E AB JMP $AB1E
|
||||
.,E194 60 RTS
|
||||
.,E195 20 B7 FF JSR $FFB7
|
||||
.,E198 29 BF AND #$BF
|
||||
.,E19A F0 05 BEQ $E1A1
|
||||
.,E19C A2 1D LDX #$1D
|
||||
.,E19E 4C 37 A4 JMP $A437
|
||||
.,E1A1 A5 7B LDA $7B
|
||||
.,E1A3 C9 02 CMP #$02
|
||||
.,E1A5 D0 0E BNE $E1B5
|
||||
.,E1A7 86 2D STX $2D
|
||||
.,E1A9 84 2E STY $2E
|
||||
.,E1AB A9 76 LDA #$76
|
||||
.,E1AD A0 A3 LDY #$A3
|
||||
.,E1AF 20 1E AB JSR $AB1E
|
||||
.,E1B2 4C 2A A5 JMP $A52A
|
||||
.,E1B5 20 8E A6 JSR $A68E
|
||||
.,E1B8 20 33 A5 JSR $A533
|
||||
.,E1BB 4C 77 A6 JMP $A677
|
||||
.,E1BE 20 19 E2 JSR $E219
|
||||
.,E1C1 20 C0 FF JSR $FFC0
|
||||
.,E1C4 B0 0B BCS $E1D1
|
||||
.,E1C6 60 RTS
|
||||
.,E1C7 20 19 E2 JSR $E219
|
||||
.,E1CA A5 49 LDA $49
|
||||
.,E1CC 20 C3 FF JSR $FFC3
|
||||
.,E1CF 90 C3 BCC $E194
|
||||
.,E1D1 4C F9 E0 JMP $E0F9
|
||||
.,E1D4 A9 00 LDA #$00
|
||||
.,E1D6 20 BD FF JSR $FFBD
|
||||
.,E1D9 A2 01 LDX #$01
|
||||
.,E1DB A0 00 LDY #$00
|
||||
.,E1DD 20 BA FF JSR $FFBA
|
||||
.,E1E0 20 06 E2 JSR $E206
|
||||
.,E1E3 20 57 E2 JSR $E257
|
||||
.,E1E6 20 06 E2 JSR $E206
|
||||
.,E1E9 20 00 E2 JSR $E200
|
||||
.,E1EC A0 00 LDY #$00
|
||||
.,E1EE 86 49 STX $49
|
||||
.,E1F0 20 BA FF JSR $FFBA
|
||||
.,E1F3 20 06 E2 JSR $E206
|
||||
.,E1F6 20 00 E2 JSR $E200
|
||||
.,E1F9 8A TXA
|
||||
.,E1FA A8 TAY
|
||||
.,E1FB A6 49 LDX $49
|
||||
.,E1FD 4C BA FF JMP $FFBA
|
||||
.,E200 20 0E E2 JSR $E20E
|
||||
.,E203 4C 9E B7 JMP $B79E
|
||||
.,E206 20 79 00 JSR $0079
|
||||
.,E209 D0 02 BNE $E20D
|
||||
.,E20B 68 PLA
|
||||
.,E20C 68 PLA
|
||||
.,E20D 60 RTS
|
||||
.,E20E 20 FD AE JSR $AEFD
|
||||
.,E211 20 79 00 JSR $0079
|
||||
.,E214 D0 F7 BNE $E20D
|
||||
.,E216 4C 08 AF JMP $AF08
|
||||
.,E219 A9 00 LDA #$00
|
||||
.,E21B 20 BD FF JSR $FFBD
|
||||
.,E21E 20 11 E2 JSR $E211
|
||||
.,E221 20 9E B7 JSR $B79E
|
||||
.,E224 86 49 STX $49
|
||||
.,E226 8A TXA
|
||||
.,E227 A2 01 LDX #$01
|
||||
.,E229 A0 00 LDY #$00
|
||||
.,E22B 20 BA FF JSR $FFBA
|
||||
.,E22E 20 06 E2 JSR $E206
|
||||
.,E231 20 00 E2 JSR $E200
|
||||
.,E234 86 4A STX $4A
|
||||
.,E236 A0 00 LDY #$00
|
||||
.,E238 A5 49 LDA $49
|
||||
.,E23A E0 03 CPX #$03
|
||||
.,E23C 90 01 BCC $E23F
|
||||
.,E23E 88 DEY
|
||||
.,E23F 20 BA FF JSR $FFBA
|
||||
.,E242 20 06 E2 JSR $E206
|
||||
.,E245 20 00 E2 JSR $E200
|
||||
.,E248 8A TXA
|
||||
.,E249 A8 TAY
|
||||
.,E24A A6 4A LDX $4A
|
||||
.,E24C A5 49 LDA $49
|
||||
.,E24E 20 BA FF JSR $FFBA
|
||||
.,E251 20 06 E2 JSR $E206
|
||||
.,E254 20 0E E2 JSR $E20E
|
||||
.,E257 20 9E AD JSR $AD9E
|
||||
.,E25A 20 A3 B6 JSR $B6A3
|
||||
.,E25D A6 22 LDX $22
|
||||
.,E25F A4 23 LDY $23
|
||||
.,E261 4C BD FF JMP $FFBD
|
||||
.,E0F9 C9 F0 CMP #$F0 EREXIT CMP #$F0 ;CHECK FOR SPECIAL CASE
|
||||
.,E0FB D0 07 BNE $E104 BNE EREXIX
|
||||
; TOP OF MEMORY HAS CHANGED
|
||||
.,E0FD 84 38 STY $38 STY MEMSIZ+1
|
||||
.,E0FF 86 37 STX $37 STX MEMSIZ
|
||||
.,E101 4C 63 A6 JMP $A663 JMP CLEART ;ACT AS IF HE TYPED CLEAR
|
||||
.,E104 AA TAX EREXIX TAX ;SET TERMINATION FLAGS
|
||||
.,E105 D0 02 BNE $E109 BNE EREXIY
|
||||
.,E107 A2 1E LDX #$1E LDX #ERBRK ;BREAK ERROR
|
||||
.,E109 4C 37 A4 JMP $A437 EREXIY JMP ERROR ;NORMAL ERROR
|
||||
|
||||
CLSCHN =$FFCC
|
||||
|
||||
.,E10C 20 D2 FF JSR $FFD2 OUTCH JSR $FFD2
|
||||
.,E10F B0 E8 BCS $E0F9 BCS EREXIT
|
||||
.,E111 60 RTS RTS
|
||||
.,E112 20 CF FF JSR $FFCF INCHR JSR $FFCF
|
||||
.,E115 B0 E2 BCS $E0F9 BCS EREXIT
|
||||
.,E117 60 RTS RTS
|
||||
|
||||
CCALL =$FFE7
|
||||
|
||||
SETTIM =$FFDB
|
||||
RDTIM =$FFDE
|
||||
|
||||
.,E118 20 AD E4 JSR $E4AD COOUT JSR PPACH ; GO OUT TO SAVE .A FOR PRINT# PATCH
|
||||
.,E11B B0 DC BCS $E0F9 BCS EREXIT
|
||||
.,E11D 60 RTS RTS
|
||||
|
||||
.,E11E 20 C6 FF JSR $FFC6 COIN JSR $FFC6
|
||||
.,E121 B0 D6 BCS $E0F9 BCS EREXIT
|
||||
.,E123 60 RTS RTS
|
||||
|
||||
READST =$FFB7
|
||||
|
||||
.,E124 20 E4 FF JSR $FFE4 CGETL JSR $FFE4
|
||||
.,E127 B0 D0 BCS $E0F9 BCS EREXIT
|
||||
.,E129 60 RTS RTS
|
||||
|
||||
RDBAS =$FFF3
|
||||
|
||||
SETMSG =$FF90
|
||||
|
||||
PLOT =$FFF0
|
||||
|
||||
.,E12A 20 8A AD JSR $AD8A CSYS JSR FRMNUM ;EVAL FORMULA
|
||||
.,E12D 20 F7 B7 JSR $B7F7 JSR GETADR ;CONVERT TO INT. ADDR
|
||||
.,E130 A9 E1 LDA #$E1 LDA #>CSYSRZ ;PUSH RETURN ADDRESS
|
||||
.,E132 48 PHA PHA
|
||||
.,E133 A9 46 LDA #$46 LDA #<CSYSRZ
|
||||
.,E135 48 PHA PHA
|
||||
.,E136 AD 0F 03 LDA $030F LDA SPREG ;STATUS REG
|
||||
.,E139 48 PHA PHA
|
||||
.,E13A AD 0C 03 LDA $030C LDA SAREG ;LOAD 6502 REGS
|
||||
.,E13D AE 0D 03 LDX $030D LDX SXREG
|
||||
.,E140 AC 0E 03 LDY $030E LDY SYREG
|
||||
.,E143 28 PLP PLP ;LOAD 6502 STATUS REG
|
||||
.,E144 6C 14 00 JMP ($0014) JMP (LINNUM) ;GO DO IT
|
||||
CSYSRZ =*-1 ;RETURN TO HERE
|
||||
.,E147 08 PHP PHP ;SAVE STATUS REG
|
||||
.,E148 8D 0C 03 STA $030C STA SAREG ;SAVE 6502 REGS
|
||||
.,E14B 8E 0D 03 STX $030D STX SXREG
|
||||
.,E14E 8C 0E 03 STY $030E STY SYREG
|
||||
.,E151 68 PLA PLA ;GET STATUS REG
|
||||
.,E152 8D 0F 03 STA $030F STA SPREG
|
||||
.,E155 60 RTS RTS ;RETURN TO SYSTEM
|
||||
|
||||
.,E156 20 D4 E1 JSR $E1D4 CSAVE JSR PLSV ;PARSE PARMS
|
||||
.,E159 A6 2D LDX $2D LDX VARTAB ;END SAVE ADDR
|
||||
.,E15B A4 2E LDY $2E LDY VARTAB+1
|
||||
.,E15D A9 2B LDA #$2B LDA #<TXTTAB ;INDIRECT WITH START ADDRESS
|
||||
.,E15F 20 D8 FF JSR $FFD8 JSR $FFD8 ;SAVE IT
|
||||
.,E162 B0 95 BCS $E0F9 BCS EREXIT
|
||||
.,E164 60 RTS RTS
|
||||
|
||||
.,E165 A9 01 LDA #$01 CVERF LDA #1 ;VERIFY FLAG
|
||||
.:E167 2C .BYTE $2C .BYT $2C ;SKIP TWO BYTES
|
||||
|
||||
.,E168 A9 00 LDA #$00 CLOAD LDA #0 ;LOAD FLAG
|
||||
.,E16A 85 0A STA $0A STA VERCK
|
||||
.,E16C 20 D4 E1 JSR $E1D4 JSR PLSV ;PARSE PARAMETERS
|
||||
;
|
||||
CLD10 ; JSR $FFE1 ;CHECK RUN/STOP
|
||||
; CMP #$FF ;DONE YET?
|
||||
; BNE CLD10 ;STILL BOUNCING
|
||||
.,E16F A5 0A LDA $0A LDA VERCK
|
||||
.,E171 A6 2B LDX $2B LDX TXTTAB ;.X AND .Y HAVE ALT...
|
||||
.,E173 A4 2C LDY $2C LDY TXTTAB+1 ;...LOAD ADDRESS
|
||||
.,E175 20 D5 FF JSR $FFD5 JSR $FFD5 ;LOAD IT
|
||||
.,E178 B0 57 BCS $E1D1 BCS JERXIT ;PROBLEMS
|
||||
;
|
||||
.,E17A A5 0A LDA $0A LDA VERCK
|
||||
.,E17C F0 17 BEQ $E195 BEQ CLD50 ;WAS LOAD
|
||||
;
|
||||
;FINISH VERIFY
|
||||
;
|
||||
.,E17E A2 1C LDX #$1C LDX #ERVFY ;ASSUME ERROR
|
||||
.,E180 20 B7 FF JSR $FFB7 JSR $FFB7 ;READ STATUS
|
||||
.,E183 29 10 AND #$10 AND #$10 ;CHECK ERROR
|
||||
.,E185 D0 17 BNE $E19E BNE CLD55 ;REPLACES BEQ *+5/JMP ERROR
|
||||
;
|
||||
;PRINT VERIFY 'OK' IF DIRECT
|
||||
;
|
||||
.,E187 A5 7A LDA $7A LDA TXTPTR
|
||||
.,E189 C9 02 CMP #$02 CMP #BUFPAG
|
||||
.,E18B F0 07 BEQ $E194 BEQ CLD20
|
||||
.,E18D A9 64 LDA #$64 LDA #<OKMSG
|
||||
.,E18F A0 A3 LDY #$A3 LDY #>OKMSG
|
||||
.,E191 4C 1E AB JMP $AB1E JMP STROUT
|
||||
;
|
||||
.,E194 60 RTS CLD20 RTS
|
||||
|
||||
;
|
||||
;FINISH LOAD
|
||||
;
|
||||
.,E195 20 B7 FF JSR $FFB7 CLD50 JSR $FFB7 ;READ STATUS
|
||||
.,E198 29 BF AND #$BF AND #$FF-$40 ;CLEAR E.O.I.
|
||||
.,E19A F0 05 BEQ $E1A1 BEQ CLD60 ;WAS O.K.
|
||||
.,E19C A2 1D LDX #$1D LDX #ERLOAD
|
||||
.,E19E 4C 37 A4 JMP $A437 CLD55 JMP ERROR
|
||||
;
|
||||
.,E1A1 A5 7B LDA $7B CLD60 LDA TXTPTR+1
|
||||
.,E1A3 C9 02 CMP #$02 CMP #BUFPAG ;DIRECT?
|
||||
.,E1A5 D0 0E BNE $E1B5 BNE CLD70 ;NO...
|
||||
;
|
||||
.,E1A7 86 2D STX $2D STX VARTAB
|
||||
.,E1A9 84 2E STY $2E STY VARTAB+1 ;END LOAD ADDRESS
|
||||
.,E1AB A9 76 LDA #$76 LDA #<REDDY
|
||||
.,E1AD A0 A3 LDY #$A3 LDY #>REDDY
|
||||
.,E1AF 20 1E AB JSR $AB1E JSR STROUT
|
||||
.,E1B2 4C 2A A5 JMP $A52A JMP FINI
|
||||
;
|
||||
;PROGRAM LOAD
|
||||
;
|
||||
.,E1B5 20 8E A6 JSR $A68E CLD70 JSR STXTPT
|
||||
.,E1B8 20 33 A5 JSR $A533 JSR LNKPRG
|
||||
.,E1BB 4C 77 A6 JMP $A677 JMP FLOAD
|
||||
|
||||
.,E1BE 20 19 E2 JSR $E219 COPEN JSR PAOC ;PARSE STATEMENT
|
||||
.,E1C1 20 C0 FF JSR $FFC0 JSR $FFC0 ;OPEN IT
|
||||
.,E1C4 B0 0B BCS $E1D1 BCS JERXIT ;BAD STUFF OR MEMSIZ CHANGE
|
||||
.,E1C6 60 RTS RTS ;A.O.K.
|
||||
|
||||
.,E1C7 20 19 E2 JSR $E219 CCLOS JSR PAOC ;PARSE STATEMENT
|
||||
.,E1CA A5 49 LDA $49 LDA ANDMSK ;GET LA
|
||||
.,E1CC 20 C3 FF JSR $FFC3 JSR $FFC3 ;CLOSE IT
|
||||
.,E1CF 90 C3 BCC $E194 BCC CLD20 ;IT'S OKAY...NO MEMSIZE CHANGE
|
||||
;
|
||||
.,E1D1 4C F9 E0 JMP $E0F9 JERXIT JMP EREXIT
|
||||
|
||||
;
|
||||
;PARSE LOAD AND SAVE COMMANDS
|
||||
;
|
||||
PLSV
|
||||
;DEFAULT FILE NAME
|
||||
;
|
||||
.,E1D4 A9 00 LDA #$00 LDA #0 ;LENGTH=0
|
||||
.,E1D6 20 BD FF JSR $FFBD JSR $FFBD
|
||||
;
|
||||
;DEFAULT DEVICE #
|
||||
;
|
||||
.,E1D9 A2 01 LDX #$01 LDX #1 ;DEVICE #1
|
||||
.,E1DB A0 00 LDY #$00 LDY #0 ;COMMAND 0
|
||||
.,E1DD 20 BA FF JSR $FFBA JSR $FFBA
|
||||
;
|
||||
.,E1E0 20 06 E2 JSR $E206 JSR PAOC20 ;BY-PASS JUNK
|
||||
.,E1E3 20 57 E2 JSR $E257 JSR PAOC15 ;GET/SET FILE NAME
|
||||
.,E1E6 20 06 E2 JSR $E206 JSR PAOC20 ;BY-PASS JUNK
|
||||
.,E1E9 20 00 E2 JSR $E200 JSR PLSV7 ;GET ',FA'
|
||||
.,E1EC A0 00 LDY #$00 LDY #0 ;COMMAND 0
|
||||
.,E1EE 86 49 STX $49 STX ANDMSK
|
||||
.,E1F0 20 BA FF JSR $FFBA JSR $FFBA
|
||||
.,E1F3 20 06 E2 JSR $E206 JSR PAOC20 ;BY-PASS JUNK
|
||||
.,E1F6 20 00 E2 JSR $E200 JSR PLSV7 ;GET ',SA'
|
||||
.,E1F9 8A TXA TXA ;NEW COMMAND
|
||||
.,E1FA A8 TAY TAY
|
||||
.,E1FB A6 49 LDX $49 LDX ANDMSK ;DEVICE #
|
||||
.,E1FD 4C BA FF JMP $FFBA JMP $FFBA
|
||||
|
||||
;LOOK FOR COMMA FOLLOWED BY BYTE
|
||||
.,E200 20 0E E2 JSR $E20E PLSV7 JSR PAOC30
|
||||
.,E203 4C 9E B7 JMP $B79E JMP GETBYT
|
||||
|
||||
;SKIP RETURN IF NEXT CHAR IS END
|
||||
;
|
||||
.,E206 20 79 00 JSR $0079 PAOC20 JSR CHRGOT
|
||||
.,E209 D0 02 BNE $E20D BNE PAOCX
|
||||
.,E20B 68 PLA PLA
|
||||
.,E20C 68 PLA PLA
|
||||
.,E20D 60 RTS PAOCX RTS
|
||||
|
||||
;CHECK FOR COMMA AND GOOD STUFF
|
||||
;
|
||||
.,E20E 20 FD AE JSR $AEFD PAOC30 JSR CHKCOM ;CHECK COMMA
|
||||
.,E211 20 79 00 JSR $0079 PAOC32 JSR CHRGOT ;GET CURRENT
|
||||
.,E214 D0 F7 BNE $E20D BNE PAOCX ;IS O.K.
|
||||
.,E216 4C 08 AF JMP $AF08 PAOC40 JMP SNERR ;BAD...END OF LINE
|
||||
|
||||
;PARSE OPEN/CLOSE
|
||||
;
|
||||
.,E219 A9 00 LDA #$00 PAOC LDA #0
|
||||
.,E21B 20 BD FF JSR $FFBD JSR $FFBD ;DEFAULT FILE NAME
|
||||
;
|
||||
.,E21E 20 11 E2 JSR $E211 JSR PAOC32 ;MUST GOT SOMETHING
|
||||
.,E221 20 9E B7 JSR $B79E JSR GETBYT ;GET LA
|
||||
.,E224 86 49 STX $49 STX ANDMSK
|
||||
.,E226 8A TXA TXA
|
||||
.,E227 A2 01 LDX #$01 LDX #1 ;DEFAULT DEVICE
|
||||
.,E229 A0 00 LDY #$00 LDY #0 ;DEFAULT COMMAND
|
||||
.,E22B 20 BA FF JSR $FFBA JSR $FFBA ;STORE IT
|
||||
.,E22E 20 06 E2 JSR $E206 JSR PAOC20 ;SKIP JUNK
|
||||
.,E231 20 00 E2 JSR $E200 JSR PLSV7
|
||||
.,E234 86 4A STX $4A STX EORMSK
|
||||
.,E236 A0 00 LDY #$00 LDY #0 ;DEFAULT COMMAND
|
||||
.,E238 A5 49 LDA $49 LDA ANDMSK ;GET LA
|
||||
.,E23A E0 03 CPX #$03 CPX #3
|
||||
.,E23C 90 01 BCC $E23F BCC PAOC5
|
||||
.,E23E 88 DEY DEY ;DEFAULT IEEE TO $FF
|
||||
.,E23F 20 BA FF JSR $FFBA PAOC5 JSR $FFBA ;STORE THEM
|
||||
.,E242 20 06 E2 JSR $E206 JSR PAOC20 ;SKIP JUNK
|
||||
.,E245 20 00 E2 JSR $E200 JSR PLSV7 ;GET SA
|
||||
.,E248 8A TXA TXA
|
||||
.,E249 A8 TAY TAY
|
||||
.,E24A A6 4A LDX $4A LDX EORMSK
|
||||
.,E24C A5 49 LDA $49 LDA ANDMSK
|
||||
.,E24E 20 BA FF JSR $FFBA JSR $FFBA ;SET UP REAL EVEYTHING
|
||||
.,E251 20 06 E2 JSR $E206 PAOC7 JSR PAOC20
|
||||
.,E254 20 0E E2 JSR $E20E JSR PAOC30
|
||||
.,E257 20 9E AD JSR $AD9E PAOC15 JSR FRMEVL
|
||||
.,E25A 20 A3 B6 JSR $B6A3 JSR FRESTR ;LENGTH IN .A
|
||||
.,E25D A6 22 LDX $22 LDX INDEX1
|
||||
.,E25F A4 23 LDY $23 LDY INDEX1+1
|
||||
.,E261 4C BD FF JMP $FFBD JMP $FFBD
|
||||
|
||||
PAGE
|
||||
SUBTTL SINE, COSINE AND TANGENT FUNCTIONS.
|
||||
273
c64disasm/combine.py
Executable file
273
c64disasm/combine.py
Executable file
|
|
@ -0,0 +1,273 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import html, re, os
|
||||
|
||||
filenames = [
|
||||
"c64disasm_ms.txt;c64disasm_cbm.txt",
|
||||
"c64disasm_de.txt",
|
||||
"c64disasm_en.txt",
|
||||
"c64disasm_sc.txt",
|
||||
"c64disasm_mn.txt",
|
||||
"c64disasm_mm.txt"
|
||||
]
|
||||
names = [
|
||||
"Microsoft/Commodore Source",
|
||||
"Data Becker [German]",
|
||||
"Lee Davison",
|
||||
"Bob Sander-Cederlof [BASIC only]",
|
||||
"Magnus Nyman [KERNAL only]",
|
||||
"Marko Mäkelä"
|
||||
]
|
||||
links = [
|
||||
"https://github.com/mist64/cbmsrc",
|
||||
"https://www.pagetable.com/?p=1015",
|
||||
"https://www.pagetable.com/?p=726",
|
||||
"https://www.pagetable.com/?p=728",
|
||||
"https://www.telecomm.at/documents/Jiffydos_Romlisting.doc",
|
||||
"http://www.unusedino.de/ec64/technical/misc/c64/romlisting.html"
|
||||
]
|
||||
descriptions = [
|
||||
"The original M6502 BASIC source by Microsoft (KIM-1 version, not everything lines up, Commodore extensions are missing, but lots of comments by the original authors)<br/>and the original C64 KERNAL source by Commodore (lots of comments by the original authors)",
|
||||
"German-language comments from <i>Das neue Commodore-64-intern-Buch</i> by Data Becker, ISBN 3890113079. Some minor corrections have been made.",
|
||||
"Comments from <i>The almost completely commented C64 ROM disassembly V1.01</i> by Lee Davison. Some minor corrections have been made.",
|
||||
"Comments adapted from <i>S-C DocuMentor for Applesoft</i> by Bob Sander-Cederlof, for the version of Microsoft BASIC that shipped with the Apple II.",
|
||||
"Comments from <i>JIFFYDOS version 6.01/version 6.02</i> by Magnus Nyman (Harlekin/FairLight), which were written for the JiffyDOS KERNAL, so some serial code and all tape code is missing comments.",
|
||||
"Comments from the <i>Commodore 64 BASIC/KERNAL ROM Disassembly Version 1.0 (June 1994)</i> by Marko Mäkelä."
|
||||
]
|
||||
|
||||
def cross_reference(string, symbols):
|
||||
hex_numbers = re.findall(r'(?<!#)\$[0-9A-F][0-9A-F]+', string)
|
||||
for hex_number in hex_numbers:
|
||||
dec_number = int(hex_number[1:], 16)
|
||||
if dec_number < 0x0400:
|
||||
string = string.replace(hex_number, "<a href=\"../c64mem/#" + '{:04X}'.format(dec_number) + "\">" + hex_number + "</a>")
|
||||
elif (dec_number >= 0xa000 and dec_number <= 0xbfff) or (dec_number >= 0xe000 and dec_number <= 0xffff):
|
||||
string = string.replace(hex_number, "<a href=\"#" + hex_number[1:] + "\">" + hex_number + "</a>")
|
||||
|
||||
for symbol in symbols:
|
||||
string = re.sub('\\b' + symbol + '\\b', '<a href="../c64mem/#' + symbol + '">' + symbol + '</a>', string)
|
||||
|
||||
return string
|
||||
|
||||
asm_donor_index = 1
|
||||
source_index = 0 # we treat the Microsoft/Commodore source differently
|
||||
|
||||
f = os.popen("git log -1 --pretty=format:%h .")
|
||||
revision = f.read()
|
||||
f = os.popen("git log -1 --date=short --pretty=format:%cd .")
|
||||
date = f.read()
|
||||
|
||||
symbols = []
|
||||
symbol_lines = [line.rstrip() for line in open('../c64mem/c64mem_src.txt')]
|
||||
for line in symbol_lines:
|
||||
if line.startswith('#') or line.startswith('-'):
|
||||
continue
|
||||
symbol = line[13:19].rstrip()
|
||||
if symbol != '':
|
||||
symbols.append(symbol)
|
||||
symbols = set(symbols)
|
||||
|
||||
data = []
|
||||
linenumber = []
|
||||
address = []
|
||||
for filename in filenames:
|
||||
d = []
|
||||
for f in filename.split(";"):
|
||||
d += [line.rstrip() for line in open(f)]
|
||||
data.append(d)
|
||||
linenumber.append(0)
|
||||
address.append(0)
|
||||
files = len(filenames)
|
||||
|
||||
asmaddress = 0
|
||||
asmlinenumber = 0
|
||||
|
||||
for i in range(0, files):
|
||||
while True:
|
||||
line = data[i][linenumber[i]]
|
||||
if len(line) > 0 and line[0] == '.':
|
||||
break
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
|
||||
print('<meta http-equiv="Content-type" content="text/html; charset=utf-8" />')
|
||||
print('<html>')
|
||||
print('<head>')
|
||||
print('<title>BASIC & KERNAL ROM Disassembly | Ultimate C64 Reference</title>')
|
||||
print('')
|
||||
print('<script language="javascript">')
|
||||
print(' window.onload = init;')
|
||||
print(' function init() {')
|
||||
print(' var tbl = document.getElementById("disassembly_table");')
|
||||
print(' for (var i = 0; i < ' + str(len(filenames)) + '; i++) {')
|
||||
print(' var key = "com.pagetable.c64disasm.column_" + i;')
|
||||
print(' var element_name = "checkbox_" + i;')
|
||||
print(' var checked = localStorage.getItem(key) != "hidden";')
|
||||
print(' document.getElementById(element_name).checked = checked;')
|
||||
print(' hideCol(i, checked);')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print(' function hideCol(col, checked) {')
|
||||
print(' var tbl = document.getElementById("disassembly_table");')
|
||||
print(' for (var i = 0; i < tbl.rows.length; i++) {')
|
||||
print(' tbl.rows[i].cells[col+1].style.display = checked ? "" : "none";')
|
||||
print(' }')
|
||||
print(' var key = "com.pagetable.c64disasm.column_" + col;')
|
||||
print(' if (checked) {')
|
||||
print(' localStorage.removeItem(key);')
|
||||
print(' } else {')
|
||||
print(' localStorage.setItem(key, "hidden");')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print('</script>')
|
||||
print('')
|
||||
print('<link rel="stylesheet" href="../style.css">')
|
||||
print('<style type="text/css">')
|
||||
print('')
|
||||
print('h3 {')
|
||||
print(' font-family: serif;')
|
||||
print('}')
|
||||
print('')
|
||||
print('.com {')
|
||||
print(' white-space: pre;')
|
||||
print('}')
|
||||
print('')
|
||||
print('div.disassembly_container {')
|
||||
print(' padding: 1em 0em 1em 16em;')
|
||||
print(' overflow: scroll;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table td, table.disassembly_table th {')
|
||||
print(' font-family: monospace;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table th.left_column {')
|
||||
print(' width: 18em;')
|
||||
print('}')
|
||||
print('')
|
||||
print('</style>')
|
||||
print('</head>')
|
||||
print('<body>')
|
||||
|
||||
# http://tholman.com/github-corners/
|
||||
print('<a href="https://github.com/mist64/c64ref" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:var(--main-color); color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>')
|
||||
|
||||
print('<div class="topnav">')
|
||||
print(' <h1>Ultimate Commodore 64 Reference</h1> ')
|
||||
#print(' <a href="#">KERNAL API</a><!-- kernal/ -->')
|
||||
print(' <a class="active" href="../c64disasm/">ROM Disassembly</a><!-- c64disasm/ -->')
|
||||
print(' <a href="../c64mem/">Memory Map</a><!-- c64mem/ -->')
|
||||
#print(' <a href="#">I/O Map</a><!-- c64io/ -->')
|
||||
#print(' <a href="#">6502 CPU</a><!-- 6502/ -->')
|
||||
print('</div>')
|
||||
|
||||
print('<div class="body">')
|
||||
print('<h1>C64 BASIC & KERNAL ROM Disassembly</h1>')
|
||||
|
||||
print('<p><i>by <a href="http://www.pagetable.com/">Michael Steil</a>, <a href="https://github.com/mist64/c64ref">github.com/mist64/c64ref</a>. Revision ' + revision + ', ' + date + '</i></p>')
|
||||
|
||||
print('<b>This allows you to view different commentaries side-by-side. You can enable/disable individual columns:</b><br/><br/>')
|
||||
print('<table class="checkbox_table">')
|
||||
for i in range(0, len(filenames)):
|
||||
print('<tr><td><input type="checkbox" id="checkbox_' + str(i) + '" checked onclick="hideCol(' + str(i) + ', document.getElementById(\'checkbox_' + str(i) + '\').checked);" /></td><td style="white-space: nowrap;"><b><a href="' + links[i] + '">' + names[i] + '</a></b><td>' + descriptions[i] + '</td></tr>')
|
||||
print('</table>')
|
||||
|
||||
print('<div class="disassembly_container">')
|
||||
print('<table id="disassembly_table" class="disassembly_table">')
|
||||
|
||||
print('<tr>')
|
||||
print('<th class="left_column">Disassembly</th>')
|
||||
for i in range(0, files):
|
||||
print('<th class="top_row">' + names[i] + '</th>')
|
||||
print('</tr>')
|
||||
|
||||
count = 0
|
||||
while(True):
|
||||
count += 1
|
||||
# if count > 80:
|
||||
# break
|
||||
|
||||
for i in range(0, files):
|
||||
if linenumber[i] >= len(data[i]):
|
||||
continue
|
||||
while len(data[i][linenumber[i]]) > 0 and (data[i][linenumber[i]][0] == '-' or data[i][linenumber[i]][0] == '#'):
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
if asmlinenumber >= len(data[asm_donor_index]):
|
||||
break
|
||||
|
||||
asm = data[asm_donor_index][asmlinenumber][0:32].rstrip()
|
||||
asmlinenumber = asmlinenumber + 1
|
||||
|
||||
if len(asm) == 0:
|
||||
continue
|
||||
if asm[0] == '#' or asm[0] == '-':
|
||||
continue
|
||||
|
||||
has_address = False
|
||||
if asm[0] == '.':
|
||||
hexaddress = asm[2:6]
|
||||
asmaddress = int(hexaddress, 16)
|
||||
has_address = True
|
||||
|
||||
asm = cross_reference(asm, symbols)
|
||||
|
||||
print('<tr>')
|
||||
print('<th class="left_column">')
|
||||
if has_address:
|
||||
print('<a name="' + hexaddress + '" />')
|
||||
print('<span class="com">' + asm + '</span></th>')
|
||||
|
||||
for i in range(0, files):
|
||||
print('<td>')
|
||||
comments = []
|
||||
while True:
|
||||
if linenumber[i] >= len(data[i]):
|
||||
break
|
||||
|
||||
line = data[i][linenumber[i]]
|
||||
|
||||
if line.startswith('.'):
|
||||
address[i] = int(line[2:6], 16)
|
||||
if address[i] > asmaddress:
|
||||
break
|
||||
comment = line[32:]
|
||||
comment = html.escape(comment)
|
||||
|
||||
comment = cross_reference(comment, symbols)
|
||||
|
||||
if comment.startswith('***'):
|
||||
comment = '<h3>' + comment[3:] + '</h3>'
|
||||
elif comment.startswith('SUBTTL'):
|
||||
comment = '<h3>' + comment[6:] + '</h3>'
|
||||
elif comment.startswith('.LIB '):
|
||||
comment = '<h3>' + comment + '</h3>'
|
||||
else:
|
||||
scomment = comment.lstrip()
|
||||
|
||||
if scomment.startswith(';'):
|
||||
comment = '<b>' + comment + '</b>'
|
||||
|
||||
if len(comment) != 0:
|
||||
comment = '<span class="com">' + comment + '</span><br />'
|
||||
|
||||
if len(comment) != 0:
|
||||
comments.append(comment)
|
||||
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
if len(comments):
|
||||
for comment in comments:
|
||||
print(comment)
|
||||
else:
|
||||
print(' ')
|
||||
|
||||
print('</td>')
|
||||
print('</tr>')
|
||||
|
||||
print('</table>')
|
||||
print('</div>')
|
||||
print('</div>')
|
||||
print('</body>')
|
||||
print('</html>')
|
||||
|
||||
3724
c64io/c64io_mapc64.txt
Normal file
3724
c64io/c64io_mapc64.txt
Normal file
File diff suppressed because it is too large
Load diff
373
c64io/c64io_prg.txt
Normal file
373
c64io/c64io_prg.txt
Normal file
|
|
@ -0,0 +1,373 @@
|
|||
- C64 I/O Map (Programmer's Reference Guide)
|
||||
-
|
||||
- C64PRG10.TXT
|
||||
-
|
||||
- practically the same:
|
||||
- 64MAP10.TXT/Commodore_64_IO_Maps.doc
|
||||
- 64MAP10.TXT/Commodore_64_Memory_Maps.txt
|
||||
------------------------------------------------------------
|
||||
-
|
||||
# [...]
|
||||
|
||||
0000 0 7-0 MOS 6510 Data Direction
|
||||
Register (xx101111)
|
||||
Bit= 1: Output, Bit=0:
|
||||
Input, x=Don't Care
|
||||
|
||||
0001 1 MOS 6510 Micro-Processor
|
||||
On-Chip I/O Port
|
||||
0 /LORAM Signal (0=Switch BASIC ROM Out)
|
||||
1 /HIRAM Signal (0=Switch Kernal ROM Out)
|
||||
2 /CHAREN Signal (0=Switch Char. ROM In)
|
||||
3 Cassette Data Output Line
|
||||
4 Cassette Switch Sense: 1 = Switch Closed
|
||||
5 Cassette Motor Control 0 = ON, 1 = OFF
|
||||
6-7 Undefined
|
||||
|
||||
|
||||
D000-D02E 53248-54271 MOS 6566 VIDEO INTERFACE CONTROLLER
|
||||
(VIC)
|
||||
|
||||
D000 53248 Sprite 0 X Pos
|
||||
D001 53249 Sprite 0 Y Pos
|
||||
D002 53250 Sprite 1 X Pos
|
||||
D003 53251 Sprite 1 Y Pos
|
||||
D004 53252 Sprite 2 X Pos
|
||||
D005 53253 Sprite 2 Y Pos
|
||||
D006 53254 Sprite 3 X Pos
|
||||
D007 53255 Sprite 3 Y Pos
|
||||
D008 53256 Sprite 4 X Pos
|
||||
D009 53257 Sprite 4 Y Pos
|
||||
D00A 53258 Sprite 5 X Pos
|
||||
D00B 53259 Sprite 5 Y Pos
|
||||
D00C 53260 Sprite 6 X Pos
|
||||
D00D 53261 Sprite 6 Y Pos
|
||||
D00E 53262 Sprite 7 X Pos
|
||||
D00F 53263 Sprite 7 Y Pos
|
||||
D010 53264 Sprites 0-7 X Pos (msb of X coord.)
|
||||
D011 53265 VIC Control Register
|
||||
7 Raster Compare: (Bit 8) See 53266
|
||||
6 Extended Color Text Mode 1 = Enable
|
||||
5 Bit Map Mode. 1 = Enable
|
||||
4 Blank Screen to Border Color: 0 = Blank
|
||||
3 Select 24/25 Row Text Display: 1=25 Rows
|
||||
2-0 Smooth Scroll to Y Dot-Position (0-7)
|
||||
|
||||
D012 53266 Read Raster/Write Raster Value for
|
||||
Compare IRQ
|
||||
D013 53267 Light-Pen Latch X Pos
|
||||
D014 53268 Light-Pen Latch Y Pos
|
||||
D015 53269 Sprite display Enable: 1 = Enable
|
||||
D016 53270 VIC Control Register
|
||||
7-6 Unused
|
||||
5 ALWAYS SET THIS BIT TO 0 !
|
||||
4 Multi-Color Mode: 1 = Enable (Text or
|
||||
Bit-Map)
|
||||
3 Select 38/40 Column Text Display:
|
||||
1 = 40 Cols
|
||||
2-0 Smooth Scroll to X Pos
|
||||
|
||||
D017 53271 Sprites 0-7 Expand 2x Vertical (Y)
|
||||
D018 53272 VIC Memory Control Register
|
||||
7-4 Video Matrix Base Address (inside VIC)
|
||||
3-1 Character Dot-Data Base Address (inside
|
||||
VIC)
|
||||
0 Select upper/lower Character Set
|
||||
|
||||
D019 53273 VIC Interrupt Flag Register (Bit = 1:
|
||||
IRQ Occurred)
|
||||
7 Set on Any Enabled VIC IRQ Condition
|
||||
3 Light-Pen Triggered IRQ Flag
|
||||
2 Sprite to Sprite Collision IRQ Flag
|
||||
1 Sprite to Background Collision IRQ Flag
|
||||
0 Raster Compare IRQ Flag
|
||||
|
||||
D01A 53274 IRQ Mask Register: 1 = Interrupt Enabled
|
||||
D01B 53275 Sprite to Background Display Priority:
|
||||
1 = Sprite
|
||||
D01C 53276 Sprites 0-7 Multi-Color Mode Select:
|
||||
1 = M.C.M.
|
||||
D01D 53277 Sprites 0-7 Expand 2x Horizontal (X)
|
||||
D01E 53278 Sprite to Sprite Collision Detect
|
||||
D01F 53279 Sprite to Background Collision Detect
|
||||
D020 53280 Border Color
|
||||
D021 53281 Background Color 0
|
||||
D022 53282 Background Color 1
|
||||
D023 53283 Background Color 2
|
||||
D024 53284 Background Color 3
|
||||
D025 53285 Sprite Multi-Color Register 0
|
||||
D026 53286 Sprite Multi-Color Register 1
|
||||
D027 53287 Sprite 0 Color
|
||||
D028 53288 Sprite 1 Color
|
||||
D029 53289 Sprite 2 Color
|
||||
D02A 53290 Sprite 3 Color
|
||||
D02B 53291 Sprite 4 Color
|
||||
D02C 53292 Sprite 5 Color
|
||||
D02D 53293 Sprite 6 Color
|
||||
D02E 53294 Sprite 7 Color
|
||||
|
||||
|
||||
D400-D7FF 54272-55295 MOS 6581 SOUND INTERFACE DEVICE (SID)
|
||||
|
||||
D400 54272 Voice 1: Frequency Control - Low-Byte
|
||||
D401 54273 Voice 1: Frequency Control - High-Byte
|
||||
D402 54274 Voice 1: Pulse Waveform Width - Low-Byte
|
||||
D403 54275 7-4 Unused
|
||||
3-0 Voice 1: Pulse Waveform Width - High-
|
||||
Nybble
|
||||
|
||||
D404 54276 Voice 1: Control Register
|
||||
7 Select Random Noise Waveform, 1 = On
|
||||
6 Select Pulse Waveform, 1 = On
|
||||
5 Select Sawtooth Waveform, 1 = On
|
||||
4 Select Triangle Waveform, 1 = On
|
||||
3 Test Bit: 1 = Disable Oscillator 1
|
||||
2 Ring Modulate Osc. 1 with Osc. 3 Output,
|
||||
1 = On
|
||||
1 Synchronize Osc.1 with Osc.3 Frequency,
|
||||
1 = On
|
||||
0 Gate Bit: 1 = Start Att/Dec/Sus,
|
||||
0 = Start Release
|
||||
|
||||
D405 54277 Envelope Generator 1: Attack/Decay Cycle
|
||||
Control
|
||||
7-4 Select Attack Cycle Duration: 0-15
|
||||
3-0 Select Decay Cycle Duration: 0-15
|
||||
|
||||
D406 54278 Envelope Generator 1: Sustain/Release
|
||||
Cycle Control
|
||||
7-4 Select Sustain Cycle Duration: 0-15
|
||||
3-0 Select Release Cycle Duration: 0-15
|
||||
|
||||
D407 54279 Voice 2: Frequency Control - Low-Byte
|
||||
D408 54280 Voice 2: Frequency Control - High-Byte
|
||||
D409 54281 Voice 2: Pulse Waveform Width - Low-Byte
|
||||
D40A 54282 7-4 Unused
|
||||
3-0 Voice 2: Pulse Waveform Width - High-
|
||||
Nybble
|
||||
|
||||
D40B 54283 Voice 2: Control Register
|
||||
7 Select Random Noise Waveform, 1 = On
|
||||
6 Select Pulse Waveform, 1 = On
|
||||
5 Select Sawtooth Waveform, 1 = On
|
||||
4 Select Triangle Waveform, 1 = On
|
||||
3 Test Bit: 1 = Disable Oscillator 1
|
||||
2 Ring Modulate Osc. 2 with Osc. 1 Output,
|
||||
1 = On
|
||||
1 Synchronize Osc.2 with Osc. 1 Frequency,
|
||||
1 = On
|
||||
0 Gate Bit: 1 = Start Att/Dec/Sus,
|
||||
0 = Start Release
|
||||
|
||||
D40C 54284 Envelope Generator 2: Attack / Decay
|
||||
Cycle Control
|
||||
7-4 Select Attack Cycle Duration: 0-15
|
||||
3-0 Select Decay Cycle Duration: 0-15
|
||||
|
||||
D40D 54285 Envelope Generator 2: Sustain / Release
|
||||
Cycle Control
|
||||
7-4 Select Sustain Cycle Duration: 0-15
|
||||
3-0 Select Release Cycle Duration: 0-15
|
||||
|
||||
D40E 54286 Voice 3: Frequency Control - Low-Byte
|
||||
D40F 54287 Voice 3: Frequency Control - High-Byte
|
||||
D410 54288 Voice 3: Pulse Waveform Width - Low-Byte
|
||||
D411 54289 7-4 Unused
|
||||
3-0 Voice 3: Pulse Waveform Width - High-
|
||||
Nybble
|
||||
|
||||
D412 54290 Voice 3: Control Register
|
||||
7 Select Random Noise Waveform, 1 = On
|
||||
6 Select Pulse Waveform, 1 = On
|
||||
5 Select Sawtooth Waveform, 1 = On
|
||||
4 Select Triangle Waveform, 1 = On
|
||||
3 Test Bit: 1 = Disable Oscillator 1
|
||||
2 Ring Modulate Osc. 3 with Osc. 2 Output,
|
||||
1 = On
|
||||
1 Synchronize Osc. 3 with Osc.2 Frequency,
|
||||
1 = On
|
||||
0 Gate Bit: 1 = Start Att/Dec/Sus,
|
||||
0 = Start Release
|
||||
|
||||
D413 54291 Envelope Generator 3: Attack/Decay Cycle
|
||||
Control
|
||||
7-4 Select Attack Cycle Duration: 0-15
|
||||
3-0 Select Decay Cycle Duration: 0-15
|
||||
|
||||
D414 54285 Envelope Generator 3: Sustain / Release
|
||||
Cycle Control
|
||||
7-4 Select Sustain Cycle Duration: 0-15
|
||||
3-0 Select Release Cycle Duration: 0-15
|
||||
|
||||
D415 54293 Filter Cutoff Frequency: Low-Nybble
|
||||
(Bits 2-0)
|
||||
D416 54294 Filter Cutoff Frequency: High-Byte
|
||||
D417 54295 Filter Resonance Control / Voice Input
|
||||
Control
|
||||
7-4 Select Filter Resonance: 0-15
|
||||
3 Filter External Input: 1 = Yes, 0 = No
|
||||
2 Filter Voice 3 Output: 1 = Yes, 0 = No
|
||||
Filter Voice 2 Output: 1 = Yes, 0 = No
|
||||
0 Filter Voice 1 Output: 1 = Yes, 0 = No
|
||||
|
||||
D418 54296 Select Filter Mode and Volume
|
||||
7 Cut-Off Voice 3 Output: 1 = Off, 0 = On
|
||||
6 Select Filter High-Pass Mode: 1 = On
|
||||
5 Select Filter Band-Pass Mode: 1 = On
|
||||
4 Select Filter Low-Pass Mode: 1 = On
|
||||
3-0 Select Output Volume: 0-15
|
||||
|
||||
D419 54297 Analog/Digital Converter: Game Paddle 1
|
||||
(0-255)
|
||||
D41A 54298 Analog/Digital Converter: Game Paddle 2
|
||||
(0-255)
|
||||
D41B 54299 Oscillator 3 Random Number Generator
|
||||
D41C 54230 Envelope Generator 3 Output
|
||||
D500-D7FF 54528-55295 SID IMAGES
|
||||
D800-DBFF 55296-56319 Color RAM (Nybbles)
|
||||
|
||||
DC00-DCFF 56320-56575 MOS 6526 Complex Interface Adapter
|
||||
(CIA) #1
|
||||
|
||||
DC00 56320 Data Port A (Keyboard, Joystick,
|
||||
Paddles, Light-Pen)
|
||||
7-0 Write Keyboard Column Values for
|
||||
Keyboard Scan
|
||||
7-6 Read Paddles on Port A / B (01 = Port A,
|
||||
10 = Port B)
|
||||
4 Joystick A Fire Button: 1 = Fire
|
||||
3-2 Paddle Fire Buttons
|
||||
3-0 Joystick A Direction (0-15)
|
||||
|
||||
DC01 56321 Data Port B (Keyboard, Joystick,
|
||||
Paddles): Game Port 1
|
||||
7-0 Read Keyboard Row Values for Keyboard
|
||||
Scan
|
||||
7 Timer B Toggle/Pulse Output
|
||||
6 Timer A: Toggle/Pulse Output
|
||||
4 Joystick 1 Fire Button: 1 = Fire
|
||||
3-2 Paddle Fire Buttons
|
||||
3-0 Joystick 1 Direction
|
||||
|
||||
DC02 56322 Data Direction Register - Port A (56320)
|
||||
DC03 56323 Data Direction Register - Port B (56321)
|
||||
DC04 56324 Timer A: Low-Byte
|
||||
DC05 56325 Timer A: High-Byte
|
||||
DC06 56326 Timer B: Low-Byte
|
||||
DC07 56327 Timer B: High-Byte
|
||||
|
||||
DC08 56328 Time-of-Day Clock: 1/10 Seconds
|
||||
DC09 56329 Time-of-Day Clock: Seconds
|
||||
DC0A 56330 Time-of-Day Clock: Minutes
|
||||
DC0B 56331 Time-of-Day Clock: Hours + AM/PM Flag
|
||||
(Bit 7)
|
||||
DC0C 56332 Synchronous Serial I/O Data Buffer
|
||||
DC0D 56333 CIA Interrupt Control Register
|
||||
(Read IRQs/Write Mask)
|
||||
7 IRQ Flag (1 = IRQ Occurred) / Set-
|
||||
Clear Flag
|
||||
4 FLAG1 IRQ (Cassette Read / Serial Bus
|
||||
SRQ Input)
|
||||
3 Serial Port Interrupt
|
||||
2 Time-of-Day Clock Alarm Interrupt
|
||||
1 Timer B Interrupt
|
||||
0 Timer A Interrupt
|
||||
|
||||
DC0E 56334 CIA Control Register A
|
||||
7 Time-of-Day Clock Frequency: 1 = 50 Hz,
|
||||
0 = 60 Hz
|
||||
6 Serial Port I/O Mode Output, 0 = Input
|
||||
|
||||
5 Timer A Counts: 1 = CNT Signals,
|
||||
0 = System 02 Clock
|
||||
4 Force Load Timer A: 1 = Yes
|
||||
3 Timer A Run Mode: 1 = One-Shot,
|
||||
0 = Continuous
|
||||
2 Timer A Output Mode to PB6: 1 = Toggle,
|
||||
0 = Pulse
|
||||
1 Timer A Output on PB6: 1 = Yes, 0 = No
|
||||
0 Start/Stop Timer A: 1 = Start, 0 = Stop
|
||||
|
||||
DC0F 56335 CIA Control Register B
|
||||
7 Set Alarm/TOD-Clock: 1 = Alarm,
|
||||
0 = Clock
|
||||
6-5 Timer B Mode Select:
|
||||
00 = Count System 02 Clock Pulses
|
||||
01 = Count Positive CNT Transitions
|
||||
10 = Count Timer A Underflow Pulses
|
||||
11 = Count Timer A Underflows While
|
||||
CNT Positive
|
||||
4-0 Same as CIA Control Reg. A - for Timer B
|
||||
|
||||
DD00-DDFF 56576-56831 MOS 6526 Complex Interface Adapter
|
||||
(CIA) #2
|
||||
|
||||
DD00 56576 Data Port A (Serial Bus, RS-232, VIC
|
||||
Memory Control)
|
||||
7 Serial Bus Data Input
|
||||
6 Serial Bus Clock Pulse Input
|
||||
5 Serial Bus Data Output
|
||||
4 Serial Bus Clock Pulse Output
|
||||
3 Serial Bus ATN Signal Output
|
||||
2 RS-232 Data Output (User Port)
|
||||
1-0 VIC Chip System Memory Bank Select
|
||||
(Default = 11)
|
||||
|
||||
DD01 56577 Data Port B (User Port, RS-232)
|
||||
7 User / RS-232 Data Set Ready
|
||||
6 User / RS-232 Clear to Send
|
||||
5 User
|
||||
4 User / RS-232 Carrier Detect
|
||||
3 User / RS-232 Ring Indicator
|
||||
2 User / RS-232 Data Terminal Ready
|
||||
1 User / RS-232 Request to Send
|
||||
0 User / RS-232 Received Data
|
||||
|
||||
DD02 56578 Data Direction Register - Port A
|
||||
DD03 56579 Data Direction Register - Port B
|
||||
DD04 56580 Timer A: Low-Byte
|
||||
DD05 56581 Timer A: High-Byte
|
||||
DD06 56582 Timer B: Low-Byte
|
||||
DD07 56583 Timer B: High-Byte
|
||||
DD08 56584 Time-of-Day Clock: 1/10 Seconds
|
||||
DD09 56585 Time-of-Day Clock: Seconds
|
||||
DD0A 56586 Time-of-Day Clock: Minutes
|
||||
DD0B 56587 Time-of-Day Clock: Hours + AM/PM Flag
|
||||
(Bit 7)
|
||||
DD0C 56588 Synchronous Serial I/O Data Buffer
|
||||
DD0D 56589 CIA Interrupt Control Register (Read
|
||||
NMls/Write Mask)
|
||||
7 NMI Flag (1 = NMI Occurred) / Set-
|
||||
Clear Flag
|
||||
4 FLAG1 NMI (User/RS-232 Received Data
|
||||
Input)
|
||||
3 Serial Port Interrupt
|
||||
1 Timer B Interrupt
|
||||
0 Timer A Interrupt
|
||||
|
||||
DD0E 56590 CIA Control Register A
|
||||
7 Time-of-Day Clock Frequency: 1 = 50 Hz,
|
||||
0 = 60 Hz
|
||||
6 Serial Port I/O Mode Output, 0 = Input
|
||||
5 Timer A Counts: 1 = CNT Signals,
|
||||
0 = System 02 Clock
|
||||
4 Force Load Timer A: 1 = Yes
|
||||
3 Timer A Run Mode: 1 = One-Shot,
|
||||
0 = Continuous
|
||||
2 Timer A Output Mode to PB6: 1 = Toggle,
|
||||
0 = Pulse
|
||||
1 Timer A Output on PB6: 1 = Yes, 0 = No
|
||||
0 Start/Stop Timer A: 1 = Start, 0 = Stop
|
||||
|
||||
DD0F 56591 CIA Control Register B
|
||||
7 Set Alarm/TOD-Clock: 1=Alarm, 0=Clock
|
||||
6-5 Timer B Mode Select:
|
||||
00 = Count System 02 Clock Pulses
|
||||
01 = Count Positive CNT Transitions
|
||||
10 = Count Timer A Underflow Pulses
|
||||
11 = Count Timer A Underflows While
|
||||
CNT Positive
|
||||
4-0 Same as CIA Control Reg. A - for Timer B
|
||||
|
||||
DE00-DEFF 56832-57087 Reserved for Future I/O Expansion
|
||||
DF00-DFFF 57088-57343 Reserved for Future I/O Expansion
|
||||
4095
c64mem/c64mem_64er.txt
Normal file
4095
c64mem/c64mem_64er.txt
Normal file
File diff suppressed because it is too large
Load diff
1255
c64mem/c64mem_64intern.txt
Normal file
1255
c64mem/c64mem_64intern.txt
Normal file
File diff suppressed because it is too large
Load diff
322
c64mem/c64mem_64map.txt
Normal file
322
c64mem/c64mem_64map.txt
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
- C64 RAM Map (64MAP10.TXT)
|
||||
-
|
||||
- Anonymous
|
||||
- Commodore_64_Memory_Maps.txt
|
||||
- in: 64MAP10.TXT, which states ftp://arnold.hiof.no/programs
|
||||
- as the original source
|
||||
-
|
||||
- Corrections (typos as well as content), translations etc.
|
||||
- welcome at: https://github.com/mist64/c64disasm
|
||||
-
|
||||
------------------------------------------------------------
|
||||
-
|
||||
# This plain text file is formatted so that it can be automatically
|
||||
# parsed in order to create cross-references etc.
|
||||
# * Lines starting with "-" is top-level information. The first line
|
||||
# is the title. Lines starting with "--" are separators.
|
||||
# * Lines starting with "#" are internal comments.
|
||||
# * Hex addresses start at column 0.
|
||||
# * Symbols start at column 13.
|
||||
# * The description starts at column 21.
|
||||
# * All lines of the description until the first blank line are
|
||||
# combined into the heading.
|
||||
# * A '.' character at the end of a heading line represents a hard
|
||||
# line break.
|
||||
# * The remaining text is in MarkDown format.
|
||||
# * All addresses are 4 digits and have a leading '$'.
|
||||
# The encoding is UTF-8.
|
||||
|
||||
$0000 D6510 6510 On-chip Data Direction Register.
|
||||
$0001 R6510 6510 On-chip 8-bit Input/Output Register.
|
||||
$0002 Unused. Free for user programs.
|
||||
$0003-$0004 ADRAY1 Jump Vector: Convert FAC to Integer in (A/Y)
|
||||
($B1AA).
|
||||
$0005-$0006 ADRAY2 Jump Vector: Convert Integer in (A/Y) to
|
||||
Floating point in (FAC); ($B391).
|
||||
$0007-$0008 Temporary Integer during OR/AND.
|
||||
$0007 CHARAC Search Character/Temporary Integer during INT.
|
||||
$0008 ENDCHR Flag: Scan for Quote at end of String.
|
||||
$0009 TRMPOS Screen Column for last TAB.
|
||||
$000A VERCK Flag: 0 = Load, 1 = Verify.
|
||||
$000B COUNT Input Buffer Pointer/Number of Subscripts.
|
||||
$000C DIMFLG Flag: Default Array dimension.
|
||||
$000D VALTYP Data type Flag: $00 = Numeric, $FF = String.
|
||||
$000E INTFLG Data type Flag: $00 = Floating point, $80 =
|
||||
Integer.
|
||||
$000F GARBFL Flag: DATA scan/List Quote/Garbage collection.
|
||||
$0010 SUBFLG Flag: Subscript reference/User Function call.
|
||||
$0011 INPFLG Input Flag: $00 = INPUT, $40 = GET, $98 =
|
||||
READ.
|
||||
$0012 TANSGN Flag: TAN sign/Comparative result.
|
||||
$0013 CHANNL File number of current Input Device.
|
||||
$0014-$0015 LINNUM Temporary: Integer value.
|
||||
$0016 TEMPPT Pointer: Temporary String Stack.
|
||||
$0017-$0018 LASTPT Last temporary String Address.
|
||||
$0019-$0021 TEMPST Stack for temporary Strings.
|
||||
$0022-$0025 INDEX Utility Pointer Area.
|
||||
$0022-$0023 INDEX1 First Utility Pointer.
|
||||
$0024-$0025 INDEX2 Secong Utility Pointer.
|
||||
$0026-$002A RES Floating point product of Multiply and
|
||||
Divide.
|
||||
$002B-$002C TXTTAB Pointer: Start of BASIC Text Area ($0801).
|
||||
$002D-$002E VARTAB Pointer: Start of BASIC Variables.
|
||||
$002F-$0030 ARYTAB Pointer: Start of BASIC Arrays.
|
||||
$0031-$0032 STREND Pointer: End of BASIC Arrays + 1.
|
||||
$0033-$0034 FRETOP Pointer: Bottom of String space.
|
||||
$0035-$0036 FRESPC Utility String Pointer.
|
||||
$0037-$0038 MEMSIZ Pointer: Highest Address available to BASIC
|
||||
($A000).
|
||||
$0039-$003A CURLIN Current BASIC Line number.
|
||||
$003B-$003C OLDLIN Previous BASIC Line number.
|
||||
$003D-$003E OLDTXT Pointer: BASIC Statement for CONT.
|
||||
$003F-$0040 DATLIN Current DATA Line number.
|
||||
$0041-$0042 DATPTR Pointer: Used by READ - current DATA Item
|
||||
Address.
|
||||
$0043-$0044 INPPTR Pointer: Temporary storage of Pointer during
|
||||
INPUT Routine.
|
||||
$0045-$0046 VARNAM Name of Variable being sought in Variable
|
||||
Table.
|
||||
$0047-$0048 VARPNT Pointer: to value of (VARNAM) if Integer, to
|
||||
descriptor if String.
|
||||
$0049-$004A FORPNT Pointer: Index Variable for FOR/NEXT loop.
|
||||
$004B-$004C VARTXT Temporary storage for TXTPTR during READ,
|
||||
INPUT and GET.
|
||||
$004D OPMASK Mask used during FRMEVL.
|
||||
$004E-$0052 TEMPF3 Temporary storage for FLPT value.
|
||||
$0053 FOUR6 Length of String Variable during Garbege
|
||||
collection.
|
||||
$0054-$0056 JMPER Jump Vector used in Function Evaluation -
|
||||
JMP followed by Address ($4C,$LB,$MB).
|
||||
$0057-$005B TEMPF1 Temporary storage for FLPT value.
|
||||
$005C-$0060 TEMPF2 Temporary storage for FLPT value.
|
||||
$0061-$0066 FAC Main Floating point Accumulator.
|
||||
$0061 FACEXP FAC Exponent.
|
||||
$0062-$0065 FACHO FAC Mantissa.
|
||||
$0066 FACSGN FAC Sign.
|
||||
$0067 SGNFLG Pointer: Series Evaluation Constant.
|
||||
$0068 BITS Bit Overflow Area during normalisation
|
||||
Routine.
|
||||
$0069-$006E ARG Auxiliary Floating point Accumulator.
|
||||
$0069 ARGEXP AFAC Exponent.
|
||||
$006A-$006D AFAC Mantissa.
|
||||
$006E ARGSGN AFAC Sign.
|
||||
$006F ARISGN Sign of result of Arithmetic Evaluation.
|
||||
$0070 FACOV FAC low-order rounding.
|
||||
$0071-$0072 FBUFPT Pointer: Used during CRUNCH/ASCII conversion.
|
||||
$0073-$008A CHRGET Subroutine: Get next Byte of BASIC Text.
|
||||
|
||||
,0073 INC $7A
|
||||
,0075 BNE $0079
|
||||
,0077 INC $7B
|
||||
,0079 LDA $0801
|
||||
,007C CMP #$3A
|
||||
,007E BCS $008A
|
||||
,0080 CMP #$20
|
||||
,0082 BEQ $0073
|
||||
,0084 SEC
|
||||
,0085 SBC #$30
|
||||
,0087 SEC
|
||||
,0088 SBC #$D0
|
||||
,008A RTS
|
||||
|
||||
$0079 CHRGOT Entry to Get same Byte again.
|
||||
$007A-$007B TXTPTR Pointer: Current Byte of BASIC Text.
|
||||
$008B-$008F RNDX Floating RND Function Seed Value.
|
||||
$0090 STATUS Kernal I/O Status Word ST.
|
||||
$0091 STKEY Flag: $7F = STOP key.
|
||||
$0092 SVXT Timing Constant for Tape.
|
||||
$0093 VERCK Flag: 0 = Load, 1 = Verify.
|
||||
$0094 C3P0 Flag: Serial Bus - Output Character buffered.
|
||||
$0095 BSOUR Buffered Character for Serial Bus.
|
||||
$0096 SYNO Cassette Sync. number.
|
||||
$0097 XSAV Temporary storage of X Register during CHRIN.
|
||||
Temporary storage of Y Register during RS232
|
||||
fetch.
|
||||
$0098 LDTND Number of Open Files/Index to File Table.
|
||||
$0099 DFLTN Default Input Device (0).
|
||||
$009A DFLTO Default Output Device (3).
|
||||
$009B PRTY Parity of Byte Output to Tape.
|
||||
$009C DPSW Flag: Byte received from Tape.
|
||||
$009D MSGFLG Flag: $00 = Program mode: Suppress Error
|
||||
Messages, $40 = Kernal Error Messages only,
|
||||
$80 = Direct mode: Full Error Messages.
|
||||
$009E PTR1 Tape Error log pass 1.
|
||||
$009E T1 Index to Cassette File name/Header ID for
|
||||
Tape write.
|
||||
$009F PTR2 Tape Error log pass 2.
|
||||
$00A0-$00A2 TIME Real-time jiffy Clock (Updated by IRQ
|
||||
Interrupt approx. every 1/60 of Second);
|
||||
Update Routine: UDTIMK ($F69B).
|
||||
$00A3 Bit Counter Tape Read or Write/Serial Bus
|
||||
EOI (End Of Input) Flag.
|
||||
$00A4 Pulse Counter Tape Read or Write/Serial Bus
|
||||
shift Counter.
|
||||
$00A5 CNTDN Tape Synchronising count down.
|
||||
$00A6 BUFPT Pointer: Tape I/O buffer.
|
||||
$00A7 INBIT RS232 temporary for received Bit/Tape
|
||||
temporary.
|
||||
$00A8 BITCI RS232 Input Bit count/Tape temporary.
|
||||
$00A9 RINONE RS232 Flag: Start Bit check/Tape temporary.
|
||||
$00AA RIDATA RS232 Input Byte Buffer/Tape temporary.
|
||||
$00AB RIPRTY RS232 Input parity/Tape temporary.
|
||||
$00AC-$00AD Pointer: Tape Buffer/Screen scrolling.
|
||||
$00AE-$00AF Tape End Address/End of Program.
|
||||
$00B0-$00B1 Tape timing Constants.
|
||||
$00B2-$00B3 TAPE1 Pointer: Start Address of Tape Buffer ($033C).
|
||||
$00B4 BITTS RS232 Write bit count/Tape Read timing Flag.
|
||||
$00B5 NXTBIT RS232 Next Bit to send/Tape Read - End of
|
||||
Tape.
|
||||
$00B6 RODATA RS232 Output Byte Buffer/Tape Read Error Flag.
|
||||
$00B7 FNLEN Number of Characters in Filename.
|
||||
$00B8 LA Current File - Logical File number.
|
||||
$00B9 SA Current File - Secondary Address.
|
||||
$00BA FA Current File - First Address (Device number).
|
||||
OPEN LA,FA,SA; OPEN 1,8,15,"I0":CLOSE 1
|
||||
$00BB-$00BC FNADR Pointer: Current File name Address.
|
||||
$00BD ROPRTY RS232 Output Parity/Tape Byte to be Input or
|
||||
Output.
|
||||
$00BE FSBLK Tape Input/Output Block count.
|
||||
$00BF MYCH Serial Word Buffer.
|
||||
$00C0 CAS1 Tape Motor Switch.
|
||||
$00C1-$00C2 STAL Start Address for LOAD and Cassette Write.
|
||||
$00C3-$00C4 MEMUSS Pointer: Type 3 Tape LOAD and general use.
|
||||
$00C5 LSTX Matrix value of last Key pressed; No Key = $40.
|
||||
$00C6 NDX Number of Characters in Keyboard Buffer
|
||||
queue.
|
||||
$00C7 RVS Flag: Reverse On/Off; On = $01, Off = $00.
|
||||
$00C8 INDX Pointer: End of Line for Input (Used to
|
||||
suppress trailing spaces).
|
||||
$00C9-$00CA Cursor X/Y (Line/Column) position at start of
|
||||
Input.
|
||||
$00CB SFDX Flag: Print shifted Characters.
|
||||
$00CC BLNSW Flag: Cursor blink; $00 = Enabled, $01 =
|
||||
Disabled.
|
||||
$00CD BLNCT Timer: Count down for Cursor blink toggle.
|
||||
$00CE GDBLN Character under Cursor while Cursor Inverted.
|
||||
$00CF BLNON Flag: Cursor Status; $00 = Off, $01 = On.
|
||||
$00D0 CRSW Flag: Input from Screen = $03, or Keyboard =
|
||||
$00.
|
||||
$00D1-$00D2 PNT Pointer: Current Screen Line Address.
|
||||
$00D3 PNTR Cursor Column on current Line, including
|
||||
Wrap-round Line, if any.
|
||||
$00D4 QTSW Flag: Editor in Quote Mode; $00 = Not.
|
||||
$00D5 LNMX Current logical Line length: 39 or 79.
|
||||
$00D6 TBLX Current Screen Line number of Cursor.
|
||||
$00D7 DATA Screen value of current Input Character/Last
|
||||
Character Output.
|
||||
$00D8 INSRT Count of number of inserts outstanding.
|
||||
$00D9-$00F2 LDTB1 Screen Line link Table/Editor temporaries.
|
||||
High Byte of Line Screen Memory Location.
|
||||
$00F3-$00F4 USER Pointer: Current Colour RAM Location.
|
||||
$00F5-$00F6 KEYTAB Vector: Current Keyboard decoding Table.
|
||||
($EB81)
|
||||
$00F7-$00F8 RIBUF RS232 Input Buffer Pointer.
|
||||
$00F9-$00FA ROBUF RS232 Output Buffer Pointer.
|
||||
$00FB-$00FE FREKZP Free Zero Page space for User Programs.
|
||||
$00FF-$010A Assembly Area for Floating point to ASCII
|
||||
conversion.
|
||||
$0100-$01FF 6510 Hardware Stack Area.
|
||||
$0100-$013E BAD Tape Input Error log.
|
||||
$013F-$01FF BASIC Stack Area.
|
||||
$0200-$0258 BUF BASIC Input Buffer (Input Line from Screen).
|
||||
$0259-$0262 LAT Kernal Table: Active logical File numbers.
|
||||
$0263-$026C FAT Kernal Table: Active File First Addresses
|
||||
(Device numbers).
|
||||
$026D-$0276 SAT Kernal Table: Active File Secondary
|
||||
Addresses.
|
||||
$0277-$0280 KEYD Keyboard Buffer Queue (FIFO).
|
||||
$0281-$0282 MEMSTR Pointer: Bottom of Memory for Operating
|
||||
System ($0800).
|
||||
$0283-$0284 MEMSIZ Pointer: Top of Memory for Operating
|
||||
System ($A000).
|
||||
$0285 TIMOUT Serial IEEE Bus timeout defeat Flag.
|
||||
$0286 COLOR Current Character Colour code.
|
||||
$0287 GDCOL Background Colour under Cursor.
|
||||
$0288 HIBASE High Byte of Screen Memory Address ($04).
|
||||
$0289 XMAX Maximum number of Bytes in Keyboard
|
||||
Buffer ($0A).
|
||||
$028A RPTFLG Flag: Repeat keys; $00 = Cursors, INST/DEL &
|
||||
Space repeat, $40 no Keys repeat, $80 all
|
||||
Keys repeat ($00).
|
||||
$028B KOUNT Repeat Key: Speed Counter ($04).
|
||||
$028C DELAY Repeat Key: First repeat delay Counter ($10).
|
||||
$028D SHFLAG Flag: Shift Keys: Bit 1 = Shift, Bit 2 = CBM,
|
||||
Bit 3 = CTRL; ($00 = None, $01 = Shift, etc.).
|
||||
$028E LSTSHF Last Shift Key used for debouncing.
|
||||
$028F-$0290 KEYLOG Vector: Routine to determine Keyboard table
|
||||
to use based on Shift Key Pattern ($EB48).
|
||||
$0291 MODE Flag: Upper/Lower Case change: $00 = Disabled,
|
||||
$80 = Enabled ($00).
|
||||
$0292 AUTODN Flag: Auto scroll down: $00 = Disabled ($00).
|
||||
$0293 M51CTR RS232 Pseudo 6551 control Register Image.
|
||||
$0294 M51CDR RS232 Pseudo 6551 command Register Image.
|
||||
$0295-$0296 M51AJB RS232 Non-standard Bits/Second.
|
||||
$0297 RSSTAT RS232 Pseudo 6551 Status Register Image.
|
||||
$0298 BITNUM RS232 Number of Bits left to send.
|
||||
$0299-$029A BAUDOF RS232 Baud Rate; Full Bit time microseconds.
|
||||
$029B RIDBE RS232 Index to End of Input Buffer.
|
||||
$029C RIDBS RS232 Pointer: High Byte of Address of Input
|
||||
Buffer.
|
||||
$029D RODBS RS232 Pointer: High Byte of Address of Output
|
||||
Buffer.
|
||||
$029E RODBE RS232 Index to End of Output Buffer.
|
||||
$029F-$02A0 IRQTMP Temporary store for IRQ Vector during Tape
|
||||
operations.
|
||||
$02A1 ENABL RS232 Enables.
|
||||
$02A2 CASTON TOD sense during Tape I/O.
|
||||
$02A3 KIKA26 Temporary storage during Tape READ.
|
||||
$02A4 STUPID Temporary D1IRQ Indicator during Tape READ.
|
||||
$02A5 LINTMP Temporary for Line Index.
|
||||
$02A6 PALNTS Flag: TV Standard: $00 = NTSC, $01 = PAL.
|
||||
$02A7-$02FF Unused.
|
||||
$0300-$0301 IERROR Vector: Indirect entry to BASIC Error
|
||||
Message, (X) points to Message ($E38B).
|
||||
$0302-$0303 IMAIN Vector: Indirect entry to BASIC Input Line
|
||||
and Decode ($A483).
|
||||
$0304-$0305 ICRNCH Vector: Indirect entry to BASIC Tokenise
|
||||
Routine ($A57C).
|
||||
$0306-$0307 IQPLOP Vector: Indirect entry to BASIC LIST
|
||||
Routine ($A71A).
|
||||
$0308-$0309 IGONE Vector: Indirect entry to BASIC Character
|
||||
dispatch Routine ($A7E4).
|
||||
$030A-$030B IEVAL Vector: Indirect entry to BASIC Token
|
||||
evaluation ($AE86).
|
||||
$030C SAREG Storage for 6510 Accumulator during SYS.
|
||||
$030D SXREG Storage for 6510 X-Register during SYS.
|
||||
$030E SYREG Storage for 6510 Y-Register during SYS.
|
||||
$030F SPREG Storage for 6510 Status Register during SYS.
|
||||
$0310 USR Function JMP Instruction ($4C).
|
||||
$0311-$0312 USRADD USR Address ($LB,$MB).
|
||||
$0313 Unused.
|
||||
$0314-$0315 CINV Vector: Hardware IRQ Interrupt Address ($EA31).
|
||||
$0316-$0317 CBINV Vector: BRK Instruction Interrupt Address
|
||||
($FE66).
|
||||
$0318-$0319 NMINV Vector: Hardware NMI Interrupt Address ($FE47).
|
||||
$031A-$031B IOPEN Vector: Indirect entry to Kernal OPEN
|
||||
Routine ($F34A).
|
||||
$031C-$031D ICLOSE Vector: Indirect entry to Kernal CLOSE
|
||||
Routine ($F291).
|
||||
$031E-$031F ICHKIN Vector: Indirect entry to Kernal CHKIN
|
||||
Routine ($F20E).
|
||||
$0320-$0321 ICKOUT Vector: Indirect entry to Kernal CHKOUT
|
||||
Routine ($F250).
|
||||
$0322-$0323 ICLRCH Vector: Indirect entry to Kernal CLRCHN
|
||||
Routine ($F333).
|
||||
$0324-$0325 IBASIN Vector: Indirect entry to Kernal CHRIN
|
||||
Routine ($F157).
|
||||
$0326-$0327 IBSOUT Vector: Indirect entry to Kernal CHROUT
|
||||
Routine ($F1CA).
|
||||
$0328-$0329 ISTOP Vector: Indirect entry to Kernal STOP
|
||||
Routine ($F6ED).
|
||||
$032A-$032B IGETIN Vector: Indirect entry to Kernal GETIN
|
||||
Routine ($F13E).
|
||||
$032C-$032D ICLALL Vector: Indirect entry to Kernal CLALL
|
||||
Routine ($F32F).
|
||||
$032E-$032F USRCMD User Defined Vector ($FE66).
|
||||
$0330-$0331 ILOAD Vector: Indirect entry to Kernal LOAD
|
||||
Routine ($F4A5).
|
||||
$0332-$0333 ISAVE Vector: Indirect entry to Kernal SAVE
|
||||
Routine ($F5ED).
|
||||
$0334-$033B Unused.
|
||||
$033C-$03FB TBUFFR Tape I/O Buffer.
|
||||
$03FC-$03FF Unused.
|
||||
221
c64mem/c64mem_jb.txt
Normal file
221
c64mem/c64mem_jb.txt
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
- C64 RAM Map (Jim Butterfield)
|
||||
-
|
||||
- Butterfield, Jim [compiled by]:
|
||||
- COMMODORE 64 MEMORY MAP
|
||||
- Classic Computer Magazine Archive COMPUTE! issue 29, October 1982, p.150
|
||||
-
|
||||
- https://www.atarimagazines.com/compute/issue29/394_1_COMMODORE_64_MEMORY_MAP.php
|
||||
- https://www.atariarchives.org/mlb/appendix_b.php
|
||||
- https://archive.org/details/1982-10-compute-magazine/page/n153/mode/2up
|
||||
-
|
||||
- Corrections (typos as well as content), translations etc.
|
||||
- welcome at: https://github.com/mist64/c64disasm
|
||||
-
|
||||
------------------------------------------------------------
|
||||
-
|
||||
# This plain text file is formatted so that it can be automatically
|
||||
# parsed in order to create cross-references etc.
|
||||
# * Lines starting with "-" is top-level information. The first line
|
||||
# is the title. Lines starting with "--" are separators.
|
||||
# * Lines starting with "#" are internal comments.
|
||||
# * Hex addresses start at column 0.
|
||||
# * Symbols start at column 13.
|
||||
# * The description starts at column 21.
|
||||
# * All lines of the description until the first blank line are
|
||||
# combined into the heading.
|
||||
# * A '.' character at the end of a heading line represents a hard
|
||||
# line break.
|
||||
# * The remaining text is in MarkDown format.
|
||||
# * All addresses are 4 digits and have a leading '$'.
|
||||
# The encoding is UTF-8.
|
||||
|
||||
$0000 D6510 Chip directional register
|
||||
$0001 R6510 Chip I/O; memory & tape control
|
||||
$0003-$0004 ADRAY1 Float-Fixed vector
|
||||
$0005-$0006 ADRAY2 Fixed-Float vector
|
||||
$0007 CHARAC Search character
|
||||
$0008 ENDCHR Scan-quotes flag
|
||||
$0009 TRMPOS TAB column save
|
||||
$000A VERCK 0 = LOAD, 1 = VERIFY
|
||||
$000B COUNT Input buffer pointer/# subscrpt
|
||||
$000C DIMFLG Default DIM flag
|
||||
$000D VALTYP Type : FF = string, 00 = numeric
|
||||
$000E INTFLG Type : 80 = integer, 00 = floating point
|
||||
$000F GARBFL DATA scan/LIST quote/memry flag
|
||||
$0010 SUBFLG Subscript/FNx flag
|
||||
$0011 INPFLG 0 = INPUT; $40 = GET; $98 = READ
|
||||
$0012 TANSGN ATN sign/Comparison eval flag
|
||||
$0013 CHANNL Current I/O prompt flag
|
||||
$0014-$0015 LINNUM Integer value
|
||||
$0016 TEMPPT Pointer : temporary strg stack
|
||||
$0017-$0018 LASTPT Last temp string vector
|
||||
$0019-$0021 TEMPST Stack for temporary strings
|
||||
$0022-$0025 INDEX Utility pointer area
|
||||
$0026-$002A RES Product area for multiplication
|
||||
$002B-$002C TXTTAB Pointer : Start-of-Basic
|
||||
$002D-$002E VARTAB Pointer : Start-of-Variables
|
||||
$002F-$0030 ARYTAB Pointer : Start-of-Arrays
|
||||
$0031-$0032 STREND Pointer : End-of-Arrays
|
||||
$0033-$0034 FRETOP Pointer : String-storage(moving down)
|
||||
$0035-$0036 FRESPC Utility string pointer
|
||||
$0037-$0038 MEMSIZ Pointer : Limit-of-memory
|
||||
$0039-$003A CURLIN Current Basic line number
|
||||
$003B-$003C OLDLIN Previous Basic line number
|
||||
$003D-$003E OLDTXT Pointer : Basic statement for CONT
|
||||
$003F-$0040 DATLIN Current DATA line number
|
||||
$0041-$0042 DATPTR Current DATA address
|
||||
$0043-$0044 INPPTR Input vector
|
||||
$0045-$0046 VARNAM Current variable name
|
||||
$0047-$0048 VARPNT Current variable address
|
||||
$0049-$004A FORPNT Variable pointer for FOR/NEXT
|
||||
$004B-$004C VARTXT Y-save; op-save; Basic pointer save
|
||||
$004D OPMASK Comparison symbol accumulator
|
||||
$004E-$0053 Misc work area, pointer, etc
|
||||
$0054-$0056 JMPER Jump vector for functions
|
||||
$0057-$0060 Misc numeric work area
|
||||
$0061 FACEXP Accum#l : Exponent
|
||||
$0062-$0065 FACHO Accum#l : Mantissa
|
||||
$0066 FACSGN Accum#l : Sign
|
||||
$0067 SGNFLG Series evaluation constant pointer
|
||||
$0068 BITS Accum#l hi-order (over flow)
|
||||
$0069-$006E ARG Accum#2 : Exponent, etc.
|
||||
$006F ARISGN Sign comparison, Acc#l vs #2
|
||||
$0070 FACOV Accum#l lo-order (rounding)
|
||||
$0071-$0072 FBUFPT Cassette buff len/Series pointer
|
||||
$0073-$008A CHRGET CHRGET subroutine; get Basic char
|
||||
$007A-$007B TXTPTR Basic pointer (within subrtn)
|
||||
$008B-$008F RNDX RND seed value
|
||||
$0090 STATUS Status word ST
|
||||
$0091 STKEY Keyswitch PIA : STOP and RVS flags
|
||||
$0092 SVXT Timing constant for tape
|
||||
$0093 VERCK Load = 0, Verify = l
|
||||
$0094 C3P0 Serial output : deferred char flag
|
||||
$0095 BSOUR Serial deferred character
|
||||
$0096 SYNO Tape EOT received
|
||||
$0097 XSAV Register save
|
||||
$0098 LDTND How many open files
|
||||
$0099 DFLTN Input device, normally 0
|
||||
$009A DFLTO Output CMD device, normally 3
|
||||
$009B PRTY Tape character parity
|
||||
$009C DPSW Byte-received flag
|
||||
$009D MSGFLG Direct = $80/RUN = 0 output control
|
||||
$009E PTR1 Tp Pass 1 error log/char buffer
|
||||
$009F PTR2 Tp Pass 2 err log corrected
|
||||
$00A0-$00A2 TIME Jiffy Clock HML
|
||||
$00A3 R2D2 Serial bit count/EOI flag
|
||||
$00A4 FIRT Cycle count
|
||||
$00A5 CNTDN Countdown, tape write/bit count
|
||||
$00A6 BUFPT Tape buffer pointer
|
||||
$00A7 INBIT Tp Wrt ldr count/Rd pass/inbit
|
||||
$00A8 BITCI Tp Wrt new byte/Rd error/inbit cnt
|
||||
$00A9 RINONE Wrt start bit/Rd bit err/stbit
|
||||
$00AA RIDATA Tp Scan; Cnt; Ld; End/byte assy
|
||||
$00AB RIPRTY Wr lead length/Rd checksum/parity
|
||||
$00AC-$00AD Pointer : tape bufr, scrolling
|
||||
$00AE-$00AF Tape end adds/End of program
|
||||
$00B0-$00B1 Tape timing constants
|
||||
$00B2-$00B3 TAPE1 Pntr : start of tape buffer
|
||||
$00B4 BITTS l = Tp timer enabled; bit count
|
||||
$00B5 NXTBIT Tp EOT/RS232 next bit to send
|
||||
$00B6 RODATA Read character error/outbyte buf
|
||||
$00B7 FNLEN # characters in file name
|
||||
$00B8 LA Current logical file
|
||||
$00B9 SA Current secndy address
|
||||
$00BA FA Current device
|
||||
$00BB-$00BC FNADR Pointer to file name
|
||||
$00BD ROPRTY Wr shift word/Rd input char
|
||||
$00BE FSBLK # blocks remaining to Wr/Rd
|
||||
$00BF MYCH Serial word buffer
|
||||
$00C0 CAS1 Tape motor interlock
|
||||
$00C1-$00C2 STAL I/O start address
|
||||
$00C3-$00C4 MEMUSS Kernel setup pointer
|
||||
$00C5 LSTX Last key pressed
|
||||
$00C6 NDX # chars in keybd buffer
|
||||
$00C7 RVS Screen reverse flag
|
||||
$00C8 INDX End-of-line for input pointer
|
||||
$00C9-$00CA Input cursor log (row, column)
|
||||
$00CB SFDX Which key : 64 if no key
|
||||
$00CC BLNSW 0 = flash cursor
|
||||
$00CD BLNCT Cursor timing countdown
|
||||
$00CE GDBLN Character under cursor
|
||||
$00CF BLNON Cursor in blink phase
|
||||
$00D0 CRSW Input from screen/from keyboard
|
||||
$00D1-$00D2 PNT Pointer to screen line
|
||||
$00D3 PNTR Position of cursor on above line
|
||||
$00D4 QTSW 0 = direct cursor, else programmed
|
||||
$00D5 LNMX Current screen line length
|
||||
$00D6 TBLX Row where curosr lives
|
||||
$00D7 DATA Last inkey/checksum/buffer
|
||||
$00D8 INSRT # of INSERTs outstanding
|
||||
$00D9-$00F2 LDTB1 Screen line link table
|
||||
$00F3-$00F4 USER Screen color pointer
|
||||
$00F5-$00F6 KEYTAB Keyboard pointer
|
||||
$00F7-$00F8 RIBUF RS-232 Rev pntr
|
||||
$00F9-$00FA ROBUF RS-232 Tx pntr
|
||||
$00FF-$010A BASZPT Floating to ASCII work area
|
||||
$0100-$01FF Processor stack area
|
||||
$0100-$013E BAD Tape error log
|
||||
$0200-$0258 BUF Basic input buffer
|
||||
$0259-$0262 LAT Logical file table
|
||||
$0263-$026C FAT Device # table
|
||||
$026D-$0276 SAT Sec Adds table
|
||||
$0277-$0280 KEYD Keybd buffer
|
||||
$0281-$0282 MEMSTR Start of Basic Memory
|
||||
$0283-$0284 MEMSIZ Top of Basic Memory
|
||||
$0285 TIMOUT Serial bus timeout flag
|
||||
$0286 COLOR Current color code
|
||||
$0287 GDCOL Color under cursor
|
||||
$0288 HIBASE Screen memory page
|
||||
$0289 XMAX Max size of keybd buffer
|
||||
$028A RPTFLG Repeat all keys
|
||||
$028B KOUNT Repeat speed counter
|
||||
$028C DELAY Repeat delay counter
|
||||
$028D SHFLAG Keyboard Shift/Control flag
|
||||
$028E LSTSHF Last shift pattern
|
||||
$028F-$0290 KEYLOG Keyboard table setup pointer
|
||||
$0291 MODE Keyboard shift mode
|
||||
$0292 AUTODN 0 = scroll enable
|
||||
$0293 M51CTR RS-232 control reg
|
||||
$0294 M51CDR RS-232 command reg
|
||||
$0295-$0296 M51AJB Bit timing
|
||||
$0297 RSSTAT RS-232 status
|
||||
$0298 BITNUM # bits to send
|
||||
$0299-$029A BAUDOF RS-232 speed/code
|
||||
$029B RIDBE RS232 receive pointer
|
||||
$029C RIDBS RS232 input pointer
|
||||
$029D RODBS RS232 transmit pointer
|
||||
$029E RODBE RS232 output pointer
|
||||
$029F-$02A0 IRQTMP IRQ save during tape I/O
|
||||
$02A1 ENABL CIA 2 (NMI) Interrupt Control
|
||||
$02A2 CASTON CIA 1 Timer A control log
|
||||
$02A3 KIKA26 CIA 1 Interrupt Log
|
||||
$02A4 STUPID CIA 1 Timer A enabled flag
|
||||
$02A5 LINTMP Screen row marker
|
||||
$0300-$0301 IERROR Error message link
|
||||
$0302-$0303 IMAIN Basic warm start link
|
||||
$0304-$0305 ICRNCH Crunch Basic tokens link
|
||||
$0306-$0307 IQPLOP Print tokens link
|
||||
$0308-$0309 IGONE Start new Basic code link
|
||||
$030A-$030B IEVAL Get arithmetic element link
|
||||
$030C SAREG SYS A-reg save
|
||||
$030D SXREG SYS X-reg save
|
||||
$030E SYREG SYS Y-reg save
|
||||
$030F SPREG SYS status reg save
|
||||
$0310-$0312 USRPOK USR function jump ($B248)
|
||||
$0314-$0315 CINV Hardware interrupt vector ($EA31)
|
||||
$0316-$0317 CBINV Break interrupt vector ($FE66)
|
||||
$0318-$0319 NMINV NMI interrupt vector ($FE47)
|
||||
$031A-$031B IOPEN OPEN vector ($F34A)
|
||||
$031C-$031D ICLOSE CLOSE vector ($F291)
|
||||
$031E-$031F ICHKIN Set - input vector ($F20E)
|
||||
$0320-$0321 ICKOUT Set - output vector ($F250)
|
||||
$0322-$0323 ICLRCH Restore I/0 vector ($F333)
|
||||
$0324-$0325 IBASIN INPUT vector ($F157)
|
||||
$0326-$0327 IBSOUT Output vector ($F1CA)
|
||||
$0328-$0329 ISTOP Test-STOP vector ($F6ED)
|
||||
$032A-$032B IGETIN GET vector ($F13E)
|
||||
$032C-$032D ICLALL Abort I/o vector ($F32F)
|
||||
$032E-$032F USRCMD Warm start vector ($FE66)
|
||||
$0330-$0331 ILOAD LOAD link ($F4A5)
|
||||
$0332-$0333 ISAVE SAVE link ($F5ED)
|
||||
$033C-$03FB TBUFFR Cassette buffer
|
||||
3382
c64mem/c64mem_mapc64.txt
Normal file
3382
c64mem/c64mem_mapc64.txt
Normal file
File diff suppressed because it is too large
Load diff
240
c64mem/c64mem_prg.txt
Normal file
240
c64mem/c64mem_prg.txt
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
- C64 RAM Map (Programmer's Reference Guide)
|
||||
-
|
||||
- Commodore 64 Programmer's Reference Guide
|
||||
- Indianapolis: Howard W. Sams & Co., Inc, 1982.
|
||||
- ISBN 0-672-22056-3
|
||||
-
|
||||
- C64PRG10.TXT, June 1996, etext #46
|
||||
- converted to etext by
|
||||
- Ville Muikkula
|
||||
- Jouko Valta
|
||||
-
|
||||
- Corrections (typos as well as content), translations etc.
|
||||
- welcome at: https://github.com/mist64/c64disasm
|
||||
-
|
||||
----------------------------------------------
|
||||
-
|
||||
# This plain text file is formatted so that it can be automatically
|
||||
# parsed in order to create cross-references etc.
|
||||
# * Lines starting with "-" is top-level information. The first line
|
||||
# is the title. Lines starting with "--" are separators.
|
||||
# * Lines starting with "#" are internal comments.
|
||||
# * Hex addresses start at column 0.
|
||||
# * Symbols start at column 13.
|
||||
# * The description starts at column 21.
|
||||
# * All lines of the description until the first blank line are
|
||||
# combined into the heading.
|
||||
# * A '.' character at the end of a heading line represents a hard
|
||||
# line break.
|
||||
# * The remaining text is in MarkDown format.
|
||||
# * All addresses are 4 digits and have a leading '$'.
|
||||
# The encoding is UTF-8.
|
||||
|
||||
$0000 D6510 6510 On-Chip Data-Direction Register
|
||||
$0001 R6510 6510 On-Chip 8-Bit Input/Output Register
|
||||
$0002 Unused
|
||||
$0003-$0004 ADRAY1 Jump Vector: Convert Floating-Integer
|
||||
$0005-$0006 ADRAY2 Jump Vector: Convert Integer--Floating
|
||||
$0007 CHARAC Search Character
|
||||
$0008 ENDCHR Flag: Scan for Quote at End of String
|
||||
$0009 TRMPOS Screen Column From Last TAB
|
||||
$000A VERCK Flag: 0 = Load, 1 = Verify
|
||||
$000B COUNT Input Buffer Pointer / No. of Subscripts
|
||||
$000C DIMFLG Flag: Default Array DiMension
|
||||
$000D VALTYP Data Type: $FF = String, $00 = Numeric
|
||||
$000E INTFLG Data Type: $80 = Integer, $00 = Floating
|
||||
$000F GARBFL Flag: DATA scan/LIST quote/Garbage Coll
|
||||
$0010 SUBFLG Flag: Subscript Ref / User Function Call
|
||||
$0011 INPFLG Flag: $00 = INPUT, $40 = GET, $98 = READ
|
||||
$0012 TANSGN Flag TAN sign / Comparison Result
|
||||
$0013 Flag: INPUT Prompt
|
||||
$0014-$0015 LINNUM Temp: Integer Value
|
||||
$0016 TEMPPT Pointer Temporary String
|
||||
$0017-$0018 LASTPT Last Temp String Address
|
||||
$0019-$0021 TEMPST Stack for Temporary Strings
|
||||
$0022-$0025 INDEX Utility Pointer Area
|
||||
$0022-$0023 INDEX1 First Utility Pointer.
|
||||
$0024-$0025 INDEX2 Second Utility Pointer.
|
||||
$0026-$002A RES Floating-Point Product of Multiply
|
||||
$002B-$002C TXTTAB Pointer: Start of BASIC Text
|
||||
$002D-$002E VARTAB Pointer: Start of BASIC Variables
|
||||
$002F-$0030 ARYTAB Pointer: Start of BASIC Arrays
|
||||
$0031-$0032 STREND Pointer End of BASIC Arrays (+1)
|
||||
$0033-$0034 FRETOP Pointer: Bottom of String Storage
|
||||
$0035-$0036 FRESPC Utility String Pointer
|
||||
$0037-$0038 MEMSIZ Pointer: Highest Address Used by BASIC
|
||||
$0039-$003A CURLIN Current BASIC Line Number
|
||||
$003B-$003C OLDLIN Previous BASIC Line Number
|
||||
$003D-$003E OLDTXT Pointer: BASIC Statement for CONT
|
||||
$003F-$0040 DATLIN Current DATA Line Number
|
||||
$0041-$0042 DATPTR Pointer: Current DATA Item Address
|
||||
$0043-$0044 INPPTR Vector: INPUT Routine
|
||||
$0045-$0046 VARNAM Current BASIC Variable Name
|
||||
$0047-$0048 VARPNT Pointer: Current BASIC Variable Data
|
||||
$0049-$004A FORPNT Pointer: Index Variable for FOR/NEXT
|
||||
$004B-$0060 Temp Pointer / Data Area
|
||||
$004B-$004C VARTXT Temporary storage for TXTPTR during
|
||||
READ, INPUT and GET.
|
||||
$004D OPMASK Mask used during FRMEVL.
|
||||
$004E-$0052 TEMPF3 Temporary storage for FLPT value.
|
||||
$0053 FOUR6 Length of String Variable during Garbage
|
||||
collection.
|
||||
$0054-$0056 JMPER Jump Vector used in Function Evaluation-
|
||||
JMP followed by Address ($4C,$LB,$MB).
|
||||
$0057-$005B TEMPF1 Temporary storage for FLPT value.
|
||||
$005C-$0060 TEMPF2 Temporary storage for FLPT value.
|
||||
$0061 FACEXP Floating-Point Accumulator #1: Exponent
|
||||
$0062-$0065 FACHO Floating Accum. #1: Mantissa
|
||||
$0066 FACSGN Floating Accum. #1: Sign
|
||||
$0067 SGNFLG Pointer: Series Evaluation Constant
|
||||
$0068 BITS Floating Accum. #1: Overflow Digit
|
||||
$0069 ARGEXP Floating-Point Accumulator #2: Exponent
|
||||
$006A-$006D Floating Accum. #2: Mantissa
|
||||
$006E ARGSGN Floating Accum. #2: Sign
|
||||
$006F ARISGN Sign Comparison Result: Accum. # 1 vs #2
|
||||
$0070 FACOV Floating Accum. #1. Low-Order (Rounding)
|
||||
$0071-$0072 FBUFPT Pointer: Cassette Buffer
|
||||
$0073-$008A CHRGET Subroutine: Get Next Byte of BASIC Text
|
||||
$0079 CHRGOT Entry to Get Same Byte of Text Again
|
||||
$007A-$007B TXTPTR Pointer: Current Byte of BASIC Text
|
||||
$008B-$008F RNDX Floating RND Function Seed Value
|
||||
$0090 STATUS Kernal I/O Status Word: ST
|
||||
$0091 STKEY Flag: STOP key / RVS key
|
||||
$0092 SVXT Timing Constant for Tape
|
||||
$0093 VERCK Flag: 0 = Load, 1 = Verify
|
||||
$0094 C3P0 Flag: Serial Bus-Output Char. Buffered
|
||||
$0095 BSOUR Buffered Character for Serial Bus
|
||||
$0096 SYNO Cassette Sync No.
|
||||
$0097 Temp Data Area
|
||||
$0098 LDTND No. of Open Files / Index to File Table
|
||||
$0099 DFLTN Default Input Device (0)
|
||||
$009A DFLTO Default Output (CMD) Device (3)
|
||||
$009B PRTY Tape Character Parity
|
||||
$009C DPSW Flag: Tape Byte-Received
|
||||
$009D MSGFLG Flag: $80 = Direct Mode, $00 = Program
|
||||
$009E PTR1 Tape Pass 1 Error Log
|
||||
$009F PTR2 Tape Pass 2 Error Log
|
||||
$00A0-$00A2 TIME Real-Time Jiffy Clock (approx) 1/60 Sec
|
||||
$00A3-$00A4 Temp Data Area
|
||||
$00A5 CNTDN Cassette Sync Countdown
|
||||
$00A6 BUFPT Pointer: Tape I/O Buffer
|
||||
$00A7 INBIT RS-232 Input Bits / Cassette Temp
|
||||
$00A8 BITCI RS-232 Input Bit Count / Cassette Temp
|
||||
$00A9 RINONE RS-232 Flag: Check for Start Bit
|
||||
$00AA RIDATA RS-232 Input Byte Buffer/Cassette Temp
|
||||
$00AB RIPRTY RS-232 Input Parity / Cassette Short Cnt
|
||||
$00AC-$00AD Pointer: Tape Buffer/ Screen Scrolling
|
||||
$00AE-$00AF Tape End Addresses/End of Program
|
||||
$00B0-$00B1 Tape Timing Constants
|
||||
$00B2-$00B3 TAPE1 Pointer: Start of Tape Buffer
|
||||
$00B4 BITTS RS-232 Out Bit Count / Cassette Temp
|
||||
$00B5 NXTBIT RS-232 Next Bit to Send/ Tape EOT Flag
|
||||
$00B6 RODATA RS-232 Out Byte Buffer
|
||||
$00B7 FNLEN Length of Current File Name
|
||||
$00B8 LA Current Logical File Number
|
||||
$00B9 SA Current Secondary Address
|
||||
$00BA FA Current Device Number
|
||||
$00BB-$00BC FNADR Pointer: Current File Name
|
||||
$00BD ROPRTY RS-232 Out Parity / Cassette Temp
|
||||
$00BE FSBLK Cassette Read / Write Block Count
|
||||
$00BF MYCH Serial Word Buffer
|
||||
$00C0 CAS1 Tape Motor Interlock
|
||||
$00C1-$00C2 STAL I/O Start Address
|
||||
$00C3-$00C4 MEMUSS Tape Load Temps
|
||||
$00C5 LSTX Current Key Pressed: CHR$(n) 0 = No Key
|
||||
$00C6 NDX No. of Chars. in Keyboard Buffer (Queue)
|
||||
$00C7 RVS Flag: Reverse Chars. - 1=Yes, 0=No Used
|
||||
$00C8 INDX Pointer: End of Logical Line for INPUT
|
||||
$00C9-$00CA Cursor X-Y Pos. at Start of INPUT
|
||||
$00CB SFDX Flag: Print Shifted Chars.
|
||||
$00CC BLNSW Cursor Blink enable: 0 = Flash Cursor
|
||||
$00CD BLNCT Timer: Countdown to Toggle Cursor
|
||||
$00CE GDBLN Character Under Cursor
|
||||
$00CF BLNON Flag: Last Cursor Blink On/Off
|
||||
$00D0 CRSW Flag: INPUT or GET from Keyboard
|
||||
$00D1-$00D2 PNT Pointer: Current Screen Line Address
|
||||
$00D3 PNTR Cursor Column on Current Line
|
||||
$00D4 QTSW Flag: Editor in Quote Mode, $00 = NO
|
||||
$00D5 LNMX Physical Screen Line Length
|
||||
$00D6 TBLX Current Cursor Physical Line Number
|
||||
$00D7 Temp Data Area
|
||||
$00D8 INSRT Flag: Insert Mode, >0 = # INSTs
|
||||
$00D9-$00F2 LDTB1 Screen Line Link Table / Editor Temps
|
||||
$00F3-$00F4 USER Pointer: Current Screen Color RAM loc.
|
||||
$00F5-$00F6 KEYTAB Vector Keyboard Decode Table
|
||||
$00F7-$00F8 RIBUF RS-232 Input Buffer Pointer
|
||||
$00F9-$00FA ROBUF RS-232 Output Buffer Pointer
|
||||
$00FB-$00FE FREKZP Free 0-Page Space for User Programs
|
||||
$00FF-$010A BASZPT Floating to String Work Area
|
||||
$0100-$01FF Micro-Processor System Stack Area
|
||||
$0100-$013E BAD Tape Input Error Log
|
||||
$0200-$0258 BUF System INPUT Buffer
|
||||
$0259-$0262 LAT KERNAL Table: Active Logical File No's.
|
||||
$0263-$026C FAT KERNAL Table: Device No. for Each File
|
||||
$026D-$0276 SAT KERNAL Table: Second Address Each File
|
||||
$0277-$0280 KEYD Keyboard Buffer Queue (FIFO)
|
||||
$0281-$0282 MEMSTR Pointer: Bottom of Memory for O.S.
|
||||
$0283-$0284 MEMSIZ Pointer: Top of Memory for O.S.
|
||||
$0285 TIMOUT Flag: Kernal Variable for IEEE Timeout
|
||||
$0286 COLOR Current Character Color Code
|
||||
$0287 GDCOL Background Color Under Cursor
|
||||
$0288 HIBASE Top of Screen Memory (Page)
|
||||
$0289 XMAX Size of Keyboard Buffer
|
||||
$028A RPTFLG Flag: REPEAT Key Used, $80 = Repeat
|
||||
$028B KOUNT Repeat Speed Counter
|
||||
$028C DELAY Repeat Delay Counter
|
||||
$028D SHFLAG Flag: Keyboard SHIFT Key/CTRL Key/C= Key
|
||||
$028E LSTSHF Last Keyboard Shift Pattern
|
||||
$028F-$0290 KEYLOG Vector: Keyboard Table Setup
|
||||
$0291 MODE Flag: $00=Disable SHIFT Keys, $80=Enable
|
||||
$0292 AUTODN Flag: Auto Scroll Down, 0 = ON
|
||||
$0293 M51CTR RS-232: 6551 Control Register Image
|
||||
$0294 M51CDR RS-232: 6551 Command Register Image
|
||||
$0295-$0296 M51AJB RS-232 Non-Standard BPS (Time/2-100) USA
|
||||
$0297 RSSTAT RS-232: 6551 Status Register Image
|
||||
$0298 BITNUM RS-232 Number of Bits Left to Send
|
||||
$0299-$029A BAUDOF RS-232 Baud Rate: Full Bit Time (us)
|
||||
$029B RIDBE RS-232 Index to End of Input Buffer
|
||||
$029C RIDBS RS-232 Start of Input Buffer (Page)
|
||||
$029D RODBS RS-232 Start of Output Buffer (Page)
|
||||
$029E RODBE RS-232 Index to End of Output Buffer
|
||||
$029F-$02A0 IRQTMP Holds IRQ Vector During Tape I/O
|
||||
$02A1 ENABL RS-232 Enables
|
||||
$02A2 TOD Sense During Cassette I/O
|
||||
$02A3 Temp Storage For Cassette Read
|
||||
$02A4 Temp D1 IRQ Indicator For Cassette Read
|
||||
$02A5 Temp For Line Index
|
||||
$02A6 PAL/NTSC Flag, 0= NTSC, 1 = PAL
|
||||
$02A7-$02FF Unused
|
||||
$0300-$0301 IERROR Vector: Print BASIC Error Message
|
||||
$0302-$0303 IMAIN Vector: BASIC Warm Start
|
||||
$0304-$0305 ICRNCH Vector: Tokenize BASIC Text
|
||||
$0306-$0307 IQPLOP Vector: BASIC Text LIST
|
||||
$0308-$0309 IGONE Vector: BASIC Char. Dispatch
|
||||
$030A-$030B IEVAL Vector: BASIC Token Evaluation
|
||||
$030C SAREG Storage for 6502 .A Register
|
||||
$030D SXREG Storage for 5502 .X Register
|
||||
$030E SYREG Storage for 6502 .Y Register
|
||||
$030F SPREG Storage for 6502 .SP Register
|
||||
$0310 USR Function Jump Instr (4C)
|
||||
$0311-$0312 USRADD USR Address Low Byte / High Byte
|
||||
$0313 Unused
|
||||
$0314-$0315 CINV Vector: Hardware Interrupt
|
||||
$0316-$0317 CBINV Vector: BRK Instr. Interrupt
|
||||
$0318-$0319 NMINV Vector: Non-Maskable Interrupt
|
||||
$031A-$031B IOPEN KERNAL OPEN Routine Vector
|
||||
$031C-$031D ICLOSE KERNAL CLOSE Routine Vector
|
||||
$031E-$031F ICHKIN KERNAL CHKIN Routine
|
||||
$0320-$0321 ICKOUT KERNAL CHKOUT Routine
|
||||
$0322-$0323 ICLRCH KERNAL CLRCHN Routine Vector
|
||||
$0324-$0325 IBASIN KERNAL CHRIN Routine
|
||||
$0326-$0327 IBSOUT KERNAL CHROUT Routine
|
||||
$0328-$0329 ISTOP KERNAL STOP Routine Vector
|
||||
$032A-$032B IGETIN KERNAL GETIN Routine
|
||||
$032C-$032D ICLALL KERNAL CLALL Routine Vector
|
||||
$032E-$032F USRCMD User-Defined Vector
|
||||
$0330-$0331 ILOAD KERNAL LOAD Routine
|
||||
$0332-$0333 ISAVE KERNAL SAVE Routine Vector
|
||||
$0334-$033B Unused
|
||||
$033C-$03FB TBUFFR Tape I/O Buffer
|
||||
$03FC-$03FF Unused
|
||||
668
c64mem/c64mem_src.txt
Normal file
668
c64mem/c64mem_src.txt
Normal file
|
|
@ -0,0 +1,668 @@
|
|||
- C64 RAM Map (Microsoft/Commodore)
|
||||
-
|
||||
- The labels and descriptions have been taken from
|
||||
- Microsoft's original BASIC for M6502 source
|
||||
- and
|
||||
- The original C64 KERNAL source by Commodore (901227-03)
|
||||
- https://github.com/mist64/cbmsrc
|
||||
-
|
||||
- Converted and formatted by Michael Steil <mist64@mac.com>
|
||||
-
|
||||
- Corrections (typos as well as content), translations etc.
|
||||
- welcome at: https://github.com/mist64/c64disasm
|
||||
-
|
||||
------------------------------------------------------------
|
||||
-
|
||||
# This plain text file is formatted so that it can be automatically
|
||||
# parsed in order to create cross-references etc.
|
||||
# * Lines starting with "-" is top-level information. The first line
|
||||
# is the title. Lines starting with "--" are separators.
|
||||
# * Lines starting with "#" are internal comments.
|
||||
# * Hex addresses start at column 0.
|
||||
# * Symbols start at column 13.
|
||||
# * The description starts at column 21.
|
||||
# * All lines of the description until the first blank line are
|
||||
# combined into the heading.
|
||||
# * A '.' character at the end of a heading line represents a hard
|
||||
# line break.
|
||||
# * The remaining text is in MarkDown format.
|
||||
# * All addresses are 4 digits and have a leading '$'.
|
||||
# The encoding is UTF-8.
|
||||
|
||||
#
|
||||
# KERNAL
|
||||
#
|
||||
|
||||
$0000 D6510 6510 data direction register
|
||||
$0001 R6510 6510 data register
|
||||
|
||||
#
|
||||
# BASIC
|
||||
#
|
||||
|
||||
$0003-$0004 ADRAY1 Store here the addr of the
|
||||
routine to turn the FAC into a
|
||||
two byte signed integer in [Y,A]
|
||||
|
||||
$0005-$0006 ADRAY2 Store here the addr of the
|
||||
routine to convert [Y,A] to a floating
|
||||
point number in the FAC.
|
||||
|
||||
$0007 CHARAC A delimiting character.
|
||||
|
||||
$0007 INTEGR A one-byte integer from "QINT".
|
||||
|
||||
$0008 ENDCHR The other delimiting character.
|
||||
|
||||
$0009 TRMPOS Position of terminal carriage.
|
||||
|
||||
$000B COUNT A general counter.
|
||||
|
||||
$000C DIMFLG
|
||||
|
||||
In getting a pointer to a variable
|
||||
it is important to remember whether it
|
||||
is being done for "dim" or not.
|
||||
|
||||
DIMFLG and VALTYP must be
|
||||
consecutive locations.
|
||||
|
||||
$000D VALTYP The type indicator.
|
||||
|
||||
0=numeric 1=string.
|
||||
|
||||
$000E INTFLG Tells if integer.
|
||||
|
||||
$000F GARBFL Whether to do garbage collection.
|
||||
|
||||
$000F DORES Whether can or can't crunch res'd words.
|
||||
|
||||
Turned on when "data"
|
||||
being scanned by crunch so unquoted
|
||||
strings won't be crunched.
|
||||
|
||||
$0010 SUBFLG Flag whether sub'd variable allowed.
|
||||
|
||||
"FOR" and user-defined function
|
||||
pointer fetching turn
|
||||
this on before calling "PTRGET"
|
||||
so arrays won't be detected.
|
||||
"STKINI" and "PTRGET" clear it.
|
||||
Also disallows integers there.
|
||||
|
||||
$0011 INPFLG Flags whether we are doing "INPUT"
|
||||
or "READ".
|
||||
|
||||
$0012 TANSGN Used in determining sign of tangent.
|
||||
|
||||
$0012 DOMASK Mask in use by relation operations.
|
||||
|
||||
$0013 CHANNL Holds channel number.
|
||||
|
||||
$0014-$0015 LINNUM Location to store line number before BUF
|
||||
so that "BLTUC" can store it all away at once.
|
||||
|
||||
A comma (preload or from ROM)
|
||||
used by input statement since the
|
||||
data pointer always starts on a
|
||||
comma or terminator.
|
||||
|
||||
$0014-$0015 POKER Set up location used by POKE.
|
||||
|
||||
Temporary for input and read code
|
||||
|
||||
$0016 TEMPPT Pointer at first free temp descriptor.
|
||||
|
||||
Initialized to point to TEMPST.
|
||||
|
||||
$0017-$0018 LASTPT Pointer to last-used string temporary.
|
||||
|
||||
$0019-$0021 TEMPST Storage for NUMTMP temp descriptors.
|
||||
|
||||
$0022-$0025 INDEX Indexes.
|
||||
|
||||
$0022-$0023 INDEX1
|
||||
|
||||
$0024-$0025 INDEX2
|
||||
|
||||
$0026 RESHO Result of multiplier and divider.
|
||||
|
||||
$0027 RESMOH One more byte.
|
||||
|
||||
$0028 RESMO
|
||||
|
||||
$0028 ADDEND Temporary used by "UMULT".
|
||||
|
||||
$0029 RESLO
|
||||
|
||||
$002B-$002C TXTTAB Pointer to beginning of text.
|
||||
|
||||
Doesn't change after being
|
||||
setup by "INIT".
|
||||
|
||||
$002D-$002E VARTAB Pointer to start of simple
|
||||
variable space.
|
||||
|
||||
Updated whenever the size of the
|
||||
program changes, set to [TXTTAB]
|
||||
by "SCRATCH" ("NEW").
|
||||
|
||||
$002F-$0030 ARYTAB Pointer to beginning of array
|
||||
table.
|
||||
|
||||
Incremented by 6 whenever
|
||||
a new simple variable is found, and
|
||||
set to [VARTAB] by "CLEARC".
|
||||
|
||||
$0031-$0032 STREND End of storage in use.
|
||||
|
||||
Increased whenever a new array
|
||||
or simple variable is encountered.
|
||||
set to [VARTAB] by "CLEARC".
|
||||
|
||||
$0033-$0034 FRETOP Top of string free space.
|
||||
|
||||
$0035-$0036 FRESPC Pointer to new string.
|
||||
|
||||
$0037-$0038 MEMSIZ Highest location in memory.
|
||||
|
||||
$0039-$003A CURLIN Current line #.
|
||||
|
||||
Set to 0,255 for direct statements.
|
||||
|
||||
$003B-$003C OLDLIN Old line number
|
||||
|
||||
Set up by ^C,"STOP"
|
||||
or "END" in a program.
|
||||
|
||||
$003D-$003E OLDTXT Old text pointer.
|
||||
|
||||
Points at statement to be exec'd next.
|
||||
|
||||
$003F-$0040 DATLIN Data line # -- remember for errors.
|
||||
|
||||
$0041-$0042 DATPTR Pointer to data.
|
||||
|
||||
Initialized to point
|
||||
at the zero in front of [TXTTAB]
|
||||
by "RESTORE" which is called by "CLEARC".
|
||||
updated by execution of a "READ".
|
||||
|
||||
$0043-$0044 INPPTR This remembers where input is coming from.
|
||||
|
||||
$0045-$0046 VARNAM Variable's name is stored here.
|
||||
|
||||
$0047-$0048 VARPNT Pointer to variable in memory.
|
||||
|
||||
$0047 FDECPT Pointer into power of tens of "FOUT".
|
||||
|
||||
$0049-$004A FORPNT A variable's pointer for "FOR" loops
|
||||
and "LET" statements.
|
||||
|
||||
$0049 LSTPNT Pntr to list string.
|
||||
|
||||
$0049 ANDMSK The mask used by WAIT for ANDing.
|
||||
|
||||
$004A EORMSK The mask for EORing in wait.
|
||||
|
||||
$004B-$004C OPPTR Pointer to current op's entry in "OPTAB".
|
||||
|
||||
$004B VARTXT Pointer into list of variables.
|
||||
|
||||
$004D OPMASK Mask created by current operator.
|
||||
|
||||
$004E-$0052 TEMPF3 A third FAC temporary (4 bytes).
|
||||
|
||||
$004E-$004F DEFPNT Pointer used in function definition.
|
||||
|
||||
$004E GRBPNT Another used in garbage collection.
|
||||
|
||||
$0050-$0052 DSCPNT Pointer to a string descriptor.
|
||||
|
||||
$0053 FOUR6 Variable constant used by garb collect.
|
||||
|
||||
$0054-$0056 JMPER
|
||||
|
||||
$0055 SIZE
|
||||
|
||||
$0056 OLDOV The old overflow.
|
||||
|
||||
$0057-$005B TEMPF1
|
||||
|
||||
$0058 HIGHDS Destination of highest element in BLT.
|
||||
|
||||
$005A HIGHTR Source of highest element to move.
|
||||
|
||||
$005C-$0060 TEMPF2
|
||||
|
||||
$005D LOWDS Location of last byte transferred into.
|
||||
|
||||
$005F LOWTR Last thing to move in BLT.
|
||||
|
||||
$0058 ARYPNT A pointer used in array building.
|
||||
|
||||
$005F GRBTOP A pointer used in garbage collection.
|
||||
|
||||
$005D DECCNT Number of places before decimal point.
|
||||
|
||||
$005E TENEXP Has a DPT been input?
|
||||
|
||||
$005F DPTFLG Base ten exponent.
|
||||
|
||||
$0060 EXPSGN Sign of base ten exponent.
|
||||
|
||||
$0061-$0066 FAC The floating accumulator
|
||||
|
||||
$0061 FACEXP
|
||||
|
||||
$0061 DSCTMP This is where temp descs are built.
|
||||
|
||||
$0062 FACHO Most significant byte of mantissa.
|
||||
|
||||
$0063 FACMOH One more.
|
||||
|
||||
$0064 FACMO Middle order of mantissa.
|
||||
|
||||
$0064 INDICE Indice is set up here by "QINT".
|
||||
|
||||
$0065 FACLO Least sig byte of mantissa.
|
||||
|
||||
$0066 FACSGN Sign of FAC (0 or -1) when unpacked.
|
||||
|
||||
$0067 SGNFLG Sign of FAC is preserved bere by "FIN".
|
||||
|
||||
$0067 DEGREE A count used by polynomials.
|
||||
|
||||
$0068 BITS Something for "SHIFTR" to use.
|
||||
|
||||
$0069-$006E The floating argument (unpacked)
|
||||
|
||||
$0069 ARGEXP
|
||||
|
||||
$006A ARGHO
|
||||
|
||||
$006B ARGMOH
|
||||
|
||||
$006C ARGMO
|
||||
|
||||
$006D ARGLO
|
||||
|
||||
$006E ARGSGN
|
||||
|
||||
$006F ARISGN A sign reflecting the result.
|
||||
|
||||
$006F-$0070 STRNG1 Pointer to a string or descriptor.
|
||||
|
||||
$0070 FACOV Overflow byte of the FAC.
|
||||
|
||||
$0071-$0072 FBUFPT Pointer into FBUFFR used by FOUT.
|
||||
|
||||
$0071-$0072 BUFPTR Pointer to buf used by "CRUNCH".
|
||||
|
||||
$0071-$0072 STRNG2 Pointer to string or desc.
|
||||
|
||||
$0071-$0072 POLYPT Pointer into polynomial coefficients.
|
||||
|
||||
$0071-$0072 CURTOL Absolute linear index is formed here.
|
||||
|
||||
$0073-$008A CHRGET RAM code.
|
||||
|
||||
This code gets changed throughout execution.
|
||||
It is made to be fast this way.
|
||||
Also, [X] and [Y] are not disturbed.
|
||||
|
||||
"CHRGET" using [TXTPTR] as the current text pntr,
|
||||
fetches a new character into ACCA after incrementing [TXTPTR]
|
||||
and sets condition codes according to what's in ACCA.
|
||||
|
||||
* not C = numeric ("0" thru "9")
|
||||
* Z = ":" or end-of-line (a null)
|
||||
|
||||
[ACCA] = new char.
|
||||
|
||||
[TXTPTR]=[TXTPTR]+1
|
||||
|
||||
The following exists in ROM if ROM exists and is loaded
|
||||
down here by init. Otherwise it is just loaded into this
|
||||
RAM like all the rest of RAM is loaded.
|
||||
|
||||
$008B-$008F RNDX
|
||||
|
||||
#
|
||||
# KERNAL
|
||||
#
|
||||
|
||||
$0090 STATUS I/O operation status byte
|
||||
|
||||
$0091 STKEY STOP key flag
|
||||
|
||||
$0092 SVXT Cassette: temp used to adjust software servo
|
||||
|
||||
$0093 VERCK Cassette: verify or load flag (Z - loading)
|
||||
|
||||
$0094 C3P0 IEEE buffered char flag
|
||||
|
||||
$0095 BSOUR Char buffer for IEEE
|
||||
|
||||
$0096 SYNO Cassette: flags if we have block SYNC (16 zero dipoles)
|
||||
|
||||
$0097 XSAV Temp for BASIN
|
||||
|
||||
$0098 LDTND Index to logical file
|
||||
|
||||
$0099 DFLTN Default input device #
|
||||
|
||||
$009A DFLTO Default output device #
|
||||
|
||||
$009B PRTY Cassette: holds current calculated parity bit
|
||||
|
||||
$009C DPSW Cassette: if NZ then expecting LL/L combination that ends a byte
|
||||
|
||||
$009D MSGFLG OS message flag
|
||||
|
||||
$009E PTR1 Cassette: count of read locations in error (pointer into bad, max 61)
|
||||
|
||||
$009E T1 Temporary 1
|
||||
|
||||
$009F PTR2 Cassette: count of re-read locations (pointer into bad, during re-read)
|
||||
|
||||
$009F T2 Temporary 2
|
||||
|
||||
$00A0-$00A2 TIME 24 hour clock in 1/60th seconds
|
||||
|
||||
$00A3 R2D2 Serial bus usage
|
||||
|
||||
$00A3 PCNTR Cassette: counts down from 8-0 for data then to ff for parity
|
||||
|
||||
$00A4 BSOUR1 Temp used by serial routine
|
||||
|
||||
$00A4 FIRT Cassette: used to indicate which half of dipole we're in
|
||||
|
||||
$00A5 COUNT Temp used by serial routine
|
||||
|
||||
$00A5 CNTDN Cassette sync countdown
|
||||
|
||||
$00A6 BUFPT Cassette buffer pointer
|
||||
|
||||
$00A7 INBIT RS-232 rcvr input bit storage
|
||||
|
||||
$00A7 SHCNL Cassette: holds FSBLK, used to direct routines, because of exit case
|
||||
|
||||
$00A8 BITCI RS-232 rcvr bit count in
|
||||
|
||||
$00A8 RER Cassette: flags errors (if Z then no error)
|
||||
|
||||
$00A9 RINONE RS-232 rcvr flag for start bit check
|
||||
|
||||
$00A9 REZ Cassette: counts zeros (if Z then correct # of dipoles)
|
||||
|
||||
$00AA RIDATA RS-232 rcvr byte buffer
|
||||
|
||||
$00AA RDFLG Cassette: holds function mode
|
||||
|
||||
MI - waiting for block SYNC
|
||||
VS - in data block reading data
|
||||
NE - waiting for byte SYNC
|
||||
|
||||
$00AB RIPRTY RS-232 rcvr parity storage
|
||||
|
||||
$00AB SHCNH Cassette: short cnt; left over from debugging
|
||||
|
||||
$00AC SAL Cassette: indirect to data storage area
|
||||
|
||||
$00AD SAH
|
||||
|
||||
$00AE EAL
|
||||
|
||||
$00AF EAH
|
||||
|
||||
$00B0 CMP0 Cassette: software servo (+/- adjust to time calcs)
|
||||
|
||||
$00B1 TEMP Cassette: used to hold dipole time during type calculations
|
||||
|
||||
$00B2-$00B3 TAPE1 Address of tape buffer #1y.
|
||||
|
||||
$00B4 BITTS RS-232 trns bit count
|
||||
|
||||
$00B4 SNSW1 Cassette: flags if we have byte SYNC (a longlong)
|
||||
|
||||
$00B5 NXTBIT RS-232 trns next bit to be sent
|
||||
|
||||
$00B5 DIFF Cassette: used to preserve SYNO (outside of bit routines)
|
||||
|
||||
$00B6 RODATA RS-232 trns byte buffer
|
||||
|
||||
$00B6 PRP Cassette: has combined error values from bit routines
|
||||
|
||||
$00B7 FNLEN Length current file n str
|
||||
|
||||
$00B8 LA Current file logical addr
|
||||
|
||||
$00B9 SA Current file 2nd addr
|
||||
|
||||
$00BA FA Current file primary addr
|
||||
|
||||
$00BB-$00BC FNADR Addr current file name str
|
||||
|
||||
$00BD ROPRTY RS-232 trns parity buffer
|
||||
|
||||
$00BD OCHAR
|
||||
|
||||
$00BE FSBLK Cassette: indicate which block we're looking at (0 to exit)
|
||||
|
||||
$00BF MYCH Cassette: holds input byte being built
|
||||
|
||||
$00C0 CAS1 Cassette manual/controlled switch
|
||||
|
||||
$00C1 TMP0
|
||||
|
||||
$00C1 STAL
|
||||
|
||||
$00C2 STAH
|
||||
|
||||
$00C3-$00C4 MEMUSS Cassette load temps (2 bytes)
|
||||
|
||||
$00C3-$00C4 TMP2
|
||||
|
||||
$00C5 LSTX Key scan index
|
||||
|
||||
$00C6 NDX Index to keyboard q
|
||||
|
||||
$00C7 RVS RVS field on flag
|
||||
|
||||
$00C8 INDX
|
||||
|
||||
$00C9 LSXP X pos at start
|
||||
|
||||
$00CA LSTP
|
||||
|
||||
$00CB SFDX SHIFT mode on print
|
||||
|
||||
$00CC BLNSW Cursor blink enab
|
||||
|
||||
$00CD BLNCT Count to toggle cur
|
||||
|
||||
$00CE GDBLN Char before cursor
|
||||
|
||||
$00CF BLNON On/off blink flag
|
||||
|
||||
$00D0 CRSW INPUT vs GET flag
|
||||
|
||||
$00D1-$00D2 PNT Pointer to row
|
||||
|
||||
$00D3 PNTR Pointer to column
|
||||
|
||||
$00D4 QTSW Quote switch
|
||||
|
||||
$00D5 LNMX 40/80 max positon
|
||||
|
||||
$00D6 TBLX
|
||||
|
||||
$00D7 DATA Cassette: holds most recent dipole bit value
|
||||
|
||||
$00D8 INSRT Insert mode flag
|
||||
|
||||
$00D9-$00F2 LDTB1 Line flags+endspace
|
||||
|
||||
$00F3-$00F4 USER Screen editor color IP
|
||||
|
||||
$00F5-$00F6 KEYTAB Keyscan table indirect
|
||||
|
||||
$00F7-$00F8 RIBUF RS-232 input buffer pointer
|
||||
|
||||
$00F9-$00FA ROBUF RS-232 output buffer pointer
|
||||
|
||||
$00FB-$00FE FREKZP Free KERNAL zero page 9/24/80
|
||||
|
||||
$00FF-$010A BASZPT Location ($00FF) used by BASIC
|
||||
|
||||
$0100-$013E BAD Cassette: storage space for bad read locations (bottom of stack)
|
||||
|
||||
#
|
||||
# BASIC
|
||||
#
|
||||
|
||||
$0200-$0258 BUF BASIC/MONITOR buffer
|
||||
|
||||
Type-in stored here.
|
||||
Direct statements execute out of
|
||||
here. Remember "INPUT" smashes buf.
|
||||
Must be on page zero
|
||||
or assignment of string
|
||||
values in direct statements won't copy
|
||||
into string space -- which it must.
|
||||
N.B.: Two nonzero bytes must precede "BUFLNM".
|
||||
|
||||
#
|
||||
# KERNAL
|
||||
#
|
||||
|
||||
$0259-$0262 LAT Logical file numbers
|
||||
|
||||
$0263-$026C FAT Primary device numbers
|
||||
|
||||
$026D-$0276 SAT Secondary addresses
|
||||
|
||||
$0277-$0280 KEYD IRQ keyboard buffer
|
||||
|
||||
$0281-$0282 MEMSTR Start of memory
|
||||
|
||||
$0283-$0284 MEMSIZ Top of memory
|
||||
|
||||
$0285 TIMOUT IEEE timeout flag
|
||||
|
||||
$0286 COLOR Active color nybble
|
||||
|
||||
$0287 GDCOL Original color before cursor
|
||||
|
||||
$0288 HIBASE Base location of screen (top)
|
||||
|
||||
$0289 XMAX
|
||||
|
||||
$028A RPTFLG Key repeat flag
|
||||
|
||||
$028B KOUNT
|
||||
|
||||
$028C DELAY
|
||||
|
||||
$028D SHFLAG SHIFT flag byte
|
||||
|
||||
$028E LSTSHF Last SHIFT pattern
|
||||
|
||||
$028F-$0290 KEYLOG Indirect for keyboard table setup
|
||||
|
||||
$0291 MODE 0-PET mode, 1-cattacanna
|
||||
|
||||
$0292 AUTODN Auto scroll down flag(=0 on,<>0 off)
|
||||
|
||||
$0293 M51CTR 6551 control register
|
||||
|
||||
$0294 M51CDR 6551 command register
|
||||
|
||||
$0295-$0296 M51AJB Non standard (bittime/2-100)
|
||||
|
||||
$0297 RSSTAT RS-232 status register
|
||||
|
||||
$0298 BITNUM Number of bits to send (fast response)
|
||||
|
||||
$0299-$029A BAUDOF Baud rate full bit time (created by open)
|
||||
|
||||
$029B RIDBE Input buffer index to end
|
||||
|
||||
$029C RIDBS Input buffer pointer to start
|
||||
|
||||
$029D RODBS Output buffer index to start
|
||||
|
||||
$029E RODBE Output buffer index to end
|
||||
|
||||
$029F-$02A0 IRQTMP Holds irq during tape ops
|
||||
|
||||
$02A1 ENABL RS-232 enables (replaces ier)
|
||||
|
||||
$02A2 CASTON TOD sense during cassettes
|
||||
|
||||
$02A3 KIKA26 Cassette: holds old D1ICR after clear on read
|
||||
|
||||
$02A4 STUPID Cassette: hold indicator (NZ - no T1IRQ yet) for T1IRQ
|
||||
|
||||
$02A5 LINTMP Temporary for line index
|
||||
|
||||
$02A6 PALNTS PAL vs NTSC flag 0=NTSC 1=PAL
|
||||
|
||||
#
|
||||
# BASIC
|
||||
#
|
||||
|
||||
$0300-$0301 IERROR indirect ERROR (output error in .X)
|
||||
$0302-$0303 IMAIN indirect MAIN (system direct loop)
|
||||
$0304-$0305 ICRNCH indirect CRUNCH (tokenization routine)
|
||||
$0306-$0307 IQPLOP indirect LIST (char list)
|
||||
$0308-$0309 IGONE indirect GONE (char dispatch)
|
||||
$030A-$030B IEVAL indirect EVAL (symbol evaluation)
|
||||
$030C SAREG .A reg
|
||||
$030D SXREG .X reg
|
||||
$030E SYREG .Y reg
|
||||
$030F SPREG .P reg
|
||||
$0310-$0312 USRPOK user function dispatch
|
||||
|
||||
#
|
||||
# KERNAL
|
||||
#
|
||||
|
||||
$0314-$0315 CINV IRQ RAM vector
|
||||
|
||||
$0316-$0317 CBINV BRK instr RAM vector
|
||||
|
||||
$0318-$0319 NMINV NMI RAM vector
|
||||
|
||||
$031A-$032D Indirects for code
|
||||
|
||||
Conforms to KERNAL spec 8/19/80
|
||||
|
||||
$031A-$031B IOPEN
|
||||
|
||||
$031C-$031D ICLOSE
|
||||
|
||||
$031E-$031F ICHKIN
|
||||
|
||||
$0320-$0321 ICKOUT
|
||||
|
||||
$0322-$0323 ICLRCH
|
||||
|
||||
$0324-$0325 IBASIN
|
||||
|
||||
$0326-$0327 IBSOUT
|
||||
|
||||
$0328-$0329 ISTOP
|
||||
|
||||
$032A-$032B IGETIN
|
||||
|
||||
$032C-$032D ICLALL
|
||||
|
||||
$032E-$032F USRCMD
|
||||
|
||||
$0330-$0331 ILOAD
|
||||
|
||||
$0332-$0333 ISAVE savesp
|
||||
|
||||
$033C-$03FB TBUFFR cassette data b
|
||||
894
c64mem/c64mem_sta.txt
Normal file
894
c64mem/c64mem_sta.txt
Normal file
|
|
@ -0,0 +1,894 @@
|
|||
- C64 RAM Map (STA)
|
||||
-
|
||||
- Joe Forster/STA:
|
||||
- Commodore 64 memory map
|
||||
- http://sta.c64.org/cbm64mem.html
|
||||
-
|
||||
- edited by awsm.de // @awsm9000
|
||||
- http://www.awsm.de/mem64/
|
||||
-
|
||||
- Corrections (typos as well as content), translations etc.
|
||||
- welcome at: https://github.com/mist64/c64disasm
|
||||
-
|
||||
------------------------------------------------------------
|
||||
-
|
||||
# This plain text file is formatted so that it can be automatically
|
||||
# parsed in order to create cross-references etc.
|
||||
# * Lines starting with "-" is top-level information. The first line
|
||||
# is the title. Lines starting with "--" are separators.
|
||||
# * Lines starting with "#" are internal comments.
|
||||
# * Hex addresses start at column 0.
|
||||
# * Symbols start at column 13.
|
||||
# * The description starts at column 21.
|
||||
# * All lines of the description until the first blank line are
|
||||
# combined into the heading.
|
||||
# * A '.' character at the end of a heading line represents a hard
|
||||
# line break.
|
||||
# * The remaining text is in MarkDown format.
|
||||
# * All addresses are 4 digits and have a leading '$'.
|
||||
# The encoding is UTF-8.
|
||||
|
||||
$0000 D6510 Processor port data direction register
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #x: 0 = Bit #x in processor port can only be read; 1 = Bit #x in processor port can be read and written.
|
||||
|
||||
Default: $2F, %00101111.
|
||||
|
||||
$0001 R6510 Processor port
|
||||
|
||||
Bits:
|
||||
|
||||
* Bits #0-#2: Configuration for memory areas $A000-$BFFF, $D000-$DFFF and $E000-$FFFF. Values:
|
||||
* %x00: RAM visible in all three areas.
|
||||
* %x01: RAM visible at $A000-$BFFF and $E000-$FFFF.
|
||||
* %x10: RAM visible at $A000-$BFFF; KERNAL ROM visible at $E000-$FFFF.
|
||||
* %x11: BASIC ROM visible at $A000-$BFFF; KERNAL ROM visible at $E000-$FFFF.
|
||||
* %0xx: Character ROM visible at $D000-$DFFF. (Except for the value %000, see above.)
|
||||
* %1xx: I/O area visible at $D000-$DFFF. (Except for the value %100, see above.)
|
||||
* Bit #3: Datasette output signal level.
|
||||
* Bit #4: Datasette button status; 0 = One or more of PLAY, RECORD, F.FWD or REW pressed; 1 = No button is pressed.
|
||||
* Bit #5: Datasette motor control; 0 = On; 1 = Off.
|
||||
|
||||
Default: $37, %00110111.
|
||||
|
||||
$0002 Unused
|
||||
|
||||
$0003-$0004 ADRAY1 Unused.
|
||||
|
||||
Default: $B1AA, execution address of routine converting floating point to integer.
|
||||
|
||||
$0005-$0006 ADRAY2 Unused.
|
||||
|
||||
Default: $B391, execution address of routine converting integer to floating point.
|
||||
|
||||
$0007 CHARAC Byte being searched for during various operations.
|
||||
Current digit of number being input.
|
||||
|
||||
$0007 INTEGR Low byte of first integer operand during AND and OR.
|
||||
Low byte of integer-format FAC during INT().
|
||||
|
||||
$0008 ENDCHR Byte being search for during various operations.
|
||||
Current byte of BASIC line during tokenization.
|
||||
High byte of first integer operand during AND and OR.
|
||||
|
||||
$0009 TRMPOS Current column number during SPC() and TAB().
|
||||
|
||||
$000A VERCK LOAD/VERIFY switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: LOAD.
|
||||
* $01-$FF: VERIFY.
|
||||
|
||||
$000B COUNT Current token during tokenization.
|
||||
Length of BASIC line during insertion of line.
|
||||
AND/OR switch; $00 = AND; $FF = OR.
|
||||
Number of dimensions during array operations.
|
||||
|
||||
$000C DIMFLG Switch for array operations
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Operation was not called by DIM.
|
||||
* $40-$7F: Operation was called by DIM.
|
||||
|
||||
$000D VALTYP Current expression type
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Numerical.
|
||||
* $FF: String.
|
||||
|
||||
$000E INTFLG Current numerical expression type
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 0 = Floating point; 1 = Integer.
|
||||
|
||||
$000F GARBFL Garbage collection indicator during memory allocation for string variable; $00-$7F = There was no garbage collection yet; $80 = Garbage collection already took place.
|
||||
|
||||
$000F DORES Quotation mode switch during tokenization; Bit #6: 0 = Normal mode; 1 = Quotation mode.
|
||||
Quotation mode switch during LIST; $01 = Normal mode; $FE = Quotation mode.
|
||||
|
||||
$0010 SUBFLG Switch during fetch of variable name
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Integer variables are accepted.
|
||||
* $01-$FF: Integer variables are not accepted.
|
||||
|
||||
$0011 INPFLG GET/INPUT/READ switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: INPUT.
|
||||
* $40: GET.
|
||||
* $98: READ.
|
||||
|
||||
$0012 TANSGN Sign during SIN() and TAN()
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Positive.
|
||||
* $FF: Negative.
|
||||
|
||||
$0013 CHANNL Current I/O device number.
|
||||
|
||||
Default: $00, keyboard for input and screen for output.
|
||||
|
||||
$0014-$0015 LINNUM Line number during GOSUB, GOTO and RUN.
|
||||
Second line number during LIST.
|
||||
|
||||
$0014-$0015 POKER Memory address during PEEK, POKE, SYS and WAIT.
|
||||
|
||||
$0016 TEMPPT Pointer to next expression in string stack
|
||||
|
||||
Values: $19; $1C; $1F; $22.
|
||||
|
||||
Default: $19.
|
||||
|
||||
$0017-$0018 LASTPT Pointer to previous expression in string stack.
|
||||
|
||||
$0019-$0021 TEMPST String stack, temporary area for processing string expressions (9 bytes, 3 entries).
|
||||
|
||||
$0022-$0025 INDEX Temporary area for various operations (4 bytes).
|
||||
|
||||
$0026-$002A RES Auxiliary arithmetical register for division and multiplication (4 bytes).
|
||||
|
||||
$002B-$002C TXTTAB Pointer to beginning of BASIC area.
|
||||
|
||||
Default: $0801, 2049.
|
||||
|
||||
$002D-$002E VARTAB Pointer to beginning of variable area.
|
||||
|
||||
(End of program plus 1.)
|
||||
|
||||
$002F-$0030 ARYTAB Pointer to beginning of array variable area.
|
||||
|
||||
$0031-$0032 STREND Pointer to end of array variable area.
|
||||
|
||||
$0033-$0034 FRETOP Pointer to beginning of string variable area.
|
||||
|
||||
(Grows downwards from end of BASIC area.)
|
||||
|
||||
$0035-$0036 FRESPC Pointer to memory allocated for current string variable.
|
||||
|
||||
$0037-$0038 MEMSIZ Pointer to end of BASIC area.
|
||||
|
||||
Default: $A000, 40960.
|
||||
|
||||
$0039-$003A CURLIN Current BASIC line number
|
||||
|
||||
Values:
|
||||
|
||||
* $0000-$F9FF, 0-63999: Line number.
|
||||
* $FF00-$FFFF: Direct mode, no BASIC program is being executed.
|
||||
|
||||
$003B-$003C OLDLIN Current BASIC line number for CONT.
|
||||
|
||||
$003D-$003E OLDTXT Pointer to next BASIC instruction for CONT
|
||||
|
||||
Values:
|
||||
|
||||
* $0000-$00FF: CONT'ing is not possible.
|
||||
* $0100-$FFFF: Pointer to next BASIC instruction.
|
||||
|
||||
$003F-$0040 DATLIN BASIC line number of current DATA item for READ.
|
||||
|
||||
$0041-$0042 DATPTR Pointer to next DATA item for READ.
|
||||
|
||||
$0043-$0044 INPPTR Pointer to input result during GET, INPUT and READ.
|
||||
|
||||
$0045-$0046 VARNAM Name and type of current variable
|
||||
|
||||
Bits:
|
||||
|
||||
* $0045 bits #0-#6: First character of variable name.
|
||||
* $0046 bits #0-#6: Second character of variable name; $00 = Variable name consists of only one character.
|
||||
* $0045 bit #7 and $0046 bit #7:
|
||||
* %00: Floating-point variable.
|
||||
* %01: String variable.
|
||||
* %10: FN function, created with DEF FN.
|
||||
* %11: Integer variable.
|
||||
|
||||
$0047-$0048 VARPNT Pointer to value of current variable or FN function.
|
||||
|
||||
$0049-$004A FORPNT Pointer to value of current variable during LET.
|
||||
|
||||
$0049 ANDMSK Value of second parameter during WAIT.
|
||||
Logical number during CLOSE and CLOSE
|
||||
Device number of LOAD, SAVE and VERIFY.
|
||||
|
||||
$004A EORMSK Value of third parameter during WAIT.
|
||||
Device number during OPEN.
|
||||
|
||||
$004B-$004C VARTXT Temporary area for saving original pointer to current BASIC instruction during GET, INPUT and READ.
|
||||
|
||||
$004D OPMASK Comparison operator indicator
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #1: 1 = ">" (greater than) is present in expression.
|
||||
* Bit #2: 1 = "=" (equal to) is present in expression.
|
||||
* Bit #3: 1 = "<" (less than) is present in expression.
|
||||
|
||||
$004E-$004F Pointer to current FN function.
|
||||
|
||||
$0050-$0052 DSCPNT Pointer to current string variable during memory allocation.
|
||||
|
||||
$0053 FOUR6 Step size of garbage collection
|
||||
|
||||
Values: $03; $07.
|
||||
|
||||
$0054-$0056 JMPER JMP ABS machine instruction, jump to current BASIC function.
|
||||
|
||||
$0055-$0056 Execution address of current BASIC function.
|
||||
|
||||
$0057-$005B TEMPF1 Arithmetic register #3 (5 bytes).
|
||||
|
||||
$005C-$0060 TEMPF2 Arithmetic register #4 (5 bytes).
|
||||
|
||||
$0061-$0066 FAC FAC, arithmetic register #1 (5 bytes).
|
||||
|
||||
$0066 FACSGN Sign of FAC
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 0 = Positive; 1 = Negative.
|
||||
|
||||
$0067 SGNFLG Number of degrees during polynomial evaluation.
|
||||
|
||||
$0068 BITS Temporary area for various operations.
|
||||
|
||||
$0069-$006E ARG, arithmetic register #2 (5 bytes).
|
||||
|
||||
$006E ARGSGN Sign of ARG
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 0 = Positive; 1 = Negative.
|
||||
|
||||
$006F-$0070 STRNG1 Pointer to first string expression during string comparison.
|
||||
|
||||
$0071-$0072 STRNG2 Temporary area for saving original pointer to current BASIC instruction during VAL().
|
||||
|
||||
$0071-$0072 POLYPT Pointer to current item of polynomial table during polynomial evaluation.
|
||||
|
||||
$0071-$0072 CURTOL Auxiliary pointer during array operations.
|
||||
|
||||
$0073-$008A CHRGET CHRGET. Machine code routine to read next byte from BASIC program or direct command (24 bytes).
|
||||
|
||||
$0079 CHRGOT CHRGOT. Read current byte from BASIC program or direct command.
|
||||
|
||||
007A-$007B Pointer to current byte in BASIC program or direct command.
|
||||
|
||||
$008B-$008F RNDX Previous result of RND().
|
||||
|
||||
$0090 STATUS Value of ST variable, device status for serial bus and datasette input/output
|
||||
|
||||
Serial bus bits:
|
||||
|
||||
* Bit #0: Transfer direction during which the timeout occured; 0 = Input; 1 = Output.
|
||||
* Bit #1: 1 = Timeout occurred.
|
||||
* Bit #4: 1 = VERIFY error occurred (only during VERIFY), the file read from the device did not match that in the memory.
|
||||
* Bit #6: 1 = End of file has been reached.
|
||||
* Bit #7: 1 = Device is not present.
|
||||
|
||||
Datasette bits:
|
||||
|
||||
* Bit #2: 1 = Block is too short (shorter than 192 bytes).
|
||||
* Bit #3: 1 = Block is too long (longer than 192 bytes).
|
||||
* Bit #4: 1 = Not all bytes read with error during pass 1 could be corrected during pass 2, or a VERIFY error occurred, the file read from the device did not match that in the memory.
|
||||
* Bit #5: 1 = Checksum error occurred.
|
||||
* Bit #6: 1 = End of file has been reached (only during reading data files).
|
||||
|
||||
$0091 STKEY Stop key indicator
|
||||
|
||||
Values:
|
||||
|
||||
* $7F: Stop key is pressed.
|
||||
* $FF: Stop key is not pressed.
|
||||
|
||||
$0092 SVXT Unknown. (Timing constant during datasette input.)
|
||||
|
||||
$0093 VERCK LOAD/VERIFY switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: LOAD.
|
||||
* $01-$FF: VERIFY.
|
||||
|
||||
$0094 C3P0 Serial bus output cache status
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 1 = Output cache dirty, must transfer cache contents upon next output to serial bus.
|
||||
|
||||
$0095 BSOUR Serial bus output cache, previous byte to be sent to serial bus.
|
||||
|
||||
$0096 SYNO Unknown. (End of tape indicator during datasette input/output.)
|
||||
|
||||
$0097 XSAV Temporary area for saving original value of Y register during input from RS232.
|
||||
Temporary area for saving original value of X register during input from datasette.
|
||||
|
||||
$0098 LDTND Number of files currently open
|
||||
|
||||
Values: $00-$0A, 0-10.
|
||||
|
||||
$0099 DFLTN Current input device number.
|
||||
|
||||
Default: $00, keyboard.
|
||||
|
||||
$009A DFLTO Current output device number.
|
||||
|
||||
Default: $03, screen.
|
||||
|
||||
$009B PRTY Unknown. (Parity bit during datasette input/output.)
|
||||
|
||||
$009C DPSW Unknown. (Byte ready indicator during datasette input/output.)
|
||||
|
||||
$009D MSGFLG System error display switch
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #6: 0 = Suppress I/O error messages; 1 = Display them.
|
||||
* Bit #7: 0 = Suppress system messages; 1 = Display them.
|
||||
|
||||
$009E PTR1 Error counter during LOAD from datasette.
|
||||
|
||||
Values: $00-$3E, 0-62.
|
||||
|
||||
$009E T1 Block header type during datasette input/output.
|
||||
Length of file name during datasette input/output.
|
||||
Byte to be put into output buffer during RS232 and datasette output.
|
||||
|
||||
$009F PTR2 Error correction counter during LOAD from datasette.
|
||||
|
||||
Values: $00-$3E, 0-62.
|
||||
|
||||
$009F T2 Auxiliary counter for writing file name into datasette buffer.
|
||||
Auxiliary counter for comparing requested file name with file name read from datasette during datasette input.
|
||||
|
||||
$00A0-$00A2 TIME Value of TI variable, time of day, increased by 1 every 1/60 second (on PAL machines)
|
||||
|
||||
Values: $000000-$4F19FF, 0-518399 (on PAL machines).
|
||||
|
||||
$00A3 R2D2 EOI switch during serial bus output
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 0 = Send byte right after handshake; 1 = Do EOI delay first.
|
||||
|
||||
Bit counter during datasette output.
|
||||
|
||||
$00A4 FIRT Byte buffer during serial bus input.
|
||||
Parity during datasette input/output.
|
||||
|
||||
$00A5 CNTDN Bit counter during serial bus input/output.
|
||||
Counter for sync mark during datasette output.
|
||||
|
||||
$00A6 BUFPT Offset of current byte in datasette buffer.
|
||||
|
||||
$00A7 INBIT Bit buffer during RS232 input.
|
||||
|
||||
$00A8 BITCI Bit counter during RS232 input.
|
||||
|
||||
$00A9 RINONE Stop bit switch during RS232 input
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Data bit.
|
||||
* $01-$FF: Stop bit.
|
||||
|
||||
$00AA RIDATA Byte buffer during RS232 input.
|
||||
|
||||
$00AB RIPRTY Parity during RS232 input.
|
||||
Computed block checksum during datasette input.
|
||||
|
||||
$00AC-$00AD Start address for SAVE to serial bus.
|
||||
Pointer to current byte during SAVE to serial bus or datasette.
|
||||
Pointer to line in screen memory to be scrolled during scrolling the screen.
|
||||
|
||||
$00AE-$00AF Load address read from input file and pointer to current byte during LOAD/VERIFY from serial bus.
|
||||
End address after LOAD/VERIFY from serial bus or datasette.
|
||||
End address for SAVE to serial bus or datasette.
|
||||
Pointer to line in Color RAM to be scrolled during scrolling the screen.
|
||||
|
||||
$00B0-$00B1 Unknown.
|
||||
|
||||
$00B2-$00B3 TAPE1 Pointer to datasette buffer.
|
||||
|
||||
Default: $033C, 828.
|
||||
|
||||
$00B4 BITTS Bit counter and stop bit switch during RS232 output
|
||||
|
||||
Bits:
|
||||
|
||||
* Bits #0-#6: Bit count.
|
||||
* Bit #7: 0 = Data bit; 1 = Stop bit.
|
||||
|
||||
Bit counter during datasette input/output.
|
||||
|
||||
$00B5 NXTBIT Bit buffer (in bit #2) during RS232 output.
|
||||
|
||||
$00B6 RODATA Byte buffer during RS232 output.
|
||||
|
||||
$00B7 FNLEN Length of file name or disk command; first parameter of LOAD, SAVE and VERIFY or fourth parameter of OPEN
|
||||
|
||||
Values:
|
||||
|
||||
* $00: No parameter.
|
||||
* $01-$FF: Parameter length.
|
||||
|
||||
$00B8 LA Logical number of current file.
|
||||
|
||||
$00B9 SA Secondary address of current file.
|
||||
|
||||
$00BA FA Device number of current file.
|
||||
|
||||
$00BB-$00BC FNADR Pointer to current file name or disk command; first parameter of LOAD, SAVE and VERIFY or fourth parameter of OPEN.
|
||||
|
||||
$00BD ROPRTY Parity during RS232 output.
|
||||
Byte buffer during datasette input/output.
|
||||
|
||||
$00BE FSBLK Block counter during datasette input/output.
|
||||
|
||||
$00BF MYCH Unknown.
|
||||
|
||||
$00C0 CAS1 Datasette motor switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: No button was pressed, motor has been switched off. If a button is pressed on the datasette, must switch motor on.
|
||||
* $01-$FF: Motor is on.
|
||||
|
||||
$00C1-$00C2 STAL Start address during SAVE to serial bus, LOAD and VERIFY from datasette and SAVE to datasette.
|
||||
Pointer to current byte during memory test.
|
||||
|
||||
$00C3-$00C4 MEMUSS Start address for a secondary address of 0 for LOAD and VERIFY from serial bus or datasette.
|
||||
Pointer to ROM table of default vectors during initialization of I/O vectors.
|
||||
|
||||
$00C5 LSTX Matrix code of key previously pressed
|
||||
|
||||
Values:
|
||||
|
||||
* $00-$3F: Keyboard matrix code.
|
||||
* $40: No key was pressed at the time of previous check.
|
||||
|
||||
$00C6 NDX Length of keyboard buffer
|
||||
|
||||
Values:
|
||||
|
||||
* $00, 0: Buffer is empty.
|
||||
* $01-$0A, 1-10: Buffer length.
|
||||
|
||||
$00C7 RVS Reverse mode switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Normal mode.
|
||||
* $12: Reverse mode.
|
||||
|
||||
$00C8 INDX Length of line minus 1 during screen input. Values: $27, 39; $4F, 79.
|
||||
|
||||
$00C9 LSXP Cursor row during screen input. Values: $00-$18, 0-24.
|
||||
|
||||
$00CA Cursor column during screen input. Values: $00-$27, 0-39.
|
||||
|
||||
|
||||
$00CB SFDX Matrix code of key currently being pressed
|
||||
|
||||
Values:
|
||||
|
||||
* $00-$3F: Keyboard matrix code.
|
||||
* $40: No key is currently pressed.
|
||||
|
||||
$00CC BLNSW Cursor visibility switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Cursor is on.
|
||||
* $01-$FF: Cursor is off.
|
||||
|
||||
$00CD BLNCT Delay counter for changing cursor phase
|
||||
|
||||
Values:
|
||||
|
||||
* $00, 0: Must change cursor phase.
|
||||
* $01-$14, 1-20: Delay.
|
||||
|
||||
$00CE GDBLN Screen code of character under cursor.
|
||||
|
||||
$00CF BLNON Cursor phase switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Cursor off phase, original character visible.
|
||||
* $01: Cursor on phase, reverse character visible.
|
||||
|
||||
$00D0 CRSW End of line switch during screen input
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Return character reached, end of line.
|
||||
* $01-$FF: Still reading characters from line.
|
||||
|
||||
$00D1-$00D2 PNT Pointer to current line in screen memory.
|
||||
|
||||
$00D3 PNTR Current cursor column. Values: $00-$27, 0-39.
|
||||
|
||||
$00D4 QTSW Quotation mode switch
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Normal mode.
|
||||
* $01: Quotation mode.
|
||||
|
||||
$00D5 LNMX Length of current screen line minus 1. Values: $27, 39; $4F, 79.
|
||||
|
||||
$00D6 TBLX Current cursor row. Values: $00-$18, 0-24.
|
||||
|
||||
$00D7 DATA PETSCII code of character during screen input/output.
|
||||
Bit buffer during datasette input.
|
||||
Block checksum during datasette output.
|
||||
|
||||
$00D8 INSRT Number of insertions
|
||||
|
||||
Values:
|
||||
|
||||
* $00: No insertions made, normal mode, control codes change screen layout or behavior.
|
||||
* $01-$FF: Number of insertions, when inputting this many character next, those must be turned into control codes, similarly to quotation mode.
|
||||
|
||||
$00D9-$00F2 LDTB1 High byte of pointers to each line in screen memory (25 bytes)
|
||||
|
||||
Values:
|
||||
|
||||
* $00-$7F: Pointer high byte.
|
||||
* $80-$FF: No pointer, line is an extension of previous line on screen.
|
||||
|
||||
$00F3-$00F4 USER Pointer to current line in Color RAM.
|
||||
|
||||
$00F5-$00F6 KEYTAB Pointer to current conversion table during conversion from keyboard matrix codes to PETSCII codes.
|
||||
|
||||
$00F7-$00F8 RIBUF Pointer to RS232 input buffer
|
||||
|
||||
Values:
|
||||
|
||||
* $0000-$00FF: No buffer defined, a new buffer must be allocated upon RS232 input.
|
||||
* $0100-$FFFF: Buffer pointer.
|
||||
|
||||
$00F9-$00FA ROBUF Pointer to RS232 output buffer
|
||||
|
||||
Values:
|
||||
|
||||
* $0000-$00FF: No buffer defined, a new buffer must be allocated upon RS232 output.
|
||||
* $0100-$FFFF: Buffer pointer.
|
||||
|
||||
$00FB-$00FE FREKZP Unused (4 bytes).
|
||||
|
||||
$00FF-$010A BASZPT Buffer for conversion from floating point to string (12 bytes.)
|
||||
|
||||
$0100-$01FF Processor stack. Also used for storing data related to FOR and GOSUB.
|
||||
|
||||
$0100-$013D BAD Pointers to bytes read with error during datasette input (62 bytes, 31 entries).
|
||||
|
||||
$0200-$0258 BUF Input buffer, storage area for data read from screen (89 bytes).
|
||||
|
||||
$0259-$0262 LAT Logical numbers assigned to files (10 bytes, 10 entries).
|
||||
|
||||
$0263-$026C FAT Device numbers assigned to files (10 bytes, 10 entries).
|
||||
|
||||
$026D-$0276 SAT Secondary addresses assigned to files (10 bytes, 10 entries).
|
||||
|
||||
$0277-$0280 KEYD Keyboard buffer (10 bytes, 10 entries).
|
||||
|
||||
$0281-$0282 MEMSTR Pointer to beginning of BASIC area after memory test.
|
||||
|
||||
Default: $0800, 2048.
|
||||
|
||||
$0283-$0284 MEMSIZ Pointer to end of BASIC area after memory test.
|
||||
|
||||
Default: $A000, 40960.
|
||||
|
||||
$0285 TIMOUT Unused. (Serial bus timeout.)
|
||||
|
||||
$0286 COLOR Current color, cursor color
|
||||
|
||||
Values: $00-$0F, 0-15.
|
||||
|
||||
$0287 GDCOL Color of character under cursor
|
||||
|
||||
Values: $00-$0F, 0-15.
|
||||
|
||||
$0288 HIBASE High byte of pointer to screen memory for screen input/output.
|
||||
|
||||
Default: $04, $0400, 1024.
|
||||
|
||||
$0289 XMAX Maximum length of keyboard buffer
|
||||
|
||||
Values:
|
||||
|
||||
* $00, 0: No buffer.
|
||||
* $01-$0F, 1-15: Buffer size.
|
||||
|
||||
$028A RPTFLG Keyboard repeat switch
|
||||
|
||||
Bits:
|
||||
|
||||
* Bits #6-#7:
|
||||
* %00 = Only cursor up/down, cursor left/right, Insert/Delete and Space repeat
|
||||
* %01 = No key repeats
|
||||
* %1x = All keys repeat.
|
||||
|
||||
$028B KOUNT Delay counter during repeat sequence, for delaying between successive repeats
|
||||
|
||||
Values:
|
||||
|
||||
* $00, 0: Must repeat key.
|
||||
* $01-$04, 1-4: Delay repetition.
|
||||
|
||||
$028C DELAY Repeat sequence delay counter, for delaying before first repetition
|
||||
|
||||
Values:
|
||||
|
||||
* $00, 0: Must start repeat sequence.
|
||||
* $01-$10, 1-16: Delay repeat sequence.
|
||||
|
||||
$028D SHFLAG Shift key indicator
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #0: 1 = One or more of left Shift, right Shift or Shift Lock is currently being pressed or locked.
|
||||
* Bit #1: 1 = Commodore is currently being pressed.
|
||||
* Bit #2: 1 = Control is currently being pressed.
|
||||
|
||||
$028E LSTSHF Previous value of shift key indicator
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #0: 1 = One or more of left Shift, right Shift or Shift Lock was pressed or locked at the time of previous check.
|
||||
* Bit #1: 1 = Commodore was pressed at the time of previous check.
|
||||
* Bit #2: 1 = Control was pressed at the time of previous check.
|
||||
|
||||
$028F-$0290 KEYLOG Execution address of routine that, based on the status of shift keys, sets the pointer at memory address $00F5-$00F6 to the appropriate conversion table for converting keyboard matrix codes to PETSCII codes.
|
||||
|
||||
Default: $EB48.
|
||||
|
||||
$0291 MODE Commodore-Shift switch
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #7: 0 = Commodore-Shift is disabled; 1 = Commodore-Shift is enabled, the key combination will toggle between the uppercase/graphics and lowercase/uppercase character set.
|
||||
|
||||
$0292 AUTODN Scroll direction switch during scrolling the screen
|
||||
|
||||
Values:
|
||||
|
||||
* $00: Insertion of line before current line, current line and all lines below it must be scrolled 1 line downwards.
|
||||
* $01-$FF: Bottom of screen reached, complete screen must be scrolled 1 line upwards.
|
||||
|
||||
$0293 M51CTR RS232 control register
|
||||
|
||||
Bits:
|
||||
|
||||
* Bits #0-#3: Baud rate, transfer speed. Values:
|
||||
* %0000: User specified.
|
||||
* %0001: 50 bit/s.
|
||||
* %0010: 75 bit/s.
|
||||
* %0011: 110 bit/s.
|
||||
* %0100: 150 bit/s.
|
||||
* %0101: 300 bit/s.
|
||||
* %0110: 600 bit/s.
|
||||
* %0111: 1200 bit/s.
|
||||
* %1000: 2400 bit/s.
|
||||
* %1001: 1800 bit/s.
|
||||
* %1010: 2400 bit/s.
|
||||
* %1011: 3600 bit/s.
|
||||
* %1100: 4800 bit/s.
|
||||
* %1101: 7200 bit/s.
|
||||
* %1110: 9600 bit/s.
|
||||
* %1111: 19200 bit/s.
|
||||
* Bits #5-#6: Byte size, number of data bits per byte; %00 = 8; %01 = 7, %10 = 6; %11 = 5.
|
||||
* Bit #7: Number of stop bits; 0 = 1 stop bit; 1 = 2 stop bits.
|
||||
|
||||
$0294 M51CDR RS232 command register
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #0: Synchronization type; 0 = 3 lines; 1 = X lines.
|
||||
* Bit #4: Transmission type; 0 = Duplex; 1 = Half duplex.
|
||||
* Bits #5-#7: Parity mode. Values:
|
||||
* %xx0: No parity check, bit #7 does not exist.
|
||||
* %001: Odd parity.
|
||||
* %011: Even parity.
|
||||
* %101: No parity check, bit #7 is always 1.
|
||||
* %111: No parity check, bit #7 is always 0.
|
||||
|
||||
$0295-$0296 M51AJB Default value of RS232 output timer, based on baud rate
|
||||
|
||||
(Must be filled with actual value before RS232 input/output if baud rate is "user specified" in RS232 control register, memory address $0293.)
|
||||
|
||||
|
||||
$0297 RSSTAT Value of ST variable, device status for RS232 input/output
|
||||
|
||||
Bits:
|
||||
|
||||
* Bit #0: 1 = Parity error occurred.
|
||||
* Bit #1: 1 = Frame error, a stop bit with the value of 0, occurred.
|
||||
* Bit #2: 1 = Input buffer underflow occurred, too much data has arrived but it has not been read from the buffer in time.
|
||||
* Bit #3: 1 = Input buffer is empty, nothing to read.
|
||||
* Bit #4: 0 = Sender is Clear To Send; 1 = Sender is not ready to send data to receiver.
|
||||
* Bit #6: 0 = Receiver reports Data Set Ready; 1 = Receiver is not ready to receive data.
|
||||
* Bit #7: 1 = Carrier loss, a stop bit and a data byte both with the value of 0, detected.
|
||||
|
||||
$0298 BITNUM RS232 byte size, number of data bits per data byte, default value for bit counters.
|
||||
|
||||
$0299-$029A BAUDOF Default value of RS232 input timer, based on baud rate
|
||||
|
||||
(Calculated automatically from default value of RS232 output timer, at memory address $0295-$0296.)
|
||||
|
||||
$029B RIDBE Offset of byte received in RS232 input buffer.
|
||||
|
||||
$029C RIDBS Offset of current byte in RS232 input buffer.
|
||||
|
||||
$029D RODBS Offset of byte to send in RS232 output buffer.
|
||||
|
||||
$029E RODBE Offset of current byte in RS232 output buffer.
|
||||
|
||||
$029F-$02A0 IRQTMP Temporary area for saving pointer to original interrupt service routine during datasette input output
|
||||
|
||||
Values:
|
||||
|
||||
* $0000-$00FF: No datasette input/output took place yet or original pointer has been already restored.
|
||||
* $0100-$FFFF: Original pointer, datasette input/output currently in progress.
|
||||
|
||||
$02A1 ENABL Temporary area for saving original value of CIA#2 interrupt control register, at memory address $DD0D, during RS232 input/output.
|
||||
|
||||
$02A2 CASTON Temporary area for saving original value of CIA#1 timer #1 control register, at memory address $DC0E, during datasette input/output.
|
||||
|
||||
$02A3-$02A4 Unknown.
|
||||
|
||||
$02A5 LINTMP Number of line currently being scrolled during scrolling the screen.
|
||||
|
||||
$02A6 PALNTS PAL/NTSC switch, for selecting RS232 baud rate from the proper table
|
||||
|
||||
Values:
|
||||
|
||||
* $00: NTSC.
|
||||
* $01: PAL.
|
||||
|
||||
$02A7-$02FF Unused (89 bytes).
|
||||
|
||||
$0300-$0301 IERROR Execution address of warm reset, displaying optional BASIC error message and entering BASIC idle loop.
|
||||
|
||||
Default: $E38B.
|
||||
|
||||
$0302-$0303 IMAIN Execution address of BASIC idle loop.
|
||||
|
||||
Default: $A483.
|
||||
|
||||
$0304-$0305 ICRNCH Execution address of BASIC line tokenizater routine.
|
||||
|
||||
Default: $A57C.
|
||||
|
||||
$0306-$0307 IQPLOP Execution address of BASIC token decoder routine.
|
||||
|
||||
Default: $A71A.
|
||||
|
||||
$0308-$0309 IGONE Execution address of BASIC instruction executor routine.
|
||||
|
||||
Default: $A7E4.
|
||||
|
||||
$030A-$030B IEVAL Execution address of routine reading next item of BASIC expression.
|
||||
|
||||
Default: $AE86.
|
||||
|
||||
$030C SAREG Default value of register A for SYS.
|
||||
Value of register A after SYS.
|
||||
|
||||
$030D SXREG Default value of register X for SYS.
|
||||
Value of register X after SYS.
|
||||
|
||||
$030E SYREG Default value of register Y for SYS.
|
||||
Value of register Y after SYS.
|
||||
|
||||
$030F SPREG Default value of status register for SYS.
|
||||
Value of status register after SYS.
|
||||
|
||||
$0310-$0312 USRPOK JMP ABS machine instruction, jump to USR() function.
|
||||
|
||||
$0311-$0312 USRADD Execution address of USR() function.
|
||||
|
||||
$0313 Unused.
|
||||
|
||||
$0314-$0315 CINV Execution address of interrupt service routine.
|
||||
|
||||
Default: $EA31.
|
||||
|
||||
$0316-$0317 CBINV Execution address of BRK service routine.
|
||||
|
||||
Default: $FE66.
|
||||
|
||||
$0318-$0319 NMINV Execution address of non-maskable interrupt service routine.
|
||||
|
||||
Default: $FE47.
|
||||
|
||||
$031A-$031B IOPEN Execution address of OPEN, routine opening files.
|
||||
|
||||
Default: $F34A.
|
||||
|
||||
$031C-$031D ICLOSE Execution address of CLOSE, routine closing files.
|
||||
|
||||
Default: $F291.
|
||||
|
||||
$031E-$031F ICHKIN Execution address of CHKIN, routine defining file as default input.
|
||||
|
||||
Default: $F20E.
|
||||
|
||||
$0320-$0321 ICKOUT Execution address of CHKOUT, routine defining file as default output.
|
||||
|
||||
Default: $F250.
|
||||
|
||||
$0322-$0323 ICLRCH Execution address of CLRCHN, routine initializating input/output.
|
||||
|
||||
Default: $F333.
|
||||
|
||||
$0324-$0325 IBASIN Execution address of CHRIN, data input routine, except for keyboard and RS232 input.
|
||||
|
||||
Default: $F157.
|
||||
|
||||
$0326-$0327 IBSOUT Execution address of CHROUT, general purpose data output routine.
|
||||
|
||||
Default: $F1CA.
|
||||
|
||||
$0328-$0329 ISTOP Execution address of STOP, routine checking the status of Stop key indicator, at memory address $0091.
|
||||
|
||||
Default: $F6ED.
|
||||
|
||||
$032A-$032B IGETIN Execution address of GETIN, general purpose data input routine.
|
||||
|
||||
Default: $F13E.
|
||||
|
||||
$032C-$032D ICLALL Execution address of CLALL, routine initializing input/output and clearing all file assignment tables.
|
||||
|
||||
Default: $F32F.
|
||||
|
||||
$032E-$032F USRCMD Unused.
|
||||
|
||||
Default: $FE66.
|
||||
|
||||
$0330-$0331 ILOAD Execution address of LOAD, routine loading files.
|
||||
|
||||
Default: $F4A5.
|
||||
|
||||
$0332-$0333 ISAVE Execution address of SAVE, routine saving files.
|
||||
|
||||
Default: $F5ED.
|
||||
|
||||
$0334-$033B Unused (8 bytes).
|
||||
|
||||
$033C-$03FB TBUFFR Datasette buffer (192 bytes).
|
||||
|
||||
$03FC-$03FF Unused (4 bytes).
|
||||
449
c64mem/combine.py
Executable file
449
c64mem/combine.py
Executable file
|
|
@ -0,0 +1,449 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import re, os
|
||||
import pprint
|
||||
import markdown
|
||||
|
||||
filenames = [
|
||||
'c64mem_mapc64.txt',
|
||||
'c64mem_64er.txt',
|
||||
'c64mem_64intern.txt',
|
||||
'c64mem_sta.txt',
|
||||
'c64mem_src.txt',
|
||||
'c64mem_prg.txt',
|
||||
'c64mem_64map.txt',
|
||||
'c64mem_jb.txt',
|
||||
]
|
||||
names = [
|
||||
'Mapping the Commodore 64',
|
||||
'64\'er [German]',
|
||||
'Data Becker [German]',
|
||||
'Joe Forster/STA',
|
||||
'Microsoft/Commodore Source',
|
||||
'Programmer\'s Reference Guide',
|
||||
'64map',
|
||||
'Jim Butterfield',
|
||||
]
|
||||
links = [
|
||||
'http://unusedino.de/ec64/technical/project64/mapping_c64.html',
|
||||
'https://archive.org/details/64er_sonderheft_1986_07/page/n6/mode/2up',
|
||||
'https://www.pagetable.com/?p=1015',
|
||||
'http://www.awsm.de/mem64/',
|
||||
'https://github.com/mist64/cbmsrc',
|
||||
'http://www.zimmers.net/cbmpics/cbm/c64/c64prg.txt',
|
||||
'http://unusedino.de/ec64/technical/project64/memory_maps.html',
|
||||
'https://www.atarimagazines.com/compute/issue29/394_1_COMMODORE_64_MEMORY_MAP.php',
|
||||
]
|
||||
descriptions = [
|
||||
'Reference from <i>Mapping the Commodore 64</i> by Sheldon Leemon, ISBN 0-942386-23-X.',
|
||||
'German-language reference from <i>Memory Map mit Wandervorschlägen</i> by Dr. H. Hauck, in 64\'er Sonderheft 1986/07.',
|
||||
'German-language reference from <i>Das neue Commodore-64-intern-Buch</i> by Data Becker, ISBN 3890113079.',
|
||||
'Reference by Joe Forster/STA, with awsm\'s changes applied.',
|
||||
'Comments from the original M6502 BASIC source by Microsoft and the original C64 KERNAL source by Commodore',
|
||||
'Reference from <i>Commodore 64 Programmer\'s Reference Guide</i>.',
|
||||
'Reference as found in "Commodore_64_Memory_Maps.txt" by anonymous.',
|
||||
'Reference by Jim Butterfield in COMPUTE! #29 (October 1982).',
|
||||
]
|
||||
|
||||
|
||||
def cross_reference(string):
|
||||
hex_numbers = re.findall(r'\$[0-9A-F][0-9A-F][0-9A-F][0-9A-F]', string)
|
||||
for hex_number in hex_numbers:
|
||||
dec_number = int(hex_number[1:], 16)
|
||||
if dec_number < 0x0400:
|
||||
if dec_number < 0x100:
|
||||
formatted_hex_number = '${:02X}'.format(dec_number)
|
||||
else:
|
||||
formatted_hex_number = '${:04X}'.format(dec_number)
|
||||
string = string.replace(hex_number, '<a href="#' + '{:04X}'.format(dec_number) + '">' + formatted_hex_number + '</a>')
|
||||
elif (dec_number >= 0xa000 and dec_number <= 0xbfff) or (dec_number >= 0xe000 and dec_number <= 0xffff):
|
||||
string = string.replace(hex_number, '<a href="../c64disasm/#' + '{:04X}'.format(dec_number) + '">' + hex_number + '</a>')
|
||||
|
||||
return string
|
||||
|
||||
|
||||
|
||||
f = os.popen('git log -1 --pretty=format:%h .')
|
||||
revision = f.read()
|
||||
f = os.popen('git log -1 --date=short --pretty=format:%cd .')
|
||||
date = f.read()
|
||||
|
||||
data = []
|
||||
linenumber = []
|
||||
address = []
|
||||
for filename in filenames:
|
||||
d = []
|
||||
for f in filename.split(';'):
|
||||
d += [line.rstrip() for line in open(f)]
|
||||
data.append(d)
|
||||
linenumber.append(0)
|
||||
address.append(0)
|
||||
files = len(filenames)
|
||||
|
||||
for i in range(0, files):
|
||||
while True:
|
||||
line = data[i][linenumber[i]]
|
||||
if len(line) > 0 and line[0] == '$':
|
||||
break
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
print('<meta http-equiv="Content-type" content="text/html; charset=utf-8" />')
|
||||
print('<html>')
|
||||
print('<head>')
|
||||
print('<title>Memory Map | Ultimate C64 Reference</title>')
|
||||
print('')
|
||||
print('<script language="javascript">')
|
||||
print(' window.onload = init;')
|
||||
print(' function init() {')
|
||||
print(' var tbl = document.getElementById("disassembly_table");')
|
||||
print(' for (var i = 0; i < ' + str(len(filenames)) + '; i++) {')
|
||||
print(' var key = "com.pagetable.c64mem.column_" + i;')
|
||||
print(' var element_name = "checkbox_" + i;')
|
||||
print(' var checked = localStorage.getItem(key) != "hidden";')
|
||||
print(' document.getElementById(element_name).checked = checked;')
|
||||
print(' hideCol(i, checked);')
|
||||
print(' }')
|
||||
print(' var key = "com.pagetable.c64mem.column_decimal";')
|
||||
print(' var element_name = "checkbox_decimal";')
|
||||
print(' var visible = localStorage.getItem(key) == "visible";')
|
||||
print(' document.getElementById(element_name).checked = visible;')
|
||||
print(' toggleDecimal(visible);')
|
||||
print(' }')
|
||||
print(' function toggleDecimal(visible) {')
|
||||
print(' var tbl = document.getElementById("disassembly_table");')
|
||||
print(' for (var i = 0; i < tbl.rows.length; i++) {')
|
||||
print(' tbl.rows[i].cells[2].style.display = visible ? "" : "none";')
|
||||
print(' }')
|
||||
print(' var key = "com.pagetable.c64mem.column_decimal";')
|
||||
print(' var cnt = document.getElementById("disassembly_container");')
|
||||
print(' if (visible) {')
|
||||
print(' cnt.className = "disassembly_container_with_dec";')
|
||||
print(' localStorage.setItem(key, "visible");')
|
||||
print(' } else {')
|
||||
print(' cnt.className = "disassembly_container_no_dec";')
|
||||
print(' localStorage.removeItem(key);')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print(' function hideCol(col, checked) {')
|
||||
print(' var tbl = document.getElementById("disassembly_table");')
|
||||
print(' for (var i = 0; i < tbl.rows.length; i++) {')
|
||||
print(' tbl.rows[i].cells[col+3].style.display = checked ? "" : "none";') # data columns start at index 3
|
||||
print(' }')
|
||||
print(' var key = "com.pagetable.c64mem.column_" + col;')
|
||||
print(' if (checked) {')
|
||||
print(' localStorage.removeItem(key);')
|
||||
print(' } else {')
|
||||
print(' localStorage.setItem(key, "hidden");')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print(' function openAll() {')
|
||||
print(' var elems = document.getElementsByTagName("details");')
|
||||
print(' document.getElementById("toggle_details_button").innerHTML = "Hide All Details";')
|
||||
print(' document.getElementById("toggle_details_button").setAttribute("onClick", "javascript: closeAll();");')
|
||||
print('')
|
||||
print(' for (let item of elems) {')
|
||||
print(' item.setAttribute("open", true);')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print('')
|
||||
print(' function closeAll() { ')
|
||||
print(' var elems = document.getElementsByTagName("details");')
|
||||
print(' document.getElementById("toggle_details_button").setAttribute("onClick", "javascript: openAll();" );')
|
||||
print(' document.getElementById("toggle_details_button").innerHTML = "Expand All Details"; ')
|
||||
print(' ')
|
||||
print(' for (let item of elems) {')
|
||||
print(' item.removeAttribute("open");')
|
||||
print(' }')
|
||||
print(' }')
|
||||
print('</script>')
|
||||
print('')
|
||||
|
||||
print('<link rel="stylesheet" href="../style.css">')
|
||||
|
||||
address_width=6.4
|
||||
label_width=4
|
||||
decimal_width=5
|
||||
|
||||
print('<style type="text/css">')
|
||||
print('')
|
||||
print('div.disassembly_container_with_dec {')
|
||||
print(' padding: 1em 0em 1em ' + str(address_width + label_width + decimal_width + 1.6) + 'em;')
|
||||
print(' overflow: scroll;')
|
||||
print('}')
|
||||
print('')
|
||||
print('div.disassembly_container_no_dec {')
|
||||
print(' padding: 1em 0em 1em ' + str(address_width + label_width + 0.9) + 'em;')
|
||||
print(' overflow: scroll;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table>tbody>tr>td, table.disassembly_table>tbody>tr>th.top_row {')
|
||||
print(' min-width: 30em;')
|
||||
print(' max-width: 40em;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table th.left_column {')
|
||||
print(' width: '+ str(address_width) +'em;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table th.label_column {')
|
||||
print(' width: ' + str(label_width) +'em;')
|
||||
print(' left: ' + str(address_width + 3) + 'em;')
|
||||
print(' z-index: 12;')
|
||||
print(' font-family: monospace;')
|
||||
print(' text-align: center;')
|
||||
print(' color: yellow;')
|
||||
print('}')
|
||||
print('')
|
||||
print('table.disassembly_table th.decimal_column {')
|
||||
print(' width: ' + str(decimal_width) + 'em;')
|
||||
print(' left: ' + str(address_width + label_width + 1.2) + 'em;')
|
||||
print(' z-index: 13;')
|
||||
print('}')
|
||||
print('')
|
||||
print('details {')
|
||||
print(' font-family: serif;')
|
||||
print('}')
|
||||
print('summary {')
|
||||
print(' font-family: Helvetica;')
|
||||
print('}')
|
||||
print('')
|
||||
print('</style>')
|
||||
print('</head>')
|
||||
print('<body>')
|
||||
|
||||
# http://tholman.com/github-corners/
|
||||
print('<a href="https://github.com/mist64/c64ref" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:var(--main-color); color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>')
|
||||
|
||||
print('<div class="topnav">')
|
||||
print(' <h1>Ultimate Commodore 64 Reference</h1> ')
|
||||
#print(' <a href="#">KERNAL API</a><!-- kernal/ -->')
|
||||
print(' <a href="../c64disasm/">ROM Disassembly</a><!-- c64disasm/ -->')
|
||||
print(' <a class="active" href="../c64mem/">Memory Map</a><!-- c64mem/ -->')
|
||||
#print(' <a href="#">I/O Map</a><!-- c64io/ -->')
|
||||
#print(' <a href="#">6502 CPU</a><!-- 6502/ -->')
|
||||
print('</div>')
|
||||
|
||||
print('<div class="body">')
|
||||
print('<h1>C64 Memory Map</h1>')
|
||||
|
||||
print('<p><i>by <a href="http://www.pagetable.com/">Michael Steil</a>, <a href="https://github.com/mist64/c64ref">github.com/mist64/c64ref</a>. Revision ' + revision + ', ' + date + '</i></p>')
|
||||
|
||||
print('<b>This allows you to view different commentaries side-by-side. You can enable/disable individual columns:</b><br/><br/>')
|
||||
print('<table class="checkbox_table">')
|
||||
for i in range(0, len(filenames)):
|
||||
print('<tr><td><input type="checkbox" id="checkbox_' + str(i) + '" checked onclick="hideCol(' + str(i) + ', document.getElementById(\'checkbox_' + str(i) + '\').checked);" /></td><td style="white-space: nowrap;"><b><a href="' + links[i] + '">' + names[i] + '</a></b><td>' + descriptions[i] + '</td></tr>')
|
||||
print('</table>')
|
||||
|
||||
print('<p>')
|
||||
print('<input type="checkbox" id="checkbox_decimal" name="checkbox_decimal" onclick="toggleDecimal(document.getElementById(\'checkbox_decimal\').checked);">')
|
||||
print('<label for="checkbox_decimal">Show Decimal Address</label></input>')
|
||||
print('<br />')
|
||||
print('<button id="toggle_details_button" onclick="closeAll()">Hide All Details</button>')
|
||||
print('</p>')
|
||||
|
||||
print('<div class="disassembly_container_no_dec" id="disassembly_container">')
|
||||
print('<table id="disassembly_table" class="disassembly_table">')
|
||||
|
||||
print('<tr>')
|
||||
print('<th class="left_column">Address</th>')
|
||||
print('<th class="label_column">Symbol</th>')
|
||||
print('<th class="decimal_column">Decimal</th>')
|
||||
for i in range(0, files):
|
||||
print('<th class="top_row">' + names[i] + '</th>')
|
||||
print('</tr>')
|
||||
|
||||
count = 0
|
||||
last_address1 = None
|
||||
last_address2 = None
|
||||
while(True):
|
||||
count += 1
|
||||
# if count > 80:
|
||||
# break
|
||||
|
||||
# make linenumber[] point to next line for all files
|
||||
for i in range(0, files):
|
||||
if linenumber[i] >= len(data[i]):
|
||||
continue
|
||||
while len(data[i][linenumber[i]]) > 0 and (data[i][linenumber[i]][0] == '-' or data[i][linenumber[i]][0] == '#'):
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
list_address1 = []
|
||||
list_address2 = []
|
||||
list_symbol = []
|
||||
for i in range(0, files):
|
||||
if linenumber[i] >= len(data[i]):
|
||||
continue
|
||||
line = data[i][linenumber[i]]
|
||||
address1 = line[1:5]
|
||||
address1 = int(address1, 16)
|
||||
address2 = line[7:11]
|
||||
if len(address2.rstrip()) != 0:
|
||||
address2 = int(address2, 16)
|
||||
else:
|
||||
address2 = None
|
||||
symbol = line[13:19].rstrip()
|
||||
list_address1.append(address1)
|
||||
list_address2.append(address2)
|
||||
list_symbol.append(symbol)
|
||||
|
||||
# reached end of all files?
|
||||
if len(list_address1) == 0:
|
||||
break
|
||||
|
||||
# the next address is the lowest one from all source
|
||||
address1 = min(list_address1)
|
||||
|
||||
# the longest range wins
|
||||
address2 = None
|
||||
symbol = None
|
||||
good_symbols = []
|
||||
for i in range(0, len(list_address1)):
|
||||
if list_address1[i] == address1 and (address2 == None or (list_address2[i] != None and list_address2[i] > address2)):
|
||||
address2 = list_address2[i]
|
||||
|
||||
# get symbols of longest range
|
||||
for i in range(0, len(list_address1)):
|
||||
if list_address1[i] == address1 and list_address2[i] == address2 and list_symbol[i] != '':
|
||||
good_symbols.append(list_symbol[i])
|
||||
#print('xxx', address1, address2, good_symbols)
|
||||
|
||||
if len(good_symbols) != 0:
|
||||
symbol = good_symbols[0]
|
||||
else:
|
||||
symbol = ''
|
||||
|
||||
print('<tr>')
|
||||
|
||||
# print address
|
||||
anchors = ''
|
||||
if address2 is not None:
|
||||
r = range(address1, address2 + 1)
|
||||
else:
|
||||
r = range(address1, address1 + 1)
|
||||
for address in r:
|
||||
anchors += '<a name="{:04X}"/>'.format(address)
|
||||
if address1 == last_address1 and address2 == last_address2:
|
||||
print('<th class="left_column" style="visibility:hidden;"> ' + anchors + ' </th>')
|
||||
else:
|
||||
hex_range = '${:04X}'.format(address1)
|
||||
if address2 != None:
|
||||
hex_range += '-${:04X}'.format(address2)
|
||||
print('<th class="left_column"> ' + anchors + hex_range + ' </th>')
|
||||
|
||||
# print symbol
|
||||
if len(symbol) == 0:
|
||||
print('<th class="label_column" style="visibility:hidden;"> </th>')
|
||||
else:
|
||||
print('<th class="label_column">' + symbol + ' <a name="' + symbol + '"/> </th>')
|
||||
|
||||
# print decimal
|
||||
if address1 == last_address1 and address2 == last_address2:
|
||||
print('<th class="decimal_column" style="visibility:hidden;"> </th>')
|
||||
else:
|
||||
dec_range = str(address1)
|
||||
if address2 != None:
|
||||
dec_range += '-' + str(address2)
|
||||
print('<th class="decimal_column"> ' + dec_range + ' </th>')
|
||||
|
||||
last_address1 = address1
|
||||
last_address2 = address2
|
||||
|
||||
for i in range(0, files):
|
||||
print('<td>')
|
||||
headings = []
|
||||
comments = []
|
||||
has_seen_blank_line = False
|
||||
is_first_line = True
|
||||
while True:
|
||||
if linenumber[i] >= len(data[i]):
|
||||
break
|
||||
|
||||
line = data[i][linenumber[i]]
|
||||
|
||||
if line.startswith('$'):
|
||||
if not is_first_line:
|
||||
# next address; stop here
|
||||
break
|
||||
|
||||
# compare whether this address matches
|
||||
cmp_address1 = line[1:5]
|
||||
cmp_address1 = int(cmp_address1, 16)
|
||||
cmp_address2 = line[7:11]
|
||||
if len(cmp_address2.rstrip()) != 0:
|
||||
cmp_address2 = int(cmp_address2, 16)
|
||||
else:
|
||||
cmp_address2 = None
|
||||
cmp_symbol = line[13:19].rstrip()
|
||||
if cmp_address1 != address1 or cmp_address2 != address2 or (cmp_symbol != symbol and cmp_symbol != ''):
|
||||
break
|
||||
|
||||
is_first_line = False
|
||||
comment = line[21:]
|
||||
# print(comment)
|
||||
|
||||
if not has_seen_blank_line:
|
||||
if len(comment.lstrip()) == 0:
|
||||
has_seen_blank_line = True
|
||||
else:
|
||||
headings.append(comment)
|
||||
else:
|
||||
scomment = comment.lstrip()
|
||||
comment = comment + '\n'
|
||||
comments.append(comment)
|
||||
|
||||
linenumber[i] += 1
|
||||
|
||||
while len(comments) > 0 and comments[-1] == '\n':
|
||||
comments = comments[0:-1]
|
||||
|
||||
#print('xxx',headings,comments)
|
||||
|
||||
is_collapsible = len(comments) and not (len(comments) == 1 and comments[0].isspace())
|
||||
if is_collapsible:
|
||||
print('<details open>')
|
||||
|
||||
if len(headings) or is_collapsible:
|
||||
print('<b>')
|
||||
all_text = ''
|
||||
if is_collapsible:
|
||||
print('<summary>')
|
||||
if not len(headings):
|
||||
print('…')
|
||||
previous_heading = ''
|
||||
for heading in headings:
|
||||
if previous_heading.endswith('.'):
|
||||
heading = '<br/>' + heading
|
||||
html_heading = markdown.markdown(heading)
|
||||
html_heading.replace('<p>', '')
|
||||
html_heading.replace('</p>', '')
|
||||
all_text += heading + ' '
|
||||
previous_heading = heading
|
||||
all_text = cross_reference(all_text)
|
||||
print(all_text)
|
||||
print('</b>')
|
||||
if is_collapsible:
|
||||
print('</summary>')
|
||||
else:
|
||||
print(' ')
|
||||
|
||||
if len(comments):
|
||||
all_text = ''
|
||||
for comment in comments:
|
||||
all_text += comment
|
||||
all_text = markdown.markdown(all_text, extensions=['tables', 'sane_lists'])
|
||||
all_text = cross_reference(all_text)
|
||||
print(all_text)
|
||||
else:
|
||||
print(' ')
|
||||
|
||||
if is_collapsible:
|
||||
print('</details>')
|
||||
|
||||
print('</td>')
|
||||
print('</tr>')
|
||||
|
||||
print('</table>')
|
||||
print('</div>')
|
||||
print('</div>')
|
||||
print('</body>')
|
||||
print('</html>')
|
||||
40
c64mem/format.py
Executable file
40
c64mem/format.py
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import pprint
|
||||
|
||||
with open('c64mem_64intern.txt', 'r') as f:
|
||||
lines = f.read().split('\n')
|
||||
|
||||
with open('symbols.txt', 'r') as f:
|
||||
sym = f.read().split('\n')
|
||||
|
||||
symbols = {}
|
||||
|
||||
for s in sym:
|
||||
if not s.startswith('$'):
|
||||
continue
|
||||
address = s[1:5]
|
||||
name = s[6:12]
|
||||
symbols[address] = name
|
||||
|
||||
#pprint.pprint(symbols)
|
||||
|
||||
for line in lines:
|
||||
if line.startswith('-') or line.startswith('#') or len(line) == 0:
|
||||
print(line)
|
||||
continue
|
||||
|
||||
if not line.startswith('$'):
|
||||
print(line)
|
||||
continue
|
||||
address = line[0:13]
|
||||
start_address = line[1:5]
|
||||
description = line[21:]
|
||||
if start_address in symbols:
|
||||
symbol = (symbols[start_address] + " ")[:8]
|
||||
else:
|
||||
symbol = " "
|
||||
print(address + symbol + description)
|
||||
|
||||
207
c64mem/symbols.txt
Normal file
207
c64mem/symbols.txt
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
$0000 D6510
|
||||
$0001 R6510
|
||||
#0002 # unnamed in Programmer's Reference Manual; part of "BLANK0" 3 (!) byte register area in BASIC source
|
||||
$0003 ADRAY1
|
||||
$0005 ADRAY2
|
||||
$0007 CHARAC # also INTEGR
|
||||
$0008 ENDCHR
|
||||
$0009 TRMPOS
|
||||
$000A VERCK
|
||||
$000B COUNT
|
||||
$000C DIMFLG
|
||||
$000D VALTYP
|
||||
$000E INTFLG
|
||||
$000F GARBFL
|
||||
$0010 SUBFLG
|
||||
$0011 INPFLG
|
||||
$0012 TANSGN
|
||||
$0013 CHANNL # unnamed in Programmer's Reference Manual
|
||||
$0014 LINNUM
|
||||
$0016 TEMPPT
|
||||
$0017 LASTPT
|
||||
$0019 TEMPST
|
||||
$0022 INDEX
|
||||
$0022 INDEX1
|
||||
$0024 INDEX2
|
||||
$0026 RESHO
|
||||
$002B TXTTAB
|
||||
$002D VARTAB
|
||||
$002F ARYTAB
|
||||
$0031 STREND
|
||||
$0033 FRETOP
|
||||
$0035 FRESPC
|
||||
$0037 MEMSIZ
|
||||
$0039 CURLIN
|
||||
$003B OLDLIN
|
||||
$003D OLDTXT
|
||||
$003F DATLIN
|
||||
$0041 DATPTR
|
||||
$0043 INPPTR
|
||||
$0045 VARNAM
|
||||
$0047 VARPNT
|
||||
$0049 FORPNT
|
||||
$004B OPPTR
|
||||
$004B VARTXT
|
||||
$004D OPMASK
|
||||
$004E DEFPNT
|
||||
$004E TEMPF3
|
||||
$0050 DSCPNT
|
||||
$0053 FOUR6
|
||||
$0054 JMPER
|
||||
$0057 TEMPF1
|
||||
$005C TEMPF2
|
||||
$0061 FAC
|
||||
$0061 FACEXP
|
||||
$0062 FACHO
|
||||
$0066 FACSGN
|
||||
$0067 SGNFLG
|
||||
$0068 BITS
|
||||
$0069 ARGEXP # aka ARG, AFAC, FAC2
|
||||
$006A ARGHO
|
||||
$006E ARGSGN
|
||||
$006F ARISGN
|
||||
$0070 FACOV
|
||||
$0071 FBUFPT
|
||||
$0073 CHRGET
|
||||
$0079 CHRGOT
|
||||
$007A TXTPTR
|
||||
$008B RNDX
|
||||
$0090 STATUS
|
||||
$0091 STKEY
|
||||
$0092 SVXT
|
||||
$0093 VERCK
|
||||
$0094 C3P0
|
||||
$0095 BSOUR
|
||||
$0096 SYNO
|
||||
$0097 XSAV # unnamed in Programmer's Reference Manual
|
||||
$0098 LDTND
|
||||
$0099 DFLTN
|
||||
$009A DFLTO
|
||||
$009B PRTY
|
||||
$009C DPSW
|
||||
$009D MSGFLG
|
||||
$009E PTR1
|
||||
$009F PTR2
|
||||
$00A0 TIME
|
||||
$00A3 PCNTR # unnamed in Programmer's Reference Manual
|
||||
$00A3 R2D2 # unnamed in Programmer's Reference Manual
|
||||
$00A4 BSOUR1 # unnamed in Programmer's Reference Manual
|
||||
$00A4 FIRT # unnamed in Programmer's Reference Manual
|
||||
$00A5 CNTDN
|
||||
$00A6 BUFPT
|
||||
$00A7 INBIT
|
||||
$00A8 BITCI
|
||||
$00A9 RINONE
|
||||
$00AA RIDATA
|
||||
$00AB RIPRTY
|
||||
$00AC SAL
|
||||
$00AE EAL
|
||||
$00B0 CMP0
|
||||
$00B2 TAPE1
|
||||
$00B4 BITTS
|
||||
$00B5 NXTBIT
|
||||
$00B6 RODATA
|
||||
$00B7 FNLEN
|
||||
$00B8 LA
|
||||
$00B9 SA
|
||||
$00BA FA
|
||||
$00BB FNADR
|
||||
$00BD ROPRTY
|
||||
$00BE FSBLK
|
||||
$00BF MYCH
|
||||
$00C0 CAS1
|
||||
$00C1 STAL
|
||||
$00C3 MEMUSS
|
||||
$00C5 LSTX
|
||||
$00C6 NDX
|
||||
$00C7 RVS
|
||||
$00C8 INDX
|
||||
$00C9 LSXP
|
||||
$00CB SFDX
|
||||
$00CC BLNSW
|
||||
$00CD BLNCT
|
||||
$00CE GDBLN
|
||||
$00CF BLNON
|
||||
$00D0 CRSW
|
||||
$00D1 PNT
|
||||
$00D3 PNTR
|
||||
$00D4 QTSW
|
||||
$00D5 LNMX
|
||||
$00D6 TBLX
|
||||
$00D7 DATA # unnamed in Programmer's Reference Manual
|
||||
$00D8 INSRT
|
||||
$00D9 LDTB1
|
||||
$00F3 USER
|
||||
$00F5 KEYTAB
|
||||
$00F7 RIBUF
|
||||
$00F9 ROBUF
|
||||
$00FB FREKZP
|
||||
$00FF BASZPT
|
||||
$0100 BAD
|
||||
$0200 BUF
|
||||
$0259 LAT
|
||||
$0263 FAT
|
||||
$026D SAT
|
||||
$0277 KEYD
|
||||
$0281 MEMSTR
|
||||
$0283 MEMSIZ
|
||||
$0285 TIMOUT
|
||||
$0286 COLOR
|
||||
$0287 GDCOL
|
||||
$0288 HIBASE
|
||||
$0289 XMAX
|
||||
$028A RPTFLG
|
||||
$028B KOUNT
|
||||
$028C DELAY
|
||||
$028D SHFLAG
|
||||
$028E LSTSHF
|
||||
$028F KEYLOG
|
||||
$0291 MODE
|
||||
$0292 AUTODN
|
||||
$0293 M51CTR
|
||||
$0294 M51CDR
|
||||
$0295 M51AJB
|
||||
$0297 RSSTAT
|
||||
$0298 BITNUM
|
||||
$0299 BAUDOF
|
||||
$029B RIDBE
|
||||
$029C RIDBS
|
||||
$029D RODBS
|
||||
$029E RODBE
|
||||
$029F IRQTMP
|
||||
$02A1 ENABL
|
||||
$02A2 CASTON # unnamed in Programmer's Reference Manual
|
||||
$02A3 KIKA26 # unnamed in Programmer's Reference Manual
|
||||
$02A4 STUPID # unnamed in Programmer's Reference Manual
|
||||
$02A5 LINTMP # unnamed in Programmer's Reference Manual
|
||||
$02A6 PALNTS # unnamed in Programmer's Reference Manual
|
||||
$0300 IERROR
|
||||
$0302 IMAIN
|
||||
$0304 ICRNCH
|
||||
$0306 IQPLOP
|
||||
$0308 IGONE
|
||||
$030A IEVAL
|
||||
$030C SAREG
|
||||
$030D SXREG
|
||||
$030E SYREG
|
||||
$030F SPREG
|
||||
$0310 USRPOK
|
||||
$0311 USRADD # from Programmer's Reference Manual; not in KERNAL/BASIC source!
|
||||
$0314 CINV
|
||||
$0316 CBINV
|
||||
$0318 NMINV
|
||||
$031A IOPEN
|
||||
$031C ICLOSE
|
||||
$031E ICHKIN
|
||||
$0320 ICKOUT
|
||||
$0322 ICLRCH
|
||||
$0324 IBASIN
|
||||
$0326 IBSOUT
|
||||
$0328 ISTOP
|
||||
$032A IGETIN
|
||||
$032C ICLALL
|
||||
$032E USRCMD
|
||||
$0330 ILOAD
|
||||
$0332 ISAVE
|
||||
$033C TBUFFR
|
||||
$0400 VICSCN
|
||||
769
c64mem/texteinschub.md
Normal file
769
c64mem/texteinschub.md
Normal file
|
|
@ -0,0 +1,769 @@
|
|||
# Texteinschub Nr. 1: Der USR-Befehl
|
||||
|
||||
Hand aufs Herz: Haben Sie USR schon einmal benutzt? Ohne Zweifel gehört dieser Befehl zu den seltenen. Ich will ihn daher hier kurz erläutern. USR hat dieselbe Funktion wie SYS, nämlich aus einem Basic-Programm direkt in ein Maschinenprogramm zu springen und dort solange weiterzufahren, bis mit dem Befehl RTS (entspricht dem Basic-Befehl RETURN) in das Basic-Programm zurückgesprungen wird. Die Sprungadresse in das Maschinenprogramm steht bei SYS gleich hinter dem Befehl.
|
||||
|
||||
Bei USR muß die Adresse zuerst in die Speicherzellen 1 und 2 (aha!!) gePOKEt werden.
|
||||
|
||||
Beispiel - Sprung auf 56524 ($DCCC):
|
||||
|
||||
* mit SYS: `SYS 56524`
|
||||
* mit USR: `POKE 1,204:P0KE 2,220:X=USR(Y)`
|
||||
|
||||
Kein Wunder, daß USR selten benutzt wird. Aber erstens ist er durch das POKEn der Low-/High-Byte-Darstellung aufgebläht und zweitens hat er auch wesentlich mehr Fähigkeiten als SYS.
|
||||
|
||||
Sein Argument, im obigen Beispiel also das »Y«, wird nämlich zuerst in den »Fließkomma-Akkumulator« FAC 1 (Floating Point Accumulator Nr. 1) gebracht, der sich in den Speicherzellen 97 bis 102 ($61 bis $66) befindet. Da wir ihn auf unserer Reise durch den Speicher noch treffen werden, brauche ich jetzt nicht näher darauf einzugehen. Wichtig ist lediglich, daß der Wert von »Y« dann vom angesprungenen Maschinenprogramm verarbeitet werden kann. Das Resultat kommt dann wieder in diesen FAC 1 und steht als Wert von X (siehe Beispiel oben) dem Basic- Programm zur Verfügung.
|
||||
|
||||
Mit USR kann man also Variable ins Maschinenprogramm zur Bearbeitung und zurück transferieren - und das ist der Unterschied zum SYS-Befehl. Ich möchte das an einem kleinen Beispiel demonstrieren. Statt allerdings ein Maschinenprogramm selbst zu schreiben, verwende ich beziehungsweise springe ich auf eine Routine des Betriebssystems, welches Werte des FAC 1 für mathematische Operationen verwendet.
|
||||
|
||||
Als mathematische Operation wähle ich das eingebaute Programm für INT, welches im VC 20 ab Speicherzelle 56524 ($DCCC) steht, im C 64 steht es ab 48332 ($BCCC). Dieses wollen wir verwenden:
|
||||
|
||||
In Zeile 10 definieren wir einen Wert für die Variable X, der in das Maschinenprogramm gebracht werden soll. Mit Zeile 20 bringen wir die Startadresse des Maschinenprogramms in die Speicherzellen 1 und 2.
|
||||
|
||||
Laut Kochrezept teilen wir die Adresse 56524 auf in ein Low- Byte = 204 und ein High-Byte = 220.
|
||||
|
||||
Der Befehl in Zeile 30 löst den ganzen USR-Vorgang aus, Zeile 40 gibt uns das Resultat.
|
||||
|
||||
10 Y=14.35
|
||||
20 POKE l,204:P0KE 2,220 30 X=USR(Y)
|
||||
40 PRINT X
|
||||
|
||||
Hinweis: Entsprechend der anderen Adresse 48332 lautet die Zeile 20 beim C 64:
|
||||
|
||||
20 POKE 785,204:POKE 786,188
|
||||
|
||||
Nach RUN erhalten wirdas Resultat 14, wie das Gesetz für INT es befiehlt. Natürlich hätten wir gleich PRINT INT (14.35) schreiben können, aber ich wollte ja nur demonstrieren. Der eigentliche Wert des USR-Befehls kommt hauptsächlich bei selbstgeschriebenen Maschinenprogrammen zum Zuge.
|
||||
|
||||
Sie können zur Übung im obigen Programm statt INT auch COS verwenden, indem Sie auf die Adresse 57935 ($E261) beziehungsweise beim C 64 auf 57938 ($E264) springen. Der Vergleich mit dem Basic-Befehl COS muß dasselbe Resultat ergeben.
|
||||
|
||||
Wer hat gemerkt, daß wir überhaupt nichts mit der Speicherzelle 0 gemacht haben, obwohl sie doch beim USR angeblich beteiligt ist?
|
||||
|
||||
Sie ist es wirklich, doch ohne unser Zutun. In diese Adresse wird beim Einschalten des Computers die Zahl 76 ($4C) geschrieben. Das ist der Code für den Maschinenbefehl »JMP«, der soviel bedeutet wie GOTO. Bei USR springt nämlich das Programm auf die Speicherzelle 0, findet dort den Sprungbefehl und in den nachfolgenden Zellen 1 und 2 die Sprungadresse - und führt den Sprung auch gleich aus.
|
||||
|
||||
# Texteinschub Nr. 2: Die Low-/High-Byte-Darstellung
|
||||
|
||||
Eine Speicherzelle der kleinen Commodore-Computer VC 20 und C 64 hat eine Länge von 8 Bit = 1 Byte. Mit diesen 8 Bit können Zahlen von 0 bis 255 ($00FF) dargestellt werden. Zur Darstellung von Zahlen über 255 verwenden wir die Low-/High- Byte-Methode.
|
||||
|
||||
Wir hängen einfach zwei Speicherzellen zusammen, mit deren 16 Bit wir Zahlen bis maximal 65535 ($FFFF) darstellen können. Die maximale Zahl 65535 ist übrigens auch die höchste Adresse des gesamten Speichers - was natürlich kein Zufall ist.
|
||||
|
||||
Ich will Ihnen jetzt zeigen, wie eine Dezimalzahl auf zwei 8-Bit- Speicherzellen verteilt wird, und umgekehrt, wie aus 2 Byte eine Dezimalzahl gebildet wird.
|
||||
|
||||
Schauen Sie sich das folgende Beispiel an:
|
||||
|
||||
DEZIMAL 47491
|
||||
DUALZAHL 1011 | 1001 | 1000 | 0011
|
||||
HEX $ B | 9 | 8 | 3
|
||||
HIGH-BYTE 185 | -
|
||||
LOW-BYTE - | 131
|
||||
|
||||
Wir gehen von der Dezimalzahl 47491 aus. Ihre duale Darstellung mit 16 Bit - 1011100110000011 - teilen wir einfach in der Mitte und erhalten damit zwei neue Dual-Zahlen mit je 8 Bit = 1 Byte. Das linke Byte nennen wir »High-Byte«, da es den höheren Teil derGesamtzahl darstellt. Das rechte Byte heißt entsprechend »Low-Byte«.
|
||||
|
||||
Jedes der beiden Bytes kann für sich allein in einer Speicherzelle untergebracht werden, in der natürlich dann der dezimale Wert des Bytes steht.
|
||||
|
||||
In der Tabelle habe ich zur Vollständigkeit noch die hexadezimalen Werte eingefügt, die sehr schön zeigen, daß der Vorteil dieserZahlendarstellung darin liegt, daß jede Einzelziffer der 4-Bit-Dualzahl entspricht, genau so wie jede Zweiergruppe dem Byte (sowohl in Dual-, als auch in Dezimaldarstellung) und die vierstellige Zahl der großen Dezimal- und Dualzahl entspricht.
|
||||
|
||||
Zur Umrechnung der Low-/High-Bytes empfehle Ich folgende Kochrezepte:
|
||||
|
||||
## Dezimal in Low-/High-Byte
|
||||
|
||||
47491:256 = 185 (High-Byte), Rest 131 (Low-Byte)
|
||||
|
||||
Der Rest fällt bei der Division per Hand automatisch an. Mit dem (Taschen-)Rechner erhält man den Rest durch:
|
||||
|
||||
185*256-47491 = -131
|
||||
|
||||
## Low-/High-Byte in Dezimal
|
||||
|
||||
High-Byte * 256 + Low Byte = Dezimal
|
||||
185 * 256 + 131 = 47491
|
||||
|
||||
Wichtige Regel: Die Mikroprozessoren von VC 20 und C64 verlangen, daß immer das Low-Byte vor dem High-Byte kommen muß. Die Zahl wird sozusagen von rechts nach links gelesen (131/185).
|
||||
|
||||
# Texteinschub Nr. 3: Manipuliertes Basic
|
||||
Wie Sie durch PRINT PEEK (1) selbst leicht feststellen, steht nach dem Einschalten des Computers im Register 1 die Zahl 55. In dualer Darstellung ist das 110111. Das entspricht dem in der ersten Zeile derTabelle 2 dargestellten »Normalzustand« der einzelnen Bits.
|
||||
|
||||
Vergleichen Sie es bitte mit der Auflistung am Anfang der Beschreibung der Speicherzelle 1. Die in Tabelle 2 dargestellten Bits sind also die rechten drei Bits der Zelle 1.
|
||||
|
||||
Lassen wir die Bits 3, 4 und 5 unverändert, ergeben die acht Kombinationen der Tabelle 2 die Zahlen 55 bis 48. Durch den Befehl POKE 1,54 können wir nun den Basic-Übersetzer aus- schalten und 8 KByte Speicher gewinnen. Nur nutzt uns das nicht viel, denn was tun - ohne Basic! Es gibt aber doch eine Anwendung. Zuvor will ich Ihnen aber noch beweisen, daß wir tatsächlich den Block A auf RAM umschalten. Der Trick besteht darin, den Basic-Übersetzer vom ROM in den darunter liegenden RAM umzuladen. Wenn er tatsächlich in RAM steht, müßten wir ihn durch POKEn verändern können zu einem Privat-Basic. Geben Sie direkt ein:
|
||||
|
||||
FOR J=40960 TO 49151: POKE J,PEEK(J): NEXT J
|
||||
|
||||
POKE J, PEEK (J) - das sieht dümmer aus als es ist. Die »Doppeldecker-Speicher« erlauben nämlich ein PEEKen nur aus dem ROM-Bereich. Ein hineinPOKEn dagegen geht nur in den RAM-Teil. Von dort aber kann er - wie gerade gesagt - nicht herausgelesen werden, es sei denn, wir schalten um!
|
||||
|
||||
Merken Sie was? Die Zeile oben liest also den Inhalt des Basic- ROMs und schreibt ihn in den RAM mit identischen Adressen. Die Ausführung der Zeile braucht einige Zeit. Wenn der Cursor wieder blinkt, schalten wir das RAM ein mit:
|
||||
|
||||
POKE 1,54
|
||||
|
||||
Wir merken natürlich noch keinen Unterschied, denn das RAM-Basic ist ja noch dasselbe.
|
||||
|
||||
Doch nun werden wir es verändern. In der Speicherzelle 41220 steht das »P« für den Befehl PRINT mit dem ASCII-Codewert 80. Dieses P ersetzen wir durch ein »G« (ASCII-Code = 71).
|
||||
|
||||
POKE41220,71
|
||||
|
||||
Versuchen Sie bitte, mit dem (nicht durch »?« abgekürzten) PRINT-Befehl ein Zeichen auf den Bildschirm zu drucken. Es wird Ihnen nicht gelingen, denn der Befehl heißt jetzt:
|
||||
|
||||
GRINT "A"
|
||||
|
||||
was beweist, daß das Basic jetzt im RAM steht. Das Umdefinieren von Befehlen Ist natürlich wenig sinnvoll. Aber wer die Maschinenprogramme des Basic kennt, kann sie auf diese Weise ändern, erweitern, einschränken, solange er sich auf in sich geschlossene Teile beschränkt.
|
||||
|
||||
Eine inzwischen oft zitierte Anwendung stammt von Jim Butterfield, den es begreiflicherweise stört, daß der Befehl ASC, welcher den ASCII-Code eines Strings erzeugt, bei einem Null- String das Programm mit ILLEGAL QUANTITY ERROR beendet. Versuchen Sie es:
|
||||
|
||||
`PRINT ASC ("A")` ergibt die Zahl 65.
|
||||
|
||||
`PRINT ASC (" ")` hat die obige Fehlermeldung zur Folge.
|
||||
|
||||
Wenn Basic im RAM steht, können wir das ändern:
|
||||
|
||||
POKE 46991,5
|
||||
|
||||
Die Wiederholung des Befehls PRINT ASC (””) ergibt jetzt 0 - und, was das Wichtige ist, das Programm läuft weiter.
|
||||
|
||||
Durch zusätzliches Umladen des Speicherblocks E und anschließendes Umschalten mit POKE 1,53 ist auch das Betriebssystem veränderbar - ein weites Feld für fortgeschrittene Programmierer in Maschinensprache.
|
||||
|
||||
Die wohl wichtigste Anwendung der Umschaltmethode wird den Maschinen-Programmierern geboten, die dadurch eine kostenlose Speichererweiterung von 16 KByte erhalten. Bei gleichzeitiger Verwendung von Basic und Maschinenprogramm kann die Umschaltung besonders vorteilhaft eingesetzt werden. Das Umschaltprogramm muß dann aber ebenfalls in Maschinensprache geschrieben sein und darf nicht im Umschaltbereich liegen.
|
||||
|
||||
Das Umschalten von den Ein-/Ausgabe-Registern des Blocks D mit POKE 1,51 erlaubt, die Bitmuster der fest programmierten Zeichen aus dem Zeichen-ROM auszulesen, in einen freien RAM-Bereich zu bringen und dort dann nach eigenen Vorstellungen zu verändern.
|
||||
|
||||
|
||||
# Texteinschub Nr. 4: Zeiger, Vektoren und Flaggen
|
||||
|
||||
Zeiger und Vektoren sind Zahlenwerte, die jeweils in zwei benachbarten Speicherzellen stehen und in der Low-/High-Byte-Darstellung eine Adresse bilden.
|
||||
|
||||
Wir sprechen von einem »Zeiger«, wenn diese Adresse den Beginn von gespeicherten Daten angibt.
|
||||
|
||||
Ein »Vektor« zeigt ebenfalls auf eine Anfangsadresse, allerdings auf die eines Maschinenprogramms. Diese Unterscheidung wird leider nicht immer ganz eindeutig angewendet.
|
||||
|
||||
Eine »Flagge« besteht aus einem Zahlenwert in einer Speicherzelle, die von einem Programm dort abgelegt wird, um sich das Resultat einer Operation zu merken, beziehungsweise um es für eine spätere Verwendung bereitzuhalten.
|
||||
|
||||
|
||||
# Texteinschub Nr. 5: Die Zahlendarstellung bei den Commodore-Computern
|
||||
|
||||
## Gleitkomma-Zahlen
|
||||
|
||||
Für diejenigen Leser, die das Thema der Zahlendarstellung in den Commodore-Handbüchern großzügig übersprungen haben, stelle ich es hier noch einmal vor.
|
||||
|
||||
Sie kennen die gängigen vier Zahlentypen:
|
||||
|
||||
* ganze Zahlen: 15, 21, 244
|
||||
* Brüche; 2/3, 26/8, 15/14
|
||||
* negative Zahlen: -15, -255
|
||||
* positive Zahlen: 10, 5, 123
|
||||
|
||||
Ganze Zahlen bereiten uns und dem Computer keine Probleme.
|
||||
|
||||
Bei Brüchen sieht es schon anders aus. Erinnern Sie sich an
|
||||
die Bruchrechnungsstunden in der Schule? Wieviel ist 51/52 + 3/4!!!
|
||||
|
||||
Ohne lange zu überlegen, rechnen wir natürlich um, 51/52 = 0,9807692 und 3/4 = 0,75; addiert ist das Resultat 1,7307692 - und schon sind Sie mitten in den Gleitkomma-Zahlen.
|
||||
|
||||
Bei obigem Beispiel gleitet allerdings noch nichts. Bei sehr großen oder aber auch sehr kleinen Bruch-Zahlen reicht uns - und einem Computer - nicht der Platz, um sie darzustellen. Die Zahl 0,000000000000000123 sprengt jeden normalen Rahmen.
|
||||
|
||||
Daher schreiben wir sie anders. Wir lassen das Komma nach rechts gleiten, bis es die erste Ziffer, die von 0 verschieden ist, findet und für jede Null, die es passiert, multiplizieren wir die Zahl mit 10.
|
||||
|
||||
Die Zahl oben sieht dann so aus: 0,123 x 10 hoch 15 (eine 1 mit 15 Nullen).
|
||||
|
||||
Die Grundzahl vorn heißt »Mantisse«, die 10 mit Hochzahl heißt »Exponent«.
|
||||
|
||||
Alle Commodore-Computer verarbeiten intern alle Zahlen in dieser Darstellung, also als Gleitkommazahl.
|
||||
|
||||
|
||||
# Texteinschub Nr. 6: Was ist ein Stapelspeicher (Stack)?
|
||||
|
||||
Der normale Arbeitsspeicher des Computers, auf englisch »Random Access Memory« oder kurz RAM genannt, hat für jede Speicherzelle eine eigene Adresse, die beim Schreiben in den Speicher oder beim Lesen aus dem Speicher angegeben werden muß.
|
||||
|
||||
Als Analogie möge eine Aktenablage dienen, bei der jeder Akt (Brief, Papier, Zeichnung) in einen Ordner kommt, mit Nummer versehen.
|
||||
|
||||
Um einen Akt herauszuholen, muß man die Nummer (Adresse) kennen, unter der er abgelegt ist.
|
||||
|
||||
Ein Stapelspeicher, auf englisch »Stack« genannt, funktioniert wie eine Aktenablage, bel der jeder Akt einfach oben auf einen Stapel gelegt wird, daher der Name. Diese Ablage erfolgt ohne Kennzeichnung oder Nummer, einfach immer der Reihe nach.
|
||||
|
||||
Einen Akt kann man aus einem Stapelspeicher nicht beliebig herausholen, da immer nur der oberste Akt zugänglich ist.
|
||||
|
||||
Die Methode der Stapelspeicher bietet sich überall dort an, wo es auf die Reihenfolge der gespeicherten Daten ankommt. Basic merkt sich zum Beispiel der Reihe nach die Adressen, von denen aus mit GOSUB ein Unterprogramm angesprungen wird. Wenn mehrere GOSUBs hintereinander eingesetzt werden, liegt auf dem Stapel Immer die letzte Absprungadresse bereit zum Rücksprung.
|
||||
|
||||
Ein Stapelspeicher hat demnach nur eine einzige Adresse, die sowohl zum Abspeichern als auch zum Auslesen dieselbe Ist.
|
||||
|
||||
Voraussetzung eines Stapelspeichers ist natürlich eine Routine, welche alle gespeicherten Daten im Stapelspeicher um einen Platz weiterschiebt, wenn eine neue Information »oben auf den Stapel gelegt wird«.
|
||||
|
||||
Das Basic der Commodore-Computer verwendet mehrere dieser Stapelspeicher.
|
||||
Die Programmiersprache Forth ist völlig auf dem Prinzip des Stapelspeichers aufgebaut.
|
||||
|
||||
|
||||
# Texteinschub Nr. 7: Der sichtbare Basic-Speicher
|
||||
|
||||
Wenn wir den Variablen A die Adresse des Speicherbeginns der Basic-Programme zuordnen und dann mit einer FOR..NEXT- Schleife den Inhalt dieser und der nächsten 100 Speicherplätze ausdrucken, sehen wir in dezimaler Darstellung die ersten 101 Zahlenwerte, mit denen der Computer ein Basic-Programm speichert.
|
||||
|
||||
Ein Verbiegen des Zeigers in Speicherzelle 43/44 kann auf diese Weise in seiner Wirkung sichtbar gemacht werden.
|
||||
|
||||
Als Demo-Programm wähle ich zwei Zeilen, welche die Zahlen 1 bis 9 und die Buchstaben A bis I ausdrucken.
|
||||
|
||||
10 PRINT "123456789"
|
||||
20 PRINT "ABCDEFGHI"
|
||||
100 A=2049 : REM*C 64
|
||||
4097 : REM*VC 20 ohne Erweiterung
|
||||
1025 : REM*VC 20 mit 3 KByte
|
||||
4609 : REM*VC 20 mit 8 KByte oder mehr
|
||||
110 PRINT CHR$(l47)
|
||||
|
||||
Zeile 100 definiert den Speicheranfang. Zeile 110 löscht den Bildschirm.
|
||||
|
||||
120 FOR J=A T0 A+100
|
||||
130 PRINT PEEK (J);
|
||||
140 NEXT J
|
||||
|
||||
Die Befehle in den Zeilen 120 bis 140 drucken den Inhalt der ersten 101 Zellen dieses Basic-Programms aus. SAVEn Sie bitte dieses kleine Programm, denn wir brauchen es noch einmal. Dann geht es los mit RUN. In Bild 3 ist der Bildschirm-Ausdruck des VC 20 mit 8 KByte dargestellt, der des C 64 zeigt praktisch dieselbe Information.
|
||||
Überspringen Sie bitte zunächst die ersten beiden Zahlen. Die dritte und vierte Zahl ist 10 und 0. Das ist (als Low- und High- Byte) die Nummer der ersten Zeile des Basic-Programms. Dann folgt 153, das ist der interne Codewert für PRINT. Diese Codes für alle Basic-Befehlswörter heißen »TOKEN«, sie sind im Texteinschub Nr. 32 angegeben.
|
||||
|
||||
Die nächste Zahl auf dem Bildschirm ist die 34, sie ist der ASCII*Code für den Gänsefuß. Danach folgen in aufsteigender Reihenfolge die ASCII-Codes der Ziffern 1 (48) bis 9 (57). Danach sehen Sie wieder den Gänsefuß (34). Schließlich kommt eine Null als Abstandszeichen zur nächsten Basic-Zeile.
|
||||
|
||||
Machen Sie bitte folgendes Experiment: Ausgehend von der Adresse der ersten auf dem Bildschirm ausgedruckten Speicherzellen - zum Beispiel 4609 beim VC 20 mit 8 KByte - zählen Sie die Zellen weiter bis zur Abgrenzungs-Null. In meinem Beispiel steht die Null in Zeile 4625. Das heißt, daß die nächste Basic-Zeile in 4626 anfängt. Und das ist genau die Zahl, die in den ersten beiden Zellen steht, die wir vorhin übersprungen haben; in meinem Beispiel steht da 18 18. Machen wir die Probe: 18 + 256 * 18 = 4626.
|
||||
|
||||
Jede Basic-Zeile im Speicher beginnt also mit der Adresse der nächsten Zeile (sie heißt Koppeladresse) und endet mit einer Null.
|
||||
|
||||
Ab 4626 folgt dann die nächste Koppeladresse, danach mit 20 0 die Zeilennummer, und Sie erkennen jetzt sicher die Codes der Angaben von Zeile 20 wieder.
|
||||
|
||||
So, jetzt wollen wir den Zeiger in 43 und 44 verbiegen. Ich schlage vor, daß wir den Basic-Beginn um zehn Adressen höher schieben. Sie müssen jetzt die in Zeile 100 oben verwendete Zahl für A in die High-/Low-Byte-Darstellung umrechnen und das Low-Byte um 10 erhöhen. Dieses Zahlenpaar POKEn wir in die Zellen 43 und 44. Vorher müssen wir aber noch in Zelle (A + 10) -1 eine Abstands-Null POKEn.
|
||||
|
||||
Wir geben diese Befehlssequenz im Direktmodus ein:
|
||||
|
||||
* für den C 64:
|
||||
|
||||
POKE 2058,0:POKE 43,11:POKE 44,8:NEW
|
||||
|
||||
* für den VC 20 (GV):
|
||||
|
||||
POKE 5006,0:P0KE 43,143:POKE 44,19:NEW
|
||||
|
||||
* für den VC 20 (= 3 KByte):
|
||||
|
||||
POKE 1034,0:P0KE 43,11:POKE 44,4:NEW
|
||||
|
||||
* für den VC 20(> 8KByte)
|
||||
|
||||
POKE 4618,0:P0KE 43,H:POKE 44,18: NEW
|
||||
|
||||
Jetzt ist der Anfang des Basic-Speichers versetzt. Um das zu prüfen, geben wir das kleine Programm von oben nochmal ein und lassen es mit RUN laufen. Der resultierende Bildschirmausdruck ist in Bild 4 dargestellt.
|
||||
|
||||
Die ersten Zahlen sind genauso wie vorher. Es sind auch die Reste von vorher, da wir den Speicher nicht auf Null gesetzt haben. Aber zählen Sie bitte die ersten zehn Adressen hoch. Da finden Sie unser Programm von vorhin genau wieder, beginnend mit der Abstands-Null. Aber Vorsicht, lassen Sie sich nicht verwirren, denn die Koppeladressen sind natürlich jetzt auch jeweils um 10 höher. Aber hinter den Koppeladressen finden wir wieder unser Programm, in gleicher Weise dargestellt wie beim ersten Mal. Da der Zeiger in 43 und 44 von allen entsprechenden Routinen des Übersetzers und des Betriebssystems abgefragt wird, läuft ein verschobenes Programm fehlerfrei, solange natürlich der Zeiger nicht wieder verändert wird.
|
||||
|
||||
|
||||
# Texteinschub Nr. 8: Normale Variable in Basic
|
||||
|
||||
Alle Daten, die in einem Basic-Programm nicht in Form von READ-DATA-Anweisungen vorkommen, werden als »Variable« unmittelbar nach dem Basic-Programm abgespeichert. Wir unterscheiden dabei zwei Typen:
|
||||
|
||||
* normale Variable
|
||||
* Felder (Arrays)
|
||||
|
||||
Wir betrachten hier nur die »normalen« Variablen.
|
||||
|
||||
Sie erscheinen in dem Speicherbereich, dessen Beginn durch den Zeiger in den Zellen 45 und 46 und dessen Ende durch den Zeiger in 47 und 48 angegeben wird, in derselben Reihenfolge, in welcher sie während des Ablaufes des Basic-Programms auf- treten. Wenn Basic dann auf eine der bereits definierten (und abgespeicherten) Variablen zurückgreifen soll, muß es den gesamten Variablenbereich von Anfang an absuchen, bis es den Namen der gesuchten Variablen gefunden hat. Wenn diese Variable ganz am Ende des Bereiches steht, kann dieser Suchprozeß recht lange dauern.
|
||||
|
||||
## Regel 1:
|
||||
|
||||
Häufig vorkommende Variable sollen am Anfang des Variablenbereichs stehen. Das wird dadurch erreicht, daß sie als erste Variable in einem Programm »definiert« werden. Falls sie erst später im Programm gebraucht werden (aber dann häufig), werden sie trotzdem am Anfang des Programms angegeben, notfalls mit einem beliebigen Wert, der später dann keine Rolle mehr spielt und ersetzt wird. Man nennt das einen »Dummy«-Wert.
|
||||
|
||||
Die Felder-Variablen stehen direkt nach den »normalen« Variablen. Auch hier kann der gewiefte Programmierer Gutes tun. Wenn nämlich nach einer Definition eines Feldes später im Programm noch normale Variable dazukommen, ist natürlich zuerst kein Platz für sie da. Das Betriebssystem des Computers muß erst alle Felder-Variablen weiterschieben, bevor die Neuankömmlinge in dem dadurch erweiterten Variablenbereich gespeichert werden können. Auch das kostet unnötig viel Zeit.
|
||||
|
||||
## Regel 2:
|
||||
|
||||
Alle normalen Variablen sollen als erste in einem Programm definiert werden. Wer also drauflos programmiert, sollte zumindest am Ende das Programm so umbauen, daß diese simple Regel erfüllt wird.
|
||||
|
||||
|
||||
# Texteinschub Nr. 9: Darstellung der normalen Variablen im Speicher
|
||||
|
||||
Die normalen Variablen kommen in drei Arten vor:
|
||||
|
||||
* ganzzahlige Variablen
|
||||
* Gleitkomma-Variablen
|
||||
* String-Variablen (Zeichenketten)
|
||||
|
||||
Der Unterschied zwischen den drei Typen ist in den Commodore-Handbüchern gut erklärt, und ich verzichte hier auf eine Wiederholung. Ich will vielmehr direkt zeigen, wie die Variablen im Speicher abgelegt sind.
|
||||
|
||||
Wir können den Speicher direkt sichtbar machen.
|
||||
|
||||
Einmal geht das in Maschinencode mittels eines Monitors beziehungsweise Disassemblers.
|
||||
|
||||
Zum anderen aber geht das auch in Basic und zwar mit folgendem Trick, den ich Th. und M.L. Beyer (MC 10/1983) abgeschaut habe.
|
||||
|
||||
Wir verlegen den Beginn des Basic-Variablenspeichers einfach auf den Beginn des Bildschirmspeichers. Auf diese Weise können wir zwar kein vernünftiges Programm laufen lassen, aber alle direkt eingegebenen Variablen-Definitionen werden sofort sichtbar, weil sie eben im Bildschirmspeicher stehen.
|
||||
|
||||
Wir erreichen die Verlegung des Speichers durch »Verbiegen« der Zeiger in den Zellen 45 und 46 und 47 und 48. Die Bedeutung dieser Zeiger ist ja im Kurs erklärt.
|
||||
|
||||
Die Speicherverlegung beziehungsweise die Methode dazu ist für den C 64 anders als für den VC 20.
|
||||
|
||||
## VC 20:
|
||||
|
||||
Alle Angaben gelten für den VC 20 ohne Speichererweiterung, also ziehen Sie bitte alle Speichermodule heraus. Der Speicherbereich für Programme und deren Variablen beginnt jetzt ab Adresse 4096, das ist Block 1 im Bild 5. Der Bildschirmspeicher beginnt ab 7680. Wir verlegen jetzt den Bildschirmspeicher in den Block 1, so daß er ebenfalls ab Adresse 4096 beginnt. Danach müssen wir noch eine Farbe - am besten Schwarz - in den Farbspeicher POKEn, der in dieser neuen Konfiguration von 37888 bis 38399 liegt. Warum das so Ist, erklärt Christoph Sauer in seinem Aufsatz »Der gläserne VC 20«, Teil 4, im 64'er 1/85, Seite 131.
|
||||
|
||||
Das High-Byte der Adresse, in welcher der Bildschirmspeicher beginnt, steht in der Speicherzelle 648. Sie können das jederzeit mit PRINT PEEK(648) nachprüfen. Umgekehrt können wir eine Zahl hineinPOKEn, wodurch der Bildschirmspeicher verschoben wird. In unserem Fall erhalten wir das High-Byte für 4096 durch 4096/256 = 16.
|
||||
|
||||
Machen Sie jetzt bitte folgende Schritte:
|
||||
|
||||
1) direkt eingeben: POKE 648,l6(RETURN),
|
||||
2) RUN/STOP und RESTORE drücken, bis der Cursor wieder da ist,
|
||||
3) direkt eingeben:
|
||||
|
||||
FOR J = 37888 TO 38399: POKE J,0: NEXT J (RETURN),
|
||||
|
||||
4) mit der DELETE-Taste (nicht mit CLR !) den ganzen Text des Bildschirms löschen,
|
||||
5) mit dem Cursor etwa acht Zeilen nach unten gehen,
|
||||
6) mit der Commodore- und SHIFT-Taste zusammen auf die Groß- und Kleinschrift umstellen.
|
||||
|
||||
Schritt 1 und 3 habe ich oben schon erklärt. Schritt 4 ist nicht absolut notwendig, aber ein leerer Bildschirm ist für uns besser. Die CLR-Taste würde Schritt 3 zunichte machen. Schritt 5 erlaubt uns, weiter unter auf dem Bildschirm Variablen einzugeben, ohne den oberen Teil vollzuschreiben. Schritt 6 schließlich erleichtert das Erkennen der Variablen-Darstelllung.
|
||||
|
||||
## C 64:
|
||||
|
||||
Beim C 64 beginnt der Bildschirmspeicher ab 1024. In Low-/ High-Byte-Darstellung ist das 0/4 (1024/256=4, Rest 0). Geben Sie bitte direkt ein:
|
||||
|
||||
POKE 46,4 :POKE 48,4
|
||||
|
||||
Das Low-Byte in 45 und 47 können wir weglassen, da es ja in beiden Fällen 0 ist. Diese Methode gilt für alle neueren C 64, bei denen direkt ein Zeichen in den Bildschirmspeicher gePOKEt werden kann, ohne sich um die Zeichenfarbe kümmern zu müssen. Es gibt noch einige C 64 mit älteren Betriebssystemen, bei denen die Zeichenfarbe auch angegeben werden muß. Hier gilt:
|
||||
|
||||
FOR J = 0 TO 1000:POKE 55296*3,14:NEXT J
|
||||
|
||||
## Alles weitere gilt für beide Computertypen gleich
|
||||
|
||||
Wenn Sie jetzt den Bildschirm löschen, den Cursor ungefähr in die Mitte des Bildschirms fahren und wiederum direkt eingeben:
|
||||
|
||||
`VARIABLE = 3` und die RETURN-Taste drücken, dann erscheinen oben sieben Zeichen. Bitte schalten Sie mit der SHIFT- und Commodore-Taste auf den zweiten Zeichensatz um, jetzt können wir besser lesen.
|
||||
|
||||
Aus anderen Kursen wissen Sie wahrscheinlich, daß Variable mit 7 Byte dargestellt werden. In der Tat sehen wir oben die ersten beiden Buchstaben des Variablennamens VA und fünf weitere Zeichen. Wir wollen aber systematisch vorgehen und uns zuerst die ganzzahligen Variablen anschauen.
|
||||
|
||||
### Ganzzahl-Variable
|
||||
|
||||
Wiederholen Sie bitte den Vorgang (Löschen, Cursor auf Mitte, 2. Zeichensatz). Jetzt geben Sie eine Ganzzahl-Variable ein:
|
||||
|
||||
VA%=3
|
||||
|
||||
Nach RETURN sehen wir als erstes Zeichen ein reverses V, dann ein reverses A, den Klammeraffen @, das kleine c und nochmals drei @. Die beiden ersten Zeichen des Variablennamens (besteht er nur aus einem Zeichen, wird mit einer 0 aufgefüllt) werden mit ihrem ASCII-Code eingegeben, zu dem bei Ganzzahl-Variablen zur Kennzeichnung einer solchen die Zahl 128 addiert wird.
|
||||
|
||||
Schauen Sie in einer ASCII-Tabelle (64’er, Ausgabe 7/84) nach: Das V hat 86, um 128 erhöht gibt das 214. Wir arbeiten hier aber im Bildschirmspeicher, der die Zahlen auf seine eigene Weise interpretiert, nämlich als Bildschirmcode. Der Bildschirmcode-Tabelle entnehmen wir das Zeichen für den Wert 214 und das ist das invertierte V. Für das A können Sie das selbst nachvollziehen.
|
||||
|
||||
Also: In unserer Darstellung erkennen wir Ganzzahl-Variable an den invertierten Zeichen des Namens.
|
||||
|
||||
Das 3. und 4. Zeichen sind das High- und Low-Byte des Variablenwertes und zwar im Bildschirmcode. In unserem Beispiel der 3 ist das High-Byte 0, also der Klammeraffe @, das Low-Byte 3, also das c. Die restlichen drei Byte sind mit 0 aufgefüllt.
|
||||
|
||||
Wenn Sie mit dem Cursor auf die 3 fahren, es mit einer 5 überschreiben und RETURN drücken, verwandelt sich das c in ein e. Beim Überschreiben mit 255 erscheint als 4. Byte das Zeichen für den Bildschirmcode 255. Beim Überschreiben mit 257 ändern sich beide Bytes. Das 3. (High-)Byte springt auf a (=1), das 4. (Low-)Byte ebenfalls auf a. Nun, 1 * 256+1 = 257.
|
||||
|
||||
Während, wie bewiesen, das Low-Byte von 0 bis 255 gehen kann, sind beim High-Byte nur Werte zwischen 0 und 127 zugelassen. Die Werte ab 128 signalisieren negative Zahlen. Probieren Sie es aus:
|
||||
|
||||
127 * 256+255=32767
|
||||
|
||||
Ein Überschreiben mit 32767 resultiert in einer Darstellung der Zeichen für den Bildschirmcode 127 und 255. Der Wert 32768 wird nicht mehr akzeptiert. Dasselbe machen wir noch schnell für negative Zahlen.
|
||||
|
||||
Überschreiben Sie bitte die letzte Zahl mit 0. Wie zu erwarten war, sind Byte 4 und 5 jetzt 0 (Klammeraffe).
|
||||
|
||||
Wenn Sie jetzt mit -1 überschreiben, erscheint für beide Bytes das Zeichen mit dem Bildschirmcode 255. Bei -2 sehen wir die Zeichen mit den Code-Werten 255 und 254.
|
||||
|
||||
Sie sehen also, daß die negativen Zahlen für ganzzahlige Variable sozusagen vom Ende der Tabelle her dargestellt werden, wobei die höchste negative Zahl wieder 32767 ist. Diese »Rückwärtszählung« ist bedingt durch die Methode der negativen Zahlendarstellung im Zweierkomplement. Der Platz und die Gelegenheit verbieten es mir, näher darauf einzugehen. Aber ich glaube, unser kleines Experiment hat Ihnen zumindest von der Darstellung her den Zusammenhang gezeigt. In Bild 6 ist diese Darstellung der ganzzahligen Variablen im Speicher wiedergegeben.
|
||||
|
||||
| 1 | 2 | 3 | 4 | 5 6 7 |
|
||||
|---------|---------|--------|--------|---------|
|
||||
| Erstes | Zweites | High- | Low- | |
|
||||
|-------------------|-----------------|---------|
|
||||
| Zeichen des | Byte des Varia- | 0 0 0 |
|
||||
| Variablen-Namens | blenwertes | |
|
||||
| (ASCII-Wert + 128)| | |
|
||||
|
||||
Bild 6. So stehen ganzzahlige Variable im Speicher
|
||||
|
||||
### Gleitkomma-Variable
|
||||
|
||||
Ich hoffe, Sie verzeihen mir, wenn ich diese Darstellung an dieser Stelle überspringe. Sie ist nämlich nicht ganz leicht zu verstehen, und ich möchte sie lieber dann im Detail erklären, wenn wir zur Diskussion der Speicherzellen 97 bis 101, nämlich des Gleitkomma-Akkumulators kommen. Da geht es in einem Stück. Als Vorgeschmack gebe ich jetzt in Bild 7 nur die Zusammenfassung an.
|
||||
|
||||
| 1 | 2 | 3 | 4 5 6 7 |
|
||||
|---------|---------|----------|--------------------------|
|
||||
| Erstes | Zweites | | |
|
||||
|-------------------| | Mantisse mit Genauig- |
|
||||
| Zeichen des | Exponent | keit von 32 Dualstellen, |
|
||||
| Variablen-Namens | + 129 | 1. Bit des 1. Bytes ist |
|
||||
| (ASCII-Wert) | | das Vorzeichen |
|
||||
|
||||
Bild 7. Gleitkomma-Variable
|
||||
|
||||
### String-Variable
|
||||
|
||||
Zuerst ist es erforderlich, den Computer in den Anfangszustand zurückzusetzen. Wenn Sie einen RESET-Schalter haben, bitte diesen drücken, sonst aber aus- und einschalten. Wir geben nach Löschen des Bildschirms in der unteren Hälfte direkt ein:
|
||||
|
||||
ZX$="A" <RETURN>
|
||||
|
||||
Wir erhalten ein Z, ein invertiertes X, ein kleines a, ein grafisches Zeichen, eine Leerstelle und zwei Klammeraffen.
|
||||
|
||||
Fahren Sie bitte jetzt mit dem Cursor auf das A und ändern den String um in BC. Nach RETURN verwandelt sich das a in das b, das 4. Zeichen ändert sich ebenfalls. Die ersten beiden Zeichen sind also wieder der Name der Variable.
|
||||
|
||||
Um zu kennzeichnen, daß es eine String-Variable ist, erscheint das 2. Zeichen des Namens invertiert. Wie oben entsteht es dadurch, daß zum ASCII-Code die Zahl 128 addiert wird. Diese Zahl wird aber wieder als Bildschirmcode interpretiert und entsprechend angezeigt (vergleichen Sie es mit den ASCII- und Bildschirmcode-Tabellen).
|
||||
|
||||
Das 3. Zeichen gibt die Länge des Strings an, also im ersten Fall mit a (=1 im Bildschirmcode), im 2. Fall mit b (=2). Zeichen 4 und 5 geben als Low- und High-Byte die Adresse an, bei der begonnen wird, den Text des Strings zu speichern. Das können wir nachprüfen.
|
||||
|
||||
Wir hatten die beiden Fälle:
|
||||
|
||||
1. ZX$ = ”A": 4. Zeichen: (Bildschirmcode: 255) und 5. Zeichen: (Bildschirmcode 156) ergibt als Adresse 40959.
|
||||
2. ZX$ = ”BC": 4. Zeichen: (Bildschirmcode 253) und 5. Zeichen: (Bildschirmcode 156) ergibt als Adresse 40957.
|
||||
|
||||
Der Text der Zeichenketten wird am Ende des Arbeitsspeichers (40959 beim C 64, 7679 beim VC 20 ohne Erweiterung) abgelegt und zwar von hinten nach vorn.
|
||||
|
||||
Mit `PRINT PEEK(40957);PEEK(40958);PEEK(40959)` drucken wir den Inhalt dieser Speicherzellen aus und erhalten: 66 67 65. Im ASCII-Code ist das: B C A. Die Zusammenfassung für String-Variable (Bild 8) sieht so aus:
|
||||
|
||||
| 1 | 2 | 3 | 4 | 5 | 6 7 |
|
||||
|---------|---------|---------|---------|---------|------|
|
||||
| Erstes | Zweites | | High- | Low- | 0 0 |
|
||||
|-------------------| Anzahl |---------|---------| |
|
||||
| Zeichen des | der | Byte der Adresse, | |
|
||||
| Variablen-Namens | Zeichen | ab welcher der | |
|
||||
| ASCII- | ASCII- | des | Text des Strings | |
|
||||
| Wert | Wert+128| Strings | abgespeichert ist | |
|
||||
|
||||
Bild 8. String-Variable
|
||||
|
||||
## Texteinschub Nr. 10: Felder in Basic
|
||||
|
||||
Zur Wiederholung: Es gibt zwei Arten von Variablen, normale Variable und Felder. Jede der beiden Arten ihrerseits kann aus Gleitkomma-Zahlen, ganzen Zahlen oder Zeichenketten bestehen.
|
||||
|
||||
Eine normale Variable kann immer nur einen Wert haben, ein Feld enthält gleichzeitig viele Werte, alle unter demselben Variablen-Namen.
|
||||
|
||||
Wir können uns ein Feld mit dem Namen KARLSTRASSE als eine Liste vorstellen, in der jedes Element zwar auch den Namen Karlstraße hat, sich aber von den anderen Elementen durch eine eigene Hausnummer unterscheidet. Jede Variable in einer Hausnummer hat einen bestimmten Wert.
|
||||
|
||||
Während eine normale Variable einfach mit A=3 einen Wert zugewiesen bekommt, muß ein Feld erst definiert werden, nämlich wie viele Elemente es enthält. Wir machen das mit dem Befehl
|
||||
|
||||
DIM KARLSTRASSE (12)
|
||||
|
||||
Dieses Feld hat 13 Elemente (von 0 bis 12). Jedem Element kann nun ein Variablenwert zugewiesen werden durch
|
||||
|
||||
KARLSTRASSE (0)=25
|
||||
KARLSTRASSE (1)=56
|
||||
|
||||
Das Feld KARLSTRASSE hat in der Klammer nur eine Zahl, man sagt, es hat nur eine Dimension.
|
||||
|
||||
Ein zweidimensionales Feld entspricht einem Schachbrett, mit Zahlen in der einen und Buchstaben in der anderen Dimension. Wir definieren es mit:
|
||||
|
||||
DIM AX (7,7)
|
||||
|
||||
AX ist der Name, jede Dimension hat acht Elemente, insgesamt kann das Feld 64 Werte enthalten.
|
||||
|
||||
Ein dreidimensionales Feld entspricht einem Quader, oder bei gleicher Elementenzahl pro Dimension (Seite) einem Würfel. Dieses wird dimensioniert mit
|
||||
|
||||
DIM BY (125,6,2)
|
||||
|
||||
Die Anzahl der Dimensionen wird nur begrenzt durch den verfügbaren Speicherplatz. Wieviel Bytes pro Feld gebraucht wer- den, entnehmen Sie bitte der Erklärung bei der Darstellung der Feld-Variablen (Texteinschub Nr. 11).
|
||||
|
||||
Ein Feld, das wie bisher gezeigt dimensioniert wird, enthält Gleitkomma-Zahlen.
|
||||
|
||||
Ein Feld mit ganzen Zahlen wird durch das Zeichen % nach dem Namen gekennzeichnet, also:
|
||||
|
||||
DIM CZ%(.,.,.)
|
||||
|
||||
Ein Feld mit Zeichenketten dagegen hat nach dem Namen das übliche Zeichen $, also:
|
||||
|
||||
DIM DT$(..,..,..)
|
||||
|
||||
»Wozu brauche ich Felder, wenn ich auch normale Variable verwenden kann?«, werden Sie vielleicht noch fragen.
|
||||
|
||||
Felder haben den großen Vorteil, daß immer dann, wenn viele Variable in einem Programm vorkommen, die alle einen gewissen Zusammenhang haben, viel Speicherplatz gespart werden kann.
|
||||
|
||||
Eine normale Variable braucht 7 Byte, eine Feld-Variable nur 5 oder bei ganzen Zahlen sogar nur 2 Byte. Zugegeben, vorher steht noch ein längerer Kopf, aber halt nur einmal. Und das zahlt sich bei vielen Variablen sehr rasch aus.
|
||||
|
||||
Und schließlich muß ich noch darauf hinweisen, daß die »Hausnummern« oder Indizes der Elemente innerhalb eines Programms durch mathematische Operationen verändert und manipuliert werden können. Aber das ist natürlich höhere Programmierkunst und geht über diese kurze Einführung hinaus.
|
||||
|
||||
|
||||
# Texteinschub Nr. 11: Darstellung der Felder-(Array-)Variablen im Speicher
|
||||
|
||||
Die Felder-Variablen kommen in drei Arten vor:
|
||||
|
||||
* als ganze Zahlen,
|
||||
* als Gleitkomma-Zahlen,
|
||||
* als Zeichenketten.
|
||||
|
||||
Sie sind in dem Texteinschub Nr. 10 »Felder in Basic« kurz beschrieben.
|
||||
|
||||
Wir wollen sie uns hier mit den Methoden anschauen, welche ich für den C 64 und für den VC 20 in dem Texteinschub Nr. 9 »Darstellung der normalen Variablen im Speicher« beschrieben habe.
|
||||
|
||||
Beim C 64 ist allerdings ein Zusatz dabei. Sie müssen, am besten gleich am Anfang, noch eingeben:
|
||||
|
||||
POKE 44,4:NEW
|
||||
|
||||
Ein eventuell auftretender SYNTAX ERROR soll uns nicht weiter stören.
|
||||
|
||||
Wenn Sie also das jeweilige Kochrezept ausgeführt und damit den Bildschirm- und den Variablenspeicher auf dieselbe Adresse gelegt haben, können wir anfangen.
|
||||
|
||||
## Gleitkomma-Feld
|
||||
|
||||
Geben Sie direkt ein:
|
||||
|
||||
DIM AB(1,2,3)
|
||||
|
||||
Wir dimensionieren also ein Feld mit dem Namen AB, es hat drei Dimensionen, die erste Dimension hat zwei (0,1) Werte, die zweite hat drei und die dritte hat vier Werte. Sobald Sie die RETURN-Taste drücken, erscheint das Feld auf dem Bildschirm. Wir sehen folgende Zeichen: A, B, invertiertesC , @ c @ d @ c @ b plus 120 Klammeraffen @.
|
||||
|
||||
Die ersten zwei Stellen sind der Name des Feldes in der Darstellung für Gleitkomma-Variable, wie in der letzten Folge beschrieben wurde. Die dritte und vierte Stelle geben im Bildschirmcode als Low- und High-Byte die Länge des Feldes an (das inverse C = 131, das © = 0, bitte nachzählen). Die fünfte Stelle zeigt die Anzahl der Dimensionen (c = 3) an. Ab der sechsten Stelle stehen die Anzahl der Elemente der Dimension (diesmal als High- und Low-Byte) und zwar beginnend mit der letzten Dimension. In unserem Falle ist das also in Stelle 6 und 7 ein @ und d (0 - 3 =4=d), Stelle 8 und 9 sind dasselbe für die zweite Dimension und schließlich Stelle 10 und 11 für die erste Dimension (0 - 1=2=b). Danach folgen entsprechend der Anzahl der dimensionierten Elemente (2*3*4=24) 6 Byte pro Element (24*5=120), die vorerst auf 0 = @ stehen, die aber mit den Werten der Elemente aufgefüllt werden.
|
||||
|
||||
Dieses Auffüllen wollen wir nachvollziehen. Geben Sie bitte direkt ein:
|
||||
|
||||
AB(0,0,0)=5
|
||||
|
||||
Wir weisen damit dem allerersten Element des Feldes den Wert 5 zu.
|
||||
|
||||
In der oberen Darstellung des Feldes AB ändern sich dadurch Byte 12 und 13. Das neu erschienene inverse C und die Leerstelle mit den drei nachfolgenden @ ist die Gleitkomma- Darstellung (Mantisse und Exponent) der Zahl 5. Auf diese Darstellung werde ich später im Verlauf dieses Kurses bei der Besprechung der Speicherzelle 97 noch genauer eingehen.
|
||||
|
||||
Wenn wir jetzt (durch Überschreiben der vorigen Anweisung) zusätzlich noch eingeben:
|
||||
|
||||
AB(1,0,0)=6
|
||||
|
||||
erreichen wir eine entsprechende Änderung der Bytes 17 und 18, also des zweiten Elements des Feldes.
|
||||
|
||||
In Bild 9 sind die Stellen eines Gleitkomma-Feldes grafisch dargestellt.
|
||||
|
||||
1 2 3 4 5 6 7 / a b c d e
|
||||
|---------|---------|------|------|--------|------|------|-\ |------|------|---------|---|---|---|---|-->
|
||||
| Erstes | Zweites | Low | High | | High | Low | / | High | Low | |
|
||||
| | Byte | Anzahl | Byte | \ | Byte |Exponent Mantisse |
|
||||
| Zeichen des |-------------| der |-------------| / |-------------| +125 |
|
||||
| Feld-Namens | Länge des | Dimen- | Anzahl der | \ | Anzahl der | des 1. Elements| des 2. Elements
|
||||
| | Feldes | sionen | Elemente | / | Elemente | |
|
||||
| | | | der letzten | \ | der ersten | |
|
||||
| | | | Dimension | / | Dimension | |
|
||||
|---------|---------|------|------|--------|-------------|-\-|-------------|---------|---|---|---|---|-->
|
||||
|<----------------------- KOPF ----------------------->| /
|
||||
|
||||
Bild 9. Gleitkomma-Feld
|
||||
|
||||
## Ganzzahliges Feld
|
||||
|
||||
Im Vergleich zu dem Gleitkomma-Feld dimensionieren wir als nächstes ein ganzzahliges Feld:
|
||||
|
||||
DIM AB%(l,2,3)
|
||||
|
||||
Jetzt erscheint auf dem Bildschirm gleich anschließend an das erste Feld eine neue Darstellung: invertiertes A, invertiertes B, ;, @, c@, d, @, c, @b plus 48 Klammeraffen @.
|
||||
|
||||
Die ersten 11 Byte haben dieselbe Bedeutung wie beim Gleitkomma-Feld, aber nur deswegen, weil wir dieselben drei Dimensionen mit identischer Elementenzahl dimensioniert haben. Bei mehr Dimensionen wäre dieser Kopf natürlich länger. Die inverse Darstellung des Feldnamens signalisiert ein ganzzahliges Feld. Die dritte Stelle zeigt das »;« - im Bildschirmcode ist das die 59. In der Tat ist das Feld nur 59 Byte lang, also wesentlich weniger als das Gleitkomma-Feld. Die 2 * 3 * 4=24 Elemente benötigen in der Ganzzahl-Darstellung nur je 2 Byte (24*2=48+11=59). Womit bewiesen ist, daß eine Ganzzahl- Darstellung mit dem Zeichen % erheblich Speicherplatz spart - allerdings nur bei Feldern!
|
||||
|
||||
Jetzt wollen wir noch den Inhalt des Feldes füllen, so wie vorher mit:
|
||||
|
||||
AB%(0,0,0)=5
|
||||
|
||||
... und prompt ändert sich Byte Nummer 13 in ein e (e = 5).
|
||||
|
||||
Eine Eingabe für das zweite Element:
|
||||
|
||||
AB$(1,0,0)=6
|
||||
|
||||
verändert das 15. Byte in ein f.
|
||||
|
||||
In Bild 10 ist der Inhalt eines Ganzzahl-Feldes grafisch dargestellt.
|
||||
|
||||
1 2 3 4 \ a b c d
|
||||
|---|---|---|---|--/--|------|------|------|------|-->
|
||||
| \ | Low | High | Low | High |
|
||||
| / | Byte | Byte |
|
||||
| KOPF \ |-------------|-------------|
|
||||
| (wie in Bild 2) / | | |
|
||||
| \ | des | des | des
|
||||
| / | 1. Elements | 2. Elements | 2. Elements
|
||||
| \ | | |
|
||||
|---|---|---|---|--/--|------|------|------|------|->
|
||||
\
|
||||
|
||||
Bild 10. Ganzzahliges Feld
|
||||
|
||||
## Felder mit Zeichenketten
|
||||
|
||||
Die Dimensionierung eines Feldes mit Zeichenketten sieht so aus:
|
||||
|
||||
DIM AB$(1,2,3)
|
||||
|
||||
Auf dem Bildschirm erscheint jetzt ein Feld:
|
||||
|
||||
Auch hier zeigen die ersten elf Stellen dieselbe Information wie bei den anderen Feldern. Zur Kennzeichnung des Zeichenketten-Feldes ist das zweite Zeichen des Feldnamens invers dargestellt. Zeichen 3 und 4 geben wieder die Länge des Feldes an. Das S hat den Bildschirmcode 83. (Vorsicht! Da wir im Groß-/Kleinbuchstaben-Modus sind, müssen wir die jeweils rechte Seite der Spalten in der Code-Tabelle nehmen). Die Länge 83 minus 11 Kopfstellen ergibt 72 Byte, geteilt durch 24 (2*3*4 = 24 Elemente) erhalten wir 3 Byte zur Darstellung eines Elements.
|
||||
|
||||
Das erste Byte gibt die Länge der Zeichenkette an, das zweite und dritte Byte (Low-/High-Byte) die Adresse, ab der die Zeichenkette im vierten Block gespeichert ist.
|
||||
|
||||
Die Methode ist also dieselbe wie bei den »normalen« Zeichenketten-Variablen. Das wollen wir uns auch noch ansehen. Geben Sie direkt ein:
|
||||
|
||||
AB$(0,0,0) = "AAAAAA"
|
||||
|
||||
In der Darstellung des Feldes ändern sich dadurch die Stellen 12, 13 und 14 und wir sehen
|
||||
|
||||
* beim C 64:
|
||||
* beim VC 20:
|
||||
|
||||
Im Bildschirm steht dafür:
|
||||
|
||||
* C 64: 6 250 159 das heißt 6 Zeichen, ab Adresse 250+159*256=40959
|
||||
* VC 20: 6 250 29 das heißt 6 Zeichen, ab Adresse 250+29*256=7674
|
||||
|
||||
Jetzt weisen wir dem letzten Element auch noch eine Zeichenkette zu:
|
||||
|
||||
AB$(1,2,3)="BB"
|
||||
|
||||
Die letzten drei Stellen des Feldes ändern sich ebenfalls, wobei die erste mit dem b eine Zeichenkettenlänge von 2 angibt, dementsprechend muß die Anfangsadresse um 2 niedriger sein als die vorher definierte Kette: Das Low-Byte 250 - 2 = 248, in der Codetabelle finden wir dafür das, was auch im Feld steht. Das High-Byte bleibt unverändert.
|
||||
|
||||
Bild 11 zeigt die grafische Darstellung des Zeichenketten-Feldes.
|
||||
|
||||
Als letztes zeige ich Ihnen noch die im vierten Block gespeicherten Zeichenketten. Wir drucken einfach den CHR$-Wert der in den betreffenden Speicherzellen stehenden Codezahlen aus mit:
|
||||
|
||||
* VC 20:
|
||||
|
||||
FOR I=248 TO 255:PRINT CHR$(PEEK(29*256+I));:NEXT
|
||||
|
||||
* C 64:
|
||||
|
||||
FOR I=248 TO 255:PRINTCHR$(PEEK(159*256+I));:NEXT
|
||||
|
||||
... und wir erhalten die beiden Zeichenketten in umgekehrter Reihenfolge, also vom Speicherende her eingespeichert. Interessant ist, daß sich vor die Felder - wenn Sie sie noch auf dem Bildschirm hatten - die neu definierte Gleitkomma-Variable l@ geschoben hat. Auch das ist eine Demonstration des Speicherverfahrens der Variablen, genauso wie ich es Ihnen in der letzten Folge erklärt habe.
|
||||
|
||||
1 2 3 4 \ a b c d e f
|
||||
|---|---|---|---|--/--|----------|-------|-------|-----|-----|-----|-->
|
||||
| \ | Länge | Low | High | |
|
||||
| / | der | Byte | |
|
||||
| KOPF \ | Zeichen- |---------------| |
|
||||
| (wie in Bild 2) / | kette der Adresse, | |
|
||||
| \ | ab der der | |
|
||||
| / | String ge- | |
|
||||
| \ | | speichert ist | |
|
||||
|---|---|---|---|--/--|--------------------------|-----------------|-->
|
||||
\ |<--- 1. Element --->|<- 2. Element ->|
|
||||
|
||||
Bild 11. Zeichenketten-Feld
|
||||
|
||||
|
||||
## Texteinschub Nr. 12: Darstellung der Variablen einer selbstdefinierten Funktion
|
||||
|
||||
Ich habe Ihnen gezeigt, wie im Programmspeicher abgelegte normale Variablen und Felder-Variablen sichtbar gemacht werden können. Damit konnten wir den Aufbau und die Darstellung der einzelnen Variablenarten studieren.
|
||||
|
||||
Heute will ich einen weiteren Variablentyp vorstellen, nämlich den der selbstdefinierten Funktionen.
|
||||
|
||||
Sie erinnern sich vielleicht, mit dem Basic-Befehl »DEF FN (Name)(Variable)« können wir komplizierte Funktionen selbst erfinden, definieren und später als »FN (Name)(Variable)< weiter verarbeiten. Diesen Typ wollen wir uns anschauen, wie er im Speicher steht.
|
||||
|
||||
Im Prinzip verwenden wir dieselben Methoden zur Sichtbarmachung wie die letzten Male.
|
||||
|
||||
Aber ein Unterschied kommt noch dazu. Der Befehl DEF kann leider nicht direkt eingegeben werden, sondern muß immer als Teil einer Programmzeile mit einer Zeilennummer versehen sein.
|
||||
|
||||
Deshalb schreiben wir zuerst ein kleines Programm zur Definition der Funktion plus Variable, bevor wir den Variablenspeicher mit dem Bildschirmspeicher zusammenlegen:
|
||||
|
||||
10 DEF FNAA(X)=3*SIN(X)+COS(X)
|
||||
20 X=5
|
||||
30 PRINT FNAA(X)
|
||||
|
||||
Die Funktion hat also den Namen »AA«. Bevor wir weitermachen, überprüfen Sie bitte mit RUN, ob alles stimmt. Nun wird der Speicher verschoben.
|
||||
|
||||
**Für den C 64 gilt:**
|
||||
|
||||
1. POKE 46,4:POKE 48,4
|
||||
2. Bildschirm löschen mit CLR-Taste
|
||||
3. Cursor auf die Mitte fahren
|
||||
4. LIST (es erscheint das Programm)
|
||||
5. auf den 2. Zeichensatz umschalten (mit C= und SHIFTTaste)
|
||||
6. RUN
|
||||
|
||||
**Für den VC 20 (ohne. Erweiterung) gilt:**
|
||||
|
||||
Nur den Bildschirm auf 4096 zu verschieben, wie das letzte Mal, geht diesmal nicht, da wir ja für DEF ein kleines Programm schreiben müssen.
|
||||
|
||||
Also legen wir Bild- und Variablenspeicher ab Adresse 5120 (5120/256=20).
|
||||
|
||||
1. POKE 46,20:CLR
|
||||
2. POKE 648,20
|
||||
3. STOP/RESTORE-Tasten, bis Cursor wieder da ist
|
||||
4. Bildschirm löschen mit CLR-Taste
|
||||
5. dfe ersten vier bis sechs Zeilen mit SPACE-Taste überfahren
|
||||
6. Cursor ein paar Zeilen nach unten
|
||||
7. LIST (es erscheint das Programm)
|
||||
8. mit Commodore- und SHIFTTaste auf 2. Zeichensatz umschalten
|
||||
9. RUN
|
||||
|
||||
Wir sehen jetzt oben zwei Gruppen mit je sieben Zeichen, wie üblich.
|
||||
|
||||
Die erste Gruppe stellt die Funktion FNAA(x) dar. Sie ist gekennzeichnet durch das invertierte erste Zeichen des Namens, während das zweite Zeichen normal erscheint.
|
||||
|
||||
Das dritte und vierte Zeichen gibt in Low-/High-Byte- Darstellung (im Bildschirmcode) die Adresse an, ab der die Funktion FNAA(x) im Programmspeicher abgelegt ist. Mit `PEEK (3. Zeichen)+256*PEEK (4. Zeichen)` kann das abgefragt werden.
|
||||
|
||||
Das fünfte und sechste Zeichen nennt die Adresse, an welcher der Zahlenwert der Funktions-Variablen X anfängt. Das siebente Zeichen schließlich ist das erste Zeichen der Funktion selbst (in unserem Beispiel die 3).
|
||||
|
||||
Die zweite Gruppe beschreibt die Variable X der Funktion. Die normale Darstellung der beiden ersten Zeichen, die den Namen darstellen, gibt uns an, daß es sich um eine Gleitkomma-Variable handelt, deren Wert als Mantisse und Exponent dargestellt ist. Der Aufbau einer Funktion ist in Bild 12 zusammengefaßt:
|
||||
|
||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|
||||
|---------|---------|---------|---------|----------|----------|---------|
|
||||
| Erstes | Zweites | Low- | High- | Low- | High- | |
|
||||
|-------------------|---------|---------|----------|----------|---------|
|
||||
| Zeichen des | Byte der Adresse, | Byte der Adresse, | 1. Zei- |
|
||||
| Funktionsnamens | ab der die | ab dem der jewei- | chen |
|
||||
|---------|---------| Funktion abge- | lige Wert der Funk- | der |
|
||||
| ASCII- | ASCII- | speichert ist | tionsvariablen X | Funk- |
|
||||
| Wert+128| Wert | | abgespeichert ist | tion |
|
||||
|
||||
Bild 12. Selbstdefinierte Funktion
|
||||
|
||||
|
||||
# Texteinschub Nr. 13: Wie zufällig sind Zufallszahlen?
|
||||
|
||||
Der Befehl RND(X) ergibt eine Zufallszahl zwischen 0 und 1 - so steht es im Commodore-Handbuch.
|
||||
|
||||
Eine Zufallszahl ist definitionsgemäß rein dem Zufall überlassen. Ihr Wert kann nicht vorhergesehen werden. Wie kann aber ein Computer, in dem alle Vorgehensweisen und Arbeitsschritte fest vorprogrammiert sind, eine zufällige Zahl erzeugen? Die Commodore-Computer machen das so:
|
||||
|
||||
Der Befehl RND nimmt eine bestimmte Ausgangszahl (auf die ich noch näher eingehen werde), auf englisch »seed« = Samen genannt, multipliziert sie mit 11879546.4 und zählt 3.92767778 * 10^8 dazu. Die 5 Byte der resultierenden Gleitkommazahl werden miteinander vertauscht und in einen positiven Bruch umgewandelt. Diese Manipulation ergibt die »Zufallszahl«, die als neuer »Samen« in den Speicherzellen 139 bis 143 gespeichert wird.
|
||||
|
||||
Es ist sicher einzusehen, daß die Zufälligkeit nicht sehr hoch sein kann, es sei denn, die oben genannte und noch nicht erklärte Ausgangszahl ist zufällig.
|
||||
|
||||
Die erste Ausgangszahl hängt vom »Argument« des RND(X)-Befehls ab, das heißt vom Wert X, der in der Klammer dahinter steht. Es gibt drei Möglichkeiten für das Argument:
|
||||
|
||||
* eine positive Zahl (egal, welcher Wert)
|
||||
* eine negative Zahl
|
||||
* die Zahl 0
|
||||
|
||||
## Eine positive Zahl
|
||||
|
||||
zum Beispiel RND (1) oder RND(56) nimmt als Samen die Zahl 0.811635157, die beim Einschalten des Computers als 5-Byte- Gleitkommazahl in die Speicherzellen 139 bis 143 geschrieben worden ist. In den fünf Zellen stehen die Zahlen 128, 79, 199, 82, 88.
|
||||
|
||||
Daraus folgt aber, daß nach dem Einschalten des Computers mit RND(1) immer dieselbe Sequenz von Zufallszahlen erzeugt wird. Schalten Sie bitte den Computer aus und ein und geben Sie ein:
|
||||
|
||||
10 PRINT RND(1):G0T0 10
|
||||
|
||||
Notieren Sie die ersten paar Zahlen und wiederholen Sie mit Aus-/Einschalten die Prozedur. Sie werden immer dieselben Zahlen sehen.
|
||||
|
||||
Zum Austesten von Programmen mit bekannten Zahlensequenzen ist diese Methode sicher wichtig, aber echte Zufallszahlen sind das nicht!
|
||||
|
||||
## Eine negative Zahl
|
||||
|
||||
zum Beispiel RND(-1)oder RND(-95) bringt als erstes das Argument selbst (in meinem Beispiel -1 oder -95) als Gleitkommazahl in die Speicherzellen 139 bis 143, von wo sie als Samen den schon beschriebenen Manipulationen unterworfen wird. Nur - mit einem bestimmten negativen Argument erhalten Sie immer dieselbe Zufallszahl. Probieren Sie es aus: PRINT RND(-2) ergibt immer dieselbe Zahl.
|
||||
|
||||
Es mag Fälle geben, wo die Vorgabe des allerersten Samens wünschenswert ist. Ich will aber von zufälligen Zählen sprechen. Wir können diese Methode des negativen Arguments dadurch verbessern, daß wir als Argument selbst eine Zufallszahl nehmen.
|
||||
|
||||
Als derartige Zahl bietet sich der Wert der inneren Uhr TI an, die beim Einschalten des Computers losläuft und 60mal in der Sekunde weitergestellt wird. Da kein Mensch wissen kann, welchen Wert die UhrTI gerade hat, kommt der Befehl RND(-TI) dem absoluten Zufall schon sehr nahe.
|
||||
|
||||
## Das Argument (0)
|
||||
|
||||
verwendet eine andere Methode. Als Samen nimmt er eine sich ständig ändernde Zahl, die beim VC 20 aus vier Registerinhalten des VIC-lnterface-Bausteins genommen werden. Beim C 64 wird es ähnlich gemacht, nur ist der VIC-Baustein ein anderer Typ.
|
||||
|
||||
Mit derselben Methode nach dem Einschalten wie im ersten Fall oben können Sie das leicht überprüfen.
|
||||
|
||||
Ich habe eingangs zitiert, daß RND(X) eine Zahl zwischen 0 und 1 erzeugt; das gilt aber nur für ein positives Argument. Wenn Sie hingegen eine Zufallszahl innerhalb eines ganz bestimmten Bereiches brauchen, müssen Sie anders vorgehen.
|
||||
|
||||
## Kochrezept Nr. 1
|
||||
|
||||
Mit folgender Formel ist derZahlenbereich beliebig vorgebbar: `X=(RND(1)*A)+B`
|
||||
|
||||
* Die Zahl A gibt einen Bereich von 0 bis A vor.
|
||||
* Die Zahl B legt den untersten Wert des Bereiches fest.
|
||||
|
||||
Beispiele:
|
||||
|
||||
* `10 PRINT (RND(1)*6)+1:GOTO 10` erzeugt Zahlen von 1 bis 6
|
||||
* `10 PRINT (RND(1)*52)+1:G0T0 10` erzeugt Zahlen von 1 bis 52
|
||||
* `10 PRINT (RND(1)*6)+10:G0T0 10` erzeugt Zahlen von 10 bis 16
|
||||
|
||||
Mit dem Vorschalten der Funktion INT vor den Befehl RND werden die Zufallszahlen auf ganze Zahlen beschränkt.
|
||||
|
||||
10 PRINT INT (RND(1)*6)+10:GOTO 10
|
||||
|
||||
Noch einmal: Zufallszahlen innerhalb bestimmter Zahlenbereiche sind gekoppelt mit einem positiven Argument. Wir haben aber gesehen, daß gerade so keine echten Zufallszahlen erzeugt werden. Deshalb brauchen wir noch ein zweites Kochrezept.
|
||||
|
||||
## Kochrezept Nr. 2
|
||||
|
||||
Wenn Sie in einem Programm nach dem Einschalten des Computers immer neue Zufallszahlen brauchen, ist es empfehlenswert, für die allererste Zufallszahl RND(-TI) oder RND(0) zu verwenden, dann aber mit RND(1) fortzufahren.
|
||||
|
||||
Dasselbe gilt, wenn ein Programm wegen INPUT oder WAIT eine Pause hat. Nach der Pause sollte zuerst ein neuer Ausgangswert genommen werden.
|
||||
|
||||
Als letztes will ich noch beschreiben, wie man Zufallszahlen innerhalb von Maschinenprogrammen erzeugen kann.
|
||||
|
||||
Im Betriebssystem steht natürlich eine Routine für den Befehl RND. Im C 64 beginnt sie ab 57495 ($E097), im VC 20 ab 57492 ($E094).
|
||||
|
||||
Der Ausgangswert (Samen) wird dabei aus dem Gleitkomma-Akkumulator Nr. 1 geholt, dessen Vorzeichen oder Wert 0 das weitere Vorgehen der Routine bestimmt.
|
||||
|
||||
Sie müssen also den Samen in den Akkumulator Nr. 1 laden und dann mit JSR auf die RND-Routine springen. Als Resultat können Sie einen oder mehrere Werte der Zellen 140 bis 143 verwenden und nach Belieben weiterverarbeiten.
|
||||
341
combine.py
341
combine.py
|
|
@ -1,341 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import cgi, re, os
|
||||
|
||||
filenames = [
|
||||
"c64disasm_ms.txt;c64disasm_cbm.txt",
|
||||
"c64disasm_de.txt",
|
||||
"c64disasm_en.txt",
|
||||
"c64disasm_sc.txt",
|
||||
"c64disasm_mn.txt",
|
||||
"c64disasm_mm.txt"
|
||||
]
|
||||
names = [
|
||||
"Microsoft/Commodore Source",
|
||||
"Data Becker [German]",
|
||||
"Lee Davison",
|
||||
"Bob Sander-Cederlof [BASIC only]",
|
||||
"Magnus Nyman [KERNAL only]",
|
||||
"Marko Mäkelä"
|
||||
]
|
||||
links = [
|
||||
"https://github.com/mist64/cbmsrc",
|
||||
"https://www.pagetable.com/?p=1015",
|
||||
"https://www.pagetable.com/?p=726",
|
||||
"https://www.pagetable.com/?p=728",
|
||||
"https://www.telecomm.at/documents/Jiffydos_Romlisting.doc",
|
||||
"http://www.unusedino.de/ec64/technical/misc/c64/romlisting.html"
|
||||
]
|
||||
descriptions = [
|
||||
"The original M6502 BASIC source by Microsoft (KIM-1 version, not everything lines up, Commodore extensions are missing, but lots of comments by the original authors)<br/>and the original C64 KERNAL source by Commodore (lots of comments by the original authors)",
|
||||
"German-language comments from <i>Das neue Commodore-64-intern-Buch</i> by Data Becker, ISBN 3890113079. Some minor corrections have been made.",
|
||||
"Comments from <i>The almost completely commented C64 ROM disassembly V1.01</i> by Lee Davison. Some minor corrections have been made.",
|
||||
"Comments adapted from <i>S-C DocuMentor for Applesoft</i> by Bob Sander-Cederlof, for the version of Microsoft BASIC that shipped with the Apple II.",
|
||||
"Comments from <i>JIFFYDOS version 6.01/version 6.02</i> by Magnus Nyman (Harlekin/FairLight), which were written for the JiffyDOS KERNAL, so some serial code and all tape code is missing comments.",
|
||||
"Comments from the <i>Commodore 64 BASIC/KERNAL ROM Disassembly Version 1.0 (June 1994)</i> by Marko Mäkelä."
|
||||
]
|
||||
|
||||
|
||||
titlecolor = ["017100", "004D7F", "99195E", "F8BA00", "B51700", "017B76"]
|
||||
darkcolor = ["D8F2CB", "C6E2FC", "BFB7E8", "FCF6CD", "F4D2E3", "D2F6F0"]
|
||||
lightcolor = ["E5F2DF","E3F0FC","D5D1E8","FCFAE6","F5E4EC","E1F5F2"]
|
||||
|
||||
asm_donor_index = 1
|
||||
source_index = 0 # we treat the Microsoft/Commodore source differently
|
||||
|
||||
f = os.popen("git log -1 --pretty=format:%h .")
|
||||
revision = f.read()
|
||||
f = os.popen("git log -1 --date=short --pretty=format:%cd .")
|
||||
date = f.read()
|
||||
|
||||
data = []
|
||||
linenumber = []
|
||||
address = []
|
||||
for filename in filenames:
|
||||
d = []
|
||||
for f in filename.split(";"):
|
||||
d += [line.rstrip() for line in open(f)]
|
||||
data.append(d)
|
||||
linenumber.append(0)
|
||||
address.append(0)
|
||||
files = len(filenames)
|
||||
|
||||
asmaddress = 0
|
||||
asmlinenumber = 0
|
||||
|
||||
for i in range(0, files):
|
||||
while True:
|
||||
line = data[i][linenumber[i]]
|
||||
if len(line) > 0 and line[0] == '.':
|
||||
break
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
|
||||
print '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'
|
||||
print '<title>Ultimate Commodore 64 BASIC & KERNAL ROM Disassembly</title>'
|
||||
print ''
|
||||
print '<script language="javascript">'
|
||||
print ' window.onload = init;'
|
||||
print ' function init() {'
|
||||
print ' var tbl = document.getElementById("disassembly_table");'
|
||||
print ' for (var i = 0; i < ' + str(len(filenames)) + '; i++) {'
|
||||
print ' var key = "column_" + i;'
|
||||
print ' var element_name = "checkbox_" + i;'
|
||||
print ' var checked = localStorage.getItem(key) != "hidden";'
|
||||
print ' document.getElementById(element_name).checked = checked;'
|
||||
print ' hideCol(i, checked);'
|
||||
print ' }'
|
||||
print ' }'
|
||||
print ' function hideCol(col, checked) {'
|
||||
print ' var tbl = document.getElementById("disassembly_table");'
|
||||
print ' for (var i = 0; i < tbl.rows.length; i++) {'
|
||||
print ' tbl.rows[i].cells[col+1].style.display = checked ? "" : "none";'
|
||||
print ' }'
|
||||
print ' var key = "column_" + col;'
|
||||
print ' if (checked) {'
|
||||
print ' localStorage.removeItem(key);'
|
||||
print ' } else {'
|
||||
print ' localStorage.setItem(key, "hidden");'
|
||||
print ' }'
|
||||
print ' }'
|
||||
print '</script>'
|
||||
print ''
|
||||
# http://tholman.com/github-corners/
|
||||
print '<a href="https://github.com/mist64/c64disasm" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#004080; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>'
|
||||
print '<style type="text/css">'
|
||||
print ''
|
||||
print 'body {'
|
||||
print ' background: #e0f0ff;'
|
||||
print ' color: #004080;'
|
||||
print ' font-family: Helvetica'
|
||||
print '}'
|
||||
print ''
|
||||
print 'a {'
|
||||
print ' color: #0060a0;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'h3 {'
|
||||
print ' font-family: serif;'
|
||||
print '}'
|
||||
print ''
|
||||
print '.com {'
|
||||
print ' white-space: pre;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'th.com {'
|
||||
print ' font-weight: bold;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'div {'
|
||||
print ' padding: 1em;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'div.disassembly_container {'
|
||||
print ' padding: 1em 0em 1em 16em;'
|
||||
print ' overflow: scroll;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table {'
|
||||
print ' border-collapse: collapse;'
|
||||
print ' border: solid 1px #0060a0;'
|
||||
print ' color: black;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'tr, td, th {'
|
||||
print ' margin: 0px;'
|
||||
print ' text-align:left;'
|
||||
print ' vertical-align: text-top;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table {'
|
||||
print ' border: solid grey;'
|
||||
print ' border-width:0px 0px 1px 0px;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table td, table.disassembly_table th {'
|
||||
print ' padding: 2px 4px;'
|
||||
print ' border: solid grey;'
|
||||
print ' border-width:0px 1px 0px 1px;'
|
||||
print ' font-family: monospace;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table th.top_row {'
|
||||
print ' border-width: 1px;'
|
||||
print ' color: #e0f0ff;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table th.left_column {'
|
||||
print ' position: absolute;'
|
||||
print ' width: 18em;'
|
||||
print ' left: 8px;'
|
||||
print ' z-index: 11;'
|
||||
print ' border: 1px solid #000;'
|
||||
print ' border-radius: 2px;'
|
||||
print ' color: #e0f0ff;'
|
||||
print ' background: #0060a0;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table th.left_column a {'
|
||||
print ' color: #e0f0ff;'
|
||||
print '}'
|
||||
print ''
|
||||
|
||||
for i in range(0, len(filenames)):
|
||||
print 'table.disassembly_table th.top_row:nth-of-type(' + str(i+2) + ') {'
|
||||
print ' background: #' + titlecolor[i] + ';'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table tr td:nth-of-type(' + str(i+1) + ') {'
|
||||
print ' background: #' + darkcolor[i] + ';'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table tr:nth-child(even) td:nth-of-type(' + str(i+1) + ') {'
|
||||
print ' background: #' + lightcolor[i] + ';'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.checkbox_table tr:nth-of-type(' + str(i+1) + ') {'
|
||||
print ' background: #' + lightcolor[i] + ';'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.checkbox_table tr:nth-of-type(' + str(i+1) + ') td:nth-of-type(2) {'
|
||||
print ' background: #' + titlecolor[i] + ';'
|
||||
print '}'
|
||||
print ''
|
||||
|
||||
print 'table.disassembly_table tr {'
|
||||
print ' background: #f0f0f0;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.disassembly_table tr:nth-child(even) {'
|
||||
print ' background: #ffffff;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.checkbox_table {'
|
||||
print ' border-color: #0060a0;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.checkbox_table a {'
|
||||
print ' color: #e0f0ff;'
|
||||
print '}'
|
||||
print ''
|
||||
print 'table.checkbox_table tr, table.checkbox_table td {'
|
||||
print ' padding: 4px 8px;'
|
||||
print ' border: solid #0060a0;'
|
||||
print ' border-width:1px 0px 1px 0px;'
|
||||
print '}'
|
||||
print ''
|
||||
print '</style>'
|
||||
print '<body>'
|
||||
|
||||
print '<h1>Ultimate Commodore 64 BASIC & KERNAL ROM Disassembly</h1>'
|
||||
|
||||
print '<p><i>by <a href="http://www.pagetable.com/">Michael Steil</a>, <a href="https://github.com/mist64/c64disasm">github.com/mist64/c64disasm</a>. Revision ' + revision + ', ' + date + '</i></p>'
|
||||
|
||||
print '<b>This allows you to view different commentaries side-by-side. You can enable/disable individual columns:</b><br/><br/>'
|
||||
print '<table class="checkbox_table">'
|
||||
for i in range(0, len(filenames)):
|
||||
print '<tr><td><input type="checkbox" id="checkbox_' + str(i) + '" checked onclick="hideCol(' + str(i) + ', document.getElementById(\'checkbox_' + str(i) + '\').checked);" /></td><td style="white-space: nowrap;"><b><a href="' + links[i] + '">' + names[i] + '</a></b><td>' + descriptions[i] + '</td></tr>'
|
||||
print '</table>'
|
||||
|
||||
print '<div class="disassembly_container">'
|
||||
print '<table id="disassembly_table" class="disassembly_table">'
|
||||
|
||||
print '<tr>'
|
||||
print '<th class="left_column">Disassembly</th>'
|
||||
for i in range(0, files):
|
||||
print '<th class="top_row">' + names[i] + '</th>'
|
||||
print '</tr>'
|
||||
|
||||
count = 0
|
||||
while(True):
|
||||
count += 1
|
||||
# if count > 80:
|
||||
# break
|
||||
|
||||
for i in range(0, files):
|
||||
if linenumber[i] >= len(data[i]):
|
||||
continue
|
||||
while len(data[i][linenumber[i]]) > 0 and (data[i][linenumber[i]][0] == '-' or data[i][linenumber[i]][0] == '#'):
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
if asmlinenumber >= len(data[asm_donor_index]):
|
||||
break
|
||||
|
||||
asm = data[asm_donor_index][asmlinenumber][0:32].rstrip()
|
||||
asmlinenumber = asmlinenumber + 1
|
||||
|
||||
if len(asm) == 0:
|
||||
continue
|
||||
if asm[0] == '#' or asm[0] == '-':
|
||||
continue
|
||||
|
||||
has_address = False
|
||||
if asm[0] == '.':
|
||||
hexaddress = asm[2:6]
|
||||
asmaddress = int(hexaddress, 16)
|
||||
has_address = True
|
||||
|
||||
hex_numbers = re.findall(r'\$[0-9A-F][0-9A-F][0-9A-F][0-9A-F]', asm)
|
||||
for hex_number in hex_numbers:
|
||||
if (hex_number[1] == 'A' or hex_number[1] == 'B' or hex_number[1] == 'E' or hex_number[1] == 'F'):
|
||||
asm = asm.replace(hex_number, "<a href=\"#" + hex_number[1:] + "\">" + hex_number + "</a>")
|
||||
|
||||
print '<tr>'
|
||||
print '<th class="left_column">'
|
||||
if has_address:
|
||||
print "<a name=\"" + hexaddress + "\"/>"
|
||||
print '<span class="com">' + asm + '</span></th>'
|
||||
|
||||
for i in range(0, files):
|
||||
print '<td>'
|
||||
comments = []
|
||||
while True:
|
||||
if linenumber[i] >= len(data[i]):
|
||||
break
|
||||
|
||||
line = data[i][linenumber[i]]
|
||||
|
||||
if line.startswith('.'):
|
||||
address[i] = int(line[2:6], 16)
|
||||
if address[i] > asmaddress:
|
||||
break
|
||||
comment = line[32:]
|
||||
comment = cgi.escape(comment)
|
||||
|
||||
hex_numbers = re.findall(r'\$[0-9A-F][0-9A-F][0-9A-F][0-9A-F]', comment)
|
||||
for hex_number in hex_numbers:
|
||||
if (hex_number[1] == 'A' or hex_number[1] == 'B' or hex_number[1] == 'E' or hex_number[1] == 'F'):
|
||||
comment = comment.replace(hex_number, "<a href=\"#" + hex_number[1:] + "\">" + hex_number + "</a>")
|
||||
|
||||
if comment.startswith('***'):
|
||||
comment = '<h3>' + comment[3:] + '</h3>'
|
||||
elif comment.startswith('SUBTTL'):
|
||||
comment = '<h3>' + comment[6:] + '</h3>'
|
||||
elif comment.startswith('.LIB '):
|
||||
comment = '<h3>' + comment + '</h3>'
|
||||
else:
|
||||
scomment = comment.lstrip()
|
||||
|
||||
if scomment.startswith(';'):
|
||||
comment = '<b>' + comment + '</b>'
|
||||
|
||||
if len(comment) != 0:
|
||||
comment = '<span class="com">' + comment + '</span><br />'
|
||||
|
||||
if len(comment) != 0:
|
||||
comments.append(comment)
|
||||
|
||||
linenumber[i] = linenumber[i] + 1
|
||||
|
||||
if len(comments):
|
||||
for comment in comments:
|
||||
print comment
|
||||
else:
|
||||
print ' '
|
||||
|
||||
print "</td>"
|
||||
print "</tr>"
|
||||
|
||||
print '</table>'
|
||||
print '</div>'
|
||||
print '</body>'
|
||||
252
style.css
Normal file
252
style.css
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
|
||||
/* Colors */
|
||||
|
||||
:root {
|
||||
--main-background: #e0f0ff;
|
||||
--main-color: #004080;
|
||||
|
||||
--highlight-background: #006ad5;
|
||||
|
||||
--border-color: #0060a0;
|
||||
|
||||
--title-color-1: #017100;
|
||||
--title-color-2: #004D7F;
|
||||
--title-color-3: #99195E;
|
||||
--title-color-4: #F8BA00;
|
||||
--title-color-5: #B51700;
|
||||
--title-color-6: #017B76;
|
||||
--title-color-7: #595959;
|
||||
--title-color-8: #714a00;
|
||||
|
||||
--dark-color-1: #D8F2CB;
|
||||
--dark-color-2: #C6E2FC;
|
||||
--dark-color-3: #BFB7E8;
|
||||
--dark-color-4: #FCF6CD;
|
||||
--dark-color-5: #F4D2E3;
|
||||
--dark-color-6: #D2F6F0;
|
||||
--dark-color-7: #E0E0E0;
|
||||
--dark-color-8: #F2E4CB;
|
||||
|
||||
--light-color-1: #E5F2DF;
|
||||
--light-color-2: #E3F0FC;
|
||||
--light-color-3: #D5D1E8;
|
||||
--light-color-4: #FCFAE6;
|
||||
--light-color-5: #F5E4EC;
|
||||
--light-color-6: #E1F5F2;
|
||||
--light-color-7: #EDEDED;
|
||||
--light-color-8: #F2EBDF;
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
|
||||
body {
|
||||
background: var(--main-background);
|
||||
color: var(--main-color);
|
||||
font-family: Helvetica;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--border-color);
|
||||
}
|
||||
|
||||
div {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
div.body {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
|
||||
/* Navigation */
|
||||
|
||||
.topnav {
|
||||
background-color: #333;
|
||||
overflow: hidden;
|
||||
padding: 0px;
|
||||
border-bottom: solid 2px var(--main-color);
|
||||
}
|
||||
|
||||
.topnav a, .topnav h1 {
|
||||
float: left;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
margin: 0px;
|
||||
text-decoration: none;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.topnav a {
|
||||
color: white;
|
||||
border-right:solid 1px var(--main-background);
|
||||
}
|
||||
|
||||
.topnav h1 {
|
||||
color: black;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.topnav a:hover {
|
||||
background-color: var(--main-background);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.topnav a.active {
|
||||
background-color: var(--highlight-background);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border: solid 1px var(--border-color);
|
||||
color: black;
|
||||
}
|
||||
|
||||
tr, td, th {
|
||||
margin: 0px;
|
||||
text-align:left;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
th.com {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/* Overview Table */
|
||||
|
||||
table.checkbox_table tr, table.checkbox_table td {
|
||||
padding: 4px 8px;
|
||||
border: solid var(--border-color);
|
||||
border-width:1px 0px 1px 0px;
|
||||
}
|
||||
|
||||
table.checkbox_table a {
|
||||
color: var(--main-background);
|
||||
}
|
||||
|
||||
|
||||
/* Overview Table: Multicolor */
|
||||
|
||||
table.checkbox_table tr:nth-of-type(1) { background: var(--light-color-1); }
|
||||
table.checkbox_table tr:nth-of-type(1) td:nth-of-type(2) { background: var(--title-color-1);}
|
||||
|
||||
table.checkbox_table tr:nth-of-type(2) { background: var(--light-color-2); }
|
||||
table.checkbox_table tr:nth-of-type(2) td:nth-of-type(2) { background: var(--title-color-2); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(3) { background: var(--light-color-3); }
|
||||
table.checkbox_table tr:nth-of-type(3) td:nth-of-type(2) { background: var(--title-color-3); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(4) { background: var(--light-color-4); }
|
||||
table.checkbox_table tr:nth-of-type(4) td:nth-of-type(2) { background: var(--title-color-4); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(5) { background: var(--light-color-5); }
|
||||
table.checkbox_table tr:nth-of-type(5) td:nth-of-type(2) { background: var(--title-color-5); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(6) { background: var(--light-color-6); }
|
||||
table.checkbox_table tr:nth-of-type(6) td:nth-of-type(2) { background: var(--title-color-6); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(7) { background: var(--light-color-7); }
|
||||
table.checkbox_table tr:nth-of-type(7) td:nth-of-type(2) { background: var(--title-color-7); }
|
||||
|
||||
table.checkbox_table tr:nth-of-type(8) { background: var(--light-color-8); }
|
||||
table.checkbox_table tr:nth-of-type(8) td:nth-of-type(2) { background: var(--title-color-8); }
|
||||
|
||||
|
||||
/* Main Table */
|
||||
|
||||
|
||||
table.disassembly_table {
|
||||
border: solid grey;
|
||||
border-width:0px 0px 1px 0px;
|
||||
}
|
||||
|
||||
table.disassembly_table td, table.disassembly_table th {
|
||||
padding: 2px 4px;
|
||||
border: solid grey;
|
||||
border-width:0px 1px 0px 1px;
|
||||
}
|
||||
|
||||
|
||||
table.disassembly_table th.left_column,
|
||||
table.disassembly_table th.label_column,
|
||||
table.disassembly_table th.decimal_column {
|
||||
position: absolute;
|
||||
border: 1px solid #000;
|
||||
border-radius: 2px;
|
||||
color: var(--main-background);
|
||||
background: var(--border-color);
|
||||
}
|
||||
|
||||
|
||||
table.disassembly_table th.left_column {
|
||||
left: 8px;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
|
||||
th.left_column a {
|
||||
color: var(--main-background);
|
||||
}
|
||||
|
||||
th.left_column a:target {
|
||||
color: yellow;
|
||||
text-shadow: 0px 1px black;
|
||||
}
|
||||
|
||||
/*
|
||||
th.left_column a:target::before {
|
||||
content: "▹";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
table.disassembly_table th.top_row {
|
||||
color: var(--main-background);
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
table.disassembly_table tr { background: #f0f0f0; }
|
||||
table.disassembly_table tr:nth-child(even) { background: #ffffff; }
|
||||
|
||||
|
||||
/* Main Table: Multicolor */
|
||||
|
||||
table.disassembly_table th:nth-child(1 of .top_row) { background: var(--title-color-1); }
|
||||
table.disassembly_table th:nth-child(2 of .top_row) { background: var(--title-color-2); }
|
||||
table.disassembly_table th:nth-child(3 of .top_row) { background: var(--title-color-3); }
|
||||
table.disassembly_table th:nth-child(4 of .top_row) { background: var(--title-color-4); }
|
||||
table.disassembly_table th:nth-child(5 of .top_row) { background: var(--title-color-5); }
|
||||
table.disassembly_table th:nth-child(6 of .top_row) { background: var(--title-color-6); }
|
||||
table.disassembly_table th:nth-child(7 of .top_row) { background: var(--title-color-7); }
|
||||
table.disassembly_table th:nth-child(8 of .top_row) { background: var(--title-color-8); }
|
||||
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(1) { background: var(--dark-color-1); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(1) { background: var(--light-color-1); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(2) { background: var(--dark-color-2); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(2) { background: var(--light-color-2); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(3) { background: var(--dark-color-3); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(3) { background: var(--light-color-3); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(4) { background: var(--dark-color-4); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(4) { background: var(--light-color-4); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(5) { background: var(--dark-color-5); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(5) { background: var(--light-color-5); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(6) { background: var(--dark-color-6); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(6) { background: var(--light-color-6); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(7) { background: var(--dark-color-7); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(7) { background: var(--light-color-7); }
|
||||
|
||||
table.disassembly_table tr td:nth-of-type(8) { background: var(--dark-color-8); }
|
||||
table.disassembly_table tr:nth-child(even) td:nth-of-type(8) { background: var(--light-color-8); }
|
||||
|
||||
Loading…
Reference in a new issue