As a simple skeleton, here's something simple for +zx:
Code: Select all
; example.asm
; zcc +zx example.asm --no-crt -create-app
defc __crt_org_code = 30000
org __crt_org_code
ld a,'A'
rst 16
ret
Note no crt code is invoked so the responsibility for any machine specific setup that's done by z88dk (stack, hardware etc) is passed over to your assembler code.
z88dk-appmake looks for the symbol __crt_org_code to determine the loading address and is probably the trick to getting this to work.
This works well for RAM based machines and results in code, rodata, bss, data being intermingled. For ROM based machines you'll have to define a section to contain your variables (bss) but this should be expected.
If you want to call a z88dk library routine, then locate the entry point and use `GLOBAL xxx` to import it, for example:
Code: Select all
; example.asm
; zcc +zx example.asm --no-crt -create-app
defc __crt_org_code = 30000
org __crt_org_code
GLOBAL asm_strlen ;Entry: hl = string, Exit: hl = length
ld hl,mystring
call asm_strlen
ret
defm "Hello"
defb 0