Author Topic: Stable offscript for TI-83+  (Read 3574 times)

0 Members and 1 Guest are viewing this topic.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Stable offscript for TI-83+
« Reply #15 on: October 18, 2023, 07:47:27 am »
It looks like I made a copy-paste error for the command to compile the iy program. It should compile to SETIY.8xp not SETIY.8xv. So just change the extension in the compile command.

I tried the programs in a ti83 emulator and they worked fine. However I added a safeguard to set_iy. (see attached) If that works, I'll give you the hex for it.
I'm still around... kind of.

Offline Cholsrea

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
  • well, i may be dumb . . . .
    • View Profile
Re: Stable offscript for TI-83+
« Reply #16 on: October 18, 2023, 03:58:37 pm »
what failsafe did you end up adding, it made it work now without any issues.

and two last questions about the assembly
is there a way to decompile compiled asm programs?
what does mov9ToOP1 do?
i tried googling it but cant find anything, that and the .db i cant find
I've been reading the manuals both for Z80 and Ti-83+ system routines, and the system routines manual uses it to but neither explain what it do.

(i've never used C before either which definitely doesn't help here, i only know python and Basic, so some of these might be common things i just never learned about. if they are what other things can i look up to get more info bc every search with ti-83 and z80 dont give me anything)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
/e

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Stable offscript for TI-83+
« Reply #18 on: October 19, 2023, 01:27:41 pm »
what failsafe did you end up adding, it made it work now without any issues.
I added ld iy, flags. No idea why that fixed it. The hex for it is now FD21F089FDCB33CEC9
Code: [Select]
#include "ti83plus.inc"

.db $BB, $6D
ld iy, flags
set 1, (iy+33h)
ret

is there a way to decompile compiled asm programs?
Yes, but only to the text based assembly instructions like I have been posting. Unless you understand them, you won't gain much from decompiling. There are probably tools to do it but I'll cover the manual way since it is good enough for most situations.
First you need to get the code you want to disassemble into hex. Writing an Axe program to do that is pretty trivial.
Once you have it in hex, you just need the opcode table. I use this one. Then you look up the hex in the table.
To cover the hex I gave you earlier:
FD21F089 translates into ld, iy, 0x89F0. If you check in ti83plus.inc, you will see that the value of 'flags' is 0x89F0. The first byte of that instruction 'FD' is a prefix that tells you to go to the IY section. The second is '21' which is ld iy, nn which loads the next two bytes into iy. The next two are F089. Since the z80 is little endian, the byte order is reversed which gives 0x89F0 as the value for the instruction.
FDCB33CE translates to set 1, (iy + 0x33). (0x33 and 33h are different ways of writing the same thing) It again uses the IY section and then another to go to the IY bits. Its 3rd byte is actually the offset so the 4th one is the instruction set 1, (iy + n)
C9 is a single byte and translates to ret.
Following those steps will let you translate any assembly program to readable instructions and let you go the other way and convert instructions to hex.


what does mov9ToOP1 do?
i tried googling it but cant find anything, that and the .db i cant find
I've been reading the manuals both for Z80 and Ti-83+ system routines, and the system routines manual uses it to but neither explain what it do.

(i've never used C before either which definitely doesn't help here, i only know python and Basic, so some of these might be common things i just never learned about. if they are what other things can i look up to get more info bc every search with ti-83 and z80 dont give me anything)
Here is a good tutorial on the basics of asm. Learning assembly when you are only familiar with high level languages like Basic and Python will be a huge jump.
Here is the best documentation on the OS. It assumes you are very familiar with assembly and is generally lacking in specifics but is still the best resource out there. It answers your question on this page.
Unless you are trying to exploit something specific in the OS (like offscript) you are probably better off using Axe to do anything fancy. Since you can inline assembly in Axe, it is still generally better to write your program in Axe and only inline asm when needed.
I'm still around... kind of.