Jig-Ulator

Sometimes an RC2014 has just one job. This one is to go Beep Whoop, Beep Beep Whoop, Beep Beep Beep Whoop! whenever a working Why Em-Ulator Sound Module PCB is put on the jig.

Jig-Ulator

Before we get to that, though, lets go back to the start and consider the Why Em-Ulator Sound Module. This is supplied to RC2014 Towers with the surface mount components assembled and the PCBs panelised. The panelisation is needed so that they will go through the assembly process at the fab house. So the first thing to do is remove the rails and separate the pair of boards.

Removing the rails is made easy with a slot cut in to a wooden box. The rails are put in to the slot and a quick bend up and down detaches them from the main PCB. The discarded rails are then collected in the box. Breaking the two PCBs apart is also a simple process.

Next the micro controller needs to be programmed. The PCB has a TC2030 Tag Connect compatible programming header next to the micro controller. The programming cable has spring loaded pogo pins and some locating pins that protrude through the board. To accommodate this, a small jig (Jiglett) is used.

The programmer is a stand alone device which has the flash hex file, eprom hex file and fuse settings for the default Why Em-Ulator settings (YM2149 at 1.7734MHz). Other settings can be programmed manually from a laptop.

For peace of mind that the firmware has been programmed successfully, and that the assembly process was correct, it needs to be tested. This is where the Jig-Ulator comes in.

At the heart of the Jig-Ulator is an RC2014 Micro. This sits in a Backplane 5 with 3 sockets fitted. One of these sockets has a Digital I/O Module for visual feedback and the other has a Rev 5 YM2149 Sound Module with an AY-3-8910 to AY-3-8912 adapter. This adapter carries all the signals (Power, 8 data lines, Reset, BC1 and BDIR) that the Why Em-Ulator needs to operate, as well as the return path for the sound from Channel A, Channel B and Channel C. The sound module is plugged in to a speaker for audio feedback.

At the front of the Jig-Ulator is a bed of nails test jig made from laser cut Perspex and pogo pins. The Perspex holds the pogo pins in place, and the upper layers have an alignment cutout so that the module under test will line up perfectly with the pins. A little bit of pressure ensures that all signals make good contact.

The RC2014 Micro has some very simple test code in ROM that runs on startup and continues indefinitely. This code isn’t elegant. Nor is it particularly efficient. And it certainly isn’t an example of how to write good Z80 assembly code. However, it has one job, test the module, and it does that well.

All of this only takes up a couple hundred bytes of the 8k ROM. It can surely be optimised to take up less space. Alternatively, the calls can be unrolled to take up more space but without needing any RAM for the stack.

            .ORG    $0000 
REG         EQU     $D8 
DAT         EQU     $D0 
START:               
            NOP      
            NOP      
            DI       ; disable interrupts
            LD      hl,$9000 
            LD      sp,hl ; set up stack
            NOP      
;set mixer reg to enable channel A
            LD      a,7 
            OUT     REG,a 
            LD      a,62 
            OUT     DAT,a 
            LD      a,15 
            OUT     0,a ; set DIO lights right

;set channel A to max volume
            LD      a,8 
            OUT     REG,a 
            LD      a,15 
            OUT     DAT,a 

;output 2 note to channel A
            LD      a,0 
            OUT     REG,a 
            LD      a,128 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,255 ;high note
            OUT     DAT,a 
            CALL    delay 

;decremental tone
            LD      a,0 
            OUT     REG,a 
            LD      b,255 
            CALL    ALOOP 

;set mixer reg to enable channel B
            LD      a,7 
            OUT     REG,a 
            LD      a,61 
            OUT     DAT,a 
            LD      a,$F0 
            OUT     0,a ; set DIO lights left

;set channel B to max volume
            LD      a,9 
            OUT     REG,a 
            LD      a,15 
            OUT     DAT,a 

;output 4 note to channel B
            LD      a,2 
            OUT     REG,a 
            LD      a,255 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,128 ;high note
            OUT     DAT,a 
            CALL    delay 
            LD      a,255 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,128 ;high note
            OUT     DAT,a 
;decremental tone
            LD      a,2 
            OUT     REG,a 
            LD      b,255 
            CALL    ALOOP 

;set mixer reg to enable channel C
            LD      a,7 
            OUT     REG,a 
            LD      a,59 
            OUT     DAT,a 
            LD      a,60 
            OUT     0,a ; set DIO lights middle

;set channel C to max volume
            LD      a,10 
            OUT     REG,a 
            LD      a,15 
            OUT     DAT,a 

