Compiled Code Never Runs Properly on TI84+ SE.

TI-82, TI-83 (plus, silver..), TI-84, TI-85 and TI-86
Post Reply
R0b0t1
New member
Posts: 3
Joined: Sat Oct 15, 2011 2:03 am

Compiled Code Never Runs Properly on TI84+ SE.

Post by R0b0t1 »

Code: Select all

zcc +ti8x -startup=10 pR.c -o pR.bin -create-app

Code: Select all

main()
{
}
or

Code: Select all

main()
{
    return 0;
}
When uploaded and run on the calculator, it either produces an error condition (usually "ERROR:LINK") or crashes the calculator (and clears the RAM). At first it was exiting successfully, but I realized I was compiling with the wrong shell/loader (the default, ION). When I changed the startup flag to specify the TIOS loader, it proceeded to be completely nonfunctional.
In the mean time I was thinking of moving back to assembly, mainly due to the libraries I was wishing to use (usb8x). Any way to get them to work with z88dk compiled code?

EDIT: z88dk is the only compiler I have found. All of the myriad assemblers I've tried have failed to produce a working program. WTF?

EDIT: Just to make sure I wasn't completely insane I assembled a few simple programs by hand. They all worked. For some reason the output of zcc/z80asm and appmake do not.

EDIT: I figured out z80asm wasn't inserting the value of a label properly. I fixed this by referencing the label like "$lbl". However, the program does still not run properly (trying to print "Hello, world!").
Last edited by R0b0t1 on Sun Oct 16, 2011 2:42 am, edited 1 time in total.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

In most of the cases it was a matter of packaging, see this topic too:
http://www.z88dk.org/forum/viewtopic.php?id=3953

On the lib point of view, try choosing the 'ansi' version (+ti8xansi), it is less firmware dependent.

BTW it is time to update the docs with the infomations we could get from the users (not really users, to be honest it is me learning..).
R0b0t1
New member
Posts: 3
Joined: Sat Oct 15, 2011 2:03 am

Post by R0b0t1 »

Thank you for your reply! I built and installed the nightly (10/22/11) but I still get the same error (or, very similar).

Code: Select all

zcc +ti8xansi -startup=10 -make-app bolo84.c -o bolo84

Code: Select all

looking-glass:bolo84 sid$ make
zcc +ti8xansi -startup=10 -make-app bolo84.c -o bolo84
cp /usr/local/share/z88dk/lib/ti83p_crt0.opt /tmp/tmpXArkGzAx.opt
cp /tmp/tmpXArkGzAx.opt /tmp/tmpXArkGzAx.asm
zcpp -I. -DZ80 -DSMALL_C -DTI8x -D__TI8x__ -DSCCZ80 -I/usr/local/share/z88dk/include  bolo84.c /tmp/tmpn69pKy9v.i
sccz80    -// -startup=10  -make-app  /tmp/tmpn69pKy9v.i
copt /usr/local/share/z88dk/lib/z80rules.2 < /tmp/tmpn69pKy9v.asm > /tmp/tmpn69pKy9v.op1
copt /usr/local/share/z88dk/lib/z80rules.1 < /tmp/tmpn69pKy9v.op1 > /tmp/tmpn69pKy9v.opt
z80asm -eopt -ns -Mo -I/usr/local/share/z88dk/lib /tmp/tmpn69pKy9v.opt
z80asm -a -m -Mo -L/usr/local/share/z88dk/lib/clibs -obolo84 -indos  -iti83pansi_clib  -iz80_crt0  /tmp/tmpXArkGzAx.opt /tmp/tmpn69pKy9v.o
1 errors occurred during assembly
Key to filenames:
/tmp/tmpn69pKy9v.o = bolo84.c
File '/tmp/tmpXArkGzAx.asm', at line 2, File open/read error

Code: Select all

#include <stdio.h>

main()
{
        puts("Hello, world!");
}
I had read about the hugeness of the standard library - assuming I can ever get anything to compile, how would "put_cons()" (or whatever it is) be used?
Last edited by R0b0t1 on Sat Oct 22, 2011 8:44 am, edited 1 time in total.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Well, the library is huge for several reasons; the 'ansi' version brings the whole font and sends it directly to the Display... that's why it is less firmware-dependent.
In addition it features a full vt100/ansi emulation, probably it makes little sense on a calculator, but it is there and has its cost in terms of size.
I'm afraid that the 'startup=10' options has several drawbacks in terms of compatibility, but I can't remeber exactly all of them.. does a working shell exist for your calculator ?
http://www.z88dk.org/wiki/doku.php?id=platform:ticalc

Onto the latter error you got: it could have with the tmp file permissions, try adjusting them on /tmp ..then, if we're still unsuccesful we'll ask for help to the guru (dom? ;) )
R0b0t1
New member
Posts: 3
Joined: Sat Oct 15, 2011 2:03 am

Post by R0b0t1 »

Well, the problem isn't the startup flag at this point. It is the inability of zcc to compile anything... I checked the permissions on /tmp, they are correct, and I don't see why zcc would be reporting a read error (apart from an error in the code).

EDIT: While we're here (sorry, offtopic question), every time I try to invoke a version of Ion's fast copy (which zeros the buffer), my available RAM goes to zero. Any ideas what is going on?

EDIT: Disregard, got it working - I had to use the SafeCopy routine. Hopefully someone can respond about what this thread is actually supposed to be about :)
Last edited by R0b0t1 on Sat Oct 29, 2011 4:15 am, edited 1 time in total.
contra-sh
Member
Posts: 13
Joined: Mon Feb 28, 2011 9:23 am

Post by contra-sh »

Firstly, what are you trying to do? A flashapp or a "normal" program?
What I would say after is not about flashapp, this is about "normal" programs stored in ram and not using shell (but you can use a shell without huge effort).


I've tried what you do in your first post and it works... If you don't use creat-app of course :)
create-app seems to be for flashapp (make-app too), I don't know in fact and I can't help you with these options.

About something which works fine (instead of talking about what's not working)...

Here's a working example :
main()
{
return 0;
}
This compilation is OK :
zcc +ti8x -startup=10 main.c -o main2.bin
bin2var main2.bin mainb.8xp
This compilation is NOT OK :
zcc +ti8x -startup=10 main.c -o main.bin -create-app
As you can see I just use bin2var separately (bin2var is a part of z88dk too).
If you use bin2var (or bin8x or bin2var2 or another one) after compiling it should work.

I haven't tested your "zcc +ti8xansi -startup=10 -make-app bolo84.c -o bolo84". But I recommend you to use external tool to create the "package" instead of trying to use make-app option.
II think it's probably the same issue.

I hope it answers to you question :)

Good luck.
Post Reply