Re: A86: more interupt probs
[Prev][Next][Index][Thread]
Re: A86: more interupt probs
Two things about calling:
1. Make sure you're saving all the registers, it seems like rst 38 should
save them, but it doesn't.
2. I've written TSRs, where there are similar problems, so I should have
realized this right away, but it took me about 20 minutes. During an
interrupt, the rom page at 4000-7FFF is not always page D (the page with
all the user routine calls). So you have to set it yourself. Here's an
example. I made up two macros to do the page switching stuff: pushR saves
the old rom page and sets it to pg. D, and popR restores the old rom page.
--Joshua
BTW, this program does stop after 255 iterations, it just takes a while. So
don't panic and reset your calc.
#include "asm86.h"
#include "ti86asm.inc"
#define pushR in a,(5) \ push af \ ld a,$0d \ out (5),a \ nop \ nop \ nop
#define popR pop af \ out (5),a
_user_int_ram EQU $d2fd
.org _asm_exec_ram
res 2,(iy+$23) ;turn user int off so it won't get called by
;accident before we're ready
ld hl,int ;copy prog to user int buffer
ld de,_user_int_ram+1
ld bc,int_end-int
ldir
ld a,(_user_int_ram+1) ;set up checksum byte
ld hl,_user_int_ram+($28*1)
add a,(hl)
ld hl,_user_int_ram+($28*2)
add a,(hl)
ld hl,_user_int_ram+($28*3)
add a,(hl)
ld hl,_user_int_ram+($28*4)
add a,(hl)
ld hl,_user_int_ram+($28*5)
add a,(hl)
ld (_user_int_ram),a
set 2,(iy+$23) ;turn it on
ret
int:
push af
push bc
push de
push hl
pushR
ld hl,var
inc (hl)
ld a,(hl)
cp $ff
jr nz,i0
res 2,(iy+$23)
i0:
ld hl,message
call _puts
popR
pop hl
pop de
pop bc
pop af
ret
message equ $-int+_user_int_ram+1
.db "It Worked!",0
var equ $-int+_user_int_ram+1
.db 0
int_end:
.end
INT1.86P
Follow-Ups:
References: