Nova Lite (32 bytes) 8 display lines 3X faster

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Nova Lite (32 bytes) 8 display lines 3X faster

Post by Bean »

I've been working on a program to show a reduced number of display lines in order to run programs faster. AND is usable on a 1K or 2K sinclair machine.

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
  
This code is based on some code I got from the great Wilf Rigter (credit where credit is due).

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.
Attachments
novalite.tzx
(416 Bytes) Downloaded 137 times
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Nova Lite (32 bytes) 8 display lines 3X faster

Post by PokeMon »

The driver is always kicked off when using additional following commands:
LOAD
SAVE
- obviously through leaving normal display mode but also the printer commands:
LPRINT
LLIST
COPY
- and last but not least editing the program through entering new lines or deleting some other lines

I did some driver attempts two years ago but throwed the idea due to special situations.
Bean
Posts: 73
Joined: Fri Aug 01, 2014 8:40 pm

Re: Nova Lite (32 bytes) 8 display lines 3X faster

Post by Bean »

Yeah, editing isn't really useful anyway because you can't see the bottom lines anyway.
But I didn't think about the printer commands, that kind of sucks.
I guess ANYTHING that switches between FAST and SLOW will kick off the driver.

Bean
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Nova Lite (32 bytes) 8 display lines 3X faster

Post by PokeMon »

Bean wrote:I guess ANYTHING that switches between FAST and SLOW will kick off the driver.

Bean
Yes - whenever SLOW mode is left and entered again later, the default ROM video driver is called.
It is the routine at address $0207 in ROM which enters last following instructions:

Code: Select all

        SET     7,(HL)          ; Indicate SLOW mode - Compute and Display.

        PUSH    AF              ; *             Save Main Registers
        PUSH    BC              ; **
        PUSH    DE              ; ***
        PUSH    HL              ; ****

        JR      L0229           ; skip forward - to DISPLAY-1.
The last line (JR $0229) is the one that sets the IX register back to the ROM video routines.
Post Reply