|
From: Russel W. <ru...@ru...> - 2001-09-23 10:55:52
|
The traditional Hello World program variation for avoiding printf is:
unsigned char * message = "Hello World!\n" ;
int main() {
unsigned char * p = message ;
while (*p != 0) {
putchar(*p++) ;
}
putchar('\n') ;
return 0 ;
}
With the addition of code to implement putchar (and initialize timer 1
and the serial port etc.) this works fine with sdcc -mmcs51 using the
s51 simulator. Using sdcc -mz80, everything compiles fine as is since
there is a default putchar implementation. However on running with sz80
I get a problem:
1065 elon:Z80 |> make cleanall helloWorld_1.ihx
rm -rf *.sym *.rst *.rel *.map *.lst *.lnk *.ihx *.cdb *.asm *~
a.out core
sdcc -mz80 helloWorld_1.c
1066 elon:Z80 |> sz80 -s /dev/pts/6 helloWorld_1.ihx
uCsim 0.3.2-pre1, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
> 187 words read from helloWorld_1.ihx
run
Simulation started, PC=0x000000
Stop at 0x000000: (106) Invalid instruction 0x00c3
F 0x000000
>
Now given that others are using the z80 aspects of sdcc I assume I am
doing something trivially stupid and that it is not actually a problem
with the z80 port of sdcc or uCsim. Anyone any ideas?
Thanks muchly.
--
Russel.
=====================================================================
Dr Russel Winder +44 20 7585 2200
41 Buckmaster Road +44 7770 465 077
London SW11 1EN, UK ru...@ru...
|