Questions about the Escalibur 64 : video RAM and clearing routine

Problems installing on other platforms
Post Reply
gameblabla
New member
Posts: 2
Joined: Mon Mar 27, 2023 9:07 am

Questions about the Escalibur 64 : video RAM and clearing routine

Post by gameblabla »

Hello,
i was playing around with the Excalibur 64 and noticed this clearing routine within z88dk :

Code: Select all

generic_console_cls:
	in	a,($50)
	bit	4,a
	jr	z,generic_console_cls
	push	af
	res	1,a
	set	0,a
	out	($70),a
	ld	hl, DISPLAY
	ld	de, DISPLAY +1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),32
	ldir
	ld	hl, COLOUR_MAP
	ld	de, COLOUR_MAP+1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	a,(__excali64_attr)
	ld	(hl),a
	ldir
	ld	hl, HIRES_MAP
	ld	de, HIRES_MAP + 1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),4		;PCG bank 0
	ldir
	pop	af
	out	($70),a
	ret
I've been looking for a way to push an uncompressed frame to the display output faster than putsprite would provide (it's way too slow)
so i copied it in my project instead of just calling just clg and then modify it later for my use...
except that it freezes when i do so.
Here's some it is in my test project :

Code: Select all

PUBLIC _cleartxt

	defc		DISPLAY = $2000
	defc		__console_w = 80
	defc 		CONSOLE_COLUMNS = 80
	defc 		CONSOLE_ROWS = 20
	defc		COLOUR_MAP = $2800
	defc		HIRES_MAP = $3000
	.__excali64_attr	defb	$70	; White on Black
	
_cleartxt:

	
	in      a,(50h)
	set     0,a
	out     (70h),a
	push	af
	
	ld	hl, DISPLAY
	ld	de, DISPLAY +1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),32
	ldir
	ld	hl, COLOUR_MAP
	ld	de, COLOUR_MAP+1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	a,(__excali64_attr)
	ld	(hl),a
	ldir
	ld	hl, HIRES_MAP
	ld	de, HIRES_MAP + 1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),4		;PCG bank 0
	ldir
	
	in      a,(50h)
	res     0,a
	out     (70h),a
	pop	af
	
	ret
I thought maybe this is a case like on the TIKI-100 or Lvov where parts of the RAM gets disabled and you have to relocate the code area elsewhere. I tried to put SECTION code_clib and SECTION code_graphics to see if it would make any difference and it didn't.
Looking at the memory mapping in rombasic.asm on the techrepo, i'm even more confused :
https://github.com/z88dk/techdocs/blob/ ... sic.asm#L8

It would seem that whenever screen RAM gets enabled, all of the RAM becomes inaccesible.
But if that's the case then why would it work for generic_console_cls and not for me ?
I'm not sure who to ask about it so i thought i would ask you guys instead.

(And yes, i'm using z88dk with the CP/M Excalibur 64 target)
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: Questions about the Escalibur 64 : video RAM and clearing routine

Post by dom »

I've just gone on a little Excalibur64 memory refresh.

It's one of those machines where the screen is paged in low in memory, so we put anything that accesses VRAM into the code_graphics section which gets relocated to high memory on startup.

It looks there are bunch of configurations for the the low memory, the mame code is a useful summary: https://github.com/mamedev/mame/blob/5c ... 4.cpp#L387

Which leads onto a couple of differences between the z88dk code and yours:

- We're waiting for vsync before writing the to VRAM. Apparently there's a contention issue: https://github.com/z88dk/z88dk/issues/1 ... -472807148

- We're toggling bit 1 of port $70, but you're not. Without toggling of bit 1, it looks like the VRAM won't be paged in.

BTW It looks like I figured out how to add a hires mode: https://github.com/z88dk/z88dk/issues/1 ... -473560199 but never got around to implementing it.
gameblabla
New member
Posts: 2
Joined: Mon Mar 27, 2023 9:07 am

Re: Questions about the Escalibur 64 : video RAM and clearing routine

Post by gameblabla »

Hey, thanks for the help !
You're right that i forgot some stuff that yours did and after doing so, it starts to work again.
How much would i have in the high memory area ? I was thinking of creating a buffer there so that i can directly copy it to the display within clear.asm. (it's not too apparent in z88dk where it puts the high memory area)

A high 320x288 resolution mode would certainly be very nice !
Last edited by gameblabla on Mon Mar 27, 2023 11:39 am, edited 1 time in total.
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: Questions about the Escalibur 64 : video RAM and clearing routine

Post by dom »

You can have as much space as you like really. The default is that code_graphics starts at 50000: https://github.com/z88dk/z88dk/blob/mas ... pm.cfg#L59
gameblabla
New member
Posts: 2
Joined: Mon Mar 27, 2023 9:07 am

Re: Questions about the Escalibur 64 : video RAM and clearing routine

Post by gameblabla »

I sort of got it to work with this (it just copies the color area right now), although it's quite finicky as it is.
Maybe eventually we will get a fast memcpy to the display interface in z88dk (?)
I've also tried other areas other than 50000 but they seem to conflict with either the main RAM or CP/M i think.

Code: Select all

	PUBLIC _Copy_Buffer
	SECTION		code_graphics
	defc		DISPLAY = $2000
	defc		__console_w = 80
	defc 		CONSOLE_COLUMNS = 80
	defc 		CONSOLE_ROWS = 24
	defc		COLOUR_MAP = $2800
	defc		HIRES_MAP = $3000
	.__excali64_attr	defb	$55	; White on Black
	EXTERN _buffer_tocopy
_Copy_Buffer:
	in	a,($50)
	bit	4,a
	jr	z,_Copy_Buffer
	push	af
	res	1,a
	set	0,a
	out	($70),a
	
	ld	hl, DISPLAY
	ld	de, DISPLAY +1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),32
	ldir
	
    ld    hl, _buffer_tocopy
    ld    de, COLOUR_MAP
    ld    bc, (CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
    ldir
    
	ld	hl, HIRES_MAP
	ld	de, HIRES_MAP + 1
	ld	bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
	ld	(hl),4		;PCG bank 0
	ldir

	pop	af
	out	($70),a
	
	ret

PUBLIC _buffer_tocopy

._buffer_tocopy
	defs 1920
Post Reply