Dear all,
I'm fighting interrupts here. Again. I have asked questions on this forum and I have presumably working code, but the application differs slightly, but obviously enough not to work. I don't understand how can it be, that I get "Hello from Mars" in my terminal window also when I activate ONLY INT1 with the code below. To add to the confusion, it happens starting with the second time INT1 is activated - the first time works fine. I know the interrupt routine is longish, I will clean it up later.
Thank you for your time,
Edmunds
I'm fighting interrupts here. Again. I have asked questions on this forum and I have presumably working code, but the application differs slightly, but obviously enough not to work. I don't understand how can it be, that I get "Hello from Mars" in my terminal window also when I activate ONLY INT1 with the code below. To add to the confusion, it happens starting with the second time INT1 is activated - the first time works fine. I know the interrupt routine is longish, I will clean it up later.
Code:
Symbol Counter = b5
Symbol row = b6
Symbol col = b7
Symbol CursorPos = b8
init:
Counter = 0
CursorPos = 2
gosub InitDisplay
gosub ClearDisplay
gosub StartScreen
hintsetup %01110111
setintflags %00001000, %00001000
main:
for Counter = 0 to 100
pause 10
next Counter
goto main
======= some more subroutines here =========
interrupt:
if UpBtnPin = 1 then interrupt 'loop until interrupt clears - up button is released
if DnBtnPin = 1 then interrupt 'loop until interrupt clears - down button is released
if SelBtnPin = 1 then interrupt 'loop until interrupt clears - select button is released
hintflag = 0
if hint0flag = 1 then 'up button pressed
sertxd ("Hello from Mars", LF, CR)
Select case CursorPos
case 2 'in case cursor is in upper position of the page, do nothing
case 3 to 7 'otherwise
gosub ClearCursor 'clear the current cursor
dec CursorPos 'decrease cursor position pointer value
gosub SetCursor 'draw the new cursor
endselect
hint0flag = 0 'reset interrupt flags
endif
if hint1flag = 1 then 'down button pressed
Select case CursorPos
case 2 to 6 'in case cursor not in the bottom position of the page ...
gosub ClearCursor 'clear the current position
inc CursorPos 'increase cursor pointer value
gosub SetCursor 'draw the new cursor
case 7 'in case cursor is in the bottom position of the page, do nothing
endselect
hint1flag = 0 'reset interrupt flags
endif
setintflags %00001000,%00001000
return
Edmunds