;output 6 note to channel C
            LD      a,4 
            OUT     REG,a 
            LD      a,128 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,255 ;high note
            OUT     DAT,a 
            CALL    delay 
            LD      a,128 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,255 ;high note
            OUT     DAT,a 
            CALL    delay 
            LD      a,128 ;low note
            OUT     DAT,a 
            CALL    delay 
            LD      a,255 ;high note
            OUT     DAT,a 
;decremental tone
            LD      a,4 
            OUT     REG,a 
            LD      b,255 
            CALL    ALOOP 


;turn sound off
            LD      a,7 
            OUT     REG,a 
            LD      a,63 
            OUT     DAT,a 
            LD      a,0 
            OUT     0,a 
            CALL    DELAY ; wait....
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            CALL    DELAY 
            JP      START ; and start all over again


            EI       ; enable interrupts
            RET      ; which will never get to. But helpful for debugging RAM based versions of the code
SHORTDELAY:          
            PUSH    hl 
            PUSH    af 
            LD      hl,1000 
            JP      DELLOOP 

DELAY:               
            PUSH    hl 
            PUSH    af 
            LD      hl,$ffff 
DELLOOP:             
            DEC     l 
            JP      nz,DELLOOP 
            DEC     h 
            JP      nz,DELLOOP 
            POP     af 
            POP     hl 
            RET      

ALOOP:               
            LD      a,b 
            OUT     DAT,a 
            CALL    SHORTDELAY 
            DEC     b 
            JP      nz,ALOOP 
            RET      


After starting up, interrupts are disabled and a stack area is defined. Then it makes a Beep-Boob on channel A, whilst turning on the right 4 LEDs on the DIO module, then plays a Whoop noise. It then does this again on Channel B, but with a Beep-Boop-Beep-Boop and illuminating the left 4 LEDs. And finally, it does this again on Channel C, but with a Beep-Boop-Beep-Boop-Beep-Boop and the middle 4 LEDs. Slight pause and back to the start.

The whole thing only takes a few seconds to confirm that everything is working as it should.

Retro Challenge 10/2016 – Still a work in progress

So, who remembers my entry for Retro Challenge in January?  It was quite devoid of effort and results I think you’ll agree.

Well, this time around, I’ve taken that theme and pushed it even further!  Even less effort and much less result.

Since January, I have had a few opportunities to carry on with the ZX81 Module.  Because I wanted this to be a Retro Challenge project, I deliberately avoided doing any work on it, so I could save it all for October.  Well, October started and I was overwhelmed with non-Retro Challenge stuff.  But after a couple of weeks, I had a spare afternoon, and decided to dedicate this to the ZX81 Module!

So, I dug out the PCBs I had manufactured in January and fired up the soldering iron;

retrochallenge10-2016_1

Time to wrack my brains and work out what my plans had been 9 months earlier.  I had failed to put any component values on the PCB, or even my Kicad schematics, so had to rifle through original ZX81 schematics to work out what these should be.

Now I knew what components I needed, it quickly dawned on me that I didn’t have very many of these at all.  This didn’t deter me though.  I fitted everything I had; IC socket, pin headers, some resistors and some transistors that may or may not be compatible;

retrochallenge10-2016_2

And that’s about it.  I have ordered the rest of the parts now, but not had an opportunity to fit them.  yet.

One thing I have learned from this experience though, is that if I get any opportunity or urge to work on this, then I will seize it.  Not wait until the next Retro Challenge.  If I’d done work on this months ago when I had the chance, then this would more likely be a trouble shooting / tweaking / developing challenge.

One other good thing that has come out of this though, is that when I started this in January, I had a few design changes or additions required for the RC2014 for it to work.  The Backplane 8 has the ability to add resistors between the CPU and the RAM.  The Universal Micro Keyboard has the right connections to work with a real ZX81 or this ZX81 Module (including diodes).  The CPU Module also now has BUSRQ, WAIT, NMI and WAIT pins broken out which is required for this.  These changes should all make things much easier.

Despite my poor efforts this time around, I have thoroughly enjoyed seeing what everybody else has achieved with their Retro Challenge.  Good work everybody else!

Retro Challenge 2016 – My Dog Ate My Homework

So, all the way back in deepest darkest December, I announced I would enter the Retro Challenge 2016 competition that ran throughout January.  Those of you that followed by blog or Twitter account when I did this in 2014 will know that I blogged and Tweeted relentlessly for the whole month, but, this time around, almost nothing.  Obviously, I’m keeping some secret about an amazing breakthrough or something, right?  Well, truth is, I’ve done almost nothing.

Things started well, and on 1st January, I designed a new backplane for the RC2014.  Although I hadn’t studied the circuit diagrams for the ZX81, Jupiter Ace or ZX Spectrum yet, I knew that there were resistiors between the Z80 CPU and other devices.  The stripboard backplane I’d been using had served me well, but it was time to progress to a better solution, and one that could be adapted better to my needs.  Knowing that PCB delivery times could be against me, I thought it best to crack on and get this  ordered.

