Z80 Second Processor Client ROM v1.21 ===================================== J.G.Harston -- 09-Dec-2014 mdfs.net/Software/Tube/Z80 The v1.20 Z80 Second Processor Client ROM has a few bugs in it. Most are minor, but some cause problems in edge cases. The Patch121 program patches the v1.20 Client ROM to create v1.21 with these bugs fixed. Code execution -------------- When code is entered if it has a ROM header the ROM type byte is checked. However, only bit 3 is tested instead of testing all of bits 0 to 3. This means that any code with a ROM type byte of 8 to 15 is recognised as Z80 code, even though only ROM type 8 is Z80 code. For example, ROM types 11, 12 and 13 are 80186, 80286 and ARM respectively. The patch fixes this so that only a ROM type of 8 is recognised as Z80 code. Unbalanced stack ---------------- If code without a ROM header is entered, the stack is unbalanced, a POP is needed before the code can return. The patch fixes this so that code is entered with a balanced stack. So that code can tell if it needs to balance the stack or not, the Zero flag is set differently. If the stack is unbalanced, the zero flag is clear (NZ); if it is balanced, the zero flag is set (Z). If a transient program wants to run in both environments it should start with the following two instructions: JR Z,P%+3:POP AF:\ Balance stack Code that starts with a ROM header is entered correctly. This is the same patch as applied when the ROM version of Z80 BBC BASIC is run, and both will co-exist. Truncated OSWORD calls ---------------------- OSWORD 5 only sends a 2-byte control block containing the address in the I/O processor to read. The patch changes this to a full 4-byte address so that if the host supports it, shadow and sideways memory can be read, for instance &FFFExxxx for shadow screen memory. OSWORD 14 only reads 16 bytes, so cannot read the 24-byte Real-Time Clock string. OSWORD 15 only sends 16 bytes, so cannot write the Real-Time Clock with a full time and date string. The patch changes these so OSWORD 14 reads 32 bytes and OSWORD 15 sends and reads 32 bytes. Updated OSWORD &FF ------------------ OSWORD &FF is updated to allow access to extended I/O memory at: &FFxRxxxx for ROM R &FF8xxxxx for Master workspace RAM &FFFDxxxx for shadow display memory &FFFExxxx for current display memory &FFFFxxxx for I/O memory The updated OSWORD &FF code also works with the Electron host where ROMSEL and TUBEIO are at different addresses. DISKRST overwrites stack ------------------------ The DISKRST call which makes a call to seek to track zero attempts to use a temporary stack. Unfortunately, it uses the same stack that the client uses on startup. If CP/M is booted at Reset, or the *CPM command is used from the Supervisor *command prompt, the stack is overwitten. Consequently, if a disk error occurs the client crashes. The patch fixes this by making DISKRST use the stack the caller is using. Corrected error numbers ----------------------- Various error messages have been given corrected error numbers.