As olofsen says, the 0x41b4 might have changed or something else, the following code is not working but it helps me to better understand the logic of an ISR call after the display is refreshed. I hope I'm in the right direction. Any ideas to make this work ?olofsen wrote: ↑Thu Jun 11, 2020 6:49 pm Just a note that the clock available here viewtopic.php?p=17265#p17265 hooks up an ISR, but I don't remember all details... The address of a C function (although consisting of assembly code) is "poked" to the startup code of the ISR that z88dk installed, at 0x41b4.The source for this alternative ISR may now be found in "lib/target/zx81/classic", but at the time it may have been in "lib". Most likely I inspected the generated P file to find the address to hook to; and in later versions of z88dk this address may have changed. But perhaps this is the difficult way to do this...
Code: Select all
/* zcc +zx81 -create-app disp_isr.c */
/* Inspired by RELOGIO By K. Murta http://zx81.eu5.org/toddysofte.html,
and the z88dk source of gmtime().
Also based on olofsen post viewtopic.php?p=17265#p17265
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <input.h>
#include <zx81.h>
extern int d_file @16396;
unsigned char i, isrText[32], *Display;
void DisplayISR(void)
{
for(i = 0; i < 32; ++i)
isrText[i] = rand()%64;
memcpy(Display,isrText,32);
#asm
jp 0x02a4 ; return to the main program
#endasm
}
void hook()
{
#asm
ld hl,_DisplayISR
ld (0x41b4),hl ; 0x41b4 I guess this address has changed in z88dk ?
ld a,0xc9
ld (0x412e),a ; same here ?
#endasm
}
void main(void)
{
Display = (unsigned char *) d_file + 1;
hook();
while(1);
}