A85: A boggling interrupt question! :)


[Prev][Next][Index][Thread]

A85: A boggling interrupt question! :)




Hey, all... it's been a while since I've asked you something, so I'll make up 
for it here.  DON'T read this unless you want to be stuck here for a while. :)

OK. Here's the deal: In my game Final Fantasy 7: The Calling, I have what I 
call an event queue, which is basically a line of events that is processed 
one by one, each after another.  Well, I have an interrupt routine that 
serves something like a cyclic timer, e.g. the interrupt routine decrements a 
value each time it is called, and when the value is zero, the interrupt 
routine inserts a timer event into the event queue.  If you understood that, 
then you can probably help now. :)  OK. Here's the problem.  I am running 
this program on the emulator one day, and I finally get it to work, but as 
soon as I try to do it on my calculator, the damned thing doesn't quite work. 
 Now I have to elaborate on THAT. :)

OK. Here's exactly what I'm doing.  In my game, each player has a "Time Bar." 
 When this bar fills up, that player gets an action, whatever the action is.  
Then, after they take the action, the bar resets to zero, and it starts 
filling up again.  OK.  Well, the interrupt routine increments every player's 
Time Bar whenever it is called.  Here's the interrupt routine:

;---Interrupt Routine for Battles---
Battle_Interrupt:
 di
 PUSH HL
 PUSH AF
 PUSH BC
 PUSH DE
 LD HL, (C_Time_Bar_Timer) ;LD HL with Cloud's Time Bar
 DEC HL ;Inc it.
 LD (C_Time_Bar_Timer), HL ;put it back into holding space.
 LD A, H ;next two lines -- check to see if HL = 0
 CP L
 CALL Z, &C_Inc_Time ;it does, so reset C_Time_Bar_Timer and insert timer 
event.
 LD HL, (S_Time_Bar_Timer) ;Repeat for enemy, Sephiroth.
 DEC HL
 LD (S_Time_Bar_Timer), HL
 LD A, H
 CP L
 CALL Z, &S_Inc_Time
 POP DE
 POP BC
 POP AF
 POP HL
 ei
 RET

You see, when the timers each reach zero, I make FLINE draw a line the size 
of the player's Time Bar wide (in pixels) to show that the timer is getting 
bigger.  It works on the emulator, but not on the 85.  Could it be that the 
hardware on the 85 is slower?  ::confused::
The interrupt routine is run through fine, every time. I know it works.  And 
it knows when it should insert the event, but it doesn't do it on the TI-85.  
It DOES on the emulator.  I'm wondering if the interrupt is getting called 
too often for regular stuff to go on outside of it.  Is that a possibility?  
Did this make any sense? :P

-Josh Morris
 dorkremi@hotmail.com