Bug Fixed ROM

For experts to discuss very technical stuff and newbies to ask why the Spectrum they bought off ebay doesn't work.
Post Reply
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Bug Fixed ROM

Post by PaddyC13 »

Hi Folks,

Is there a bug fixed 48K ROM that is totally compatible with the original? I have searched the internet but the ROMs I have found all seem to have extra functionality. I want to use this ROM in BasinC so it needs to have the same entry points.

BTW, this is a great forum but how does it relate to WOS? Is/has Spectrum Computing replaced WOS?

Many thanks

Paddy
User avatar
1024MAK
Bugaboo
Posts: 3104
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Bug Fixed ROM

Post by 1024MAK »

As far as I know, although there have been various suggestions to fix some of the minor bugs, there is not a bug fixed ROM image with the same entry points. This is partly due to there not actually being any official list of entry points...

Each coder/programmer just jumped into the ROM wherever they wanted...

So the ONLY standard ROM, is the official Sinclair ROM.

WoSf is alive and well over at https://www.worldofspectrum.org/forums/discussions. Lee is continuing work on WoS.

This forum has not, and according to the this sites owner, is not intended to replace WoSf.

This site (Spectrum Computing) and this forum is entirely separate from WoS and WoSf.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
User avatar
Rorthron
Dynamite Dan
Posts: 1644
Joined: Sun Nov 12, 2017 10:35 pm

Re: Bug Fixed ROM

Post by Rorthron »

PaddyC13 wrote: Sat Oct 06, 2018 5:21 pm BTW, this is a great forum but how does it relate to WOS? Is/has Spectrum Computing replaced WOS?
As Mark has said, this forum is separate from WoS. I think PeterJ and R-Tape wanted to provide an alternative place for people to discuss the Spectrum, away from the troubles that have beset WoS in recent years.

I personally am very grateful they gave us this place.
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

Thanks everyone. I was wondering if the Spectrum Community (re. Z80 experts! ;)) would like to collaborate on making a modified 48K ROM that has a few changes but remains compatible. So far I have made the following simple changes to the standard 48K ROM:

Code: Select all

The Spectrum Forum 48K ROM
==========================

Filename   : TBC
Version    : 0.01
Start Date : 08-Oct-2018

ROM modified by Paddy Coleman and members of the Spectrum Computing Forum.

The ZX Spectrum ROM is copyright Amstrad PLC.

Amstrad have kindly given their permission for the redistribution of their copyrighted material but retain that copyright. 

Changes
=======

(v0.01: Asthetics) - Amended Copyright message
----------------------------------------------
Status: Implemented
Test  : Reboot ZX Spectrum

Changed copyright message to "SCF 48K ROM v?.?? C Sinclair" at address $1539. The last byte of the text ("r") needs to have 128 added to its ASCII code i.e. 114 becomes 242 or $F2.  The Original message was "C 1982 Sinclair Research Ltd".

N.B. SCF stands for "Spectrum Computing Forum".

(v0.01: Asthetics) - Replacement Font
-------------------------------------
Status: Implemented
Test  : Print something on the screen

New font designed and inserted at address $3D00-$3FFF (768 bytes).  Each character is made up of 8 btes from space (ASCII 32) to copyright (ASCII 126).

(v0.01: Enhancement) - DRAW/PLOT/CIRCLE uses the full screen
------------------------------------------------------------
Status: Implemented
Test  : DRAW 50,200/PLOT 50,180/CIRCLE 128,96,95

Change byte at address $22AB (PIXEL-ADD) from $AF (175) to $BF (191).
Looking at other versions of the ROM and books the other worthwhile fixes are:

To Do

* Startup colours
* Remove SPACE from "GO TO" and "GO SUB"
* There is a mistake in 'division' whereby the 34th bit of a division is lost
* The value of -65536 is sometimes put in 'short' form and at other times in 'floating-point' and this leads to troubles
* scroll? to Scroll?
* Remove ZX Printer check in PRINT routine
* Cursor left subroutine (CHR$ 8)
* Cursor right subroutine (CHR$ 9)
* SAVE DATA error
* STR$ error
* SCREEN$ error

Will need to investigate how to fix/implement these unless someone has the patches already? Any other errors/changes worth looking at?

Many thanks

Paddy
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

Done a couple more changes...

Code: Select all

