Calculator Community > ASM

Stable offscript for TI-83+

<< < (4/4)

E37:
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.

Cholsrea:
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)

Eeems:

--- Quote from: Cholsrea on October 18, 2023, 03:58:37 pm ---what does mov9ToOP1 do?

--- End quote ---
https://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:417A

--- Quote from: Cholsrea on October 18, 2023, 03:58:37 pm ---i tried googling it but cant find anything, that and the .db i cant find

--- End quote ---
https://taricorp.gitlab.io/83pa28d/lesson/week1/day03/index.html#variables

E37:

--- Quote from: Cholsrea on October 18, 2023, 03:58:37 pm ---what failsafe did you end up adding, it made it work now without any issues.

--- End quote ---
I added ld iy, flags. No idea why that fixed it. The hex for it is now FD21F089FDCB33CEC9

--- Code: ---#include "ti83plus.inc"

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

--- End code ---


--- Quote from: Cholsrea on October 18, 2023, 03:58:37 pm ---is there a way to decompile compiled asm programs?

--- End quote ---
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.



--- Quote from: Cholsrea on October 18, 2023, 03:58:37 pm ---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)

--- End quote ---
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.

Navigation

[0] Message Index

[*] Previous page

Go to full version