Author Topic: Patching the OS  (Read 7297 times)

0 Members and 1 Guest are viewing this topic.

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Patching the OS
« on: September 02, 2013, 05:27:22 pm »
I was wondering how I would write a simple patch, for example enabling lowercase letters or writing a hotkey (ex. mirage's on+apps). I know some assembly, so I won't be starting from scratch.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Patching the OS
« Reply #1 on: September 02, 2013, 05:29:20 pm »
You could just use a existing app like MOS, or, what is far more awesome, DCS to do that.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Patching the OS
« Reply #2 on: September 02, 2013, 05:34:03 pm »
Thanks, but I want to do it myself and learn how everything works.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Patching the OS
« Reply #3 on: September 02, 2013, 05:35:48 pm »
http://answers.yahoo.com/question/index?qid=20100105162418AAR1i7Z
Quote
If you don't have MirageOS, you can switch on the functionality by making a hex code assembly program. Just create a new program and enter the following as code:
:AsmPrgmFDCB24DEC9

AsmPrgm can be found in the Catalog.

Make sure you type it in EXACTLY as shown; one mistake will cause your calculator to crash.
To run this program, you have to use the Asm( token which can be found in the Catalog, [2nd][0]. Asm(prgmLOWERC should be similar to what it would look like.

If you're interested in some more hex codes, check out http://tibasicdev.wikidot.com/hexcodes
Does that help?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Patching the OS
« Reply #4 on: September 02, 2013, 06:30:04 pm »
Haha kinda, thanks for helping but what I want is to learn how to write that or learn exactly how it works.

Offline Hooloovoo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 225
  • Rating: +22/-0
    • View Profile
Re: Patching the OS
« Reply #5 on: September 02, 2013, 06:35:56 pm »
That is just setting a flag which tells the OS to use lowercase.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:



(actually I have quite a few more than this, but I don't feel like making bars for them all.)

Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: Patching the OS
« Reply #6 on: September 02, 2013, 09:13:57 pm »
I would probably use a hook to check for your hotkey ( http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9B84 ) or maybe use the font hook. ( http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9B9C ) and like fortytwo mentioned, set the lowercase flag. (I can't find it on wikiti, but I know it exists :( )

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Patching the OS
« Reply #7 on: September 03, 2013, 12:34:00 am »
Since the title of the thread is "patching the OS," I am assuming you actually want to modify the OS itself instead of simply using what the OS has to offer. In that, thepenguin77 is pretty knowledgeable. Really, it would most likely amount to toggling a handful of bits in the OS (bits, not even whole bytes would need to be edited). I haven't dabbled in that yet, but to expand a little on what was said before...

The hex code FDCB24DEC9 translates to:
Code: [Select]
     set 3,(iy+24h)
     ret
When you say you have assembly experience, I am not sure if you mean specifically Z80, or other assembly languages, but basically, the OS reserves the index register IY for its own use. It points tot he start of the system flags, and as its name implies, flags can thus be referenced as an offset from IY. so IY+0 would be the first byte, IY+1 would be the second, et cetera. Almost all of the instructions that use the register pair HL can use one of the two index registers (the other is IX). So for example, ld a,(iy+7) would load the contents 7 bytes ahead of where IY points into a.

The instructions starting with set res and bit allow you to modify or read an individual bit of an 8-bit register or the byte of ram pointed to by the register pair HL. SO this gives you b,c,d,e,h,l,(hl),a. With these, you can use an index register in place of (hl) allowing you to use (ix+const). Taking a look at the code above, again, we have:

Code: [Select]
     set 3,(iy+24h)
Since IY should be pointing to the flags, the OS keeps the offset 24h as the byte with the flag controlling lowercase mode. In particular, it is bit 3 at offset 24h that is the appropriate flag. You don't have to memorize the flags and offsets too much, though, if you don't want to. The ti83plus.inc file has defines and equates that will let you do something like:
Code: [Select]
     set lwrCaseActive,(iy+appLwrCaseFlag)

The links that Assemblybandit provided are to an excellent resource if you want to learn how the OS works. Hooks were intended to provide a safe way to modify the actions of or update functionality of the OS without actually needing to go in and permanently edit it.

I hope  this helps!

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Patching the OS
« Reply #8 on: September 03, 2013, 11:58:15 pm »
Wow, thank you so much guys, that is exactly what I was looking for. I'll take a look at those links and try figuring everything out (and yes, I do have some experience with the z80 processor). I'm not used to people being so helpful, thanks!

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Patching the OS
« Reply #9 on: September 04, 2013, 01:44:48 am »
And if you really want to make an OS patch for the 83+/84+ (say, because some behaviour can't be changed through a hook), FYI, we've been able to sign arbitrary OS with TI's private key since 2009 (because a single person at first, then a collective effort, factored the relevant 512-bit RSA public keys), and we can still bend to our will recent 84+ models which validate a signature in the OS using a 2048-bit RSA key.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Patching the OS
« Reply #10 on: September 04, 2013, 02:49:23 am »
I'm not used to people being so helpful, thanks!

Hey, that's just how we roll here. ;) Welcome to onmimaga. You should head over and <a href=http://www.omnimaga.org/index.php?board=10.0>introduce yourself.</a>
« Last Edit: September 04, 2013, 09:53:28 am by Art_of_camelot »

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: Patching the OS
« Reply #11 on: September 04, 2013, 09:43:07 am »
Well, you may have titled the page improperly because you don't actually need to patch the OS. But when the time finally comes and you want to patch the OS, I did in fact make a patcher. (Physically patching the OS sucks. It takes so much code to make such a small change, even if you know exactly what you want to change).

And while we're at it, I might as well link to my guide on hooks since this information is available literally nowhere.
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 TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Patching the OS
« Reply #12 on: September 04, 2013, 09:55:18 am »
By the way, if you feel it's an appropriate place, you can upload the guide in our <a href=http://www.omnimaga.org/index.php?action=articles;cat=11>tutorials section.</a>

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Patching the OS
« Reply #13 on: September 04, 2013, 12:58:51 pm »
On the TI-Z80 series, besides thepenguin77's patcher, PolyPatch84 is a set of ready-made patches on the computer side.
On the TI-68k series, there's my tiosmod+amspatch, also on the computer side, to be followed by Rabbitsign.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.