Page 1 of 1

disable keyboard to gain speed ?

Posted: Wed Jul 17, 2019 5:12 pm
by goyo
Is it possible in the c language to disable the Oric keyboard management and read directly the codes of the keyboard?
would anyone have the code in c?
I've heard that it takes 20% of the oric processor... :!: :?:

Re: disable keyboard to gain speed ?

Posted: Wed Jul 17, 2019 5:47 pm
by Dbug
20% is not the keyboard reading, it's the total cost of the default ROM IRQ, and there are multiple reasons for that:
- it runs at 100hz, which for all intent and purpose is completely stupid, they should have used a 50hz interrupt
- it is doubly vectorized, so the ROM vector in FFFE-FFFF jumps to whatever is in page 2, so it can be redefined by the user (It's nice but costly)
- it updates internal timers, things like WAIT, blinking cursor, some sounds, ...
- it scans the entire keyboard

the main problem in fixing all that is that you can't really make changes compatible with the system, so when you start replacing the irq handler by your own, any keyboard or timer based code that calls the ROM will fail.

If you are willing to do that, the best approach is to make a disk based game, because then you can use the overlay ram and have FFFE point directly to your irq handler.

You can see an example in my CEO competition entry: http://miniserve.defence-force.org/svn/ ... Road/vbl.s

The code only handles arrow keys and space.

Re: disable keyboard to gain speed ?

Posted: Wed Jul 17, 2019 5:55 pm
by goyo
Dbug wrote:
Wed Jul 17, 2019 5:47 pm
20% is not the keyboard reading, it's the total cost of the default ROM IRQ, and there are multiple reasons for that:
- it runs at 100hz, which for all intent and purpose is completely stupid, they should have used a 50hz interrupt
- it is doubly vectorized, so the ROM vector in FFFE-FFFF jumps to whatever is in page 2, so it can be redefined by the user (It's nice but costly)
- it updates internal timers, things like WAIT, blinking cursor, some sounds, ...
- it scans the entire keyboard

the main problem in fixing all that is that you can't really make changes compatible with the system, so when you start replacing the irq handler by your own, any keyboard or timer based code that calls the ROM will fail.

If you are willing to do that, the best approach is to make a disk based game, because then you can use the overlay ram and have FFFE point directly to your irq handler.

You can see an example in my CEO competition entry: http://miniserve.defence-force.org/svn/ ... Road/vbl.s

The code only handles arrow keys and space.
Ok it more clear for me , thanks for all these informations Dbug :)