ZX80 development thread

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Shaun_B
Posts: 329
Joined: Wed Apr 22, 2009 9:22 am

ZX80 development thread

Post by Shaun_B » Thu Dec 07, 2017 10:06 am

Hi,

I thought I'd start a thread for ZX80 specific dev talk (it may be an echo chamber) for the ZX80 and compatible clones.

I'll post C, BASIC and Assembly [in C wrapper] snippets here for people to digest, re-use, improve etc...

Thanks,

Shaun.

User avatar
sirmorris
Posts: 2696
Joined: Thu May 08, 2008 4:45 pm
Location: oxon, uk

Re: ZX80 development thread

Post by sirmorris » Thu Dec 07, 2017 11:01 am

I think that's a great idea - you may just spark an interest in coding for this challenging machine!
--=== ZXpand+ ... A more moderner all-in-one upgrade solution for ZX81 ===--
* SD/MMC storage * 32K Hires-capable RAM * AY sound chip * Joystick port * Serial *
* BASIC enhancements - plug & play * Reset button * Auto-boot facility *

User avatar
Paul
Posts: 880
Joined: Thu May 27, 2010 7:15 am
Location: Germanys west end

Re: ZX80 development thread

Post by Paul » Thu Dec 07, 2017 11:07 am

Yesss,
Wasn't there a wait for keypress for ZX80 in assembly from you somewhere around?
I'm searching for this...
Kind regards Paul
In theory, there is no difference between theory and practice. But, in practice, there is.

Shaun_B
Posts: 329
Joined: Wed Apr 22, 2009 9:22 am

Re: ZX80 development thread

Post by Shaun_B » Thu Dec 07, 2017 11:29 am

I'll start with my generic CLS() routine in z88dk (C):

Code: Select all

/**
 * Clears the screen
 *
 * @author	sbebbington
 * @date	22 Aug 2017
 * @version	1.1a
 */
void cls()
{
	__asm
	exx
	ld hl, ($400c)
	ld bc, $0300
	ld d, $21
	inc l
	CLS:
		dec d
		jr z, NEWLINE
		ld (hl), $00
	DECC:
		inc hl
		dec c
		jr z, DECB
		jr CLS
	DECB:
		dec b
		jr z, EXIT
		jr CLS
	NEWLINE:
		ld (hl), $76
		ld d, $21
		jr DECC
	EXIT:
	call $0747
	exx
	__endasm;
}
In usual assembly, you can remove the exx instructions at the start and end of each block (this is required because of the way that C works; preserve the registers before the custom assembly to restore them before returning from the C function wrapper). Calling location $0747 places the cursor at effective position zero of the DFILE (well, position zero must always be a newline, so the next one).

Regards,

Shaun

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests