Odd problem with printf
Posted: Sun Jun 09, 2019 1:24 am
I have found a problem that I can't work around (sorta).
I pushed code to my github inttools-z80. The problem is seen when trying to build and run ctc.com.
This is a test program used to wring out the ctc interrupt code. But I am having a problem with printf not working as expected.
Please look at ctcdriver.c, there is a call to loader (loader.c) that takes in 2 strings. I am attempting to print the stings in loader
but no joy. If however I print the strings in the calling function, everything starts to work. This has been vexing me for about
a week. I keep thinking that I really do know how to use printf, but I don't seem to be good at it....
Anyway, maybe someone can take a peek at the code and inform me what I am doing wrong.
I have looked at the C inline with the asm listings, and I don't spot any difference in loader.c, in ctcdriver.c I find more push
and pop of the hl register, but it looks like the stack is balanced.
'
here is the output I get with code at needed.
C>ctc
Running on ZSDOS
Open s
Loading: s
Here is what I get when I add the printf in the caller function.
C>ctc
Running on ZSDOS
CTCINT.HEX Loadable CTC interupt handler
Open CTCINT.HEX
Loading: Loadable CTC interupt handler
I pushed code to my github inttools-z80. The problem is seen when trying to build and run ctc.com.
This is a test program used to wring out the ctc interrupt code. But I am having a problem with printf not working as expected.
Please look at ctcdriver.c, there is a call to loader (loader.c) that takes in 2 strings. I am attempting to print the stings in loader
but no joy. If however I print the strings in the calling function, everything starts to work. This has been vexing me for about
a week. I keep thinking that I really do know how to use printf, but I don't seem to be good at it....
Anyway, maybe someone can take a peek at the code and inform me what I am doing wrong.
I have looked at the C inline with the asm listings, and I don't spot any difference in loader.c, in ctcdriver.c I find more push
and pop of the hl register, but it looks like the stack is balanced.
'
here is the output I get with code at needed.
C>ctc
Running on ZSDOS
Open s
Loading: s
Here is what I get when I add the printf in the caller function.
C>ctc
Running on ZSDOS
CTCINT.HEX Loadable CTC interupt handler
Open CTCINT.HEX
Loading: Loadable CTC interupt handler