DeskTop: Initial disassembly of segments 5/6

This commit is contained in:
Joshua Bell 2018-01-05 09:42:32 -08:00
parent 81ec68bd1b
commit e739737ac5
13 changed files with 1542 additions and 49 deletions

View File

@ -3,7 +3,7 @@ CC65 = ~/dev/cc65/bin
CAFLAGS = --target apple2enh --list-bytes 0
CCFLAGS = --config asm.cfg
TARGETS = loader.built a2d.built desktop.built
TARGETS = loader.built a2d.built desktop.built s5.built s6.built
.PHONY: clean all
all: $(TARGETS)
@ -24,3 +24,5 @@ check:
diff loader.built orig/DESKTOP2_s0_loader
diff a2d.built orig/DESKTOP2_s1_a2d
diff desktop.built orig/DESKTOP2_s2_desktop
diff s5.built orig/DESKTOP2_s5
diff s6.built orig/DESKTOP2_s6

View File

@ -15,15 +15,15 @@ probably the disk copy code which is swapped in dynamically.
The file is broken down into multiple segments:
* segment 0: load - offset $0000, length $0580, loaded at $2000
* segment 1: aux1 - offset $0580, length $8000, loaded at $4000 (through $BFFF)
* segment 2: aux2 - offset $8580, length $1D00, loaded at $D000 (through $ECFF)
* segment 3: aux2 - offset $A280, length $0500, loaded at $FB00 (through $FFFF)
* segment 4: main - offset $A780, length $7F00, loaded at $4000 (through $BEFF)
* main $BF00-$BFFF is ProDOS buffers
* main $C000-$CFFF is I/O space
* main $D000-$FFFF is ProDOS
* segment 5: _TBD_ - 38k so must be further subdivided. Disk Copy???
* segment 0: load - address $2000-$257F, length $0580, file offset $000000
* segment 1: aux1 - address $4000-$BFFF, length $8000, file offset $000580
* segment 2: aux2 - address $D000-$ECFF, length $1D00, file offset $008580
* segment 3: aux3 - address $FB00-$FFFF, length $0500, file offset $00A280
* segment 4: main - address $4000-$BEFF, length $7F00, file offset $00A780
* segment 5: main - address $0800-$0FFF, length $0800, file offset $012680
* segment 6: main - address $0290-$03EF, length $0160, file offset $012E80
* segment N: _TBD_ - 38k so must be further subdivided. Disk Copy???
## Structure
@ -34,13 +34,17 @@ The file is broken down into multiple segments:
Invoked at $2000; patches the ProDOS QUIT routine (at LC2 $D100) then
invokes it. That gets copied to $1000-$11FF and run by ProDOS.
The invoked code stashes the current prefix and re-patches ProDOS. It
then (in a convoluted way) loads in the second $200 bytes of the
system file at $2000 and invokes that.
The invoked code stashes the current prefix and re-patches ProDOS with
itself. It then (in a convoluted way) loads in the second $200 bytes of
`DESKTOP2` at $2000 and invokes that.
This code then loads the rest of the file as a sequence of segments,
moving them to the appropriate destination in aux/banked/main memory.
There's fourth chunk of code; it's unclear where that ends up or how
it is invoked, but it appears to handle an OpenApple+ClosedApple+P
key sequence and invoke slot one code - possibly debugging support?
### GUI Library "A2D"
`a2d.s`

View File

@ -14,5 +14,8 @@ function daseg {
#daseg s4_main1 4000
#daseg 12680_1BCDF
#daseg s5
#daseg s6
make
make check

41
desktop/infos/s5.info Normal file
View File

@ -0,0 +1,41 @@
GLOBAL {
STARTADDR $800;
PAGELENGTH 0; # No paging
CPU "6502";
};
# Softswitches / I/O ROM
LABEL { NAME "RAMRDOFF"; ADDR $C002; };
LABEL { NAME "RAMRDON"; ADDR $C003; };
LABEL { NAME "RAMWRTOFF"; ADDR $C004; };
LABEL { NAME "RAMWRTON"; ADDR $C005; };
LABEL { NAME "ALTZPOFF"; ADDR $C008; };
LABEL { NAME "ALTZPON"; ADDR $C009; };
LABEL { NAME "LCBANK1"; ADDR $C08B; };
LABEL { NAME "AUXMOVE"; ADDR $C311; };
LABEL { NAME "XFER"; ADDR $C314; };
# A2Desktop
LABEL { NAME "A2D"; ADDR $4000; };
LABEL { NAME "UNKNOWN_CALL"; ADDR $8E00; };
LABEL { NAME "MLI"; ADDR $BF00; };
LABEL { NAME "A2D_RELAY"; ADDR $D000; };
LABEL { NAME "DESKTOP_RELAY"; ADDR $D040; };
# Applesoft
LABEL { NAME "FSUB"; ADDR $E7A7; };
LABEL { NAME "FADD"; ADDR $E7BE; };
LABEL { NAME "FMULT"; ADDR $E97F; };
LABEL { NAME "FDIV"; ADDR $EA66; };
LABEL { NAME "ROUND"; ADDR $EB2B; };
LABEL { NAME "FLOAT"; ADDR $EB93; };
LABEL { NAME "FIN"; ADDR $EC4A; };
LABEL { NAME "FOUT"; ADDR $ED34; };
# Monitor
LABEL { NAME "INIT"; ADDR $FB2F; };
LABEL { NAME "BELL1"; ADDR $FBDD; };
LABEL { NAME "HOME"; ADDR $FC58; };
LABEL { NAME "COUT"; ADDR $FDED; };
LABEL { NAME "SETKBD"; ADDR $FE89; };
LABEL { NAME "SETVID"; ADDR $FE93; };

View File

@ -5,24 +5,8 @@
.include "../inc/auxmem.inc"
.include "../inc/prodos.inc"
L02B4 := $02B4
L02B6 := $02B6
L02C3 := $02C3
L02C5 := $02C5
L02E6 := $02E6
L035F := $035F
L0393 := $0393
L03B3 := $03B3
L03C1 := $03C1
L03E5 := $03E5
L0800 := $0800
IRQ_VECTOR := $3FE
L0800 := $0800 ; init location
L7ECA := $7ECA ; ???
MONZ := $FF69
SELECTOR := $D100
;;; ==================================================
;;; Patch self in as ProDOS QUIT routine (LCBank2 $D100)
@ -312,8 +296,8 @@ segment_dest_table:
segment_size_table:
.word $8000,$1D00,$0500,$7F00,$0800,$0160
segment_type_table: ; 0 = main, 1 = aux, 2 = banked (main)
.byte $01,$02,$02,$00,$00,$00
segment_type_table: ; 0 = main, 1 = aux, 2 = banked (aux)
.byte 1,2,2,0,0,0
num_segments:
.byte 6
@ -395,7 +379,7 @@ next_segment:
segment_num: .byte 0
;; Handle bank-switched memory segment
banked_segment:
.proc banked_segment
sta ALTZPON
lda LCBANK1
lda LCBANK1
@ -414,28 +398,30 @@ banked_segment:
sta $06+1
clc
adc segment_size_table+1,x
sta L212D
sta max_page
lda segment_size_table,x
beq L2112
inc L212D
L2112: ldy #0
L2114: lda ($06),y
beq :+
inc max_page
: ldy #0
loop: lda ($06),y
sta ($08),y
iny
bne L2114
bne loop
inc $06+1
inc $08+1
lda $06+1
cmp L212D
bne L2114
cmp max_page
bne loop
sta ALTZPOFF
lda ROMIN2
rts
L212D: .byte 0
max_page:
.byte 0
.endproc
;; Handle aux memory segment
aux_segment:
.proc aux_segment
lda #$00
sta $06
sta $08
@ -448,23 +434,25 @@ aux_segment:
sta $06+1
clc
adc segment_size_table+1,x
sta L2168
sta max_page
sta RAMRDOFF
sta RAMWRTON
ldy #$00
L2152: lda ($06),y
loop: lda ($06),y
sta ($08),y
iny
bne L2152
bne loop
inc $06+1
inc $08+1
lda $06+1
cmp L2168
bne L2152
cmp max_page
bne loop
sta RAMWRTOFF
rts
L2168: .byte 0
max_page:
.byte 0
.endproc
;; Padding
.res $2200 - *,0
@ -475,6 +463,18 @@ L2168: .byte 0
.proc rest
L02B4 := $02B4
L02B6 := $02B6
L02C3 := $02C3
L02C5 := $02C5
L02E6 := $02E6
L035F := $035F
L0393 := $0393
L03B3 := $03B3
L03C1 := $03C1
L03E5 := $03E5
;; Test for OpenApple+ClosedApple+P
pha
lda BUTN0

Binary file not shown.

Binary file not shown.

BIN
desktop/orig/DESKTOP2_s5 Normal file

Binary file not shown.

BIN
desktop/orig/DESKTOP2_s6 Normal file

Binary file not shown.

1189
desktop/s5.s Normal file

File diff suppressed because it is too large Load Diff

247
desktop/s6.s Normal file
View File

@ -0,0 +1,247 @@
.org $290
; da65 V2.16 - Git f5e9b401
; Created: 2018-01-05 09:39:35
; Input file: orig/DESKTOP2_s6
; Page: 1
.setcpu "6502"
A2D := $4000
UNKNOWN_CALL := $8E00
L9F00 := $9F00
MLI := $BF00
RAMRDOFF := $C002
RAMRDON := $C003
RAMWRTOFF := $C004
RAMWRTON := $C005
ALTZPOFF := $C008
ALTZPON := $C009
LCBANK1 := $C08B
AUXMOVE := $C311
XFER := $C314
A2D_RELAY := $D000
DESKTOP_RELAY := $D040
FSUB := $E7A7
FADD := $E7BE
FMULT := $E97F
FDIV := $EA66
ROUND := $EB2B
FLOAT := $EB93
FIN := $EC4A
FOUT := $ED34
INIT := $FB2F
BELL1 := $FBDD
HOME := $FC58
COUT := $FDED
SETKBD := $FE89
SETVID := $FE93
jmp L02E5
ora ($20,x)
.byte $02
L0296: brk
.byte $03
L0298: .byte $80
L0299: .byte $02
brk
L029B: php
L029C: ora ($04,x)
L029E: brk
L029F: brk
L02A0: jsr L9F00
brk
brk
L02A5: ora ($00,x)
asl a
.byte $80
.byte $02
brk
L02AB: brk
L02AC: brk
L02AD: brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
.byte $0C
.byte $42
eor ($53,x)
eor #$43
rol $5953
.byte $53
.byte $54
eor $4D
.byte $04
inc $0280
brk
brk
brk
L02D0: jsr MLI
dec $93
.byte $02
beq L02DD
pla
pla
jmp L03CB
L02DD: rts
L02DE: jsr MLI
iny
.byte $97
.byte $02
rts
L02E5: lda $C082
lda #$00
sta L03B8
lda #$20
sta L03B9
ldx #$16
lda #$00
L02F6: sta $BF58,x
dex
bne L02F6
jsr L02D0
lda $0220
sta L0296
jsr MLI
cpy $A7
.byte $02
beq L0310
jmp L03CB
L0310: lda L02AB
cmp #$B3
bne L031D
jsr L03C0
jmp L03BA
L031D: cmp #$06
bne L0345
lda L02AC
sta L03B8
sta L029F
lda L02AD
sta L03B9
sta L02A0
cmp #$0C
bcs L033E
lda #$BB
sta L029B
bne L037D
L033E: lda #$08
sta L029B
bne L037D
L0345: cmp #$FC
bne L037D
lda #$BC
sta L0298
lda #$02
sta L0299
L0353: jsr L02DE
beq L0374
ldy $0220
L035B: lda $0220,y
cmp #$2F
beq L036A
dey
cpy #$01
bne L035B
jmp L03CB
L036A: dey
sty $0220
jsr L02D0
jmp L0353
L0374: lda L0296
sta $0220
jmp L0382
L037D: jsr L02DE
bne L03CB
L0382: lda L029C
sta L029E
jsr MLI
dex
sta $D002,x
.byte $3B
jsr MLI
cpy L02A5
bne L03CB
lda L02AB
cmp #$FC
bne L03AE
jsr L02D0
ldy $0280
L03A5: lda $0280,y
sta $2006,y
dey
bpl L03A5
L03AE: lda #$03
pha
lda #$B9
pha
jsr L03C0
.byte $4C
L03B8: brk
L03B9: .byte $20
L03BA: jsr MLI
adc $C9
.byte $02
L03C0: lda #$01
sta $BF6F
lda #$CF
sta $BF58
rts
L03CB: rts
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk
brk

View File

@ -30,3 +30,7 @@ HOME := $FC58
COUT := $FDED
SETKBD := $FE89
SETVID := $FE93
MONZ := $FF69
;;; Miscellaneous
IRQ_VECTOR := $3FE

View File

@ -13,6 +13,9 @@ DATEHI := $BF91
TIMELO := $BF92
TIMEHI := $BF93
;;; Patch Locations
SELECTOR := $D100
;;; Housekeeping Calls
CREATE := $C0
DESTROY := $C1