goapple2/docs/chivalry-debug.org

254 lines
6.8 KiB
Org Mode
Raw Normal View History

2013-04-21 23:49:58 +00:00
* Debugging the Chivalry disk
Ascending memory references from $1F76.
** Disassembly of routine that is overwriting from $1F76
$73,$74
$77,$78
$5B
$5C
$5D
$62
$1F51: A0 00 LDY #$00
$1F53: B1 73 LDA ($73),Y
$1F55: 85 5C STA $5C
$1F57: C8 INY
$1F58: B1 73 LDA ($73),Y
$1F5A: 85 5B STA $5B
$1F5C: C8 INY
$1F5D: 18 CLC
$1F5E: 98 TYA
$1F5F: 65 73 ADC $73
$1F61: 85 73 STA $73
$1F63: A9 00 LDA #$00
$1F65: 65 74 ADC $74
$1F67: 85 74 STA $74
$1F69: 20 9C 1D JSR $1D9C
$1F6C: A2 00 LDX #$00
$1F6E: A0 00 LDY #$00
$1F70: A5 5C LDA $5C
$1F72: 85 5D STA $5D
$1F74: B1 73 LDA ($73),Y
$1F76: 91 77 STA ($77),Y
$1F78: C8 INY
$1F79: C6 5D DEC $5D
$1F7B: D0 F7 BNE $1F74
$1F7D: 18 CLC
$1F7E: 98 TYA
$1F7F: 65 73 ADC $73
$1F81: 85 73 STA $73
$1F83: A9 00 LDA #$00
$1F85: 65 74 ADC $74
$1F87: 85 74 STA $74
$1F89: E6 62 INC $62
$1F8B: C6 5B DEC $5B
$1F8D: D0 DA BNE $1F69
$1F8F: 60 RTS
** Routine it calls: $1D9C
$5E
$61
$62
$64
$77
$78
$1D9C: A5 62 LDA $62
$1D9E: AA TAX
$1D9F: 0A ASL
$1DA0: 0A ASL
$1DA1: 29 1C AND #$1C
$1DA3: 85 78 STA $78
$1DA5: 8A TXA
$1DA6: 6A ROR
$1DA7: AA TAX
$1DA8: 6A ROR
$1DA9: 6A ROR
$1DAA: 6A ROR
$1DAB: 08 PHP
$1DAC: 29 03 AND #$03
$1DAE: 05 78 ORA $78
$1DB0: 05 5E ORA $5E
$1DB2: 85 78 STA $78
$1DB4: 8A TXA
$1DB5: 29 60 AND #$60
$1DB7: 85 77 STA $77
$1DB9: 6A ROR
$1DBA: 28 PLP
$1DBB: 6A ROR
$1DBC: 29 98 AND #$98
$1DBE: 05 77 ORA $77
$1DC0: 85 77 STA $77
$1DC2: A6 61 LDX $61
$1DC4: BD D2 1D LDA $1DD2,X
$1DC7: 18 CLC
$1DC8: 65 77 ADC $77
$1DCA: 85 77 STA $77
$1DCC: BD 5E 1E LDA $1E5E,X
$1DCF: 85 64 STA $64
$1DD1: 60 RTS
** Boot sector addresses
$26 buffer pointer
$2B boot slot
$3D Last bsectr read
$3E address btemp
$5C offset to reader
* apple][js shim
disk_categories['Local Saves'].push({category: 'Game', filename: 'http://localhost:8000/chivalry.json', name: 'Chivalry'})
* Nybble files
** apple2js
d5 aa 96 ff fe aa aa af af fa fb de aa eb
d5 aa ad ff 96 96 a7 9d ae 96 d6 b4 ed 96 96 96 a7 9e b2 96 d6 b6 f2
9b 96 96 a7 96 b2 97 d7 b6 ef 9a 96 96 9d 97 97 96 d6 b5 ee 97 96 96
96 96 96 96 d6 b9 f9 9a 9b a7 ae ae 96 96 d6 96 fa 9e a6 a7 a7 a7 96
96 b4 f3 9f 97 9b 9d 9d 9d 96 96 d6 ed ef d7 f2 ed b9 bd ae ea 96 96
96 ac ad 96 96 ad ad 97 96 96 96 a7 ac ac ac ac 9b af 96 96 96 b2 ac
ad ad ac ac 97 96 96 96 ac ac 96 96 ac ac da 9f 96 96 96 96 96 96 96
96 9a a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6
96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96
96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 97 97 96 96 96 96 96 96
96 96 db 96 96 96 ac ad 96 96 ad ad 97 96 96 96 a7 ac ac ac ac 9b af
96 96 96 b2 ac ad ad ac ac 97 96 96 96 ac ac 96 96 ac ac da 9f 96 96
96 96 96 96 96 96 9a a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96
96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6
96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 97 97 96
96 96 96 96 96 96 96 9f 96 96 96 96 96 96 96 b2 f3 fb ef be ad af eb
9a de aa eb
** Mine
d5 aa 96 ff fe aa aa af af fa fb de aa eb
d5 aa ad ff 96 96 a7 9d ae 96 d6 b4 ed 96 96 96 a7 9e b2 96 d6 b6 f2
9b 96 96 a7 96 b2 97 d7 b6 ef 9a 96 96 9d 97 97 96 d6 b5 ee 97 96 96
96 96 96 96 d6 b9 f9 9a 9b a7 ae ae 96 96 d6 96 fa 9e a6 a7 a7 a7 96
96 b4 f3 9f 97 9b 9d 9d 9d 96 96 d6 ed ef d7 f2 ed b9 df ae ce 96 96
96 ac ad 96 96 ad ad 97 96 96 96 a7 ac ac ac ac 9b af 96 96 96 b2 ac
ad ad ac ac 97 96 96 96 ac ac 96 96 ac ac da 9f 96 96 96 96 96 96 96
96 9a a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6
96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96
96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 97 97 96 96 96 96 96 96
96 96 db 96 96 96 ac ad 96 96 ad ad 97 96 96 96 a7 ac ac ac ac 9b af
96 96 96 b2 ac ad ad ac ac 97 96 96 96 ac ac 96 96 ac ac da 9f 96 96
96 96 96 96 96 96 9a a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96
96 96 a6 96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6
96 a6 96 96 96 96 96 96 96 a6 96 a6 96 96 96 96 96 96 96 a6 97 97 96
96 96 96 96 96 96 96 9f 96 96 96 96 96 96 96 b2 f3 fb ef be ad af eb
9a de aa eb
* Divergence?
$B700: (797128) No
$8004: (14016092) Yes
* Slot 6 accesses from:
1 Slot6 access from $C632
1 Slot6 access from $C635
1 Slot6 access from $C638
1 Slot6 access from $C63B
1 Slot6 access from $C640
1 Slot6 access from $C64A
$C661: 14, 367, 767, etc.
$C6AD: 86
$C6BF: 256
$B952: 10, 367, etc.
$B907: 86
$B918: 256
0xB942: error return
0xB942: good return
* Possibly innocuous differences:
38,39c38,40
< $0026: FD FD
---
> $0026: F7 F2
< $002C: FD 02
---
> $002C: F2 0D
< $01FC: 30
---
> $01FC: 34
26,27
2C:
2D:
2D: 0D - sector number from header
2E: 01 - track number from sector header
2F: FE - volume number from sector header
2C: F2 - sector header checksum
CURRENT.TRACK .EQ $478
DRIVE.1.TRACK .EQ $478 THRU 47F (INDEX BY SLOT)
DRIVE.2.TRACK .EQ $4F8 THRU 4FF (INDEX BY SLOT)
SEARCH.COUNT .EQ $4F8
RETRY.COUNT .EQ $578
SLOT .EQ $5F8
SEEK.COUNT .EQ $6F8
SECTOR .EQ $2D
TRACK .EQ $2A
VOLUME .EQ $2F
DRIVE.NO .EQ $35
DCT.PNTR .EQ $3C,3D
BUF.PNTR .EQ $3E,3F
MOTOR.TIME .EQ $46,47
IOB.PNTR .EQ $48,49
* Append A,X,Y,SP,P,PC
NOP: EA
LDA #$00: A9 00
LDX #$00: A2 00
LDY #$00: A0 00
CMP #$AA: C9 AA
PHP #$08
PLA #$68
* Notes - status
0xB99E - is not a good address, because it's used to return from READ.ADDRESS as well as READ.SECTOR.
** After 69th sector access
100: a2js: 0xB8C7, goa2: 0xB8C7 - match
125000: a2js: 0x1DC0, goa2: 0x1DC0 - match
187500: a2js: 0x1DA5, goa2: 0x1DA5 - match
195312: a2js: 0x1F69, goa2: 0x1F69 - match
197265: a2js: 0x1DB7, goa2: 0x1DB7 - match
197509: a2js: 0x02F8, goa2: 0x02F8 - match
197631: a2js: 0x030C, goa2: 0x030C - match
197646: a2js: 0xBD13, goa2: 0xBD13 - match
197653: a2js: 0xBD3F, goa2: 0xBD3F - match
197657: a2js: 0xBD43, goa2: 0xBD43 - match
197659: a2js: 0xBD49, goa2: 0xBD49 - DIFF in P
197661: a2js: 0xBD4F, goa2: 0xBD4C - LOTS!
197692: a2js: 0xBD70, goa2: 0xBD3C - LOTS!
197753: a2js: 0xBA03, goa2: 0xBD5A - DIFF!
198241: a2js: 0xBA03, goa2: 0xBA03 - DIFF in A,X
199218: a2js: 0xBA02, goa2: 0xBA02 - DIFF in X
203125: a2js: 0xBA03, goa2: 0xBA03 - DIFF in A,X
218750: a2js: 0xBA05, goa2: 0xBA02 - DIFF!
250000: a2js: 0xBA03, goa2: 0xBA0C - DIFF!
500000: a2js: 0xBDA0, goa2: 0xBDA1 - DIFF!
(/ (+ 197657 197661) 2)
197659