Close

SOFTWARE INTERNALS: The boot process

A project log for A 4$, 4ICs, Z80 homemade computer on breadboard

No iron, no cry! Build a mini 4MHz Z80 64kB RAM system with Basic and Forth interpreters, CP/M 2.2, QP/M 2.71, Assembler and C toolchains

just4funJust4Fun 01/04/2017 at 14:350 Comments

Here is a description of the two phases boot process and the sources of the Loader and the uBIOS + Basic (as requested by some people).


At power on, the Atmega32A uses a DMA access to SRAM to copy the loader in the upper memory address space.
Because the loader is small, only a limited number of address lines are requested, saving some GPIOs for others tasks.

When the Atmega32A completes the DMA loading phase (first phase), it releases the Z80 bus and resets the Z80 CPU that starts to execute the loader from SRAM starting at address $0000.


Then the loader relocates itself at the bottom of the memory address space and it loads from the Atmega32A (this time used as a "virtual" sequential ROM in the I/O address space) the uBIOS + Basic image (second phase).

After this second load phase it jumps to the starting address of the uBIOS + Basic image, and executes it.

Inside the Arduino sketch you can see the two hex arrays. The smaller one is the Loader image, the bigger one is the uBIOS + Basic image.


In the Files section I've added the Loader source (S091116.asm) I wrote from scratch, and the two files (uBIOS and Basic) I took from the Grant's site. I've modified the first one (the one I've called uBIOS) that contains the I/O routines due the different HW design. In particular I changed the I/O addresses, the init code made for the original ACIA and the code to menage the internal registers of the ACIA. I've changed also the code that manages the ACIA serial handshaking because not needed here (the serial is managed inside the Atmega32A by the Arduino bootloader "environment") . You can easily see any modification in the source (S121216.asm) because they are marked with the string "Z80-MBC:" in the comment.

I left the Basic interpreter (basic.asm) untouched (for now, until I need some custom commands...).

Discussions