I for the life of me cannot create (or find) a putchar implementation that works with sz80 (ucsim). Can someone post an example that works with ucsim? I have noticed a few people asking the same question over the years, and usually the response is, you need to implement your own putchar function. Can someone provide one? I have seen some other examples of putchar (mcs51, etc), but they don't seem to work for z80. I know this question probably comes from a state of ingorance, but a simple hello world example (c code, and sz80 command line showing how it run it, would be very nice.)
If its just for the simulator, not for hardware: Have a look at the putchar used in the regression tests (sdcc/support/regression/ports/ucz80/support.asm).
Thanks.. Enclosed is an attachment of a file that contains a putchar function that compiles with sdcc and I can run via sz80 (the ucsim z80 emulator)
I compiled it with the following command:
sdcc -I/usr/share/sdcc/include -mz80 t1.c -o t1.ihx
and saw the output invoking the ucsim program (sz80) via
unix prompt>sz80 t1.ihx
Here is the output:
$ sz80 t1.ihx
uCsim 0.6-pre54, Copyright (C) 1997 Daniel Drotos.
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; typeshow c' for details.0> Loading from t1.ihx
151 words read from t1.ihx
run
Simulation started, PC=0x000000
Start.
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaDone.
Stop at 0x000207: (104) Breakpoint
SZ-A-PNC Flags= 0x5b 91 [ A= 0x00 0 .
01-1-011
BC= 0x0261 [BC]= 00 0 . DE= 0x000a [DE]= 4d 77 M HL= 0xff0a [HL]= 00 0 .
IX= 0x0000 [IX]= c3 195 . IY= 0x0000 [IY]= c3 195 . SP= 0x0000 [SP]= c3 195 .
? 0x0207 76 HALT
F 0x000207
Simulated 1180 ticks in 0.000306 sec, rate=0.348812
0> quit
Thanks.. I put this info here so that others that maybe want an implementation of puchar that with the simulator can also have access to what I learned..
I'm failing to find where I can close this ticket myself. Can someone close it for me?
Thanks!