Time Available For Application Code On ZX81
Posted: Tue Aug 04, 2015 6:33 pm
As mentioned in another thread, I'm re-learning the ZX81. I've been trying from various sources including here to get an accurate measure of how many clock cycles are available to the programmer per frame. So in the end I wrote a short assembly routine to test it. It simply zeroes the BC registers then increments them in a loop during one frame, and reports the total back to BASIC-
Running this on the EightyOne emulator in PAL (British TV) mode, it reports back 700 loops; each loop takes 26 clock cycles (or should do!) so that works out to 18,200 clock cycles available. By comparison, running it on the 60Hz mode there is a paltry 384 loops, which works out to 9,984 clock cycles.
Does this look correct to everyone else? From this, it would seem the UK machine ran at almost twice the speed of the US one. On the UK machine, you have about 0.29 of the time for programme code, compared to a mere 0.15 in the USA. However, this isn't a real ZX81, though I assume the emulator is accurate in this regard. Can anyone confirm? Or have I coded something wrongly?
Code: Select all
//Count cycles between screen frames
format zx81
;labelusenumeric
;LISTON
// hardware options to be set and change defaults in ZX81DEF.INC
MEMAVL = MEM_16K // can be MEM_1K, MEM_2K, MEM_4K, MEM_8K, MEM_16K, MEM_32K, MEM_48K
// default value is MEM_16K
STARTMODE EQU SLOW_MODE // SLOW or FAST
DFILETYPE EQU AUTO // COLLAPSED or EXPANDED or AUTO
STARTUPMSG EQU '' // any message will be shown on screen after loading, max. 32 chars
include '..\SINCL-ZX\ZX81.INC' // definitions of constants
AUTORUN:
PRINT USR #start
start:
ld bc, $0000 //will be the counter
ld a, $8F //Bottom Margin
loop1:
cp IXl
jr z, loop1 //If in bottom margin, loop
ld a, $81 //Top Margin
loop2:
cp IXl
jr z, loop2 //If in top margin, loop
//Must now be at start of Bottom Margin
ld a, $8F
loop3:
cp IXl
inc bc
jr z, loop3 //If in bottom margin, loop
ld a, $81 //Top Margin
loop4:
cp IXl
inc bc
jr z, loop4 //If in top margin, loop
//End of top margin, return to BASIC
ret
include '..\SINCL-ZX\ZX81DISP.INC' ; include D_FILE and needed memory areas
VARS_ADDR:
db 80h
WORKSPACE:
Does this look correct to everyone else? From this, it would seem the UK machine ran at almost twice the speed of the US one. On the UK machine, you have about 0.29 of the time for programme code, compared to a mere 0.15 in the USA. However, this isn't a real ZX81, though I assume the emulator is accurate in this regard. Can anyone confirm? Or have I coded something wrongly?