Screenshot from 2016-01-31 16:01:00

The basic circuit is very very simple – however, I wanted to get this just right, not only for Retro Challenge 2016, but for other possible RC2014 uses.  Essentially, there are 8 40 way connectors that are linked straight through – however, the data lines and address lines for the leftmost 2 connectors and rightmost 2 connectors are separated by a pair of pads.  These can either be shorted together for up to 8 commoned connectors, or have resistors soldered across them.  I also added a power connector and the option of either running 5v directly in to the board, or regulating a higher voltage down via a LM7805.

(more…)

HDMI and USB Keyboard Support

So, the RC2014 is a great little computer.  We all know that.  However, to communicate with it, it is easiest to use the serial port and hook it up to a laptop or desktop PC.  This makes detracts from the fact that it is small, portable and cheap as well as missing the point of running code on such a basic computer.  So I’ve been looking for a solution to this.

Back when this was still running on a breadboard, I hooked up an Atmel ‘328 that was connected to a keyboard and 4 x 20 LCD display.  It communicated with the RC2014 over the serial port and kind of worked ok, although 4 lines was very restrictive and the Atmel couldn’t really keep the screen running and listening at the same time.   I have thought about using a ‘328 to drive a composite output, or maybe some kind of bigger LCD panel, but nothing really struck me as just right.

That is, until the kind people at Raspberry Pi released a cheap multifunction interface device a couple of weeks ago!

2015-12-18 22.13.44

(more…)

Retro Challenge January 2016 – Preamble

So, you may well remember that I entered Retro Challenge 18 months ago, and what a fun crazy busy time that was!  Well, the January Retro Challenge competition is about to kick off in just over 2 weeks.

If you’re not familiar with Retro Challenge, shame on you!  But you can de-shame yourself by heading over to http://www.retrochallenge.org/ and seeing what it’s all about.  Essentially, it’s a month long bi-annual competition where the entrants set themselves a goal based around old school computing and blog, tweet and share their experiences.  The goals are pretty loose, as long as they are based on something from last centuary (modern emulators of old kit is fine).

The challenge I set myself was to take a breadboard based Z80 computer and bring it to life in modular PCB form in such a way that I could spell out my name on.  Have a look back through my blog to see how I did.  Spoiler —->

IMG_20140730_205950

(more…)

RC2014 SD Bootloader Update

Just a quick update to about the SD Bootloader I designed a few posts ago.  Well, the PCBs have arrived and last week I took a soldering iron to one of them and gave it a quick test

One side of the board is effectively an Arduino, so without plugging it in to the RC2014, I connected up an FTDI lead and uploaded the Arduino Blink sketch.  A quick check with a multimeter and one of the pins was altenating between 5v and 0v.  So far, all good! (more…)

RC2014 Bootloader for SD Cards

So, the RC2014 is great.  I can run Microsoft BASIC and program it from there, and as long as I am using a terminal emulator, I can copy & paste to save and load programs.  Alternatively, I can write Z80 code using an online compiler then download it, copy it to USB stick, move it to my old Windows 2000 laptop (which has a parallel port) so I can burn it on to EPROM to see if it works, make adjustments and repeat with another EPROM.

I will be the first to admit, however, that this is probably not the most efficient workflow.  Not to mention the time and effort involved in wiping the limited stock of aged EPROMS.

So, I am in the process of designing an SD Card based bootloader.

i (2)

(more…)

RC2014 with ZX Printer interface

My original plan had never been to design and build my own computer.  I had, however, planned to build a clone of the Sinclair ZX80, which has been on my bucket list of things to own for year, and which I had found plans for online.  Whilst collecting the parts and reading up on simple Z80 computers I got kind of sidetracked and ended up with the RC2014.

The print out shown was what was left from the last time this was connected to a ZX Spectrum!

The heart of the RC2014 is a Zilog Z80 CPU, which is the same one that Sinclair used in the ZX80, ZX81, ZX Spectrum and Z88.  If the ZX81 and ZX Spectrum can run a ZX Printer, then surely it follows that the RC2014 will be able to too?

(more…)

Assembly Language Vs Lego

I guess this is kind of a follow up to my Retro Challenge posts, as it was thoughts that stemmed from teaching myself Assembly Language for my Z80 project.  Essentially it is a comparison between programming in the 70’s and today against building with Lego in the 70s and today.

lego_thesimpsons

But before I get stuck in, can you identify this famous TV family from a few crude Lego bricks? (more…)

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

(more…)