Skip to content

Commit 90893aa

Browse files
author
HexTank
committed
Allow option to specify which bank to page out to, as 128k mode and ROMS are a bit problematic when patched.
1 parent 071b55b commit 90893aa

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Tools/Client/main.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ struct SNA_Regs
122122
struct SmartLINK_Regs : SNA_Regs
123123
{
124124
uint16_t pc;
125+
uint8_t bank;
125126
}
126127
#ifdef __GNUC__
127128
__attribute((packed))
@@ -631,7 +632,7 @@ vector<shared_ptr<vector<uint8_t>>> send_z80(string snapshot_to_load)
631632
outRegs.im = inRegs->im;
632633
outRegs.pc = isV1 ? inRegs->pc : static_cast<Z80_V2_Shared_Regs*>(inRegs)->_pc; // v2 has pc address for all subsequent versions.
633634
outRegs.border = inRegs->border;
634-
635+
outRegs.bank = isV1 || static_cast<Z80_V2_Shared_Regs*>(inRegs)->hardwareMode == 0 ? 3 : 0x80;
635636

636637
int snapshotIndex = sizeof(Z80_V1_Shared_Regs) + (isV1 ? 0 : (static_cast<Z80_V2_Shared_Regs*>(inRegs)->headerSize + sizeof(uint16_t))); // v2 has extra header size for all subsequent versions.
637638
shared_ptr<vector<uint8_t>> payload;

targets/spectrum/smartcard/smartcard_rom.asm

+9-5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ restart_snapshot:
9494
; setup the jmp PC in video memory
9595
ld bc, (sna_header+27)
9696
ld ((rst_pc_val - rst_cust_begin) + screen_mem), bc
97+
; setup the rom we want to page out to
98+
ld a, (sna_header+29)
99+
ld ((rst_rom_val - rst_cust_begin) + screen_mem), a
97100
endif
98101
ei ; wait until just after a Spectrum frame IRQ before restarting snapshot
99102
halt ; (to absorb any pending IRQ)
@@ -565,18 +568,19 @@ slink_image: incbin "smartlink.scr.zx7"
565568
; -- Code to be placed at the top of vmem for restoring snapshot registers before execution
566569
; --------------------------------------------------------------------------------------------
567570

568-
rst_cust_begin: db $ed, $79 ; out (c),a - start point when paging custom roms, not paging out / turning off smart card
569-
db $01 ; ld bc
570-
rst_bc_val: db $00, $00 ; ,xxxx
571+
rst_cust_begin: db $3e ; ld a, - start point when paging custom roms, not paging out / turning off smart card
572+
rst_rom_val: db $00 ; xx
573+
db $ed, $79 ; out (c),a
574+
db $01 ; ld bc,
575+
rst_bc_val: db $00, $00 ; xxxx
571576
db $3e ; ld a,
572577
rst_r_val: db $00 ; xx
573-
db $d3, $fe ; out (254),a - set border colour
574578
db $ed, $4f ; ld r, a
575579
db $3e ; ld a,
576580
rst_a_val: db $00 ; xx
577581
rst_ei_val: db $fb ; ei
578582
rst_orig_begin: db $c3 ; jp - start point when paging original spectrum rom / turning off smart card
579-
rst_pc_val: db $00, $00 ; ,xxxx
583+
rst_pc_val: db $00, $00 ; xxxx
580584
rst_end:
581585

582586
; --------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)