From 57cdd81dcb2e29d85c8927c36d44e6ea7953442f Mon Sep 17 00:00:00 2001 From: Tolik <85737314+Tolik-Trek@users.noreply.github.com> Date: Sat, 25 Oct 2025 23:51:00 +1000 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=81=D1=82=D1=8B=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20RAM=5FROUTINES=20=D0=B2=20SP=5F128=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B5=D1=80=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20SWAP=5FRO?= =?UTF-8?q?M?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SP_128.ASM | 378 ++++++++++++++++++++++++++++++--------------------- SP_TRDOS.ASM | 2 +- SP__48.ASM | 5 +- 3 files changed, 228 insertions(+), 157 deletions(-) diff --git a/SP_128.ASM b/SP_128.ASM index 4e0b443..ef3492d 100644 --- a/SP_128.ASM +++ b/SP_128.ASM @@ -2,11 +2,14 @@ ; *** SPECTRUM 128 ROM 0 DISASSEMBLY *** ; ************************************** 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 ; to reverse engineer and publish Spectrum ROM disassemblies. - ; ===== ; NOTES ; ===== @@ -248,90 +251,90 @@ ; 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. -SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine. -YOUNGER EQU #5B14 ; 9 Return paging subroutine. -ONERR EQU #5B1D ; 18 Error handler paging subroutine. -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. -POUT2 EQU #5B4A ; 14 RS232 character output pre-routine. -TARGET EQU #5B58 ; 2 Address of subroutine to call in ROM 1. -RETADDR EQU #5B5A ; 2 Return address in ROM 0. -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. -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] -SERFL EQU #5B61 ; 2 Second character received flag: - ; Bit 0 : 1=Character in buffer. - ; Bits 1-7: Not used (always hold 0). - ; #5B62 ; Received Character. -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] -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] - ; 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 2: 1=Editing RAM disk catalogue. - ; Bit 3: 1=Using RAM disk commands, 0=Using cassette commands. - ; Bit 4: 1=Indicate LOAD. - ; Bit 5: 1=Indicate SAVE. - ; Bit 6; 1=Indicate MERGE. - ; 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] - ; 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] - ; Used as column pixel counter in COPY routine. - ; 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] -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 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_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. -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. -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_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). -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. -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: - ; Bit 0 : 1=Key '+' pressed. - ; Bit 1 : 1=Key '6' pressed. - ; Bit 2 : 1=Key '5' pressed. - ; Bit 3 : 1=Key '4' pressed. - ; Bits 4-5: Always 0. - ; Bit 6 : 1=Indicates successful communications to the keypad. - ; Bit 7 : 1=If communications to the keypad established. -ROW23 EQU #5B89 ; 1 Stores keypad key press data for rows 1 and 2: - ; Bit 0: 1=Key ')' pressed. - ; Bit 1: 1=Key '(' pressed. - ; Bit 2: 1=Key '*' pressed. - ; Bit 3: 1=Key '/' pressed. - ; Bit 4: 1=Key '-' pressed. - ; Bit 5: 1=Key '9' pressed. - ; Bit 6: 1=Key '8' pressed. - ; Bit 7: 1=Key '7' pressed. -ROW45 EQU #5B8A ; 1 Stores keypad key press data for rows 4 and 5: - ; Bit 0: Always 0. - ; Bit 1: 1=Key '.' pressed. - ; Bit 2: Always 0. - ; Bit 3: 1=Key '0' pressed. - ; Bit 4: 1=Key 'ENTER' pressed. - ; Bit 5: 1=Key '3' pressed. - ; Bit 6: 1=Key '2' pressed. - ; Bit 7: 1=Key '1' pressed. -SYNRET EQU #5B8B ; 2 Return address for ONERR routine. -LASTV EQU #5B8D ; 5 Last value printed by calculator. -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. -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). - ; 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. +;SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine. +;YOUNGER EQU #5B14 ; 9 Return paging subroutine. +;ONERR EQU #5B1D ; 18 Error handler paging subroutine. +;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. +;POUT2 EQU #5B4A ; 14 RS232 character output pre-routine. +TARGET EQU #5B58 ; 2 Address of subroutine to call in ROM 1. +RETADDR EQU #5B5A ; 2 Return address in ROM 0. +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. +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] +SERFL EQU #5B61 ; 2 Second character received flag: + ; Bit 0 : 1=Character in buffer. + ; Bits 1-7: Not used (always hold 0). + ; #5B62 ; Received Character. +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] +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] + ; 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 2: 1=Editing RAM disk catalogue. + ; Bit 3: 1=Using RAM disk commands, 0=Using cassette commands. + ; Bit 4: 1=Indicate LOAD. + ; Bit 5: 1=Indicate SAVE. + ; Bit 6; 1=Indicate MERGE. + ; 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] + ; 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] + ; Used as column pixel counter in COPY routine. + ; 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] +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 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_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. +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. +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_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). +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. +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: + ; Bit 0 : 1=Key '+' pressed. + ; Bit 1 : 1=Key '6' pressed. + ; Bit 2 : 1=Key '5' pressed. + ; Bit 3 : 1=Key '4' pressed. + ; Bits 4-5: Always 0. + ; Bit 6 : 1=Indicates successful communications to the keypad. + ; Bit 7 : 1=If communications to the keypad established. +ROW23 EQU #5B89 ; 1 Stores keypad key press data for rows 1 and 2: + ; Bit 0: 1=Key ')' pressed. + ; Bit 1: 1=Key '(' pressed. + ; Bit 2: 1=Key '*' pressed. + ; Bit 3: 1=Key '/' pressed. + ; Bit 4: 1=Key '-' pressed. + ; Bit 5: 1=Key '9' pressed. + ; Bit 6: 1=Key '8' pressed. + ; Bit 7: 1=Key '7' pressed. +ROW45 EQU #5B8A ; 1 Stores keypad key press data for rows 4 and 5: + ; Bit 0: Always 0. + ; Bit 1: 1=Key '.' pressed. + ; Bit 2: Always 0. + ; Bit 3: 1=Key '0' pressed. + ; Bit 4: 1=Key 'ENTER' pressed. + ; Bit 5: 1=Key '3' pressed. + ; Bit 6: 1=Key '2' pressed. + ; Bit 7: 1=Key '1' pressed. +SYNRET EQU #5B8B ; 2 Return address for ONERR routine. +LASTV EQU #5B8D ; 5 Last value printed by calculator. +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. +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). + ; 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. ; ------------------------- ; Standard System Variables @@ -922,28 +925,49 @@ NMI_POINT: ; RET ; ; ENT -;SWAP_ROM + +;L006B Paging subroutine RAM_ROUTINES: -L006B: PUSH AF ; Save AF and BC. - PUSH BC ; - LD BC,#7FFD ; - LD A,(BANK_M) ; #5B5C. - XOR #10 ; Select other ROM. - DI ; Disable interrupts whilst switching ROMs. - LD (BANK_M),A ; #5B5C. - OUT (C),A ; Switch to the other ROM. - EI ; - POP BC ; Restore BC and AF. - POP AF ; - RET ; -.Size EQU $-L006B + DISP BASIC_FN.x128.ROM_SWAP +SWAP_ROM: + IFNDEF MODIFIED_SWAP + PUSH AF ; Save AF and BC. + PUSH BC ; + LD BC,$7FFD ; + LD A,(BANK_M) ; $5B5C. +.PRESENCE: XOR $10 ; Select other ROM. + DI ; Disable interrupts whilst switching ROMs. + LD (BANK_M),A ; $5B5C. + OUT (C),A ; Switch to the other ROM. + EI ; + 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) ; --------------------------- ; Switch to the other ROM from that currently paged in ; and then return to the address held in RETADDR. -;YOUNGER +YOUNGER: L007F: CALL SWAP_ROM ; #5B00. Toggle to the other ROM. PUSH HL ; 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 ; 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) @@ -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 ; can be accessed. -;PIN -L009A: LD HL,L06D8 ; RS232 input routine within ROM 0. - JR L00A2 ; +PIN: +L009A: LD HL,L06D8 ; RS232 input routine within ROM 0. + JR POUT.L00A2 ; ; -------------------------- ; '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 ; can be accessed. ; Entry: A=Byte to send. - -;POUT -L009F: LD HL,L07CA ; RS232 output routine within ROM 0. - -L00A2: EX AF,AF' ; Save AF registers. - LD BC,#7FFD ; - LD A,(BANK_M) ; #5B5C. Fetch the current paging configuration - PUSH AF ; and save it. - AND #EF ; Select ROM 0. - DI ; Ensure interrupts are disabled whilst paging. - LD (BANK_M),A ; #5B5C. Store the new paging configuration. - OUT (C),A ; Switch to ROM 0. - JP L05E6 ; Jump to the RS232 channel input/output handler routine. - +;L009F: +POUT: + IFNDEF MODIFIED_SWAP + LD HL,L07CA ; RS232 output routine within ROM 0. +.L00A2: EX AF,AF' ; Save AF registers. + LD BC,#7FFD ; + LD A,(BANK_M) ; #5B5C. Fetch the current paging configuration + PUSH AF ; and save it. + AND #EF ; Select ROM 0. + DI ; Ensure interrupts are disabled whilst paging. + LD (BANK_M),A ; #5B5C. Store the new paging configuration. + OUT (C),A ; Switch to ROM 0. + 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) ; ------------------------ ; 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 ; the calling routine. - -;POUT2 -L00B5: 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. - LD BC,#7FFD ; - DI ; Ensure interrupts are disabled whilst paging. - LD (BANK_M),A ; #5B5C. Store original paging configuration. - OUT (C),A ; Switch back to original paging configuration. - EI ; - EX AF,AF' ; Restore AF registers. For a read, A holds the byte read and the flags the success status. - RET +;L00B5: +POUT2: + IFNDEF MODIFIED_SWAP + 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. + LD BC,#7FFD ; + DI ; Ensure interrupts are disabled whilst paging. + LD (BANK_M),A ; #5B5C. Store original paging configuration. + OUT (C),A ; Switch back to original paging configuration. + EI ; + 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 ;<<<<<<<<<<<<<<<<<<<<<<<<< End of RAM Routines >>>>>>>>>>>>>>>>>>>>>>>>>; @@ -1054,7 +1122,10 @@ L00C9: LD A,B ; LD HL,#C000 ; Start of the current RAM bank. LD DE,#C001 ; 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. CP (HL) ; Check RAM integrity. JR NZ,L0131 ; Jump if RAM error found. @@ -1069,7 +1140,6 @@ L00C9: LD A,B ; DJNZ L00C9 ; Repeat for other RAM banks. LD (ROW01),A ; #5B88. Signal no communications in progress to the keypad. - LD C,#FD ; LD D,#FF ; LD E,#BF ; @@ -1077,11 +1147,15 @@ L00C9: LD A,B ; LD A,#0E ; OUT (C),A ; Select AY register 14. LD B,E ; BC=#BFFD. - LD A,#FF ; - 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] + ;!TEST + LD A,#FF ; + 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. + ;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 A,#01 ; AHL=Free space in RAM disk. 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 ; 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. EX DE,HL ; Swap so destination is #FFFF. 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. 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 ; ------------------------------ @@ -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 (#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 BC,RAM_Routines.Size + LD BC,RAM_Routines2.Size LDIR ; Copy the routine to RAM bank 7 at address #FCAE. RET ; @@ -14075,7 +14145,7 @@ L335F: LD HL,#0000 ; Signal no line number of command. ; DE=Insertion address within Keyword Construction Buffer. ; ; 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. LD BC,#7FFD ; @@ -14260,7 +14330,7 @@ L3426: LD A,B ; Fetch the character code of the matching token (#00 OUT (C),D ; EI ; Re-enable interrupts. 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 ; --------------------------------------------------------------------- diff --git a/SP_TRDOS.ASM b/SP_TRDOS.ASM index 412a2c6..a63ecb0 100644 --- a/SP_TRDOS.ASM +++ b/SP_TRDOS.ASM @@ -137,8 +137,8 @@ CONT_5: //////////////////////////////////////////////////////////////////////// -REDIR_RST38: _mInfoBLOCK #38-$,#FF +REDIR_RST38: ; JP RST38X ; EI ; RET diff --git a/SP__48.ASM b/SP__48.ASM index 24ef118..44d8756 100644 --- a/SP__48.ASM +++ b/SP__48.ASM @@ -7,7 +7,8 @@ ; The Spectrum ROMs are copyright Amstrad, who have kindly given permission ; to reverse engineer and publish ROM disassemblies. -; DEFINE NEW_TAP_PROC +SWAP_ROM EQU #5B00 ; 20 Swap paging subroutine for BASIC 128 ROM + ; ===== ; 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 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