This commit is contained in:
4am 2019-09-30 14:22:56 -04:00
commit c2e5fe8a92
7 changed files with 143 additions and 68 deletions

Binary file not shown.

View File

@ -56,20 +56,21 @@ Reenter
ldx #$A4 ldx #$A4
stx $3F4 stx $3F4
RestoreStackNextTime RestoreStackNextTime
clc ; SMC bne SearchMode ; (SMC) not an unconditional branch because code
bcc SearchMode ; not an unconditional branch because code ; might change the branch target to the next opcode
; might change the 'clc' just before it
; If we fall through to here, it's because we backed up the stack and ; If we fall through to here, it's because we backed up the stack and
; stack pointer and wanted this routine to restore it and return to ; stack pointer and wanted this routine to restore it and return to
; caller. ; caller.
lda #$18 ; reset to 'clc' opcode so we don't try to lda #(SearchMode - RestoreStackNextTime) - 2
sta RestoreStackNextTime ; restore the same stack twice ; reset to branch so we don't try to
sta RestoreStackNextTime + 1
; restore the same stack twice
ldx #$F1 ldx #$F1
- lda $DF00,x ; restore stack - lda STACKBASE - $F0,x ; restore stack
sta $100,x sta $100,x
inx inx
bne - bne -
ldx $DFF0 ; restore stack pointer ldx STACKBASE ; restore stack pointer
txs txs
SwitchToBank1 SwitchToBank1
+READ_RAM1_WRITE_RAM1 +READ_RAM1_WRITE_RAM1
@ -119,21 +120,52 @@ SwitchToBank2
!word Reenter ; IRQ vector ($FFFE-F) !word Reenter ; IRQ vector ($FFFE-F)
} }
LastMover LastMover
!pseudopc $D600 { !if ((hdddataend & 255) > $ec) and ((hdddataend & 255) < $f0) {
; in the unlikely event that a bit over 16 bytes are left in the page
; then use it for the stack
STACKBASE = (hdddataend + 15) and -16
FONTSRC = *
!pseudopc STACKBASE + 16 {
FONTDST = *
!source "src/ui.font.data.a" !source "src/ui.font.data.a"
COPYDST = *
COPYSRC = LastMover + COPYDST - FONTDST
!source "src/ui.font.a" !source "src/ui.font.a"
!source "src/prodos.impl.a" !source "src/prodos.impl.a"
LCRAM2_END = * LCRAM2_END = *
!if * > $DFEF { !if * > $E000 {
!error "code is too large: ends at ", * !error "code is too large: ends at ", *
}
}
EvenLasterMover
} else {
; otherwise place stack after code
; and begin font on the next page
COPYSRC = *
!pseudopc hdddataend {
COPYDST = *
!source "src/prodos.impl.a"
!source "src/ui.font.a"
STACKBASE = *
LCRAM2_END = STACKBASE + 16
FONTDST = (LCRAM2_END + 255) and -256
}
EvenLasterMover
FONTSRC = *
!pseudopc FONTDST {
!source "src/ui.font.data.a"
!if * > $E000 {
!error "code is too large: ends at ", *
}
} }
} }
EvenLasterMover
!if RELBASE = $2000 { !if RELBASE = $2000 {
!ifdef PASS2 { !ifdef PASS2 {
} else { ;PASS2 } else { ;PASS2
!set PASS2=1 !set PASS2=1
!warn "LCRAM2 ends at ", LCRAM2_END !warn "ProRWTS ends at ", hddcodeend - 1
!warn "STACK at ", STACKBASE
!warn "LCRAM2 ends at ", LCRAM2_END - 1
!warn "RELBASE = ", $10000 - (LastMover - FirstMover) !warn "RELBASE = ", $10000 - (LastMover - FirstMover)
} }
} }

View File

@ -121,9 +121,20 @@ NotGS clc
inc @FM+5 inc @FM+5
bne @FM bne @FM
+ ldy #>(255 + EvenLasterMover - LastMover) ldy #4
@LM lda LastMover,x ; relocate font data to $D600 in RAM bank 2 @ELM lda FONTSRC,x
sta $D600,x ; and pseudo-ProDOS to $DA00 in RAM bank 2 ; relocate font data to RAM bank 2
sta FONTDST,x
inx
bne @ELM
inc @ELM+2
inc @ELM+5
dey
bne @ELM
ldy #>(255 + EvenLasterMover - LastMover)
@LM lda COPYSRC,x ; relocate pseudo-ProDOS to RAM bank 2
sta COPYDST,x
inx inx
bne @LM bne @LM
inc @LM+2 inc @LM+2

View File

