Author Topic: Interrupt question  (Read 7289 times)

0 Members and 2 Guests are viewing this topic.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Interrupt question
« on: April 05, 2018, 11:36:27 am »
Quick question: Is there anyway to set an interrupt to trigger in X clock ticks? I was looking at some code and think I found a way to shave ~600-1800 clock ticks off of fastCopy (the lcd routine) if there is.
I'm still around... kind of.

Offline Geekboy1011

  • The Oneironaut
  • Donator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2031
  • Rating: +119/-2
  • Dream that Awakening dream
    • View Profile
Re: Interrupt question
« Reply #1 on: April 05, 2018, 05:38:48 pm »
Depends on the model! On the models with crystal timers yes, On the models with out sadly no.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Interrupt question
« Reply #2 on: April 06, 2018, 03:37:41 pm »
Depends on the model! On the models with crystal timers yes, On the models with out sadly no.
My knowledge is somewhat... lacking... in crystal timers. Can it be accomplished in > ~20 clock cycles?
In generalized pseudocode is to:
Code: [Select]
Interrupt:
exx
64 loop for y
ld i,(breakSave) // change the interrupt location (I know you can't just set I)
12 loop for x
set interrupt to trigger in ~25 clock ticks (15 for next 2 instructions and 10 for after)
exx
ret
//go and execute 1 or 2 instructions while we wait for the lcd to be ready
breakSave: //when the interrupt triggers it will jump to right here
exx
out ($10),a // write to the lcd
endXLoop:
endyLoop:
ld i,(Interrupt) // restore the interrupt location
exx
ret
I'm not sure if all the code is correctly formatted. Ignore any incorrect syntax. I'm sure you get the idea of what my goal is. I want to spend time executing useful code while I wait for the lcd to be ready for another write. It only works if the function is in an interrupt of course. I don't think that it will help with greyscale display since they have less waisted time waiting for the lcd to be ready. I can't create the method since I don't know how to use crystal timers. Some code showing me how to use them would be nice.
I'm still around... kind of.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Interrupt question
« Reply #3 on: April 06, 2018, 04:03:39 pm »
I don't know crystals timers well, sorry. I do however remember a comment from about six years ago by thepenguin77, I think, involving this same premise. I couldn't find the post though :(

Offline Hooloovoo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 225
  • Rating: +22/-0
    • View Profile
Re: Interrupt question
« Reply #4 on: April 07, 2018, 12:02:36 am »
I believe there is a way to set an interrupt on a certain number of cpu cycles having elapsed. I haven't ever used it, though.
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30
From what I understand about the timers, you could set the counter to 15, and the on/off port to 0x80 to get interrupts every 15 ticks.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:



(actually I have quite a few more than this, but I don't feel like making bars for them all.)

Offline Geekboy1011

  • The Oneironaut
  • Donator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2031
  • Rating: +119/-2
  • Dream that Awakening dream
    • View Profile
Re: Interrupt question
« Reply #5 on: April 10, 2018, 07:50:36 pm »
What @Hooloovoo linked is what you would want to use @E37 That page explains it all :D

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Interrupt question
« Reply #6 on: April 11, 2018, 07:34:28 pm »
I believe there is a way to set an interrupt on a certain number of cpu cycles having elapsed. I haven't ever used it, though.
http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30
From what I understand about the timers, you could set the counter to 15, and the on/off port to 0x80 to get interrupts every 15 ticks.

That does help. However, it is too niche a solution to make the effort worthwhile. I would only be able to have a 2% speed gain in a ti84 that used an interrupt to display a non-greyscale image. That isn't really a common case, and isn't really worth the effort. It was a fun thought experiment though.
I'm still around... kind of.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Interrupt question
« Reply #7 on: April 19, 2018, 09:45:37 pm »
I have a bit of an obscure question. I have been looking into ways of creating multi-page apps in Axe. I know it can be done by swapping pages at 0x4000 and using a jump table, but that requires that the program use multiple apps which looks ugly. Looking at the app header I know that there is 1 byte that determines the number of pages an app is. I was wondering what would happen if I changed that byte. I know that even if I unlocked flash, I can only write a 0 onto a 1 so I would need to save the app's data and clear the flash page. So... theoretically speaking, if I looked through the archive to find X pages free in a row, copied the app to that page changing the number of pages byte to X then I could paste other 1 page Axe apps in the other pages and use a jump table in them. Would that work? Would the OS ignore the apps pasted into the second page even though it had a legal header? (I guess I could just change the header to all 0's)

Another idea: Is there a way to mark a 16k segment of flash as taken without it showing up anywhere? If I could do that, I could create the standard jump table at the start of the app with the page number as the offset of the app to the block of flash and simply call the Bcall for multi-page apps.

I suppose this is a lot of work for not much gain... just a prettier app screen. Maybe there is a way to hide apps in the menu by naming them something illegal.
I'm still around... kind of.