Page 1 of 1

Smaller compressed screen.

Posted: Sun Jul 14, 2019 11:03 am
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.

Re: Smaller compressed screen.

Posted: Sun Jul 14, 2019 12:11 pm
by dr beep
BTW, this will NOT work on a 48K ZX81.

Re: Smaller compressed screen.

Posted: Sun Jul 21, 2019 9:28 pm
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!! :)

Re: Smaller compressed screen.

Posted: Thu Jul 25, 2019 9:31 pm
by stefano
we're looking forward for seeing it back alive and kicking, Stefano ;)

Re: Smaller compressed screen.

Posted: Thu Nov 21, 2019 6:23 pm
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.

Re: Smaller compressed screen.

Posted: Thu Nov 21, 2019 6:33 pm
by dr beep
The full model for most bytes codeable.
modelzx81.asm
(1.45 KiB) Downloaded 268 times