Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: lue on October 17, 2011, 09:07:17 pm

Title: Unknown problem with add two numbers program
Post by: lue on October 17, 2011, 09:07:17 pm
I have just started learning assembler for my TI-84+SE using Hot Dog's TI-83+ Z80 ASM tutorial, and I can't seem to get my first assembler program to work. I compiled it with spasm and used binpac8x.py to turn the resulting output into an .8xp file. I then load this in TilEm and executing it causes TilEm to show its "calculator off" screen and an infinite stream of output in the terminal I started TilEm from.

Here is my current addupL.asm file (the ti83plus.inc comes straight from Hot Dog's zip file):
Code: [Select]
#include "ti83plus.inc"

.org 40399

.db t2ByteTok, tAsmCmp

bcall(_ClrLCDFull)
ld a, 1
; solve problem 1+5
add a, 5
ld h, 0
ld l, a

bcall(_DispHL)
bcall(_getKey)
bcall(_ClrLCDFull)

ret

Since I've just started, I can't tell if there's a problem in the code itself or in the build process itself. Any ideas?
Title: Re: Unknown problem with add two numbers program
Post by: AngelFish on October 17, 2011, 09:29:44 pm
One thing I notice is that _DispHL is called just before _ClrLCDFull. Are you sure _getkey is blocking?
Title: Re: Unknown problem with add two numbers program
Post by: calcdude84se on October 17, 2011, 10:31:49 pm
It is indeed blocking. It will wait until a key (or key combo, like 2nd+3) is pressed. (On a related note, use _GetKeyRetOff instead; _GetKey can create memory leaks if you use it to turn off the calc during the program. Unless you're using the unmodified form of ti83plus.inc direct from TI, ti83plus.inc should have it.)
The program looks like it should work; flow is linear!
Though it shouldn't make a difference, the .org line should have 40339, not 40399. Change that just to make sure. Also, if you think it might be TiLem, try it on your calc just to be sure.
Edit: 2100th post!
Title: Re: Unknown problem with add two numbers program
Post by: lue on October 19, 2011, 01:44:26 am
The .org number was just a typo on my part, although changing it didn't fix the problem.

There's no _GetKeyRetOff in my ti83plus.inc (although at this point it's not necessary, and if I need it later I can just add it to the include)

It crashed just as badly on my calculator as in the emulator, so at least it wasn't the emulator. Since the program is straightforward, I think it's something wrong in spasm or binpac8x. Since spasm has a decent reputation, I'm inclined to think binpac8x is messing up when it creates the .8xp. I'll look over binpac8x now, but does anyone know for sure if either of these has problems?