@ -9,16 +9,16 @@
; D000..E5F4 - persistent data structures (per-game cheat categories, ; D000..E5F4 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore) ; gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; EC9F..FFF9 - main program code ; ECA0..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors ; FFFA..FFFF - NMI, reset, IRQ vectors
; ;
; LC RAM BANK 2 ; LC RAM BANK 2
; D000..D3FF - ProRWTS data ; D000..D3FF - ProRWTS data
; D400..D5FF - ProRWTS code ; D400..D5F7 - ProRWTS code
; D600..D9FF - HGR font data ; D5F8..DB52 - HGR font code & ProRWTS glue code
; DA00..DF5D - HGR font code & ProRWTS glue code ; DB53..DB62 - backup of stack (during gameplay and self-running demos)
; ...unused... ; ...unused...
; DFF0..DFFF - backup of stack (during gameplay and self-running demos) ; DC00..DFFF - HGR font data
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; soft switches ; soft switches

View File

@ -117,7 +117,8 @@ seekread stx bloklo
sty blokhi sty blokhi
entry jmp $d1d1 entry jmp $d1d1
fakeMLI pla fakeMLI beq readblk
retcall pla
tax tax
inx inx
inx inx
@ -125,6 +126,12 @@ fakeMLI pla
txa txa
pha pha
rts rts
readblk dey
dey
sty adrhi
tay
jsr seekread
bcc retcall
fakeMLI_e fakeMLI_e
filename !byte filename_e - filename_b filename !byte filename_e - filename_b

View File

@ -635,13 +635,13 @@ LaunchInternal
jsr SaveOrRestoreScreenHoles ; save screen hole contents jsr SaveOrRestoreScreenHoles ; save screen hole contents
ldy #$F1 ldy #$F1
- lda $100,y - lda $100,y
sta $DF00,y ; back up stack sta STACKBASE - $F0,y ; back up stack
iny iny
bne - bne -
tsx ; back up stack pointer tsx ; back up stack pointer
stx $DFF0 stx STACKBASE
lda #$38 ; 'sec' opcode to tell |Reenter| to sty RestoreStackNextTime + 1
sta RestoreStackNextTime ; restore the stack and stack pointer ; tell |Reenter| to restore the stack and stack pointer
ldx #(end_promote-promote-1) ldx #(end_promote-promote-1)
- lda promote,x ; copy ProDOS shim to main memory - lda promote,x ; copy ProDOS shim to main memory

View File

