Skip to content

First Blink for Olduino/Z

October 18, 2015


Here’s the oluino/z prototype-prototype running a blink sketch. It’s a prototype-prototype because I plan to move it onto Lee Hart’s protoboard once i have the circuit nailed down. That will still just be a prototype because I need to get a board made to fit the arduino rails on it.

The prototype-prototype hardware is shown below. The little board on the left includes the reset button and the serial connection with an extra diode between serial in and /INT. The leads to the ZMC CPU board are 5V/Gnd(red/black) output bits 7 to serial and bit 0 for the led(both yellow), input bit 7(orange), /INT(white) and /reset(blue).
15-10-18 proto-proto

The blink program was compiled with SDCC and loaded into the ZMC with Josh Bensadon’s ZMC monitor which has been hacked(Thanks Josh!) to run without the front panel. Compiling is easy from textpad but I had to copy the hex output from the compiler into a terminal program to run it then issue a separate “Go 8000” to the monitor program to start. I still need to have a hard look at the monitor to make it act more like a bootloader and also to leave port 40 alone except for bit 7 which is serial i/o.

I cordially dislike the Z80 machine language but I have to admit the darn thing is fast. The delay routine source and assembly are shown below with clock counts on the instructions. Because I’m just soaking up time I don’t care that the code is clumsy so each pass through is 11 instructions taking 77 clocks or 19.25 uS so it takes 50,000 passes for a 1 sec delay. In the long run I want to use the same kind of timer circuit/interrupt as the ZMC front panel uses and clock myself from that rather than spinning. In the medium term I’ll make some kind of one ms soaker routine in assembly that will be more reliable and the loop in the delay routine will just be once per ms.

void delay(unsigned int howlong){
	unsigned int i;
	for (i=0;i<howlong;i++){
		__asm nop __endasm;
	}
}
******************Timed Assembly follows**************
_delay::
;C:\Users\Bill\Desktop\olduinoZ\1stblink.c:16: for (i=0;i<howlong;i++){
	ld	de,#0x0000
00103$:			11 inst, 77 clocks(payload+4)=0.01925ms i.e. 50/ms
	ld	hl,#2 	T7
	add	hl,sp 	T15
	ld	a,e 	T4
	sub	a, (hl) T7
	ld	a,d 	T4
	inc	hl	T6	
	sbc	a, (hl)	T7
	ret	NC	T5	
;C:\Users\Bill\Desktop\olduinoZ\1stblink.c:17: __asm nop __endasm;
	nop 		T4
;C:\Users\Bill\Desktop\olduinoZ\1stblink.c:16: for (i=0;i<howlong;i++){
	inc	de	T6
	jr	00103$	T12
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: