Author Topic: Mirage safe zones  (Read 7445 times)

0 Members and 1 Guest are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Mirage safe zones
« on: February 25, 2011, 04:16:49 pm »
So since I am already using L1,L3,L4,L5 and L6 in PortalX, and yet I am looking into adding greyscale to certain parts.  The best way would be to move the variables from L1 into L2 with the Realloc() function, but doesn't use large portions of L2?  What areas are safe?  If I turn off interrupts, will that make L2 safer, or still dangerous?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Mirage safe zones
« Reply #1 on: February 25, 2011, 05:41:28 pm »
I believe this is what you would have to do:
di
Backup all the contents that you will override in L2 somewhere.
<stuff using L2>
Restore the backup
ei

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Mirage safe zones
« Reply #2 on: February 25, 2011, 05:43:31 pm »
Yeah if you absolutely need these areas, you'll have to store their content elsewhere prior using them, such as an arbitrary buffer inside your program or in a temporary appvar.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Mirage safe zones
« Reply #3 on: February 25, 2011, 05:45:12 pm »
Oh yeah, if you use a program you can just put a Zeros(768) at the end of your program for another buffer. ;D

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Mirage safe zones
« Reply #4 on: February 26, 2011, 12:18:48 am »
You can use LnReg to transfer interrupt control from Mirage to the OS.  That would be the best idea since you can still use OS routines that require interrupts.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Mirage safe zones
« Reply #5 on: February 26, 2011, 12:22:28 am »
Oh yeah, if you use a program you can just put a Zeros(768) at the end of your program for another buffer. ;D

O.O
* Qwerty.55 hugs ztrumpet
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Mirage safe zones
« Reply #6 on: February 26, 2011, 09:59:48 pm »
You can use LnReg to transfer interrupt control from Mirage to the OS.  That would be the best idea since you can still use OS routines that require interrupts.

O.O
* ZTrumpet hugs Quigibo

How does that work?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mirage safe zones
« Reply #7 on: February 26, 2011, 10:18:16 pm »
You can use LnReg to transfer interrupt control from Mirage to the OS.  That would be the best idea since you can still use OS routines that require interrupts.

O.O
* ZTrumpet hugs Quigibo

How does that work?

LnReg sets interrupt mode 1 (normal), which doesn't use any extra data. Mirage uses a custom interrupt (mode 2) whose data needs to be stored in RAM. Mirage uses L2 for this data.

So I don't have to start another topic, is L2 completely safe to use if I do FnOff or LnReg? I use L2 for an array in Contra, and for some reason when I mess with it enough, Return returns straight to the homescreen instead of back to the Mirage shell.

And in other cases, Return returns back to Mirage, but the GUI is messed up (none of the program names appear, though I can still run them).
« Last Edit: February 26, 2011, 10:19:08 pm by Deep Thought »




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: Mirage safe zones
« Reply #8 on: February 26, 2011, 10:29:22 pm »
There is one byte in statVars (I assume L2) that mirage uses. That is $8A4A. If it is 1, mirage quits to the homescreen. If it is anything else, it doesn't.
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 Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mirage safe zones
« Reply #9 on: February 26, 2011, 10:40:52 pm »
Ah, that must be it. Mirage uses it regardless of whether interrupts are enabled?

EDIT: StatVars is $8A3A... Is that it?

EDIT2: Lol, just realized I can type "statvars" with one hand :D
« Last Edit: February 26, 2011, 10:42:04 pm by Deep Thought »




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: Mirage safe zones
« Reply #10 on: February 26, 2011, 10:47:12 pm »
Yep, $8A4A is the spot. This is the shortest possible (clean) program demonstrating my point.

Code: [Select]
xor a
jr nc, $+2
nop
inc a
ld ($8A4A), a
ret

When you run it, you essentially quit mirage.

Edit:
   Ok, now it's the smallest.
« Last Edit: February 26, 2011, 10:49:24 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 Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Mirage safe zones
« Reply #11 on: February 27, 2011, 02:09:54 am »
Is that byte the only byte Mirage uses?  I got the impression that it also used a lot more bytes for local variables and stuff, which is why the gui gets messed up

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mirage safe zones
« Reply #12 on: March 20, 2011, 02:15:40 pm »
*bump*

Anybody know the answer? The mirdevinfo package doesn't mention this at all.




Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: Mirage safe zones
« Reply #13 on: March 20, 2011, 04:21:22 pm »
Quote from: mirgui.inc
FolderBytes           = StatVars+5      ;(10)   Holds one data byte for each folder, which
                                        ;       contains the number of progs in the folder,
                                        ;       (99 Max), and then Bit 7 is used to notate
                                        ;       if the folder is either Open or Closed.
That's probably what's causing your problems.  I don't know why that couldn't have been stored somewhere else (e.g., in cmdShadow, and use statVars for the cached appvar settings instead) but there you have it.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mirage safe zones
« Reply #14 on: March 20, 2011, 06:59:48 pm »
Thanks! I didn't see that.

Guess I could save that into the program somewhere and restore it before exiting. What does the (10) mean?