Here is what I came up with. It is only 32 bytes of machine code and is setup to display 8 lines and gives a 3X speed improvement.
With a couple pokes you can changes the number of display lines (less lines = more speed). 1 line is almost the same speed as FAST mode.
Here is the code:
Code: Select all
; NOVALITE
START:
LD IX,VIDEO DD218740
RET C9
VIDEO:
LD A,R ED5F
LD BC,$1901 010109
LD A,$F5 3EF5
CALL 02B5 CDB502
LD(IY+MARGIN),$9F FD36289F
CALL $0292 CD9202
CALL $0220 CD2002
LD IX,VIDEO DD218740
JP 02A4 C3A402
It is setup for NTSC and 8 display lines.
The top margin is always the default value (31 for NTSC, 55 for PAL). Then the number of display lines (+1) is in location 16523, so for 8 display lines this location holds the value 9. The bottom margin is in location 16532 and needs to be 223 - (display lines * 8) so the default value is 159. For PAL the bottom margin needs to be 247 - (display lines * 8).
You can also force a NTSC machine to generate PAL by setting the bottom margin to 271 - (display lines * 8) of course the minimum number of display lines is 2 because the value cannot exceed 255. Also the screen will be shifted up slightly because the top margin is only 31 instead of 55.
NOTE: "display lines" is NOT the value in memory location 16523 that memory location must be set to (display lines+1).
For the demo program, run it, then delete line 5 (that starts the driver) and see the speed difference.
Anyway if anyone has any questions or comments I'd love to hear them.
Bean
P.S. I forgot to mention some restrictions.
If you go to FAST mode then back to SLOW mode you need to start the driver again.
If you use PAUSE you will need to restart the driver. PAUSE 1 is a good way to stop the driver.
If you need to use INPUT you'll need to stop the driver, do the INPUT and start the driver again.
If you want to try this on real hardware enter the REM line as seen, then do POKE 16520,95 then POKE 16543,195 before starting it. Use keywords and remember there are only 32 bytes so the "<>" is the single token symbol.