Skip to content

Commit

Permalink
new build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
HeronErin committed Jan 11, 2024
1 parent a68af9c commit ccc98fc
Show file tree
Hide file tree
Showing 31 changed files with 23 additions and 52 deletions.
38 changes: 4 additions & 34 deletions build_app.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,37 +1,7 @@
DIRECTORY=$(cd `dirname $0` && pwd)

cd $1




#!/bin/bash
export MAINC="main.c"
export OUT_NAME=$2

trunkName=$(head -c 8 <<<$2) # truncate name to make sure it is no more than 8 char long

# Compile with custom crt0
docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -DFLASH_APP -subtype=asm -o $1/$OUT_NAME.bin $1/$MAINC -crt0 other_files/ti83p_crt0_app.asm $3

# Now we need to rebuild the .bin with our custom name

nameLn=${#trunkName} #length of trunkName

cat $OUT_NAME.bin | head -c 18 > x.bin # Write bytes before name in header
echo -n $trunkName >> x.bin # Write your name

# Pad name (if needed)
while [ $nameLn -lt 8 ]
do
echo -n " " >> x.bin
((nameLn++))
done

# Write rest of app
cat $OUT_NAME.bin | tail -c+27 >> x.bin
rm -f $OUT_NAME.bin # Could be write protected
mv x.bin $OUT_NAME.bin

$DIRECTORY/other_files/rabbitsign -t 8xk -g -f $OUT_NAME.bin

# rm $OUT_NAME.bin
cd $1
zcc +ti83p -create-app -subtype=app_one_page -o $OUT_NAME.bin $MAINC -pragma-string:name=$2
mv $OUT_NAME.bin.8xk $OUT_NAME.8xk
13 changes: 4 additions & 9 deletions build_prog.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
DIRECTORY=$(cd `dirname $0` && pwd)



#!/bin/bash
export MAINC="main.c"
export OUT_NAME=$2


docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -DRAM_PROG -subtype=asm -o $1/$OUT_NAME.bin $1/$MAINC $3
cat <( echo -ne "\xbb\x6d" ) $1/$OUT_NAME.bin > $1/$OUT_NAME.bin2

cd $1
python $DIRECTORY/other_files/binpac8x.py $OUT_NAME.bin2 -O $OUT_NAME
zcc +ti83p -subtype=asm -create-app -o $OUT_NAME.bin $MAINC
# echo docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -subtype=asm -o $OUT_NAME.bin $MAINC
# +ti83p -DRAM_PROG -subtype=asm -create-app -o $1/$OUT_NAME.bin $1/$MAINC $3
# rm $OUT_NAME.bin $OUT_NAME.bin2

5 changes: 0 additions & 5 deletions build_prog_zcc.sh

This file was deleted.

4 changes: 4 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
rm examples/*/*.bin
rm examples/*/*.8xk
rm examples/*/*.8xp
Binary file removed examples/2048/2048.8xp
Binary file not shown.
Binary file removed examples/2048/s2048.8xk
Binary file not shown.
Binary file removed examples/2048/s2048.8xp
Binary file not shown.
Binary file removed examples/advanced_math/amath.8xk
Binary file not shown.
Binary file removed examples/advanced_math/amath.8xp
Binary file not shown.
Binary file removed examples/appvars/varz.8xk
Binary file not shown.
Binary file removed examples/appvars/varz.8xp
Binary file not shown.
Binary file removed examples/fast_math/fmath.8xk
Binary file not shown.
Binary file removed examples/fast_math/fmath.8xp
Binary file not shown.
Binary file removed examples/greyScale/grey.8xk
Binary file not shown.
Binary file removed examples/greyScale/grey.8xp
Binary file not shown.
1 change: 0 additions & 1 deletion examples/helloworld/.buildid

This file was deleted.

Binary file added examples/helloworld/hello.8xk
Binary file not shown.
Binary file removed examples/helloworld/helloWorld.8xk
Binary file not shown.
Binary file removed examples/helloworld/helloWorld.8xp
Binary file not shown.
Binary file removed examples/helloworld/helloWorld.bin
Binary file not shown.
Binary file removed examples/helloworld/helloWorld.bin2
Binary file not shown.
3 changes: 2 additions & 1 deletion examples/helloworld/main.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define USE_NUMBER
#include "../../lib/essentials.c"
#include "../../lib/textio.c"
#include "../../lib/userinput.c"
Expand All @@ -11,7 +12,7 @@ void main() {
resetPen();

println("Hello 8-bit World!");

newline();
PressAnyKey();

return;
Expand Down
Binary file removed examples/interupts/irupt.8xk
Binary file not shown.
Binary file removed examples/interupts/irupt.8xp
Binary file not shown.
Binary file removed examples/memory/mem.8xk
Binary file not shown.
Binary file removed examples/memory/mem.8xp
Binary file not shown.
Binary file removed examples/shapes/shapes.8xk
Binary file not shown.
Binary file removed examples/shapes/shapes.8xp
Binary file not shown.
Binary file removed examples/sprites/sprite.8xk
Binary file not shown.
Binary file removed examples/sprites/sprite.8xp
Binary file not shown.
11 changes: 9 additions & 2 deletions other_files/binpac8x.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def parsefile(fnamein,fnameout,abspath,calctype,oncalcname):
fho.write(bytearray(b'**TI83F*')) #byte 00, length 08
fho.write(mybytearray([26,10,0])) #byte 08, length 03

fho.write(bytearray(b'Made with TIConstructor&packed by BinPac8x'))
fho.write(bytearray(b" "))
#byte 11, length 42

bincontents = fhi.read();
Expand Down Expand Up @@ -100,13 +100,18 @@ def parsefile(fnamein,fnameout,abspath,calctype,oncalcname):
headersize = 17 # 17-byte header

datasize = binsize + headersize

size_hb = math.floor(datasize/256);
size_lb = datasize - 256*size_hb;
fho.write(mybytearray([size_lb,size_hb])); #byte 53, length 02
safeprint("On-calc name: "+oncalcname)
oncalcname.encode()
bsize_hb = math.floor(binsize/256);
bsize_lb = binsize - 256*bsize_hb;
print(bsize_lb, bsize_hb)
print("bin b", binsize)
# print("bin bb", bbinsize)
print("data", datasize)

# Construct the header in the data field
if calctype=="2" or calctype=="3":
Expand Down Expand Up @@ -157,16 +162,18 @@ def parsefile(fnamein,fnameout,abspath,calctype,oncalcname):
chksum = 2*bsize_lb + 2*bsize_hb + 12 + 0 + 12 + 8;
else:
chksum = 2*bsize_lb + 2*bsize_hb + 6 + 0 + 0 + 13 + 0; #including [13,0]

print("Headsum", chksum% 65536)
for c in oncalcname:
chksum += ord(c);
print("name", chksum% 65536)
if sys.version[0] == '2':
for c in bincontents:
chksum += ord(c);
else:
for c in bincontents:
chksum += c;
chksum = chksum % 65536
print("bod", chksum% 65536)
cs_hb = math.floor(chksum/256);
cs_lb = chksum - 256*cs_hb;
fho.write(mybytearray([cs_lb,cs_hb])); #byte 63, length 02
Expand Down

0 comments on commit ccc98fc

Please sign in to comment.