Quick Start Guide

Installation

Build from source (macOS / Linux / BSD):

git clone https://github.com/humbertocsjr/hcsdkretro.git
cd hcsdkretro
make posix
sudo make install

Or install via package manager:

PlatformFormat
macOS.pkg installer
Linux x86_64.deb package
Windows.exe NSIS installer

Hello World — Assembly (Z80 / CP/M)

Create hello.s:

section data
msg: db "Hello World!$"

section text
global _start
_start:
    ld de, msg
    ld c, 9          ; BDOS print string
    call 5
    ld c, 0          ; BDOS exit
    call 5

Assemble, link, and run:

hcasm-z80 -o hello.obj hello.s
hclink-bin -text 0x100 -o hello.com hello.obj
msxdosemu hello.com

Hello World — B Language (Z80 / CP/M)

Create hello.b:

extrn putchar;

main() {
    putchar('H'); putchar('e'); putchar('l');
    putchar('l'); putchar('o'); putchar('!');
}

Compile with library:

hcbcomp-z80 -o hello.s hello.b
hcasm-z80 -o hello.obj hello.s
hclink-bin -text 0x100 -o hello.com hello.obj libs/z80-cpm-b.lib
msxdosemu hello.com

Using the Project Builder

Create hello.prj:

[config]
sdk_path = ./bin

[files:z80]
hello.b

[libs]
libs/z80-cpm-b.lib

[link:release]
format = bin
text = 0x100
filename = hello.com

Build and run:

hcbuild hello.prj make release
msxdosemu hello.com

8086 MS-DOS EXE Project

For 8086 programs needing far pointers and MZ EXE format, use [files:8086exe]:

[config]
sdk_path = ./bin

[files:8086exe]
main.b

[libs]
libs/8086-msdos-exe-b.lib

[link:release]
format = mz
stack = 1024
filename = program.exe

Project File Format (.prj)

SectionDescription
[config]Optional settings (sdk_path, verbose, dump, keep)
[files:ARCH]Source files for architecture (z80, 8086, 8086exe, 8080, 8085)
[libs:start]Startup objects (linked first)
[libs]Libraries and additional objects
[link:RELEASE]Link configuration (format, text, data, bss, filename, stack, symbols)

[Builder Documentation] · [B Compiler Reference] · [Sample Programs]