Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: AngelFish on November 14, 2010, 03:23:12 pm
-
I was recently experimenting with some ASM code, and as some of you might be aware, I kind of ****ed up Wabbit. It stopped loading apps altogether and programs weren't running correctly. Reinstalling fixed most of the problems, except that wabbit is now really slow. Anyway, I tried some code, and it didn't appear to work, so I'm wondering if this is just wabbit, or me
Would anyone mind looking over this example code?
#include "ti83plus.inc"
.org $9d93
.db 0BBh, 06Dh
ld hl,0
ld (CurRow),hl
ld hl,String
bcall(_PutS)
bcall(_getkey)
ret
String:
.db "Hello World",0
From what I understand, this should display "Hello World" and wait for the user to press a key. The problem is that it's not doing that. It's just running through the program.
-
Indeed, it should. Are you using a shell to run the program?
-
No, I'm running it with the Asm( tag from the homescreen.
-
It works perfectly fine for me O_o.
-
Would you mind trying the compiled file?
-
Sending now :)
-
Thanks :)
You don't have to use your physical calculator though. I wouldn't want my code to break something.
-
The file disassembles to
ld hl,0
ld ($0000),hl
ld hl,string
ret
string:
.db "Hello World",0
O_o
Edit: I sent it to my physical calc because I have Calcsys there ;)
-
That's really odd.
I've checked the Batch file and the source I posted is the entire example code. I can't seem to find any reason for it to ignore the bcalls.
EDIT: Bcalls are included in the 83plus.inc file, right?
-
They indeed are :)
What are you using to assemble it? What does it say?
-
I'm using SPASM. It hasn't given me any feedback thus far.
-
That's strange. What's especially disconcerting is that it changed curRow to a 0 and eliminated both bcall's entirely.
Could you try replacing each bcall(xxxx) with "rst 28h \ .dw xxxx", where xxxx is the name of the routine bcalled?
If you could disassemble it yourself, that would be helpful too :)
-
Replacing the commands throws the calculator into an infinite loop. :(
By the way, the disassembled program is this:
LD B, 21
LD BC, 9D00
or L
NOP
NOP
DEC B
Inc HL
LD BC, 9D00
...
I know that can't be the proper code, but that's what location the VAT lists the program at. Before that location are a few dozen NOPs and after it the code repeats.
-
That's really odd.
I've checked the Batch file and the source I posted is the entire example code. I can't seem to find any reason for it to ignore the bcalls.
EDIT: Bcalls are included in the 83plus.inc file, right?
It's also ignoring the CurCol load...
Does Spasm give you any errors? Maybe the names weren't defined.
-
Nope. SPASM executes without returning any errors.
-
Are you, by any chance, running this on a Ti-84+ with OS 2.53? Make sure it's on classic mode if so
-
As much as I'd like to blame OS v 2.53 for this, switching the mode doesn't do anything.
-
Are you sure you're including ti83plus.inc? SPASM likes to pretend that it's correctly assembled a program, when in fact, it has actually replaced any bad opcodes or labels with 0. This is bad if you have jp badLabel.
-
You can check the source from the previous page. I included the file and I'm pretty sure I have the correct file, seeing as how I'm using the official ti83plus.inc. Using the one provided by TI doesn't change anything either. Also, the include instruction is from Buckydude himself. That makes me fairly certain of its validity.
-
Are you sure you're including ti83plus.inc? SPASM likes to pretend that it's correctly assembled a program, when in fact, it has actually replaced any bad opcodes or labels with 0. This is bad if you have jp badLabel.
That's not very good. I didn't know SPASM did that :(
Also, does the ti83plus.inc file define it b_call or bcall? That could make a difference, since it would then not include the bcall at all.
And you are using the ti83plus.inc for SPASM, correct? Other versions might not work.
-
If you're using the official ti83plus.inc from TI, that file uses ZMASM syntax for macros and equates. I don't think spasm supports that syntax, or at least, it didn't the last time I checked.
Also, the official syntax defined by TI is "B_CALL PutS", not "bcall(_PutS)", so if you're using the official ti83plus.inc, it doesn't surprise me that the latter doesn't work.
It might help if you could post a listing file.
-
I tried both files.
-
There are many different versions of ti83plus.inc floating around out there. Which two, specifically, did you try?
For TASM - and I assume this would also work for SPASM - you'd want to include something along these lines, at the top of the file:
#define bcall(x) rst 28h \ .dw x
#define bjump(x) call BRT_JUMP0 \ .dw x
#define equ .equ
#define EQU .equ
Back in the day, when I used TASM, I liked to add:
.addinstr B_CALL * EF 3 NOP 1
.addinstr B_JUMP * 0050CD 5 NOP 1
which lets you write "B_CALL _PutS", a little bit closer to TI's official syntax. I don't remember if SPASM supports addinstr.
In addition, you probably need to comment out the macro definitions later in the file.