I finally got SDCC working! Hooray!

However, the compiled 8xp files don't actually run. They transferr correctly, show up right on the calc, but the LCD turns off and the calc seems to have entered a soft-brick state. I can only take out the batteries.

Correct me if I'm wrong, but it seems to me that the crt0 file tokenized the asm code in the format that the calculator takes as a legit asm file. Thats why I didn't have any problems transferring/viewing in DCS/TI OS.

Its just that the code is really screwy.

Here's the link to my ASM code for the hello world program generated by sdcc: (the DCS method):

https://dl.dropbox.com/u/109591486/test.asm

Here's the C file:

https://dl.dropbox.com/u/109591486/test.c
Step through it in a debugger and see where it is going wrong. Set a breakpoint at $9d93.
which debugger do you reccomend?
WabbitEmu, jsTIfied, PTI (if you can find it anywhere these days), and TilEm are all reasonable options.
Oh! That was a boneheadded question Smile.

I'll test it out
Oh, yeah, I remember this bug quite well. "jp" in the CRT0, for some reason, does not actually write both bytes of the requisite address, causing the "jp exit" to go into never-never land. However, if you change that "jp" to a "jr", it will work fine. And this does not affect "jp's" generated by your code (such as at the end of a super huge while(1) loop).
so just change jp exit to jr exit?
That should work in this case. jr can only be used for short jumps, but this looks short.


GinD: Not with me. I can get it to you later today, but edit the source that compiles to make the .rel if you want. I think I might also have the jp bug in mine though.
elfprince13 wrote:
WabbitEmu, jsTIfied, PTI (if you can find it anywhere these days), and TilEm are all reasonable options.
Hey don't forget the venerable TI Flash Debugger, though that is mainly aimed at use for debugging Flash applications.
I was just playing with this a little more, and I should offer this little bit of insight: when combining multiple sources, you must specify the -mz80 switch for each one, but you do not need to specify all of those crt0 options for any of your files except for the last one. But I was running into a problem - what do you do when those files reference the 83 Plus library files (created earlier)?

EDIT: Never mind, I figured it out. I think you guys might be edified by my current build setup:
- The crt0 file is the same as the one elfprince provided, but has the "jp _exit" changed to "_jr exit", which comes right after the original header pointers.
- SDCC\bin and a folder containing Wabbitsign ("wabbit") and WabbitEmu ("wabbitemu") are both in my PATH.
- My folder structure for my project has a "bin" folder, a "crt0" folder (containing the .rel for the crt0), and an "obj" folder. My source is in the root of the folder structure.
- A batch file in my root reads:

Code:
echo off
@echo ------------------------
@echo Compiling...
@echo ------------------------
sdcc -mz80 -c depend.c -L ../lib -I ../include -DTI83P -DION -o "./obj/"
if ERRORLEVEL=1 goto fail

sdcc -mz80 helloworld.c obj/depend.rel --no-std-crt0 --code-loc 0x9DAE --data-loc 0x9872 -L ../lib -I ../include -DTI83P -DION -Wl crt0/ti83p_dcs.rel ti83p.lib -o "./obj/"
if ERRORLEVEL=1 goto fail

:package
@echo Compile succeeded! Packaging...
@echo ------------------------
makebin -p -s 65536 obj/helloworld.ihx obj/helloworld.bin
cutbin obj/helloworld.bin obj/helloworld_small.bin 0x9d93
wabbit obj\helloworld_small.bin bin\HELLO.8xp
goto end

:fail
@echo ------------------------
@echo Compile Failed!
@echo Fix the errors above and try again.
@echo ------------------------
goto end

:end
pause

(I should recode that in Python Smile )
- After running the compiler batch, I run another batch that just deploys the final 8xp to WabbitEmu.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement