interrupts on flash debugger
Moderator: MaxCoderz Staff
interrupts on flash debugger
for some odd reason, my interrupt i made for a program will only run once, the thing is though, that nowhere in the interrupt or the program do i di. and another thing, once i im2 then ei, it will sometimes immediatly go to the interrupt, and sometimes it takes it a little while... any help???
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
Do you acknowledge the interrupts? See here for an example.
- calc84maniac
- Regular Member
- Posts: 112
- Joined: Wed 18 Oct, 2006 7:34 pm
- Location: The ex-planet Pluto
- Contact:
Re: interrupts on flash debugger
When you enter an interrupt, interrupts are temporarily disabled. Before returning, make sure they are enabled by either using "reti" to return or doing an "ei \ ret".Batman wrote:for some odd reason, my interrupt i made for a program will only run once, the thing is though, that nowhere in the interrupt or the program do i di. and another thing, once i im2 then ei, it will sometimes immediatly go to the interrupt, and sometimes it takes it a little while... any help???
~calc84maniac has spoken.
Projects:
F-Zero 83+
Project M (Super Mario for 83+)
Projects:
F-Zero 83+
Project M (Super Mario for 83+)
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
RETI doesn't affect IFF1 or IFF2; it's to support daisy-chained interrupts (on the hardware level). You still need to EI when using RETI. RETN, on the other hand, copies IFF2 back to IFF1, which is useful with non-maskable interrupts (the Z80 copies IFF1 to IFF2 before restarting at $66).calc84maniac wrote:When you enter an interrupt, interrupts are temporarily disabled. Before returning, make sure they are enabled by either using "reti" to return or doing an "ei \ ret".
Re: interrupts on flash debugger
so are you saying that i should
ei
reti
at the end of the interrupt?
;i had no idea that interrupts automatically disable interrupts once they are run. that kinda makes sense though i guess so that an interrupt isn't run during the interrupt...
ei
reti
at the end of the interrupt?
;i had no idea that interrupts automatically disable interrupts once they are run. that kinda makes sense though i guess so that an interrupt isn't run during the interrupt...
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
EI \ RET or EI \ RETI will both work (RETI isn't required as the TI hardware doesn't use daisy-chained interrupts). EI itself has a one-instruction delay, so interrupts are only enabled after the RETI.
My service routine looks like this:
I back up registers to the stack; if you don't need to preserve the shadow registers you could just use EXX (like the TI-OS ISR).
My service routine looks like this:
Code: Select all
Handler:
push af
in a,(4) ; Get source of interrupt.
bit 0,a
jr z,InterruptNotOnKey
push af
; Handle ON key interrupts.
pop af
InterruptNotOnKey:
bit 1,a
jp z,InterruptNotTimer1
push af
; Handle timer 1 interrupts.
pop af
InterruptNotTimer1:
; Acknowledge/re-enable:
ld a,%00001000 ; Disable/ack all interrupts; keep calc powered.
out (3),a
ld a,%00001011 ; Enable timer interrupt 1 and ON key.
out (3),a
ld a,%00000110 ; Slowest speed.
out (4),a
pop af
ei
reti
Re: interrupts on flash debugger
wow, thats cool. well, i figured it out thanks to yours' help...
xor a
out ($03), a
di
;interrupt here
ld a, %00010011
out ($03),a
ei
ret
correct right???
Thanx!
xor a
out ($03), a
di
;interrupt here
ld a, %00010011
out ($03),a
ei
ret
correct right???
Thanx!
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
Interrupts are automatically disabled (IFF1 and IFF2 are reset) before the CPU jumps to your interrupt service routine, so you don't need that DI in there. I'd recommend flicking through the interrupts section in the official Z80 user manual.
Reading port 4 will tell you which piece of hardware (on key, timer, link port) generated the interrupt.
That will switch the calculator off (low power mode) if you HALT, you probably don't want to do that. Output %00001000 rather than 0.xor a
out ($03), a
That too will switch of the calculator when it goes into HALT. It also enables the link port interrupt; maybe you want %0001011? See here for a more thorough description of the bits.ld a, %00010011
out ($03),a
Reading port 4 will tell you which piece of hardware (on key, timer, link port) generated the interrupt.
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
Re: interrupts on flash debugger
Im not sure the flash debugger emulates interrupts properly either way .
Re: interrupts on flash debugger
you know what?, I think you are right about it not handling interrupts right, cause when i coded it, it worked perfectly, no mistakes... but when i sent i to my ti 84+, it just said "done" after execution... what's the deal with that??? did yall want to take a look at it?
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
BBC BASIC is unusable in Flash Debugger too. The moral of the story is: don't test your apps in Flash debugger, use PindurTI, Wabbitemu or similar.
Re: interrupts on flash debugger
that pindur ti says, "not a valid win 32 application"???
question, what have you made as far as asm games go???
finished ones of course...
question, what have you made as far as asm games go???
finished ones of course...
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
Try downloading it again? Which OS are you using?Batman wrote:that pindur ti says, "not a valid win 32 application"???
http://www.ticalc.org/archives/files/au ... /6296.html, though how is that relevant?question, what have you made as far as asm games go??? finished ones of course...
Re: interrupts on flash debugger
sorry, i got it to working, though i don't really know much about roms...
but i have it so that i can open up the prog. in it so its ok...
Quite impressive, I guess you aren't in high school... were did you learn programming like that??? It's Awsome!
but i have it so that i can open up the prog. in it so its ok...
Well i didn't want to offend you but you are pretty smart at programming and i wanted to know some of the works that you have done...http://www.ticalc.org/archives/files/au ... /6296.html, though how is that relevant?
Quite impressive, I guess you aren't in high school... were did you learn programming like that??? It's Awsome!
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: interrupts on flash debugger
The .clc files in the Flash Debugger installation directory are usable ROMs.
Cheers. I work, but learned most of my Z80 programming from CoBB's Z80 documentation and AsmGuru.Quite impressive, I guess you aren't in high school... were did you learn programming like that??? It's Awsome!