+------------------------------------------------------------------------------+
| THE SPECTRUM FORUM 48K ROM                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
| Filename   : 48.ROM                                                          |
| Start Date : 08-Oct-2018                                                     |
| Version    : 0.01 : 08-Oct-2018                                              |
|              0.02 : xx-Oct-2018                                              |
|                                                                              |
| ROM modified by Paddy Coleman and members of the Spectrum Computing Forum.   |
|                                                                              |
| The ZX Spectrum ROM is copyright Amstrad PLC.                                |
|                                                                              |
| Amstrad have kindly given their permission for the redistribution of their   |
| copyrighted material but retain that copyright.                              |
+------------------------------------------------------------------------------+

CHANGES
=======

+-------+-------------+--------------------------------------------------------+
| v0.02 | Enhancement | Startup colours                                        |
+-------+-------------+--------------------------------------------------------+

Status  : Implemented
Test    : Reboot ZX Spectrum

Change the startup colours to white text on black paper and border.  At address
$11CD (START/NEW) change byte value from $07 (white) to $00 (black).  In
addition, at address $1266 (RAM-SET) change byte value from $38 to $07.

+-------+-----------+----------------------------------------------------------+
| v0.01 | Asthetics | Amended Copyright message                                |
+-------+-----------+----------------------------------------------------------+

Status  : Implemented
Test    : Reboot ZX Spectrum

Changed copyright message to "SCF 48K ROM v?.?? C Sinclair" at address $1539.
The last byte of the text ("r") needs to have 128 added to its ASCII code i.e.
114 becomes 242 or $F2.

The Original message was "C 1982 Sinclair Research Ltd".

N.B. SCF stands for "Spectrum Computing Forum".

+-------+-----------+----------------------------------------------------------+
| v0.01 | Asthetics | Replacement Font                                         |
+-------+-----------+----------------------------------------------------------+

Status  : Implemented
Test    : Print something on the screen!

New font designed and inserted at address $3D00-$3FFF (768 bytes).  Each
character is made up of 8 btes from space (ASCII 32) to copyright (ASCII 126).

+-------+-------------+--------------------------------------------------------+
| v0.01 | Enhancement | DRAW, PLOT, and CIRCLE uses the full screen            |
+-------+-------------+--------------------------------------------------------+

Status  : Implemented
Test    : DRAW 50,200, PLOT 50,180 and CIRCLE 128,96,95

Change byte at address $22AB (PIXEL-ADD) from $AF (175) to $BF (191).

-------------------------------------------------------------------------------- 
Been using a neat tool called Hex Editor Neo to patch the changes (free version available).

Paddy
Last edited by PaddyC13 on Mon Oct 08, 2018 3:59 pm, edited 1 time in total.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: Bug Fixed ROM

Post by ZXDunny »

Bear in mind that some games will not be compatible no matter what you do - iirc, Auf Monty for example checksums the ROM when its loaded.
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

Hi Paul,

Yes, I read that whilst researching changes to the ROM. Personally, it is not a problem for me as I do not play many games and if I do then switching back to the standard ROM is not a big thing.

Many thanks

Paddy
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

Hi Folks,

As Paul pointed out, if you are going to use the ROM with Basinc then you need to be VERY careful as it relies on code being in the right place!

As of today, the modified ROM has the following features:

Code: Select all

+------------------------------------------------------------------------------+
| THE SPECTRUM FORUM 48K ROM                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
| Filename   : 48.ROM                                                          |
| Start Date : 08-Oct-2018                                                     |
| Version    : 0.01 : 08-Oct-2018                                              |
|              0.02 : 09-Oct-2018                                              |
|                                                                              |
| ROM modified by Paddy Coleman and members of the Spectrum Computing Forum.   |
|                                                                              |
| The ZX Spectrum ROM is copyright Amstrad PLC.                                |
|                                                                              |
| Amstrad have kindly given their permission for the redistribution of their   |
| copyrighted material but retain that copyright.                              |
|                                                                              |
+------------------------------------------------------------------------------+

CHANGES
=======

+-------+-----------+----------------------------------------------------------+
| v0.02 | Asthetics | Change "scroll?" to "Scroll?"                            |
+-------+-----------+----------------------------------------------------------+

Status  : Implemented
Test    : 100 PRINT "Test":GO TO 100

Changed the "s" of the scroll message to "S".  At address $0CF9 change byte
value from $73 (115) to $3F (63).

+-------+---------+------------------------------------------------------------+
| v0.02 | Bug Fix | CHR$ 8 - Backspace/Cursor Left                             |
+-------+---------+------------------------------------------------------------+

Status  : Implemented
Test    : PRINT AT 0,0;CHR$ 8;"Test" - Prints string starting at 24,31
	  PRINT AT 1,0;CHR$ 8;"Test" - Does nothing
	  PRINT AT 2,0;CHR$ 8;"Test" - Works

