Problem is that your routine must be finished before the next interrupt starts so screenupdate can be done correctly.
What if your routine would need more time than available? You can solve it with this routine.
The program has an exampleroutine which can be your own, as well as the frequency your routine will be activated.
Code: Select all
; interrupt on a ZX81 ; activate interruptroutine ld ix,introut ret intfreq equ 4 ; can be set by user introut ld a,r ; timed display ld a,#f5 ld bc,#1901 ; 25 newlines call #2b5 ; lowres display call #292 call #220 ; all routines needed for a full display ld ix,introut ; reactivate your intrupt routine ; here the routine starts, but we need to test if intrupt is allowed ld hl,counter ; we test interrupt within intrupt dec (hl) ; or interrupt not yet allowed jr nz,exit ; if so exit routine ld (hl),intfreq ; your own routine each intfreg ; here your routine starts ld hl,frames ; this routine uses ld a,(hl) ; multiple screenupdates sub 2 longint cp (hl) jr nz,longint exit jp #2a4 ; back to mainroutine counter db intfreq