Smaller compressed screen.

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Smaller compressed screen.

Post by dr beep »

The ZX81 has a compressed screen to code games in 1K.
However when we have a small game with just a few lines (like Chess or Bejeweled each 8 lines).
we still have 17 linefeeds to fill the screen. I was wondering if this could be less.
You can execute code on the screen, so why wouldn't you jump back to a newline earlier on the screen
and use a loop to fill the screen? Easier said than done. A jump back to latest Newline didn't do
in all cases. This routine shortens the screenmemory when 16 lines or less are used. When you use more
fill the screen with Newlines like normal.

Due to the jump the screenlayout is corrupted. This can be solved with more linefeeds on the last line.
This routine works in all cases. Sometimes less linefeeds work, but you need to try.

This screen is part of Bukster's BEJEWELED.

Code: Select all

ONEKDISPLAY:
	DB $76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
	DB $00,$00,$00,$00,$00,$00,$00,$00,$76
lives	DB $80,$80,$80,$80
dispsc	DB $9C,$9C,$9C,$9C
; end of visible screen

; Screenfiller, max size will work always less linefeed might work.
; Screen with less than 16 lines wil be shorter with this code.
lf	db #76,#76,#76,#76,#76,#76
	jp lf+#8000
; fill rest of screen by jumping back to lower part of screen intruptcounter will end in right way.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Smaller compressed screen.

Post by dr beep »

BTW, this will NOT work on a 48K ZX81.
User avatar
marste
Posts: 250
Joined: Sun Aug 10, 2014 9:58 pm
Location: Italy
Contact:

Re: Smaller compressed screen.

Post by marste »

Wonderful, seems "a lot" of bytes saved!!

As soon I'll be able to get back on the 1K Super Micro Chess I'll try it for sure!!

Thank you Johan!! :)
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Smaller compressed screen.

Post by stefano »

we're looking forward for seeing it back alive and kicking, Stefano ;)
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Smaller compressed screen.

Post by dr beep »

I was coding my latest 1K hires game as I noticed a large screenline going to another without a NewLine.

It was an error, but it made me try something else to reduce the smallest screen on a ZX81.

I came up with this:

Code: Select all

dfile 	db 118
 	db "T"+101,"E"+101,"S"+101,"T"+101	; first line
	db 118						; Newline first line
 	db "T"+101,"E"+101,"S"+101,"T"+101	; second line
	db 118						; Newline second line
	jp (hl)						; THIS FILLS THE ENTIRE SCREEN 
This is a 2 line screen where the rest of the screen is filled with just 1 byte.

How does it work:
After the second Newline a jump to uppermemory is done. The address is set in HL.
You don't need a Newline to fill the line or the screen. So you can execute the JP (HL) which has bit 6 set so executable in highmemory.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Smaller compressed screen.

Post by dr beep »

The full model for most bytes codeable.
modelzx81.asm
(1.45 KiB) Downloaded 264 times
Post Reply