Bug is caused by the Cursor Left subroutine ($0A23) checking for line 1 rather
than line 0.  At address $0A33 change byte value from $18 (24) to $19 (25).

+-------+-------------+--------------------------------------------------------+
| v0.02 | Enhancement | Startup colours                                        |
+-------+-------------+--------------------------------------------------------+

Status  : Implemented
Test    : Reboot ZX Spectrum

Change the startup colours to white text on black paper and border.  At address
$11CD (START/NEW) change byte value from $07 (white) to $00 (black).  In
addition, at address $1266 (RAM-SET) change byte value from $38 to $07.

+-------+-----------+----------------------------------------------------------+
| v0.01 | Asthetics | Amended Copyright message                                |
+-------+-----------+----------------------------------------------------------+

Status  : Implemented
Test    : Reboot ZX Spectrum

Changed copyright message to "SCF 48K ROM v?.?? C Sinclair" at address $1539.
The last byte of the text ("r") needs to have 128 added to its ASCII code i.e.
114 becomes 242 or $F2.

The Original message was "C 1982 Sinclair Research Ltd".

N.B. SCF stands for "Spectrum Computing Forum".

+-------+-----------+----------------------------------------------------------+
| v0.01 | Asthetics | Replacement Font                                         |
+-------+-----------+----------------------------------------------------------+

Status  : Implemented
Test    : Print something on the screen!

New font designed and inserted at address $3D00-$3FFF (768 bytes).  Each
character is made up of 8 btes from space (ASCII 32) to copyright (ASCII 126).

+-------+-------------+--------------------------------------------------------+
| v0.01 | Enhancement | CIRCLE, DRAW and PLOT uses the full screen             |
+-------+-------------+--------------------------------------------------------+

Status  : Implemented
Test    : DRAW 50,200, PLOT 50,180 and CIRCLE 128,96,95

Change byte at address $22AB (PIXEL-ADD) from $AF (175) to $BF (191).

-------------------------------------------------------------------------------- 
Sadly I don't believe it is legal for me to share the binary file and this is why I have put the patching details in the comments above.

Kind regards

Paddy
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

Strange, the line ‘IF 1/2<>0.5 THEN PRINT “Bug”’ works in Basinc i.e. it does not print Bug?

Paddy
dfzx
Manic Miner
Posts: 673
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: Bug Fixed ROM

Post by dfzx »

PaddyC13 wrote: Tue Oct 09, 2018 8:03 pm Strange, the line ‘IF 1/2<>0.5 THEN PRINT “Bug”’ works in Basinc i.e. it does not print Bug?
Is there actually a bug there? Comparing floating point numbers for equality is generally a bad idea on any computer. Is that what it's doing?
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
PaddyC13
Drutt
Posts: 20
Joined: Fri Mar 09, 2018 4:46 pm
Location: UK

Re: Bug Fixed ROM

Post by PaddyC13 »

dfzx wrote: Tue Oct 09, 2018 8:26 pm
PaddyC13 wrote: Tue Oct 09, 2018 8:03 pm Strange, the line ‘IF 1/2<>0.5 THEN PRINT “Bug”’ works in Basinc i.e. it does not print Bug?
Is there actually a bug there? Comparing floating point numbers for equality is generally a bad idea on any computer. Is that what it's doing?
Apparently this test should produce “Bug” on a standard 48K Spectrum. In Basinc it works so I wonder if it does something under the covers.

Paddy
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Bug Fixed ROM

Post by PeterJ »

PaddyC13 wrote: Sat Oct 06, 2018 5:21 pm BTW, this is a great forum but how does it relate to WOS? Is/has Spectrum Computing replaced WOS?
Welcome to the forum. As others have said we aren't related to WoS (although we are very greatful to the work done over the years by key people to preserve many titles). The site was originally created to catalogue titles created post 2013 (with much thank's to [mention]Einar Saukas[/mention] for the creation of the open source ZXDB database) which is as far as I'm aware the last time the WoS database was updated. The forum was added later as an alternative place to discuss the Spectrum away from any of the issues of the past. [mention]R-Tape[/mention] and I are the administrators of the forum.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: Bug Fixed ROM

Post by ZXDunny »

You can check what BASin/BASinC does to the ROM if you look in the source (which should be included with each distribution). Head into ROMUtils.pas and open it with a text editor, then browse to the procedures ROMTrap and ModifyROM.

There's no calculator patches in there, so the calculator bug is quite weird.
Post Reply