Author Topic: Making a game w/o OS?  (Read 6551 times)

0 Members and 1 Guest are viewing this topic.

Offline joshop

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Making a game w/o OS?
« on: March 09, 2022, 08:13:23 pm »
I wanted to try my hand at making a game in assembly, which I had some background in (actually 6502, so this Z80 stuff feels easy in comparison). After agonizing about how many resources are taken up by the TI OS doing things that I don't even need (calculator stuff, not really useful for a game that's going to be running instead of that stuff anyway), I wondered if it would be possible to just eschew the operating system and write my game in place of it, assuming I was willing to go without some of the useful functions it gives you. My game would be the only code running on the calculator, period, which would give me more control. Of course, it wouldn't be useful as a calculator anymore, but that's neither here nor there.
  • Is this even possible? Can you just overwrite the OS and run something in place of it?
  • If it is, and I go ahead with it, is it possible to reinstall the TI OS from nothing without any sort of code for working with the link port, etc.?
  • Is this just a normal thing and I'm clueless to the world of TI development?

Offline lolpro11

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +2/-0
    • View Profile
Re: Making a game w/o OS?
« Reply #1 on: March 09, 2022, 08:28:25 pm »
Which calculator is this referring to? If you are talking about TI 84s, then there should be community alternate system calls. Any call to TI's OS is really slow and should be avoided.

For the TI-Nspires, there is a bootloader that does replace the OS in memory. https://github.com/tangrs/nspire-linux-loader2

You should "reinstall" the OS by pressing the reset button. This clears the RAM and boots the system back to its original state.

Offline joshop

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Making a game w/o OS?
« Reply #2 on: March 09, 2022, 08:39:12 pm »
Oh, right, not sure how I forgot to specify. I'm talking about TI 84+.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Making a game w/o OS?
« Reply #3 on: March 10, 2022, 05:29:59 pm »
Since we have the signing keys, yes you can replace the OS with your own that just plays the game. I think TI-Boy SE also has logic that just unloads large portions of the OS when launching and the adds it back when quitting. That might be the better option: https://github.com/calc84maniac/tiboyse
/e

Offline joshop

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Making a game w/o OS?
« Reply #4 on: March 10, 2022, 05:51:49 pm »
Okay, good to know. That sounds like a better idea, since requiring the user to replace the OS with a different one is obviously suboptimal. What's the actual process for unloading the OS (what ports to write to to modify flash or whatever), and where does it get backed up to?

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Making a game w/o OS?
« Reply #5 on: March 10, 2022, 06:14:20 pm »
Okay, good to know. That sounds like a better idea, since requiring the user to replace the OS with a different one is obviously suboptimal. What's the actual process for unloading the OS (what ports to write to to modify flash or whatever), and where does it get backed up to?
That's a great question for @calc84maniac
/e

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Making a game w/o OS?
« Reply #6 on: March 10, 2022, 07:07:44 pm »
Going back to the original questions: I think you may be under an incorrect impression that you'd need to do this. The system is not multi-threaded, aside from some OS interrupts which you can easily disable or replace with your own handler once your program is started. At that point there are no "resources" taken by the OS other than the memory it resides in, as long as you never call into it.

The only reason TI-Boy does anything to the OS in the first place is because I wanted to override the first 16KB of the memory map to match a Game Boy cartridge's memory layout as closely as possible, and that area of the address space is mapped to a fixed part of the Flash chip normally containing OS code. This isn't something that would be particularly helpful in most other scenarios, in my opinion, since you can freely map any Flash memory into other areas of the address space whenever you want.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline joshop

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Making a game w/o OS?
« Reply #7 on: March 11, 2022, 06:01:41 am »
Okay, thanks. I actually didn't realize that you could replace the OS ISR with your own.