Qasm : Quick Assembly SDK v2.0

William White (a long time member of the ti community) created a small tool called qasm which allow to create assembly programs easily.

The same file could be converted for multiple targets including the one we talk about here (ti 84 plus file format : 8xp)

The language itself is basically very close to assembly but shorter (and much more “human readable”?!).

The sample given is like this :

 ClrScrn
 HomeUp
 PutSml("Hello, ")
 InvText
 BigText($0202,"How are")
 BigText($0303,"You ")
 For(Stuff,$25)
 InvText
 PutBig("Today?")
 NewLine
 GetKey
 EndFor(Stuff)
 ClrScrn
 ClrGraph
 HomeUp
 BigText($0000,"Wow!!")
 SmlText($1020,"Cool")
 Sprite($0108, $FCF0, "Smiley")
 Pause
 Stop

Smiley:
.db %00111100
.db %01000010
.db %10100101
.db %10000001
.db %10100101
.db %10011001
.db %01000010
.db %00111100

For an assembly developper as I am, I see the assembly source code behind each instructions, but it’s a good idea to have a script close to assembly but a bit more “high level” :)

How it works exactly ?

You create a file, give it to qasm, the output is an assembly file, you assemble it with your prefered assembler (but assembly studio 8x is recommended and I guess it uses TASM?! someone could confirm?).

Assembly studio 8x is available here :
http://www.ticalc.org/archives/files/fileinfo/158/15892.html

As I’m a bit curious, I will look inside C source code.

Here’s a piece of it :

if (strstr(bckup, ” BigText($”)) {
ti[1] = 1;
strcat(cde, “\n ld hl,$+6\n call PutBig\n.db “);
strncat(cde, cod, strlen(cod) – 3);
strcat(cde, “,0\n”);
}

In fact, strstr is a kind of strcmp (compare strings here strstr match substrings) and then the program writes :

ld hl, $+6
call PutBig
.db “a string to print”,0

Nice usage of $ ($+6 means “here + 6 bytes”) to get the adress of the string stored just after the call !

The multiple output format is handled by a if/then/else statements, the translation is done like the previous sample.

To conclude, that’s a cool program, test it quickly !

Leave a Reply

© 2021 ti-84-plus.com. All Rights Reserved. Theme WP Castle by Saeed Salam.