Author Topic: Disassembling the OS with IDA  (Read 13329 times)

0 Members and 1 Guest are viewing this topic.

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Disassembling the OS with IDA
« on: January 29, 2012, 05:03:12 pm »
Is there an easy way to emulate ROM paging in IDA, or do I have to disassemble each page separately? 
ld a, 0
ld a, a

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Disassembling the OS with IDA
« Reply #1 on: January 29, 2012, 05:30:39 pm »
There probably is an easy way, however, we do not know how to do it. So you are free to look ;D (I've talked to brandonW about this)

But, on another note, brandonW's Pterodactyl will break an OS file into pages and assign all of the common memory locations with their proper names. (As well as take a solid whack at the page 00 calls)

So, I recommend pterodactylling your OS, and then going in page by page. After that, you'll have to convert the two bytes after every rst 28h (bcall) to data to avoid weirdness. (If you happen to be disassembling 2.53 or 2.55 and you are on a x64 machine, I can give you my current progress (I'm pretty sure this is actually legal too :D))
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Disassembling the OS with IDA
« Reply #2 on: January 29, 2012, 06:19:09 pm »
Thanks.  I saw something about using paging on 8086 code, but it seems that the method depends on the Segment Register.  (AAAHH!  :P)

(If you happen to be disassembling 2.53 or 2.55 and you are on a x64 machine, I can give you my current progress (I'm pretty sure this is actually legal too :D))
Thanks for the offer, but I think I'll learn the most if I disassemble it myself.  :)

Unfortunately, brandonw.net seems to be down right now.  I'll download that tool as soon as it goes back online.
ld a, 0
ld a, a

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Disassembling the OS with IDA
« Reply #3 on: January 29, 2012, 06:23:58 pm »
Good thing I downloaded it a while ago :P

Edit:
   I should also point out that if you ever intend to consult others or ask questions, brandonW destroyed OS 2.41 and my workhorse is 2.53. Talking about different OS's can be a little challenging sometimes.
« Last Edit: January 29, 2012, 06:28:21 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Disassembling the OS with IDA
« Reply #4 on: January 29, 2012, 08:25:27 pm »
I should also point out that if you ever intend to consult others or ask questions, brandonW destroyed OS 2.41 and my workhorse is 2.53. Talking about different OS's can be a little challenging sometimes.
I'm going to disassemble OS 2.55.  I want to take a look at the USB routines and the BASIC parser.  Maybe I can fix that annoying mathprint screen glitch.  :P

EDIT: Hey, look at that!  His site is back up.  :)
EDIT2: It asks for the end of BCALL jump table.  What should I put down for 2.55?  I don't know because I haven't disassembled the OS yet.  :P
EDIT3: I entered the example numbers, hopefully that's right.



EDIT4: Ok, I somewhat figured out the paging. 

Edit > Segments > Create Segment
Segment Name = (Just note that if your name starts with a number, an underscore will be automatically added.)
Start Address = IDA linear address
End Address = IDA linear address + 1 (If you want your page to end at 0x4FFFF, use 0x50000)
Base = (StartAddress - VirtualAddress) / 0x10


Example:
Segment Name: Page02
Start Address: 8000
End Address: C000
Base: 400
« Last Edit: January 29, 2012, 09:56:14 pm by ralphdspam »
ld a, 0
ld a, a

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Disassembling the OS with IDA
« Reply #5 on: February 02, 2012, 03:28:02 pm »
Missed your post somehow.

I'm going to disassemble OS 2.55.  I want to take a look at the USB routines and the BASIC parser. 

The usb routines are mostly on boot page 6F, though, there are some in the OS (they're just more complicated).

Quote
Maybe I can fix that annoying mathprint screen glitch.  :P

Already figured it out. It has to do with the universal flash exploit. It's not fixable, but there is a workaround. I posted it in the OS glitch compilation thread.


Also, I believe we've known about segments, the real beauty would be making all the bcalls and such jump around to each other.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112