Костыльно поправлены RAM_ROUTINES в SP_128 для сохранения статуса прерываний в функции SWAP_ROM

This commit is contained in:
Tolik 2025-10-25 23:51:00 +10:00
parent a585ef51e5
commit 57cdd81dcb
3 changed files with 228 additions and 157 deletions

View File

@ -2,11 +2,14 @@
; *** SPECTRUM 128 ROM 0 DISASSEMBLY *** ; *** SPECTRUM 128 ROM 0 DISASSEMBLY ***
; ************************************** ; **************************************
INCLUDE 'Shared_Includes/macroses/macros.z80' INCLUDE 'Shared_Includes/macroses/macros.z80'
INCLUDE 'inc/rom_routines.inc'
DEFINE MODIFIED_SWAP
TST_PATCH_ADDR EQU #5CC0
; The Spectrum ROMs are copyright Amstrad, who have kindly given permission ; The Spectrum ROMs are copyright Amstrad, who have kindly given permission
; to reverse engineer and publish Spectrum ROM disassemblies. ; to reverse engineer and publish Spectrum ROM disassemblies.
; ===== ; =====
; NOTES ; NOTES
; ===== ; =====
@ -248,90 +251,90 @@
; These are held in the old ZX Printer buffer at #5B00-#5BFF. ; These are held in the old ZX Printer buffer at #5B00-#5BFF.
; Note that some of these names conflict with the system variables used by the ZX Interface 1. ; Note that some of these names conflict with the system variables used by the ZX Interface 1.
SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine. ;SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine.
YOUNGER EQU #5B14 ; 9 Return paging subroutine. ;YOUNGER EQU #5B14 ; 9 Return paging subroutine.
ONERR EQU #5B1D ; 18 Error handler paging subroutine. ;ONERR EQU #5B1D ; 18 Error handler paging subroutine.
PIN EQU #5B2F ; 5 RS232 input pre-routine. ;PIN EQU #5B2F ; 5 RS232 input pre-routine.
POUT EQU #5B34 ; 22 RS232 token output pre-routine. This can be patched to bypass the control code filter. ;POUT EQU #5B34 ; 22 RS232 token output pre-routine. This can be patched to bypass the control code filter.
POUT2 EQU #5B4A ; 14 RS232 character output pre-routine. ;POUT2 EQU #5B4A ; 14 RS232 character output pre-routine.
TARGET EQU #5B58 ; 2 Address of subroutine to call in ROM 1. TARGET EQU #5B58 ; 2 Address of subroutine to call in ROM 1.
RETADDR EQU #5B5A ; 2 Return address in ROM 0. RETADDR EQU #5B5A ; 2 Return address in ROM 0.
BANK_M EQU #5B5C ; 1 Copy of last byte output to I/O port #7FFD. BANK_M EQU #5B5C ; 1 Copy of last byte output to I/O port #7FFD.
RAMRST EQU #5B5D ; 1 Stores instruction RST #08 and used to produce a standard ROM error. RAMRST EQU #5B5D ; 1 Stores instruction RST #08 and used to produce a standard ROM error.
RAMERR EQU #5B5E ; 1 Error number for use by RST #08 held in RAMRST. RAMERR EQU #5B5E ; 1 Error number for use by RST #08 held in RAMRST.
BAUD EQU #5B5F ; 2 Baud rate timing constant for RS232 socket. Default value of 11. [Name clash with ZX Interface 1 system variable at #5CC3] BAUD EQU #5B5F ; 2 Baud rate timing constant for RS232 socket. Default value of 11. [Name clash with ZX Interface 1 system variable at #5CC3]
SERFL EQU #5B61 ; 2 Second character received flag: SERFL EQU #5B61 ; 2 Second character received flag:
; Bit 0 : 1=Character in buffer. ; Bit 0 : 1=Character in buffer.
; Bits 1-7: Not used (always hold 0). ; Bits 1-7: Not used (always hold 0).
; #5B62 ; Received Character. ; #5B62 ; Received Character.
COL EQU #5B63 ; 1 Current column from 1 to WIDTH. COL EQU #5B63 ; 1 Current column from 1 to WIDTH.
WIDTH EQU #5B64 ; 1 Paper column width. Default value of 80. [Name clash with ZX Interface 1 Edition 2 system variable at #5CB1] WIDTH EQU #5B64 ; 1 Paper column width. Default value of 80. [Name clash with ZX Interface 1 Edition 2 system variable at #5CB1]
TVPARS EQU #5B65 ; 1 Number of inline parameters expected by RS232 (e.g. 2 for AT). TVPARS EQU #5B65 ; 1 Number of inline parameters expected by RS232 (e.g. 2 for AT).
FLAGS3 EQU #5B66 ; 1 Flags: [Name clashes with the ZX Interface 1 system variable at #5CB6] FLAGS3 EQU #5B66 ; 1 Flags: [Name clashes with the ZX Interface 1 system variable at #5CB6]
; Bit 0: 1=BASIC/Calculator mode, 0=Editor/Menu mode. ; Bit 0: 1=BASIC/Calculator mode, 0=Editor/Menu mode.
; Bit 1: 1=Auto-run loaded BASIC program. [Set but never tested by the ROM] ; Bit 1: 1=Auto-run loaded BASIC program. [Set but never tested by the ROM]
; Bit 2: 1=Editing RAM disk catalogue. ; Bit 2: 1=Editing RAM disk catalogue.
; Bit 3: 1=Using RAM disk commands, 0=Using cassette commands. ; Bit 3: 1=Using RAM disk commands, 0=Using cassette commands.
; Bit 4: 1=Indicate LOAD. ; Bit 4: 1=Indicate LOAD.
; Bit 5: 1=Indicate SAVE. ; Bit 5: 1=Indicate SAVE.
; Bit 6; 1=Indicate MERGE. ; Bit 6; 1=Indicate MERGE.
; Bit 7: 1=Indicate VERIFY. ; Bit 7: 1=Indicate VERIFY.
N_STR1 EQU #5B67 ; 10 Used by RAM disk to store a filename. [Name clash with ZX Interface 1 system variable at #5CDA] N_STR1 EQU #5B67 ; 10 Used by RAM disk to store a filename. [Name clash with ZX Interface 1 system variable at #5CDA]
; Used by the renumber routine to store the address of the BASIC line being examined. ; Used by the renumber routine to store the address of the BASIC line being examined.
HD_00 EQU #5B71 ; 1 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CE6] HD_00 EQU #5B71 ; 1 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CE6]
; Used as column pixel counter in COPY routine. ; Used as column pixel counter in COPY routine.
; Used by FORMAT command to store specified baud rate. ; Used by FORMAT command to store specified baud rate.
; Used by renumber routine to store the number of digits in a pre-renumbered line number reference. [Name clash with ZX Interface 1 system variable at #5CE7] ; Used by renumber routine to store the number of digits in a pre-renumbered line number reference. [Name clash with ZX Interface 1 system variable at #5CE7]
HD_0B EQU #5B72 ; 2 Used by RAM disk to store header info - length of block. HD_0B EQU #5B72 ; 2 Used by RAM disk to store header info - length of block.
; Used as half row counter in COPY routine. ; Used as half row counter in COPY routine.
; Used by renumber routine to generate ASCII representation of a new line number. ; Used by renumber routine to generate ASCII representation of a new line number.
HD_0D EQU #5B74 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CE9] HD_0D EQU #5B74 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CE9]
HD_0F EQU #5B76 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CEB] HD_0F EQU #5B76 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CEB]
; Used by renumber routine to store the address of a referenced BASIC line. ; Used by renumber routine to store the address of a referenced BASIC line.
HD_11 EQU #5B78 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CED] HD_11 EQU #5B78 ; 2 Used by RAM disk to store file header information (see RAM disk Catalogue section below for details). [Name clash with ZX Interface 1 system variable at #5CED]
; Used by renumber routine to store existing VARS address/current address within a line. ; Used by renumber routine to store existing VARS address/current address within a line.
SC_00 EQU #5B7A ; 1 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details). SC_00 EQU #5B7A ; 1 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details).
SC_0B EQU #5B7B ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details). SC_0B EQU #5B7B ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details).
SC_0D EQU #5B7D ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details). SC_0D EQU #5B7D ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details).
SC_0F EQU #5B7F ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details). SC_0F EQU #5B7F ; 2 Used by RAM disk to store alternate file header information (see RAM disk Catalogue section below for details).
OLDSP EQU #5B81 ; 2 Stores old stack pointer when TSTACK in use. OLDSP EQU #5B81 ; 2 Stores old stack pointer when TSTACK in use.
SFNEXT EQU #5B83 ; 2 End of RAM disk catalogue marker. Pointer to first empty catalogue entry. SFNEXT EQU #5B83 ; 2 End of RAM disk catalogue marker. Pointer to first empty catalogue entry.
SFSPACE EQU #5B85 ; 3 Number of bytes free in RAM disk (3 bytes, 17 bit, LSB first). SFSPACE EQU #5B85 ; 3 Number of bytes free in RAM disk (3 bytes, 17 bit, LSB first).
ROW01 EQU #5B88 ; 1 Stores keypad data for row 3, and flags: ROW01 EQU #5B88 ; 1 Stores keypad data for row 3, and flags:
; Bit 0 : 1=Key '+' pressed. ; Bit 0 : 1=Key '+' pressed.
; Bit 1 : 1=Key '6' pressed. ; Bit 1 : 1=Key '6' pressed.
; Bit 2 : 1=Key '5' pressed. ; Bit 2 : 1=Key '5' pressed.
; Bit 3 : 1=Key '4' pressed. ; Bit 3 : 1=Key '4' pressed.
; Bits 4-5: Always 0. ; Bits 4-5: Always 0.
; Bit 6 : 1=Indicates successful communications to the keypad. ; Bit 6 : 1=Indicates successful communications to the keypad.
; Bit 7 : 1=If communications to the keypad established. ; Bit 7 : 1=If communications to the keypad established.
ROW23 EQU #5B89 ; 1 Stores keypad key press data for rows 1 and 2: ROW23 EQU #5B89 ; 1 Stores keypad key press data for rows 1 and 2:
; Bit 0: 1=Key ')' pressed. ; Bit 0: 1=Key ')' pressed.
; Bit 1: 1=Key '(' pressed. ; Bit 1: 1=Key '(' pressed.
; Bit 2: 1=Key '*' pressed. ; Bit 2: 1=Key '*' pressed.
; Bit 3: 1=Key '/' pressed. ; Bit 3: 1=Key '/' pressed.
; Bit 4: 1=Key '-' pressed. ; Bit 4: 1=Key '-' pressed.
; Bit 5: 1=Key '9' pressed. ; Bit 5: 1=Key '9' pressed.
; Bit 6: 1=Key '8' pressed. ; Bit 6: 1=Key '8' pressed.
; Bit 7: 1=Key '7' pressed. ; Bit 7: 1=Key '7' pressed.
ROW45 EQU #5B8A ; 1 Stores keypad key press data for rows 4 and 5: ROW45 EQU #5B8A ; 1 Stores keypad key press data for rows 4 and 5:
; Bit 0: Always 0. ; Bit 0: Always 0.
; Bit 1: 1=Key '.' pressed. ; Bit 1: 1=Key '.' pressed.
; Bit 2: Always 0. ; Bit 2: Always 0.
; Bit 3: 1=Key '0' pressed. ; Bit 3: 1=Key '0' pressed.
; Bit 4: 1=Key 'ENTER' pressed. ; Bit 4: 1=Key 'ENTER' pressed.
; Bit 5: 1=Key '3' pressed. ; Bit 5: 1=Key '3' pressed.
; Bit 6: 1=Key '2' pressed. ; Bit 6: 1=Key '2' pressed.
; Bit 7: 1=Key '1' pressed. ; Bit 7: 1=Key '1' pressed.
SYNRET EQU #5B8B ; 2 Return address for ONERR routine. SYNRET EQU #5B8B ; 2 Return address for ONERR routine.
LASTV EQU #5B8D ; 5 Last value printed by calculator. LASTV EQU #5B8D ; 5 Last value printed by calculator.
RNLINE EQU #5B92 ; 2 Address of the length bytes in the line currently being renumbered. RNLINE EQU #5B92 ; 2 Address of the length bytes in the line currently being renumbered.
RNFIRST EQU #5B94 ; 2 Starting line number when renumbering. Default value of 10. RNFIRST EQU #5B94 ; 2 Starting line number when renumbering. Default value of 10.
RNSTEP EQU #5B96 ; 2 Step size when renumbering. Default value of 10. RNSTEP EQU #5B96 ; 2 Step size when renumbering. Default value of 10.
STRIP1 EQU #5B98 ; 32 Used as RAM disk transfer buffer (32 bytes to #5BB7). STRIP1 EQU #5B98 ; 32 Used as RAM disk transfer buffer (32 bytes to #5BB7).
; Used to hold Sinclair stripe character patterns (16 bytes to #5BA7). ; Used to hold Sinclair stripe character patterns (16 bytes to #5BA7).
; ... ; ...
TSTACK EQU #5BFF ; n Temporary stack (grows downwards). The byte at #5BFF is not actually used. TSTACK EQU #5BFF ; n Temporary stack (grows downwards). The byte at #5BFF is not actually used.
; ------------------------- ; -------------------------
; Standard System Variables ; Standard System Variables
@ -922,28 +925,49 @@ NMI_POINT:
; RET ; ; RET ;
; ENT ; ENT
;SWAP_ROM
;L006B Paging subroutine
RAM_ROUTINES: RAM_ROUTINES:
L006B: PUSH AF ; Save AF and BC. DISP BASIC_FN.x128.ROM_SWAP
PUSH BC ; SWAP_ROM:
LD BC,#7FFD ; IFNDEF MODIFIED_SWAP
LD A,(BANK_M) ; #5B5C. PUSH AF ; Save AF and BC.
XOR #10 ; Select other ROM. PUSH BC ;
DI ; Disable interrupts whilst switching ROMs. LD BC,$7FFD ;
LD (BANK_M),A ; #5B5C. LD A,(BANK_M) ; $5B5C.
OUT (C),A ; Switch to the other ROM. .PRESENCE: XOR $10 ; Select other ROM.
EI ; DI ; Disable interrupts whilst switching ROMs.
POP BC ; Restore BC and AF. LD (BANK_M),A ; $5B5C.
POP AF ; OUT (C),A ; Switch to the other ROM.
RET ; EI ;
.Size EQU $-L006B POP BC ; Restore BC and AF.
POP AF ;
RET ;
ELSE
PUSH AF ; Save AF and BC.
PUSH BC ;
LD A,R
PUSH AF
LD A,(BANK_M) ; $5B5C.
.PRESENCE: XOR #10 ; Select other ROM.
CALL TST_KOSTYL
POP AF
JP PO,TST_KOSTYL2.no_EI
JR TST_KOSTYL2
;
RET ; ­  ¢á直© á«ãç ©
BLOCK #7F-$$$,0
ENDIF
; ˆá¯®«ì§ã¥âáï ¢ L3B49 SP__48.ASM
ASSERT SWAP_ROM.PRESENCE = #5B08, "ERROR: SWAP_ROM.PRESENCE NOT GOOD"
; --------------------------- ; ---------------------------
; Return to Other ROM Routine (copied to #5B14) ; Return to Other ROM Routine (copied to #5B14)
; --------------------------- ; ---------------------------
; Switch to the other ROM from that currently paged in ; Switch to the other ROM from that currently paged in
; and then return to the address held in RETADDR. ; and then return to the address held in RETADDR.
;YOUNGER YOUNGER:
L007F: CALL SWAP_ROM ; #5B00. Toggle to the other ROM. L007F: CALL SWAP_ROM ; #5B00. Toggle to the other ROM.
PUSH HL ; PUSH HL ;
LD HL,(RETADDR) ; #5B5A. LD HL,(RETADDR) ; #5B5A.
@ -955,16 +979,30 @@ L007F: CALL SWAP_ROM ; #5B00. Toggle to the other ROM.
; --------------------- ; ---------------------
; This error handler routine switches back to ROM 0 and then ; This error handler routine switches back to ROM 0 and then
; executes the routine pointed to by system variable TARGET. ; executes the routine pointed to by system variable TARGET.
;L0088:
ONERR:
IFNDEF MODIFIED_SWAP
DI ; Ensure interrupts are disabled whilst paging.
LD A,(BANK_M) ; #5B5C. Fetch current paging configuration.
AND #EF ; Select ROM 0.
LD (BANK_M),A ; #5B5C. Save the new configuration
LD BC,#7FFD ;
OUT (C),A ; Switch to ROM 0.
EI ;
JP L00C3 ; Jump to #00C3 (ROM 0) to continue.
ELSE
LD A,(BANK_M) ; $5B5C. Fetch current paging configuration.
AND $EF ; Select ROM 0.
CALL TST_KOSTYL
JR .exit
TST_KOSTYL2: EI
.no_EI: POP BC ; Restore BC and AF.
POP AF ;
RET
ONERR.exit: EI ;
JP L00C3 ; Jump to $00C3 (ROM 0) to continue.
ENDIF
;ONERR
L0088: DI ; Ensure interrupts are disabled whilst paging.
LD A,(BANK_M) ; #5B5C. Fetch current paging configuration.
AND #EF ; Select ROM 0.
LD (BANK_M),A ; #5B5C. Save the new configuration
LD BC,#7FFD ;
OUT (C),A ; Switch to ROM 0.
EI ;
JP L00C3 ; Jump to #00C3 (ROM 0) to continue.
; ------------------------- ; -------------------------
; 'P' Channel Input Routine (copied to #5B2F) ; 'P' Channel Input Routine (copied to #5B2F)
@ -973,9 +1011,9 @@ L0088: DI ; Ensure interrupts are disabled whilst paging.
; It causes ROM 0 to be paged in so that the new RS232 routines ; It causes ROM 0 to be paged in so that the new RS232 routines
; can be accessed. ; can be accessed.
;PIN PIN:
L009A: LD HL,L06D8 ; RS232 input routine within ROM 0. L009A: LD HL,L06D8 ; RS232 input routine within ROM 0.
JR L00A2 ; JR POUT.L00A2 ;
; -------------------------- ; --------------------------
; 'P' Channel Output Routine (copied to #5B34) ; 'P' Channel Output Routine (copied to #5B34)
@ -984,37 +1022,67 @@ L009A: LD HL,L06D8 ; RS232 input routine within ROM 0.
; It causes ROM 0 to be paged in so that the new RS232 routines ; It causes ROM 0 to be paged in so that the new RS232 routines
; can be accessed. ; can be accessed.
; Entry: A=Byte to send. ; Entry: A=Byte to send.
;L009F:
;POUT POUT:
L009F: LD HL,L07CA ; RS232 output routine within ROM 0. IFNDEF MODIFIED_SWAP
LD HL,L07CA ; RS232 output routine within ROM 0.
L00A2: EX AF,AF' ; Save AF registers. .L00A2: EX AF,AF' ; Save AF registers.
LD BC,#7FFD ; LD BC,#7FFD ;
LD A,(BANK_M) ; #5B5C. Fetch the current paging configuration LD A,(BANK_M) ; #5B5C. Fetch the current paging configuration
PUSH AF ; and save it. PUSH AF ; and save it.
AND #EF ; Select ROM 0. AND #EF ; Select ROM 0.
DI ; Ensure interrupts are disabled whilst paging. DI ; Ensure interrupts are disabled whilst paging.
LD (BANK_M),A ; #5B5C. Store the new paging configuration. LD (BANK_M),A ; #5B5C. Store the new paging configuration.
OUT (C),A ; Switch to ROM 0. OUT (C),A ; Switch to ROM 0.
JP L05E6 ; Jump to the RS232 channel input/output handler routine. JP L05E6 ; Jump to the RS232 channel input/output handler routine.
ELSE
LD HL,L07CA ; RS232 output routine within ROM 0.
.L00A2: EX AF,AF' ; Save AF registers.
LD A,(BANK_M) ; #5B5C. Fetch the current paging configuration
PUSH AF ; and save it.
AND #EF ; Select ROM 0.
;
JR TST_KOSTYL3
;
TST_KOSTYL: LD BC,#7FFD ;
DI ; Ensure interrupts are disabled whilst paging.
LD (BANK_M),A ; #5B5C. Store the new paging configuration.
OUT (C),A ; Switch to ROM 0.
RET
ENDIF
; ------------------------ ; ------------------------
; 'P' Channel Exit Routine (copied to #5B4A) ; 'P' Channel Exit Routine (copied to #5B4A)
; ------------------------ ; ------------------------
; Used when returning from a channel 'P' read or write operation. ; Used when returning from a channel 'P' read or write operation.
; It causes the original ROM to be paged back in and returns back to ; It causes the original ROM to be paged back in and returns back to
; the calling routine. ; the calling routine.
;L00B5:
;POUT2 POUT2:
L00B5: EX AF,AF' ; Save AF registers. For a read, A holds the byte read and the flags the success status. IFNDEF MODIFIED_SWAP
POP AF ; Retrieve original paging configuration. EX AF,AF' ; Save AF registers. For a read, A holds the byte read and the flags the success status.
LD BC,#7FFD ; POP AF ; Retrieve original paging configuration.
DI ; Ensure interrupts are disabled whilst paging. LD BC,#7FFD ;
LD (BANK_M),A ; #5B5C. Store original paging configuration. DI ; Ensure interrupts are disabled whilst paging.
OUT (C),A ; Switch back to original paging configuration. LD (BANK_M),A ; #5B5C. Store original paging configuration.
EI ; OUT (C),A ; Switch back to original paging configuration.
EX AF,AF' ; Restore AF registers. For a read, A holds the byte read and the flags the success status. EI ;
RET EX AF,AF' ; Restore AF registers. For a read, A holds the byte read and the flags the success status.
RET
ELSE
EX AF,AF' ; Save AF registers. For a read, A holds the byte read and the flags the success status.
POP AF ; Retrieve original paging configuration.
CALL TST_KOSTYL
EI ;
EX AF,AF' ; Restore AF registers. For a read, A holds the byte read and the flags the success status.
RET
;
TST_KOSTYL3:
LD BC,L05E6
PUSH BC
JR TST_KOSTYL
ENDIF
;
ENT
RAM_ROUTINES.Size EQU $-RAM_ROUTINES RAM_ROUTINES.Size EQU $-RAM_ROUTINES
;<<<<<<<<<<<<<<<<<<<<<<<<< End of RAM Routines >>>>>>>>>>>>>>>>>>>>>>>>>; ;<<<<<<<<<<<<<<<<<<<<<<<<< End of RAM Routines >>>>>>>>>>>>>>>>>>>>>>>>>;
@ -1054,7 +1122,10 @@ L00C9: LD A,B ;
LD HL,#C000 ; Start of the current RAM bank. LD HL,#C000 ; Start of the current RAM bank.
LD DE,#C001 ; LD DE,#C001 ;
LD BC,#3FFF ; All 16K of RAM bank. LD BC,#3FFF ; All 16K of RAM bank.
LD A,#FF ; ;!TEST
LD A,#FF ;
;LD A,C
;
LD (HL),A ; Store #FF into RAM location. LD (HL),A ; Store #FF into RAM location.
CP (HL) ; Check RAM integrity. CP (HL) ; Check RAM integrity.
JR NZ,L0131 ; Jump if RAM error found. JR NZ,L0131 ; Jump if RAM error found.
@ -1069,7 +1140,6 @@ L00C9: LD A,B ;
DJNZ L00C9 ; Repeat for other RAM banks. DJNZ L00C9 ; Repeat for other RAM banks.
LD (ROW01),A ; #5B88. Signal no communications in progress to the keypad. LD (ROW01),A ; #5B88. Signal no communications in progress to the keypad.
LD C,#FD ; LD C,#FD ;
LD D,#FF ; LD D,#FF ;
LD E,#BF ; LD E,#BF ;
@ -1077,11 +1147,15 @@ L00C9: LD A,B ;
LD A,#0E ; LD A,#0E ;
OUT (C),A ; Select AY register 14. OUT (C),A ; Select AY register 14.
LD B,E ; BC=#BFFD. LD B,E ; BC=#BFFD.
LD A,#FF ; ;!TEST
OUT (C),A ; Set AY register 14 to #FF. This will force a communications reset to the keypad if present. LD A,#FF ;
JR L0137 ; Jump ahead to continue. OUT (C),A ; Set AY register 14 to #FF. This will force a communications reset to the keypad if present.
JR L0137 ; Jump ahead to continue.
L00FF: DB #00 ; [Spare byte] ;OUT (C),D
;JR L0137
;
_mInfoBLOCK #0100 - $,0
;L00FF: DB #00 ; [Spare byte]
; ==================== ; ====================
@ -1166,7 +1240,7 @@ L0137: LD B,D ; Complete setting up the sound chip registers.
LD HL,#2BEC ; LD HL,#2BEC ;
LD A,#01 ; AHL=Free space in RAM disk. LD A,#01 ; AHL=Free space in RAM disk.
LD (SFSPACE),HL ; #5B85. Current address. LD (SFSPACE),HL ; #5B85. Current address.
LD (SFSPACE+2),A ; #5B87. Current RAM bank. LD (SFSPACE+2),A; #5B87. Current RAM bank.
LD A,#05 ; LD A,#05 ;
CALL L1C64 ; Page in logical RAM bank 5 (physical RAM bank 0). CALL L1C64 ; Page in logical RAM bank 5 (physical RAM bank 0).
@ -1178,7 +1252,7 @@ L0137: LD B,D ; Complete setting up the sound chip registers.
LD BC,#00A8 ; There are 21 User Defined Graphics to copy. LD BC,#00A8 ; There are 21 User Defined Graphics to copy.
EX DE,HL ; Swap so destination is #FFFF. EX DE,HL ; Swap so destination is #FFFF.
RST #28 ; RST #28 ;
DW MAKE_ROOM+#000C ; Calling this address (LDDR/RET) in the main ROM DW MAKE_ROOM+#000C; Calling this address (LDDR/RET) in the main ROM
; cleverly copies the 21 characters to the end of RAM. ; cleverly copies the 21 characters to the end of RAM.
EX DE,HL ; Transfer DE to HL. EX DE,HL ; Transfer DE to HL.
@ -9313,10 +9387,6 @@ L2330: CALL L18A1 ; Ensure end-of-statement or end-of-line.
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ; ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ;
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ; ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ;
; ------------------------------ ; ------------------------------
; Main Menu - Tape Loader Option ; Main Menu - Tape Loader Option
; ------------------------------ ; ------------------------------
@ -14054,9 +14124,9 @@ L335F: LD HL,#0000 ; Signal no line number of command.
LD (#FC9F),HL ; Signal no further character to fetch from the BASIC line within the program area. LD (#FC9F),HL ; Signal no further character to fetch from the BASIC line within the program area.
LD (#FCA1),HL ; Signal no further character to fetch from the Keyword Construction Buffer. LD (#FCA1),HL ; Signal no further character to fetch from the Keyword Construction Buffer.
LD HL,RAM_Routines ; Source for Insert Keyword Representation Into Keyword Construction Buffer routine. LD HL,RAM_Routines2 ; Source for Insert Keyword Representation Into Keyword Construction Buffer routine.
LD DE,#FCAE ; Destination for Insert Keyword Representation Into Keyword Construction Buffer routine. LD DE,#FCAE ; Destination for Insert Keyword Representation Into Keyword Construction Buffer routine.
LD BC,RAM_Routines.Size LD BC,RAM_Routines2.Size
LDIR ; Copy the routine to RAM bank 7 at address #FCAE. LDIR ; Copy the routine to RAM bank 7 at address #FCAE.
RET ; RET ;
@ -14075,7 +14145,7 @@ L335F: LD HL,#0000 ; Signal no line number of command.
; DE=Insertion address within Keyword Construction Buffer. ; DE=Insertion address within Keyword Construction Buffer.
; ;
; Copied to physical RAM bank 7 at #FCAE-#FCFC by subroutine at #335F (ROM 0). ; Copied to physical RAM bank 7 at #FCAE-#FCFC by subroutine at #335F (ROM 0).
RAM_Routines: RAM_Routines2:
L3374: DI ; Disable interrupts whilst paging. L3374: DI ; Disable interrupts whilst paging.
LD BC,#7FFD ; LD BC,#7FFD ;
@ -14260,7 +14330,7 @@ L3426: LD A,B ; Fetch the character code of the matching token (#00
OUT (C),D ; OUT (C),D ;
EI ; Re-enable interrupts. EI ; Re-enable interrupts.
RET ; <<< Last byte copied to RAM >>> RET ; <<< Last byte copied to RAM >>>
RAM_Routines.Size EQU $-RAM_Routines RAM_Routines2.Size EQU $-RAM_Routines2
; --------------------------------------------------------------------- ; ---------------------------------------------------------------------
; Create Next Line Number Representation in Keyword Construction Buffer ; Create Next Line Number Representation in Keyword Construction Buffer
; --------------------------------------------------------------------- ; ---------------------------------------------------------------------

View File

@ -137,8 +137,8 @@ CONT_5:
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
REDIR_RST38:
_mInfoBLOCK #38-$,#FF _mInfoBLOCK #38-$,#FF
REDIR_RST38:
; JP RST38X ; JP RST38X
; EI ; EI
; RET ; RET

View File

@ -7,7 +7,8 @@
; The Spectrum ROMs are copyright Amstrad, who have kindly given permission ; The Spectrum ROMs are copyright Amstrad, who have kindly given permission
; to reverse engineer and publish ROM disassemblies. ; to reverse engineer and publish ROM disassemblies.
; DEFINE NEW_TAP_PROC SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine for BASIC 128 ROM
; ===== ; =====
; NOTES ; NOTES
; ===== ; =====
@ -19166,7 +19167,7 @@ L3B46: LD HL,#010F ; Vector table entry in Editor ROM -> JP #03A2
; Return to Editor ROM at address in HL ; Return to Editor ROM at address in HL
L3B49: EX (SP),HL ; Change the return address L3B49: EX (SP),HL ; Change the return address
JP #5B00 ; Page Editor ROM and return to the address on the stack JP SWAP_ROM ; Page Editor ROM and return to the address on the stack
; ------------------------------------- ; -------------------------------------
; STATEMENT INTERPRETATION RETURN PATCH ; STATEMENT INTERPRETATION RETURN PATCH