BUGFIXES


THE 4K ZX80 ROM

The only bug that I am aware of that applies to the ZX80 ROM is

The Empty REM Bug
Take the following

10 REM
20 REM DEMO
30 REM
40 PRINT "HI THERE"

If you run this program then nothing happens as an empty REM causes the next line to be treated as a REMark also.

The fix is to make the address of the REM command that of the previous instruction [ld a,(hl)] so that the command starts with the character following REM in the accumulator.
;; P-REM
L079B:  DEFB    $05             ; Class-05 - variable syntax checked entirely
                                ; by routine.
        DEFW    L0849           ; address: was $084A

You will then have a bug-free computer.
This is a minor feature that some people found useful. I am unaware of any other quirks in the ZX80 although you might like to consider changing the spelling of the RANDOMISE keyword.
In the routine LOOK-VARS bit 5 of FLAGS is reset and then set if evaluating an INTEGRAL FUNCTION although no use is made of this. There are two places where a JP instruction unrelated to timing could be replaced with a JR. However this only creates a few spare bytes. The code is optimized and a joy to read.


THE 8K ZX81 ROM

The ZX81 enjoyed a wide success, and although there were one or two bugs in the first ROM, the second ROM had few quirks although there was clearly not enough ROM space to incorporate all the routines that had been written.

The Division Error
The biggest change was the transition from integer to floating point arithmetic. The same routines were used in the ZX Spectrum and the division routine has attracted some criticism as binary fractions are not held with the accuracy with which they could be. It would require about 160 extra bytes to achieve this. This is most noticable with

PRINT INT (.5 + .5) which gives the answer zero and not one.

Similarly PRINT 1/2 = .5 gives the answer 0 - false.

You can improve the window of accuracy by altering the DECIMAL TO FLOATING POINT routine.
;; NXT-DGT-1
L14E5:  RST     20H             ; NEXT-CHAR
        CALL    L1514           ; routine STK-DIGIT
        JR      C,L14F5         ; forward to E-FORMAT


        RST     28H             ;; FP-CALC
        DEFB    $E0             ;;get-mem-0
        DEFB    $A4             ;;stk-ten
        DEFB    $05             ;;division - make this DEFB $04 - multiply.
        DEFB    $C0             ;;st-mem-0
        DEFB    $04             ;;multiply - make this DEFB $05 - division.
        DEFB    $0F             ;;addition
        DEFB    $34             ;;end-calc

        JR      L14E5           ; loop back till exhausted to NXT-DGT-1