Retro Challenge – Closing Thoughts

Wow! What an awesome month July has been.  The whole Retro Challenge thing has been great, and despite moments of stress or despair, I have thoroughly enjoyed taking part and seeing what everyone else has been up to.  Before I sum up my project, I should make a few honourable mentions.

Retro Challenge – A huge thanks to Mark and Wgoodf do a great job in hosting this twice a year.  Keeping everyone updated via Twitter has worked really well.  Cheers guys!

Grant Searle is responsible for the general Z80 design I used and also converted MS BASIC from the Nascom to run on this.  Really, this project is a test of my understanding of Grants work and seeing how far I can take things.

Nottingham Hackspace has an amazing “parts bin” that included the LEDs, Veroboard, case, some of the logic chips and the RAM I used.

OSHPark did a great job (for a very good price!) on the PCBs – even if the postal system did keep me on the edge of my seat for a bit!

Chris Gammell introductions to KiCad PCB design videos were critical in guiding me through the various stages of board design.

Rodney Zaks book Programming the Z80 has been like a bible for me.  Combined with a few dozen other resources of Z80 info on line I’ve been able to at least get the basics assembly language programming.

CLRHome is a great online Z80 IDE that can compile assembly language in a variety of output formats including for the ZX Spectrum.  I doubt I could have managed this in notepad!

All of the other Retro Challenge entrants deserve a mention too, but there’s a few that really caught my eye and taught me stuff about their particular approach to RC2014, such as Wgoodf – Turtles all the way down, Ians restoration of Northstar Horizon, Tezzas restoration and programming of Challenger 4P, John finishing work on Fahrfall

IMG_20140730_205950

I have shared the PCB design files on OSHPark, so if you want to build your own Z80 computer but don’t want to get involved in the PCB design side, you just need to click Add To Cart and the boards will pop through your letterbox soon.  I think all the component info and other details you need are there, but if you do decide to build your own, please let me know.  I’d love to see other people using the RC2014!

I cannot get my head around Github, so, for now, the design files and source code are not up there.  If I can get Github to do what I expect it to do any time soon I’ll upload the files.  In the mean time though, I am going to print the schematics, BOMs and PCB layouts as pdf files for those of you that want to take a look.  Feel free to drop me a line if you want the actual KiCad files or if there’s anything I can help you with.

As for the Z80 assembler code, here’s an abridged version (The full ASCII stuff was posted here a couple of weeks ago, and makes for a very long tedious lising!).  As I have said before, I am not a programmer, so I know that this is not pretty code.  It is not efficient code.  It is not easy to read code.  It does, however, do what I needed it to do, so that’s fine by me :-)

#define DECODED $9000
#define DEC2 $9001
#define DEC3 $9002
#define DEC4 $9003
#define DEC5 $9004
#define WRKSPC $8045

.org $0000

NOP 
NOP
di ;disable intrupts.
NOP
NOP
NOP

ld hl,WRKSPC
ld sp,hl ;set stack pointer to 0x8045

;clear led matrix

ld a,255
out (0),a
ld a,0
out (1),a
out (2),a
out (3),a
out (4),a
out (5),a
ld a,49
out (129),a

;Fill display memory - 1st character
ld b,0
ld c,8
ld ix,STRING
ld a,(ix+0)
sub 32
ld hl,0
ld l,a
add hl,hl ;2 x string(b)
add hl,hl ;4 x string(b)
add hl,hl ;8 x string(b)
ld de,ASCII
add hl,de ; hl now points to ASCII +( 8 x (STRING+b)) 
ld de,DECODED 
Loops80: 
ld a,(hl) ;load A with line from ASCII
ld (de),a ;DECODED now contains line of stuff 
inc de
inc de
inc de
inc de
inc de ;added 5 to DECODED address 
inc hl ;increment to next line of ASCII
dec c 
jp nz,Loops80 ; repeat for next 7 lines

;This bit of code is copied & pasted 5 times for each character, but with an incrementing "ld a,(ix+0) and the loops80: For brevity I've omitted them here

;5th character

ld c,8
ld ix,STRING
ld a,(ix+4)
sub 32
ld hl,0
ld l,a
add hl,hl ;2 x string(b)
add hl,hl ;4 x string(b)
add hl,hl ;8 x string(b)
ld de,ASCII
add hl,de ; hl now points to ASCII + 8 x (STRING+b) 
ld de,DEC5 
Loops84: 
ld a,(hl)
ld (de),a ;decoded now contains line of stuff 
inc de
inc de
inc de
inc de
inc de ;added 5 to decode address 
inc hl
dec c 
jp nz,Loops84


;Main Loop

START:
ld hl,DECODED
ld a,127 ;start x with $01111111
ld b,8
ROWLOOP: 
out (0),a 
ld c,5
COLLOOP: 
ld d,(hl)
out (c),d
inc hl
dec c
jp nz,COLLOOP ;repeat this loop 5 times
call DELAY
rrca ;move to next row <<10111111<<<11011111<<etc
dec b
jp nz,ROWLOOP ;repeat this loop 8 times
jp START


DELAY:
push hl ;save hl and af registers
push af
ld hl,1000
DELLOOP: 
dec l
jp nz,DELLOOP ;countdown l from 255 to 0
dec h
jp nz,DELLOOP ;countdown h from 16 to 0
;clear led matrix
ld a,255
out (0),a
ld a,0
out (1),a
out (2),a
out (3),a
out (4),a
out (5),a 
pop af ;restore hl and af registers
pop hl
ret



STRING:
.db "SOwen" ;this is the text to be displayed


ASCII: ;these ascii characters were taken from ZX Spectrum ROM
; $20 - Character: ' ' CHR$(32)

.defb %00000000
.defb %00000000

;See previous post for full ascii listing

Thanks to everyone that has been keeping up with this project and encouraging me along the way.  There’s still a lot that I want to do with the RC2014 computer, but I’m sure a lot of that can wait until the Winter Challenge!

1 Comment
  1. […] RC2014 system started as one man’s “Retro Challenge”. See here for […]

Comments are closed