I've been trying to get SDCC running on my original TI-84, just starting with a simple Hello World Program. The following is my current code:


Code:

#include <ti83p.h>
#define NULL 0x0000
__at NULL const int ALE;
volatile const char Description[9] = "TestProg";
volatile const char Icon[32] = {0xFF,0xFF,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0x80,0x01,
            0x80,0x01,0xFF,0xFF};
__at 0x86D7 unsigned int Pen;

void ClrLCDFull() __naked
{
   __asm
      push ix
      rst #0x28
      .dw #0x4540
      pop ix
      ret
   __endasm;
}
void NewLine() __naked
{
   __asm
      push ix
      rst #0x28
      .dw #0x452E
      pop ix
      ret
   __endasm;
}
void PutS(char *s) // non-naked, let SDCC do its thing
{
   s; // Stop SDCC from saying 'Unused variable', but
   //    outputs no code for that.

   __asm
      ld l,4(ix)
      ld h,5(ix)
      rst #0x28
      .dw #0x450A
   __endasm;
   
   // Note that there was no ret above.
   // If we manually return from inline asm,
   // SDCC will ignore it and not restore IX
}

void main()
{
   ClrLCDFull();
   Pen = 0;
   PutS("Greetings, World!");
   NewLine();
}


I'm using the Crt0 from https://www.cemetech.net/forum/viewtopic.php?t=8482&start=0

I've been using this build script on Windows 10 from https://www.cemetech.net/forum/viewtopic.php?t=7087&start=0


Code:
sdasz80 -p -g -o tios_crt0.rel tios_crt0.s
sdcc --no-std-crt0 --code-loc 40347 --data-loc 0 --std-sdcc99 -mz80 --reserve-regs-iy -o tios.ihx tios_crt0.rel tios.c
hex2bin tios.ihx
binpac8x.py -O SDCC tios.bin tios.8xp



When built this way, the program does nothing when run through the TI-OS shell using Asm(prgmSDCC). Doesn't crash, just immediately exits after doing nothing. When run from Doors CS, I cas see the custom icon (empty square), but it immediately crashes when run. I can't seem to find the source now, but someone here said that setting the --data-loc to 0 crashes the calculator, suggesting that it should be 0x9872, or AppBackupScreen. However, when I pass this option the resulting 8xp file isn't recognized as an ASM file at all in both Doors CS and TI-OS. I also saw that the bin file generated by hex2bin was quite bloated and mostly full of FFs. Does anyone know what's going wrong?
  
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