@ -16,7 +16,7 @@ ver_02 = 1
verbose_info = 0 ;set to 1 to enable display of memory usage verbose_info = 0 ;set to 1 to enable display of memory usage
enable_floppy = 0 ;set to 1 to enable floppy drive support enable_floppy = 0 ;set to 1 to enable floppy drive support
poll_drive = 0 ;set to 1 to check if disk is in drive, recommended if allow_multi is enabled poll_drive = 0 ;set to 1 to check if disk is in drive, recommended if allow_multi is enabled
allow_extend = 1 ;enable support for more than two MicroDrive (or more than four CFFA) partitions use_smartport = 1 ;set to 1 to enable support for more than two MicroDrive (or more than four CFFA) partitions
override_adr = 1 ;set to 1 to require an explicit load address override_adr = 1 ;set to 1 to require an explicit load address
aligned_read = 0 ;set to 1 if all reads can be a multiple of block size aligned_read = 0 ;set to 1 if all reads can be a multiple of block size
enable_readseq=0 ;set to 1 to enable reading multiple sequential times from the same file without seek enable_readseq=0 ;set to 1 to enable reading multiple sequential times from the same file without seek
@ -207,7 +207,9 @@ init jsr SETKBD
jsr SETVID jsr SETVID
lda DEVNUM lda DEVNUM
sta x80_parms + 1 sta x80_parms + 1
!if use_smartport = 0 {
sta unrunit1 + 1 sta unrunit1 + 1
} ;use_smartport
and #$70 and #$70
!if (enable_floppy + enable_write) > 1 { !if (enable_floppy + enable_write) > 1 {
sta unrslot1 + 1 sta unrslot1 + 1
@ -380,16 +382,37 @@ adjpath tya
lsr lsr
tay tay
ldx DEVADR01HI, y ldx DEVADR01HI, y
!if (enable_floppy + allow_extend) > 0 {
cpx #$c8 cpx #$c8
bcc set_slot bcc set_slot
!if enable_floppy = 1 { !if enable_floppy = 1 {
php
;check if current device is floppy
lsr lsr
ora #$c0 ora #$c0
tax tax
plp stx blokhi
} else { ;enable_floppy = 0 ldy #0
sty bloklo
iny
lda (bloklo), y
cmp #$20
bne not_floppy
iny
iny
lda (bloklo), y
bne not_floppy
iny
iny
lda (bloklo), y
cmp #3
bne not_floppy
ldy #$ff
lda (bloklo), y
beq set_slot
not_floppy
} ;enable_floppy
;find SmartPort device for basic MicroDrive support ;find SmartPort device for basic MicroDrive support
@ -414,25 +437,22 @@ adjpath tya
ldy #$ff ldy #$ff
lda (bloklo), y lda (bloklo), y
beq - beq -
} ;enable_floppy
} ;enable_floppy or allow_extend
set_slot stx slot + 2 set_slot stx slot + 2
!if allow_extend = 1 { !if use_smartport = 0 {
stx unrentry1 + 2
} ;allow_extend
stx unrentry2 + 2 stx unrentry2 + 2
!if allow_extend = 1 { } else { ;use_smartport = 1
stx unrentry1 + 2
stx unrentry3 + 2 stx unrentry3 + 2
} ;allow_extend } ;use_smartport
slot ldx $cfff slot ldx $cfff
!if enable_floppy = 1 { !if enable_floppy = 1 {
php php
beq bankram beq bankram
} ;enable_floppy } ;enable_floppy
!if use_smartport = 0 {
stx unrentry2 + 1 stx unrentry2 + 1
!if allow_extend = 1 { } else { ;use_smartport = 1
bcc bankram
;use SmartPort entrypoint instead ;use SmartPort entrypoint instead
@ -442,8 +462,6 @@ slot ldx $cfff
stx unrentry1 + 1 stx unrentry1 + 1
stx unrentry3 + 1 stx unrentry3 + 1
;detect extended remapping and update unit accordingly
lda #<(readbuff + $200) lda #<(readbuff + $200)
sta adrlo sta adrlo
ldy #>(readbuff + $200) ldy #>(readbuff + $200)
@ -451,30 +469,24 @@ slot ldx $cfff
stx x80_parms + 4 stx x80_parms + 4
lda #0 lda #0
sta x80_parms + 5 sta x80_parms + 5
jsr unrhddrd
jsr MLI jsr MLI
!byte $80 !byte $80
!word x80_parms !word x80_parms
bcc + ;always
iterunit inc unrunit2 iterunit inc unrunit2
;enable use of SmartPort entrypoint
lda #$2c
sta unrentry2
unrentry1 jsr $d1d1 unrentry1 jsr $d1d1
!byte cmdread !byte cmdread
!word unrpacket !word unrpacket
bcs iterunit bcs iterunit
+ ldy #$0f ldy #$0f
- lda readbuff + 4, y - lda readbuff + 4, y
cmp readbuff + $204, y cmp readbuff + $204, y
bne iterunit bne iterunit
dey dey
bpl - bpl -
} ;allow_extend } ;use_smartport
bankram bankram
!if load_banked = 1 { !if load_banked = 1 {
@ -2608,7 +2620,11 @@ skiptree
beq + beq +
} ;enable_seek } ;enable_seek
!if enable_write = 1 { !if enable_write = 1 {
!if use_smartport = 0 {
stx command stx command
} else { ;use_smartport = 1
stx pcommand
} ;use_smartport
} ;enable_write } ;enable_write
} ;aligned_read } ;aligned_read
} else { ;rwts_mode = 1 } else { ;rwts_mode = 1
@ -2813,34 +2829,43 @@ hddreaddirsect ldy #>hdddirbuf
ldy #>hdddirbuf ldy #>hdddirbuf
hddreaddirsect hddreaddirsect
} ;allow_trees } ;allow_trees
unrhddrd = unrelochdd + (* - reloc)
sty adrhi sty adrhi
hddseekrd ldy #cmdread hddseekrd ldy #cmdread
!if (aligned_read + enable_write) > 1 { !if (aligned_read + enable_write) > 1 {
hddseekrdwr sty command hddseekrdwr
} else { ;aligned_read = 0 or enable_write = 0 !if use_smartport = 0 {
sty command sty command
} else { ;use_smartport = 1
sty pcommand
} ;use_smartport
} else { ;aligned_read = 0 or enable_write = 0
!if use_smartport = 0 {
sty command
} else { ;use_smartport = 1
sty pcommand
} ;use_smartport
hddseekrdwr hddseekrdwr
} ;aligned_read and enable_write } ;aligned_read and enable_write
!if use_smartport = 0 {
stx bloklo stx bloklo
sta blokhi sta blokhi
} else { ;use_smartport = 1
stx pblock
sta pblock + 1
} ;use_smartport
!if use_smartport = 0 {
unrunit1 = unrelochdd + (* - reloc) unrunit1 = unrelochdd + (* - reloc)
lda #$d1 lda #$d1
sta unit sta unit
unrentry2 = unrelochdd + (* - reloc) unrentry2 = unrelochdd + (* - reloc)
jmp $d1d1 jmp $d1d1
} else { ;use_smartport = 1
!if allow_extend = 1 { lda adrhi
ldx #4 sta paddr + 1
- lda command + 1, x lda adrlo
sta packet + 1, x sta paddr
dex
bne -
lda command
sta pcommand
unrentry3 = unrelochdd + (* - reloc) unrentry3 = unrelochdd + (* - reloc)
jsr $d1d1 jsr $d1d1
pcommand !byte 0 pcommand !byte 0
@ -2851,9 +2876,9 @@ unrpacket = unrelochdd + (* - reloc)
packet !byte 3 packet !byte 3
unrunit2 = unrelochdd + (* - reloc) unrunit2 = unrelochdd + (* - reloc)
!byte 0 !byte 0
!word readbuff + $200 paddr !word readbuff + $200
!byte 2, 0, 0 pblock !byte 2, 0, 0
} ;allow_extend } ;use_smartport
!if rwts_mode = 1 { !if rwts_mode = 1 {
vollist_b vollist_b