ROM patch, attempt number 2
ZXNet echo conference «code.zx»
From Kirill Frolov → To All 4 April 2002
Press RESET immediately, All!
The first version had a terrible glitch.
=== Cut ===
; (L) Copyleft Kirill Frolov 04-04-2002
;
; Patch for Basic-128.
; The patch is applied using ALASM
; assembler The patch does the following
; changes in BASIC firmware:
;
; 1. Removed from the menu
; "Tape Loader" item.
; 2. The item "TR-Dos" is put first
; in the menu (instead of "Tape Loader").
; 3. The last item "TR-DOS" has been replaced
; item "Reset" to perform
; cold reset programs.
; 4. If at the moment of reset the
; Caps Shift key then happens
; exit to the menu without performing
; "cold reset".
; 5. While holding down the Symbol Shift key
; Basic-128 starts
; (program in shadow bank ROM
; will not be launched).
; 6. If the above keys are not
; are held, then checked
; RAM contents by addresses
; #5c00..#5c0f. If audited
; cells are filled with one value
; what is supposed to have happened
; the computer turns on and happens
; execution of the cold program
; reset", otherwise exit
; on the menu.
;
; Notes:
; To call an image test from
; Basic-128 required when resetting
; hold down 3 keys at the same time:
; Caps Shift, Symbol Shift and Space
; (or Symbol Shift and Break).
; While simultaneously holding
; Caps Shift and Symbol Shift
; (or one Ext Mode key); you will exit to the Basic-128 menu.
; By exiting to the menu we mean
; launching a program from a shadow bank
; ROM" on computers like Scorpion and
; Kay or exit to the Basic-128 menu
; on a Pentagon type computer (if
; If necessary, the program can be
; upgraded to run programs
; from an additional ROM bank to
; Pentagon computer). In additional
; the ROM bank can contain commanders
; (boot) TR-DOS (for example
; Quick Commander) or firmware type
; MadROM.
; Under "cold reset"
; implies the launch of the program
; from TR-DOS ROM bank to boot
; boot file (if necessary, it is possible
; modernization of the program for launch
; iS-DOS from hard drive).
;
; For the patch to work correctly
; you need to set the computer type
; Pentagon or Scorpion/Kay.
;
; The ROM firmware should be patched
; Basic-128 from the Pentagon computer.
;
; VIMAIE! The program is not intended
; to fix computer ROM
; Scorpion working with shadow
; monitor. Change ROM contents
; Basic-128 in the Scorpion computer
; DO NOT if you have a shadow monitor.
; If you want to use this
; the patch will have to be abandoned
; using shadow monitor and
; replace the contents of Basic-48,
; Basic-128 and TR-DOS standard
; firmware (for example from computers
; Pentagon or Kay).
;
; and different versions of the Kay computer
; the program has not been tested and; it might not work.
;
; Setting the machine type
; PENTAGON = 0
MACHINE EQU 1 ; SCORPION & KAY = 1
;-------------------------------------------------------
LOAD EQU #C000
JMP128 EQU #0009
TEST128 EQU #00C7
TTSBEG EQU #3C20 ; TAPE-TESTER #43 BYTES
TTSEND EQU #3C63
RSRBEG EQU #06E8 ; RS232 RECEIVER #E2 BYTES
RSREND EQU #07CA
RSSBEG EQU #11A3 ; RS232 TRANSMITTER #48 BYTES
RSSEND EQU #11EB
TEMPSTK EQU #5C08
TEMPPRG EQU #5D3B
ORG LOAD
DISP 0
; loading standard PETAGO firmware Basic-128
INCBIN "rom128"
;--------------------------------------------------
ORG LOAD+JMP128
DISP JMP128
JP TEST
;--------------------------------------------------
ORG LOAD+RSRBEG
DISP RSRBEG
XOR A
RET ; NO RS232
TEST
LD SP,TEMPSTK
LD HL,#5C00
LD BC,#10
LD A,(HL)
CPL1 CPI
JP NZ,BRESET
JP PE,CPL1
LD A,#FE
IN A,(#FE) ; CAPS SHIFT
RRA
JP NC,BRESET
JP POWERUP
PRESET DI
LD SP,TEMPSTK
POWERUP LD HL,R_PUP
JR RJP
BRESET LD A,#7F
IN A,(#FE) ; SYMBOL SHIFT
AND #02
JP Z,TEST128
LD HL,R_RES
R.J.P.
LD DE,TEMPPRG
LD BC,#0080 ; FIXME size
LDIR
LD BC,#7FFD
JP TEMPPRG ; DISP TEMPPRG
R_PUP LD HL,0
PUSH HL
LD A,#10
OUT (C),A
JP #3D2F
R_RES IFN MACHINE
LD HL,#0A00
OUT (C),L
LD B,#1F
OUT (C),H
RST #00
ELSE
JP TEST128
ENDIF
; ENT
; DISP $-LOAD
;---------------------------------------------------
ORG LOAD+RSSBEG
DISP RSSBEG
RET
;-----------------------------------------------------
ORG LOAD+#275E
DB "TR-Dos "
DW #2020,#A020
ORG LOAD+#2784
DB "Reset"
DW #2020,#2020
DW #A020
ORG LOAD+#2744+2
DW #2816
ORG LOAD+#2744+14
DW PRESET
;-----------------------------------------------------
ORG LOAD+TTSBEG
DISP TTSBEG
;-----------------------------------------------------
ENT
=== Cut ===