Next and the RST 16

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
Post Reply
User avatar
Bedazzle
Manic Miner
Posts: 314
Joined: Sun Mar 24, 2019 9:03 am

Next and the RST 16

Post by Bedazzle »

Hello, I'm totally troubled with ROM printing on Next. Can somebody guide me?
Code below is normally running on 128 machine, but does print nothing on Next.

Code: Select all

	DEVICE ZXSPECTRUM128
	;DEVICE ZXSPECTRUMNEXT

ROM_CLS	EQU  0x0DAF             ; Clears the screen and opens channel 2
REGULAR	EQU %00010000		; ULA screen in Bank 5, 48K ROM, Bank 0

	page 0
	org #C000

START:
	ld sp, 25000

	ld a, REGULAR
	ld bc,#7FFD
	out (c),a
	
	CALL ROM_CLS            ; Clear screen and open Channel 2 (Screen)
	call cls

	LD A, 65                ; Character to print
	RST 0x10

	ld a, 1
	out(254), a

looper:
	di
	halt


cls:
	ld  hl,$4000
	ld  de,$4001
	ld  bc,$1800
	ld  (hl),l
	ldir
	ld  (hl),%00101001
	ld  bc,$02FF
	ldir
	ret


	;SAVENEX OPEN "test.nex", START, 25000 : SAVENEX AUTO : SAVENEX CLOSE
	SAVESNA "test.sna", START
SNG
Drutt
Posts: 13
Joined: Sat Dec 23, 2023 12:16 am

Re: Next and the RST 16

Post by SNG »

You are copying 1 too many bytes to LAYER 0 and therefore clobbering the start of the paging routine after the attributes.

LDIR counts down to zero. You get this right for attributes but by then you’ve tried to stuff 6145 bytes into the pixel area.

Off by one errors are almost the only sort I make, these days. :D

P.S. I hope you’re doing a CLEAR below it before moving SP!
Post Reply