compiling with z88dk for amstrad 6128

Amstrad CPC and NC systems
Post Reply
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

compiling with z88dk for amstrad 6128

Post by andromeda92 »

now i want compil for amstrad 6128 program with z88dk,
bin is generated but not work with wincpc, compiling in assembly it work

Code: Select all

#include <stdio.h>

main()
{
    printf("Hello World !");
    fgetc_cons();
}
command line:

Code: Select all

${config:z88_path}/bin/zcc.exe +cpc -clib=ansi -E -I${config:z88_path}/include ${workspaceFolder}/src/${workspaceFolderBasename}.c -o ${workspaceFolder}/bin/${workspaceFolderBasename}.bin
${} is variable from vs code
else is

Code: Select all

zcc +cpc -clibs -Ic:\z88dk\lib myfile.c -o myfile.bin
I probably forgot something
Thanks
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

Re: compiling with z88dk for amstrad 6128

Post by andromeda92 »

this not work

Code: Select all

"${config:z88_path}/bin/zcc.exe +cpc -lmz -lndos -lcpcfs -l6128_math -mz80 --math-cpc -O2 -SO2 -iquote. -DZ80 -DCPC -D__CPC__ -M -subtype=default -clib=default -Ca-I${config:z88_path}/lib/target/cpc/def -I${config:z88_path}/include/arch/cpc  -compiler=sdcc -E ${workspaceFolder}/src/${workspaceFolderBasename}.c -o ${workspaceFolder}/bin/${workspaceFolderBasename}.bin"                             
i need to relocate to $4000
User avatar
dom
Well known member
Posts: 2140
Joined: Sun Jul 15, 2007 10:01 pm

Re: compiling with z88dk for amstrad 6128

Post by dom »

As noted here: https://github.com/z88dk/z88dk/wiki/Pla ... g-programs the default org is $1200, to change it to somewhere else just add -pragma-define:CRT_ORG_CODE=0x4000
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

Re: compiling with z88dk for amstrad 6128

Post by andromeda92 »

with this command line should it work?
zcc.exe +cpc -v -mz80 -pragma-define:CRT_ORG_CODE=0x4000 prog.c -o prog.bin

I removed the -E parameter and added the environment variables in windows, it almost compiles but I have this error.

Code: Select all

z88dk-z80asm -mz80 -b -d -o"D:\data\dev\Z88DK\hello/bin/hello.bin" -L. -L"c:\z88dk\lib\config\..\..\\lib\clibs\z80" -I"C:\Users\admin\AppData\Local\Temp\zcc00001F58B79E3" -D__SCCZ80 -L"c: \z88dk\lib\config\..\..\/lib/clibs" -I"c:\z88dk\lib\config\..\..\/lib" -lcpc_clib -l"z80_crt0" "C:\ Users\admin\AppData\Local\Temp\zcc00001F58B79E4.o" "C:\Users\admin\AppData\Local\Temp\zcc00001F58B79E2.o"
stdio/fputc_callee.c::wrapper_fputc_callee_z80::0::1:57: error: undefined symbol: writebyte
 ^---- writebyte
what is ?
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

Re: compiling with z88dk for amstrad 6128

Post by andromeda92 »

the c code is

Code: Select all

#include <stdio.h>

main()
{
    printf("Hello World !");   
    //fgetc_cons();
}
[EDIT]
if I leave the -E parameter I have no error, it compiles but it does not work in the emulator
What is the -E parameter ?
User avatar
dom
Well known member
Posts: 2140
Joined: Sun Jul 15, 2007 10:01 pm

Re: compiling with z88dk for amstrad 6128

Post by dom »

See here: https://github.com/z88dk/z88dk/wiki/Too ... e-frontend

-E stops at the preprocessing stage.

There’s the following stages in z88dk:

- preprocessing
- compilation
- peephole optimisation
- assembling
- binary creation
- Rom, disc, tape generation
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

Re: compiling with z88dk for amstrad 6128

Post by andromeda92 »

Problem resolved it work,

"${config:z88_path}/bin/zcc.exe +cpc -v -create-app -lcpcfs -zorg=0x4000 -mz80 -pragma-define:CRT_ORG_CODE=0x4000 ${workspaceFolder}/src/${workspaceFolderBasename}.c -o ${workspaceFolder}/bin/${workspaceFolderBasename}.bin"
andromeda92
Member
Posts: 22
Joined: Wed Apr 17, 2024 1:05 am

Re: compiling with z88dk for amstrad 6128

Post by andromeda92 »

now it's how to use the firmware.

for example the code below

Code: Select all

 //SCR_SET_MODE 0
 __asm
 ld a, #0
 call #0xBC0E
 __endasm;

but the compiler does not recognize assembly directives
for example ld, __asm.

How to do ido ?

maybe I forgot an include or a compiler parameter?
Post Reply