Z88 Internal ROM Modifications | Updated 22 August 2004 |
There is a bug in the interface between OZ and BBC BASIC making the following errors not trappable:
17 Escape 192 Too many files open 222 Channel 252 File not found (etc.) 253 Sorry, not implemented 254 Bad commandRichard Russel's BASIC patch relies on error 253 being trappable. The error 'No room' is reported when trying to use the patch.
The cause of the bug was found by Richard Russell, the author of BBC BASIC Z80, and reported to Cambridge Computer Ltd 27th January 1989 but was not corrected until OZ was updated to version 4.0.
This bug can be eliminated by reprogramming the (EP)ROM chip.
At ROM image offset 19960h (bank 6 offset 1960h) you find the byte sequence 7D B4 CA 76 FE hex.
In assembly: LD A,L OR H JP Z,FE76hChange the first two bytes to make the sequence 24 25 CA 76 FE hex.
In assembly: INC H DEC H JP Z,FE76hThis is the fix that was introduced in OZ 4.0.
There is a bug in the serial port receiving routines corrupting characters received using odd or even parity by not stripping the parity bit.
The bug was reported by Michael J. Sims in the Z88 Users' Club newsletter Z88 EPROM May/June 1988.
The cause of this bug was found when disassembling the OS_SI operating system call in July 1998.
This bug can be eliminated by reprogramming the (EP)ROM chip.
At ROM image offset 1D03Ch (bank 7 offset 103Ch) for OZ up to 2.6, (and 3.0) or offset 0A63Ch (bank 2 offset 263Ch) for OZ 3.12 and up, you find the byte sequence CB 75 28 02 E6 7F hex.
In assembly: BIT 6,L JR Z,9042h AND 7FhChange the second byte to make the sequence CB 7D 28 02 E6 7F hex.
In assembly: BIT 7,L JR Z,9042h AND 7Fh
The bug was reported by Steve Marsh in the Z88 Users' Club newsletter Z88 EPROM Nov/Dec 1988.
- From The BBC BASIC(Z80) Reference Manual for the Z88: "There is a bug in versions of the filer up to and including version 3 that will cause the Z88 to crash if you use the device :RAM.- and then perform a soft reset whilst any files are still present in the device."
- From Z88 Developers' Notes v0.93: "Due to a bug in the current operating system (version 2.2/3.0) if any files are stored in the device when a Soft Reset occurs, the system becomes badly confused, and is it very likely that a crash will follow sometime later."
- From Z88 Developers' Notes v3.0: "NOTE: V4 has fixed the :RAM.- problem. Some foreign V3.xx versions contains the fix as well."
The effects of the bug can be more easily avoided by reprogramming the (EP)ROM chip for the OZ features related to Boot.cli, K.sgn and S.sgn, not to create or use files in :Ram.-.
At ROM image offset 080A9h (bank 2 offset 0A9h) you find the text: ':Ram.-/Boot.cli'.
At ROM image offset 089E4h (bank 2 offset 9E4h) you find the text: '.T<:Ram.-/K.sgn'.
At ROM image offset 089F7h (bank 2 offset 9F7h) you find the text: '.T>:Ram.-/S.sgn'.
Replace all occurances of ':Ram.-' with ':Ram.0'.
A better alternative is to upgrade to OZ version 3.21, 4.0 or 4.01.
The possibility of having more than one instance of the Diary application running at the same time. For instance one for work and one private. The change was suggested by Gunther Strube in the Z88 Users' Club newsletter Z88 EPROM April 1990 and offered as a service by Gunther in Tim Swenson's Z88 Source Book.
This ability can be achieved by reprogramming the (EP)ROM chip.
At ROM image offset 1FE59h (bank 7 offset 3E59h) you find the sequence 11 00 48 hex.
These are the Diary application type byte 1 and 2 and the key 'H' to help section.
Change the first byte to make the sequence 01 00 48 hex.
In BASIC it is useful to use inverted caps shift. That is type upper case letters when shift is not pressed and lower case letters when shift is pressed. You can press [] CAPSLOCK after starting BASIC to have inverted caps shift but it can also be made the default state when starting BASIC by reprogramming the (EP)ROM chip.
This modification was pioneered by Keith Rickard.
At ROM image offset 1FEC9h (bank 7 offset 3EC9h) you find the sequence 22 01 48 hex.
These are the BASIC application type byte 1 and 2 and the key 'H' to help section.
Change the second byte to make the sequence 22 03 48 hex.
At ROM image offset 1D44Eh (bank 7 offset 144Eh) for OZ up to 2.6, (and 3.0) or offset 1D58Eh (bank 7 offset 158Eh) for OZ 3.12 and up, you find the byte sequence 11 yy YY 01 dd mm E7 09 16 hex.
This is the date setting at hard reset. In assembly from OZ 2.2/3.0:
LD DE,07C3h ;1987 LD BC,0901h ;September 1st RST 20h ;OZ system call GN_DEI, Convert zoned format date to internal format. DEFW 1609hTo be conventional you should set it to the date of your modification.
Version strings can be found at the following locations:
ROM Image Bank 7 Version Offset Offset String 1E437h 2437h " 2.2" " 3.0" 1E49Fh 249Fh " 2.5" " 2.6" 1E681h 2681h " 3.12" 1E698h 2698h " 3.13" 1E67Ah 267Ah " 3.17 (Turkey)" " 3.18 (Germany)" 1E6AEh 26AEh " 3.19 (Spain)" 1E682h 2682h " 3.21 (Denmark)" " 3.23 (Italy)" 1E68Eh 268Eh " 3.26 (France)" 1E680h 2680h " 4.001 (UK)" 1E680h 2680h " 4.0 (UK)"I suggest replacing the dot in the OZ version number with a lower case p to indicate that a patch is applied.
Some words from the author:
Standard disclaimers apply, if it blows your Z88 then it isn't my fault.
Anyone willing to part with his EPROM emulator, or lending it for non-specified period? :)
Jorma
Download Finnish/Swedish OZ 4.01 (FI) ROM, 6 November 2002, 93K.
512 KB Internal ROM
For wiring the missing top address lines see Don Waltermans
instructions for 512 KB internal RAM at Z88 Forever!
For a JEDEC pinout SGS-Thomson 27C4001 EPROM, I used the following connections:
+--------------+ VCC |1 +--+ 32| VCC Leg bent out and connected to A16 ROE |2 31| VCC Leg bent out and connected to A18 A15 |3 30| VCC Leg bent out and connected to A17 A12 |4 29| A14 A7 |5 28| A13 A6 |6 27| A8 A5 |7 Z88 26| A9 A4 |8 ROM 25| A11 A3 |9 PCB 24| A16 Leg bent out and connected to ROE A2 |10 23| A10 A1 |11 22| CE A0 |12 21| D7 D0 |13 20| D6 D1 |14 19| D5 D2 |15 18| D4 VSS |16 17| D3 +--------------+There is a much better way to connect the chip outlined in Z88 Motherboard Modifications.
Layout courtesy Thierry Peycru.
Copy from the bottom of a 128 KB OZ image, offset address 0 to 1FFD2h, to bottom of 512 KB ROM image, offset address 0 to 1FFD2h. That's including application front DOR.
Copy from the top of the same OZ image, offset address 1FFC0h to 1FFFFh, to top of 512 KB ROM image, offset address 7FFC0h to 7FFFFh. That's the application front DOR and card header.
The application front DOR card size at 7FFFCh should be changed from 8 to 20h (32 banks).
Now you have a 512 KB OZ image that runs exactly like the original 128 KB OZ ROM.
To add more applications, prepare and add bank images like you would for an external ROM card with one exception. All bank references in internal ROM DORs should be absolute or relative to the top of internal ROM bank space. Top bank is 1Fh and not 3Fh like on external ROMs. For internal 512 KB and external 1024 KB ROMs, absolute and relative bank addressing is the same.
Any bank switching code in added applications is almost certain to need changes as per above.
The application front DOR of the last original OZ application Imp-Export is located at 07FC5h.
Change the brother link to point to your first added application.
Keith Rickard pioneered this this technique too and put OZ 4.0, QuickEdit and SpellMaster on a 512 KB EPROM with 256 KB still free.
Back to Cambridge Computer Z88