Page 2 of 2

Posted: Mon 31 Dec, 2007 3:11 am
by tr1p1ea
Simplest way to get it working is to extract the z88dk to some directory, then navigate to the bin sub directory and create a file called 'hello.c' which would contain:

Code: Select all

#pragma string name Hello World
#pragma data icon 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;

#include <stdio.h>

main() {
	// print string
	printf("Hello World!");

	// wait for keypress
	while( getk() == 0 ) {
	}
}
Save it and you would compile it from the command line like this:

Code: Select all

zcc +ti8xansi -startup=1 -o hello.bin hello.c
Then you would use a program like 'devpac8x.com' to link it:

Code: Select all

devpac8x hello
You should now have an 83+/84+ Ion compatible program that will display 'Hello World!', wait for a keypress and then exit.

Setting up your environment vars properly would make things easier of course.

Posted: Mon 31 Dec, 2007 3:46 am
by cjgone
Thanks tr1p. :D


Sweet, hello world in 3,402 bytes. :D




Just wondering... If I call a function with parameters, and I want to retrieve them in assembly language, how would I do that? Are they on the stack?

Posted: Mon 31 Dec, 2007 10:41 am
by driesguldolf
cjgone wrote:Sweet, hello world in 3,402 bytes. :D
WTF?!? 3,402 bytes? ROFL it probabely never heard of B_CALL()s... It probabely stores its own font as well :P

Posted: Mon 31 Dec, 2007 5:01 pm
by Liazon
that is kinda a lot... O.o

Posted: Mon 31 Dec, 2007 7:40 pm
by CoBB
The culprit must be the printf() function, which is infamous for its size. It must be avoided at all costs.

Posted: Mon 31 Dec, 2007 10:27 pm
by cjgone
Luckily, that wasn't the "optimized" version. :D




(Yup, it uses its own font :P)