8-Bit Labs

Experiments in retro computers, assembly language and electronics

Posts tagged #Z80

Clear Screen Utility for CP/M

19 Jul 2023

Occasionally after playing a game or running a program that uses color in CP/M, my terminal isn’t reset and isn’t using my default colors. Even worse is when it leaves the terminal with dark text on a black background! CP/M has the CLS command, but it does not reset the default colors, so I decided to write a quick assembly program to reset the terminal using ANSI Escape Sequences. ; Clear the screen and reset colors org 100H ; CPM Program start address ; ============================================================================= ; Definitions and methods for CP/M development bdos equ $5 ; CP/M BDOS vector address...

Using the HI-TECH C II Compiler in CP/M

15 Jun 2023

The HI-TECH C is a nearly ANSI C compliant compiler that runs on Z80 based CP/M machines. Version 3.09 was last released in March 1989 but the company has since made it freely available for both commercial and non-commercial use. Tony Nicholson has picked up development of the compiler and has released 17 patched versions of HI-TECH C on GitHub at agn453/HI-TECH-Z0-C. You can download the latest binary distrubtion from htc-bin.lbr. A Z280 version is also available, z280bin.lbr. Each of these are uncompressed LBR files, so you should be able to copy them to a disk and extract them using...

Z80 Assembly Instruction Set

31 May 2023

As I am refreshing my Z80 assembly skills I realized that I don’t have a good understanding of some of the less popular instructions. To make sure that I understand how everything works I’ve gone through all of the instructions and made notes on how they work. This will be a living document that I will update as I find errors or ommisions. It is intended to be a quick reference. Each of the instructions has the information that I find useful, not a full explanation. I hope that others find it valuable too. Data Load Instruction Destination Source LD...

Learning Z80 Assembly on the RC2014

20 May 2023

I am reading Programming the Z80 by Rodnay Zaks to refresh my knowledge of Z80 assembly. I usually develop and compile the code on my laptop, but this time I wanted to experience writing and testing the code on my RC2014 computer running CP/M. The assembler that ships with CP/M uses 8080 instructions, so instead I am using Z80ASM by SLR Systems. I edit the files using ZDE 1.6. The book provides sample code like this for 8-bit addition, LD A,(ADR1) ; LOAD OP1 INTO A LD HL,ADR2 ; LOAD ADDRESS OF OP2 INTO HL ADD A,(HL) ; ADD OP2...