TI-84 Plus Emulation

From Hackspire
Revision as of 22:36, 23 January 2009 by Some Person (talk | contribs)
Jump to navigation Jump to search

TI-84 Plus Silver Edition OS

Image file

The archive memory of the TI-84 Plus Silver Edition is integrated to the TI-Nspire OS as 64KB files in a PK-Zip file (see the OS upgrade file format). The OS code is encrypted and perhaps compressed with the rest of the TI-Nspire OS code in certificate field 8070. Fortunately a ROM image of the emulated TI-84 Plus can be dumped through the DBUS with standard tools such as TiLP.

OS Emulation

Do not expect the emulated TI-84 Plus Silver Edition to offer more features than the real one. The speed is roughly the same, and the RAM and archive memory have equivalent sizes (the whole memory of the TI-Nspire is not visible from the emulated TI-84 Plus Silver Edition).

Starting with version 2.42 (and continued with 2.44 and 2.46), even-numbered versions of the TI-84 Plus Silver Edition OS are used while the latest version available for the real TI-84 Plus Silver Edition is 2.43. The version of the boot code is 1.02, according to 0x400F of ROM page 7F (see WikiTI).

Some features are disabled in the Nspire versions: the key combo for the self-test doesn't work, and the TI-84 Plus Silver Edition OS can't be upgraded (an error is returned by the computer link software).

The TI-84 Plus Silver Edition ROM archive memory is set up with preinstalled Flash applications, but they can be deleted from the current memory image. These applications are restored on a full reset from the back of the case.

Hardware Emulation

Z80

The emulated Z80 has several special opcodes, which control functions such as linking, Flash reading and writing, and lock/unlock the TI-84 Plus Silver Edition keypad.

USB

The USB ports are not emulated, and events on the USB bus are not propagated to the memory-mapped port according to Calcsys and usb8x's USBTools and PortMon. The TI-84 Plus/SE (and 89 Titanium) USB controller has a quite complicated port interface, and the TI-Nspire probably uses a different controller. Texas Instruments has probably preferred to integrate a DBUS to the snap-in TI-84 Plus Silver Edition keypad and emulate it rather than to waste time on USB emulation.

When connected to a computer linking software such as TI-Connect or TiLP, a TI-89 Titanium is strangely advertised by the USB descriptors (fixed in versions 2.44+). Commands can be sent by the computer to this fake Titanium through the OUT endpoint, but the TI-Nspire never responds. Forcing TI-84 Plus as device type in TiLP doesn't change anything. Since the USB descriptors of the TI-84 Plus Silver Edition ROM image in the TI-Nspire OS have not been changed, the USB attachment is entirely handled by the TI-Nspire, and not by the emulated TI-84 Plus Silver Edition which never sees the USB events as described above.

Connecting a USB optical mouse with an adapter in TI-84 Plus Silver Edition mode makes the mouse flicker as in the TI-Nspire standard mode, but much slower (~1 second instead of ~0.2s).

Flash Writing

The Flash protection through port 14h works as it does in a real TI-84 Plus Silver Edition. However, there were some changes to communicating with the Flash chip.

Instead of emulating the odd method of communicating with the Flash chip through memory-mapped commands, these commands have been replaced with invalid instructions, which the emulator will catch and intercept. When it comes across one of these instructions, it will check the destination Flash page and will IGNORE writes/erases if it does not fall within the user archive (pages 08h-69h). This makes OS updates through the TI-OS impossible, although it is possible to work around this.

Writes to the user archive will be stored in the Nspire file system and preserved if the keypad is removed. However, if you do manage to write to OS space, writes here are NOT preserved and are restored to the original OS contents when re-inserting the keypad. This implies that the entire OS as well as the user archive is copied to RAM, and only written back to the Flash chip when removing the keypad or turning off the calculator.

If the certificate sector is erased and then the calculator is fully reset, the certificate is rebuilt using the same calculator ID and validation number. It is unknown whether this is stored somewhere or calculated, perhaps based on the Nspire's unique ID.

Working and Non-working Programs

Programs known not to work with the Nspire emulator include programs which use undocumented instructions such as "in 0,(c)" and anything involving IXH or IXL, and also anything that relies on direct USB communication or the USB activity hook.

Please mention any TI-84 Plus Silver Edition programs which do not work with the TI-Nspire integrated emulator, with enough details for the authors or other hackers to fix them. Mention only noteworthy programs when they work, which wouldn't obviously be compatible for example because of special use of the TI-84 Plus Silver Edition hardware.

Working

  • Noshell : All features work except when running an incompatible assembly program.
  • MirageOS: Brandon Wilson has released a patch for MirageOS 1.2. Without it the TI-Nspire reboots when run with at least one assembly program in memory (because it uses IXH/IXL once it finds a program).
  • CalcUtil 2.021b: All features work except when running an incompatible assembly program.

Not Working

  • DCS 6.1
  • SimCity 83
  • msd8x: System hangs, forcing cold boot. Both msd8x and usb8x cannot work because they rely on the OS passing USB events to the USB activity hook, which does not fire in even-numbered OS versions. The complicated port interface is also not emulated, making most of the code in these applications useless. Making it work would require a massive rewrite of all the routines to use the special opcodes from the emulator, and there is no guarantee there are or will be matching instructions for the necessary operations.

We Don't Know

Programs we would like you to try and comment:

We Need Your Help

  • Try as many assembly programs and Flash applications for the TI-84 Plus Silver Edition as possible on the TI-Nspire to find which ones do not work. We will try to make them compatible with the TI-Nspire, and may be TI-Nspire hackers may use the underlying emulation flaw. You may also try the non-tested and noteworthy programs mentioned above.
  • Calculate the difference between the CPU and the DBUS speed of the emulated TI-84 Plus Silver Edition and a real one.
  • Test intensely and in detail the accuracy of the emulation (CPU, memory mapping, ports, ...) and report your tests.