sirmorris wrote: ↑Sun Sep 10, 2017 9:42 am
* Yes, the ZX81 appears to have a pet - a restless red 'ant' (escaped from the classic game?) which relentlessly patrols RAM from the end to the start. It's (most likely) a read instruction in the display routine. I've fleetingly looked into the emulation but I suspect it's a genuine access by the ROM rather than a bug. Kudos points to anyone tracking it down
That is standard behaviour. It is the reason why my ZX81-emulator on the ZX Spectrum needs a reset button and RST 0 won't work. By heard first 5 bytes are overwritten. Since my emulator is coded in RAM the start gets corrupted.
Edit: This is a split and continuation from this post Mark
Last edited by 1024MAK on Mon Sep 11, 2017 8:29 pm, edited 1 time in total.
0229 DISPLAY-1 LD HL,(FRAMES)
DEC HL
022D DISPLAY-P LD A,+7F
AND H
OR L
LD A,H
JR NZ,0237,ANOTHER
RLA
JR 0239,OVER-NC
0237 ANOTHER LD B,(HL)
SCF
0239 OVER-NC LD H,A
LD (FRAMES),HL
RET NC
specifically the line at $0237 LD B,(HL)
regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
; -----------------------
; THE 'MAIN DISPLAY' LOOP
; -----------------------
; This routine is executed once for every frame displayed.
;; DISPLAY-1
L0229: LD HL,($4034) ; fetch two-byte system variable FRAMES.
DEC HL ; decrement frames counter.
;; DISPLAY-P
L022D: LD A,$7F ; prepare a mask
AND H ; pick up bits 6-0 of H.
OR L ; and any bits of L.
LD A,H ; reload A with all bits of H for PAUSE test.
; Note both branches must take the same time.
JR NZ,L0237 ; (12/7) forward if bits 14-0 are not zero
; to ANOTHER
RLA ; (4) test bit 15 of FRAMES.
JR L0239 ; (12) forward with result to OVER-NC
; ---
;; ANOTHER
L0237: LD B,(HL) ; (7) Note. Harmless Nonsensical Timing weight.
SCF ; (4) Set Carry Flag.
; Note. the branch to here takes either (12)(7)(4) cyles or (7)(4)(12) cycles.
;; OVER-NC
L0239: LD H,A ; (4) set H to zero
LD ($4034),HL ; (16) update system variable FRAMES
RET NC ; (11/5) return if FRAMES is in use by PAUSE
; command.
Fix?
Why, what's broken?
I can't see the harm in that bit of code reading throughout memory.
You never know, it may help a bit with the refresh of any dynamic RAM in a RAM pack...