Sunday, 27 April 2025

WOZMON

 Apple 1

Steve Wozniak was the brains behind the first Apple computers.  In conjunction with Steve Jobs (the Salesman) they formed Apple computers and in 1976 released the Apple 1.  As you can see from the advertisement below it came with a TV and keyboard interface so that you could communicate with it.


The computer is based on a 6502 microprocessor which was first sold in 1975 and was significantly cheaper than any similar product.  It opened the gate to hobbyist computing.  The 6502 was also the heart of the Apple ][ computer which became both a hobbyist and a business machine the following year.

My BEN2 computer also contains a 6502 processor which means that it runs the same machine code instructions as Apple1.  

WOZMON


A small program, called the monitor, was provided in Apple1 ROM.  It allowed the user to look at memory, type programs into memory and run programs.  It is famous because it was written by Steve Wozniak and packs lots of functionality into only 248 bytes of ROM.  An assembly listing of the monitor was provided in the Apple1 user manual.

For some time I have been thinking about trying to make wozmon work on BEN2. Ben Eater had  the same thoughts and has kindly created a couple of brilliant tutorials on using wozmon and amending it to run on his 6502 system.  

Conversion


The Ben Eater 6502 (and mine) use an ACIA serial interface chip to communicate with a PC so that it can use the PC screen and keyboard and doesn't require us to manually attach them.   In contrast Apple1 uses a physical screen and keyboard.  In order to use wozmon we need to change the keyboard character input and screen character output subroutines.

Using Bens amended wozmon version I was easily able to build and run wozmon on BEN2.
Here is a sample session showing the first few bytes of wozmon code at FF00-FF1F.
I then change the contents of address 1000 from CC to AA and check the results.
Finally I return to run my original monitor.

The Apple1 manual even gives you a sample program you can type in and run.  The results are shown below.
 

Conclusion

This is an amazing connection back over 50 years to the genius who was the brains behind Apple.
As always Kudos is due to Ben Eater who makes it easy for us to follow these steps from the past.


Saturday, 19 April 2025

Ben Eater BEN2 Posts

Back in 2023 building BEN2 took up a lot of my time.  I haven't done anything with it since then but as I intend to continue development, I have been reviewing the history.
Links to my blog posts on the journey are listed below together with some very brief details.

05/03/23BEN2 : A new startDesign for 6502+ROM+RAM+VIA
30/03/23BEN2: BuildSoldering + LED blink program
20/04/23LCDLCD output + full speed clock
30/04/23Terminal and keyboardAdd ACIA for serial IO
18/05/23XmodemPOC for WSL serial downloads
02/06/23AMI: Daughter BoardBoard for ACIA+LCD+clock+LEDs+buttons
04/06/23Xmodem : relocatable ProgramsAllow different RAM destination for downloads
07/06/23Streamline Downloadsautomate compile, link and download steps
11/06/23Xmodem : Flash Programs to ROMallow downloads to be saved in 6502 ROM
02/07/23Flashing and updated Monitor to ROMEnable new monitor to be saved in ROM
04/07/23Monitor V3 finally releasedMON3+TERMtest+VIAtest completed
12/07/23VIA: Use Shift Register for more LEDsAdd Shift Register chip to AMI
05/08/23InterruptionsConfigure Interrupt Service Routines
07/08/23Clock TimerUse LCD for a digital clock
02/10/23SoundPlay sounds and Music
20/10/23MON4 cutoverAdd shift register and sound functions
09/11/23MON5 CutoverImprove VIA usage

Saturday, 5 April 2025

PC : End of Life Kicker

My Windows PC hardware is becoming quite venerable.  Back in April 2016, just before I left work I purchased a HP Pavilion 550 which had a reasonable specification: I5 processor,  128GB SSD and 2TB hard drive, 8GB RAM and Window 10.

It broke down after 4.5 years in December 2020 and I considered upgrading, but honestly there was nothing better to spend my money on.  Instead I purchased a re-conditioned HP 800 G1 desktop with a very similar specification for £200.  The HP 800 G1 first became available in 2014 so it now about 10 years old.




Back in the olden days it was necessary to buy a new PC every couple of years and my bench mark was to spend £1,000.  As Windows and software products increased their processing requirements a computer would soon begin to feel sluggish and need replacing.  Clearly this is no longer true as both my existing and previous computers date from about 2015 and aren't lacking in specification.  In fact both the HP Pavilion and 800 G1 are still available to purchase refurbished on eBay for around £60.
Over that time period processors have not become significantly faster, instead they have many more cores/threads and can handle more simultaneous activities but I believe, for most people, that isn't really necessary.  For me there are only a few areas which feel slow: compiling FPGA images (Quartus), compiling guest Operating systems (linux guests) and 3D modelling software (Autodesk).
The two hardware factors which do make a difference are SSDs and memory capacity.  An SSD for the C: drive is vital to prevent the OS chuntering away for ages. Plenty of memory needs to be available as applications (particularly chrome) gobble it up and it is usually best to keep many apps loaded.

Both these PCs run Windows 10 and neither of them has the TPM 2.0 hardware required to run Windows 11.  As yet there is nothing in Windows 11 that I might need to use.
Windows 10 support, including security fixes is supposed to be terminated in 2025 as Microsoft try to force people to upgrade their PC and OS.  You would have thought that after 10 years there are no more bugs to discover but I guess there are!

The title of this post is "EOL kicker" and the reason for this is C: drive space.  Previous PCs have 128GB SSD C: drives which seems quite a lot.  However, software tends to be installed on C and uses it for data storage.  Over time I have tried to move files to D wherever possible and each time C fills up I look for more opportunities.
However, I finally gave up looking for more ways to save space and purchased a Crucial 256GB SSD  for the princely sum of £16.  I have used Crucial drives before and really like the software and instructions to copy and replace a system drive.  It only takes a few minutes work and an hours copying time.


I hope / believe my problems are now over, at least until we see what happens in October as millions of people moan at Microsoft.  In fact I have a little sympathy for Microsoft in this respect, they have done a good job keeping the software working for ten years - without me (and others) providing extra revenue by upgrading our systems.




Tuesday, 1 April 2025

Zigbee

 In my study I have a very good Philips Hue dimmable light bulb.  I can easily control it on my iPad with the Philips app.  However, it really doesn't want to be controlled by Home Assistant (HA) and is very reluctant to be configured in Google Home(GH).  Previously with lots of effort I managed to configure it in GH then control it via a link from HA to GH.  When this stopped working, as you do, I googled a solution.  

Unsurprisingly there were plenty of moans from HA people about Philips and the consensus was that it was better to control their lights through Zigbee.  I know almost nothing about Zigbee but decided this was a good opportunity to find out.

Zigbee is a low-power wireless protocol suitable for devices like bulbs and switches.  A single device called a Zigbee co-ordinator (ZC) talks to Zigbee End Devices (ZED) to make up a network.  You can build a mesh network by adding Zigbee routers (ZR) which can communicate with ZC and ZED.  The Philips Hue "bridge" incorporates a ZC so that it can communicate with the bulbs.

The Sonoff Zigbee dongle is a popular ZC and it costs very little so I sent off for one from Ali Express.

It only took a couple of weeks to arrive and I was quickly able to plug it in to my HA server.  HA discovered it automatically.

I started the Zigbee "Add Device" function and put the Hue bulb into pairing mode.  Zigbee found the bulb straight away and it is now happily working in HA.  Job done.

So we now have wifi, bluetooth and zigbee communication available to us.  

3D Printing : Boxes

Intro

I setup my Neptune 3D Printer in January.
My focus should be on producing useful things:

  • Not easily available to buy
  • items that can be made to meet my specific requirements
  • having a purpose, beyond short-term entertainment

Software

The printer comes with Elegoo Cura which converts object files from STL (standard triangle language) format so that they can be printed.  STL files define the shape of an object as a number of flat triangular surfaces; they dont contain scale or colour information as standard.  Cura is a popular software package to convert the shapes into instructions in GCODE format suitable for a 3D printer.  The printer works by printing a layer (i.e. fixed height or Z-coordinate) of filament and Cura creates "slices" through an object (in STL format) and saves them in a GCODE format file so that the printer can produce it.  The software is very clever and adds an internal lattice within objects to strengthen them and stop them collapsing.

Tinkercad is a leading web-based CAD (Computer Aided Design) software package which can be used to create, view and edit STL files.  I used it in my initial investigations to download models from the internet  so that I could view them and decide whether to print them.   Once I had an STL file I wanted to print I could load it into Elegoo Cura, convert it to GCODE and send it to the Neptune to print it.



Tinkercad is free on-line software from Autodesk (the makers of Autocad).  It has loads of functionality and is capable of producing a wide variety of objects and is aimed at hobbyists.  For more complex designs I expect to use Autodesk Fusion 360 which is a more complete, sophisticated, full CAD package.  The important functions are free for personal use.


A last bit of software which is really useful is the printer web interface.  Initially I loaded GCODE files onto a USB stick for printing.  However, once  the printers ethernet cable is connected.  Files can be drag-dropped onto the web-page.  It also provides many functions to control the printer and view what it is doing.




Boxes

The first useful item I need to make is a box to hold an ESP32 development board.  I have a variety of PCB projects either soldered myself or purchased which dont have their own boxes.  This is fine whilst developing but sub-optimal for long-term use.  The specific box needs to have space internally for the board and connections.  There need to be four posts on the internal base of the box to screw the board on and suitable holes should be provided for wires in or out.  The box will have a tight fitting lid.

I first looked at models available on the internet, there are many types available.  The main problem is making a box which is the right size, with posts for the board in the right place.  It is usually possible to stretch / squash dimensions on the model to make them appropriate but significant trial and error is required.  I decided to use a standard box+lid design and build my own posts on a base which will fit into the box.

The first step is to design a post.  It is a cuboid 7mm x7mm in cross-section.  Its height can vary depending on connections from the bottom side of the board.  I decided to use standard M3 screws which are often used to fix PCBs.  I found that a 3.2mm hole in the top of the post is ideal to screw into.




Next I carefully measured the distance between holes on the ESP32 board and made a base cuboid 7mm bigger on each so that I could place the posts easily in each corner.  This completed the prototype standoff design.  It doesn't require much effort to print out and check that it fits the board properly.
I decided to make the posts shorter and use a short standard brass M3 post on top to attach the board to.  This works better to avoid the posts interfering with components on the board.


I could now make the external box to hold the board and spacer.  It also needs space for wire connections inside.  It is straightforward to add holes for wires to go in and out.

The board connects a programmable LED strip which is on my desk.  The result looks great to me, very professional.