3

So I have a TI-84 Plus C Silver Edition. I just started working on writing assembly programs on it using the opcodes. I found a good reference chart here, but was wondering how to do bcalls, specifically how to print a character to the screen. It seems as if the hex code for the call is 3 bytes long, but call takes in 2 bytes. So how do I call it? Also, does anyone know the memory location programs are loaded into when they are run for my calculator? I haven't been able to find it yet.

fuzzything44
  • 701
  • 4
  • 15
  • The link to the chart doesn't bring up anything for me. Please fix it so I can verify my research. – George Phillips Oct 31 '15 at 22:30
  • The link now works. As far as I can tell it is correct for my calculator, but with not being able do display things all I can do is make programs that should or should not complete. – fuzzything44 Oct 31 '15 at 22:44
  • I'm only really familiar with the non-C version, but bcall is probably still `EF xx xx` – harold Oct 31 '15 at 22:52

2 Answers2

2

Based on the definitions here: http://wikiti.brandonw.net/index.php?title=84PCSE:OS:Include_File , a "bcall" is a RST 28 instruction followed by the specific number of the bcall. So to print a character you would do (given that PutC is 44FB):

rst 28h
dw 44FBh

Presumably the character to print is in A register.

George Phillips
  • 4,564
  • 27
  • 25
  • So I just put in `3EC6EF44FBC9` which should set a to C6 (letter l if I remember correctly), rst 28h, and then 44FB, the call. The C6 is to end the program. When I run it, my calculator turns off and the RAM gets cleared. I am using OS 4.0, not 4.2 if that matters. Any clue why it crashed? – fuzzything44 Nov 01 '15 at 01:09
  • Alright, I found out what I was doing wrong. I was using the .dw value 44FB as it is. In hex I needed to reverse it to FB44. Anyways, thanks for the header file. It should help me a ton in the future. – fuzzything44 Nov 02 '15 at 18:25
1

TI uses rst 28h for their bcall which translates to hexadecimal as EF. Bcalls are 2 bytes, but keep in mind that the Z80 and eZ80 are little-endian processors. So as mentioned earlier, _PutC is 44FB, so you would have to use the FB first, then the 44, making bcall(_PutC) equivalent to EFFB44.

I think the calc you are using has an eZ80. While the eZ80 is backwards compatible with the Z80 instruction set, the table to which you linked is not complete for the eZ80. If you are looking to get really wild, you can use the docs provided by Zilog here though I must warn you that if you are not fairly comfortable with Z80 Assembly, the reading material will be too dense.

Zeda
  • 382
  • 4
  • 13