Author Topic: Mirage OS usage  (Read 13220 times)

0 Members and 3 Guests are viewing this topic.

Offline danny90444

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +0/-0
  • Physics :)
    • View Profile
    • facebook
Mirage OS usage
« on: June 30, 2012, 04:57:13 pm »
So i was reading one of the articles here and it said something about a program saving high scores to itself. Can someone exlpain this/"writeback" to me?
Schrodinger's cat walks into a bar... and doesn't.

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: Mirage OS usage
« Reply #1 on: June 30, 2012, 05:13:24 pm »
Well, it is, that every time a program is run from archive via a shell, a copy of it is stored in ram and then executed. Now, if the program modifies itself to store data it will ONLY modify the copy in ram, leaving the original in archive untouched.
Now, with writeback enabled, the shell will copy the program back from ram to archive when exiting it.

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

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 OS usage
« Reply #2 on: June 30, 2012, 06:47:00 pm »
To clarify, with writeback enabled, before execution the program is actually unarchived during execution. It is archived upon exit. The good side of that is that it saves your highscores and stuff, but the downside is that your calculator will garbagecollect/reorganize archive every 5 minute or so, which is long and annoying, and if the game crashes, it won't get archived, so you'll lose it upon a RAM clear.

Offline danny90444

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +0/-0
  • Physics :)
    • View Profile
    • facebook
Re: Mirage OS usage
« Reply #3 on: June 30, 2012, 07:45:30 pm »
I garbage collect on my own so i dnt mind . Could you explain what i need to actually put in my program to save highscores?
Schrodinger's cat walks into a bar... and doesn't.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Mirage OS usage
« Reply #4 on: June 30, 2012, 09:15:27 pm »
A section with the initial data following a label:
Code: [Select]
HScoreData:
.db 100,90,80,70,60,50,40,30,20,10,0
for example. Then modify the memory locations in terms of the label. As an example:
Code: [Select]
ld hl,(score)
 ld (HScoreData+10),hl
 ld hl,HScoreData
 call SortD
« Last Edit: June 30, 2012, 09:15:43 pm by blue_bear_94 »
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline danny90444

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +0/-0
  • Physics :)
    • View Profile
    • facebook
Re: Mirage OS usage
« Reply #5 on: July 01, 2012, 07:12:21 pm »
A section with the initial data following a label:
Code: [Select]
HScoreData:
.db 100,90,80,70,60,50,40,30,20,10,0
for example. Then modify the memory locations in terms of the label. As an example:
Code: [Select]
ld hl,(score)
 ld (HScoreData+10),hl
 ld hl,HScoreData
 call SortD


Sorry but i dont understand any of that :/
Schrodinger's cat walks into a bar... and doesn't.

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 OS usage
« Reply #6 on: July 01, 2012, 08:45:01 pm »
What language are you writing this in?
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 blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Mirage OS usage
« Reply #7 on: July 01, 2012, 09:28:13 pm »
z80 Assembly. In Axe you might do it this way:
Code: [Select]
Data(100,90,80,70,60,50,40,30,20,10,0)->GDB1HS
.later...
S->{GDB1HS+10}
sub(SORTD,GDB1HS)
.assume SORTD is a subroutine
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline danny90444

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +0/-0
  • Physics :)
    • View Profile
    • facebook
Re: Mirage OS usage
« Reply #8 on: July 01, 2012, 09:55:03 pm »
z80 Assembly. In Axe you might do it this way:
Code: [Select]
Data(100,90,80,70,60,50,40,30,20,10,0)->GDB1HS
.later...
S->{GDB1HS+10}
sub(SORTD,GDB1HS)
.assume SORTD is a subroutine


And whats in the subroutine? sorry im just really confused because im new to this.
Schrodinger's cat walks into a bar... and doesn't.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Mirage OS usage
« Reply #9 on: July 02, 2012, 11:02:09 am »
Assume that the SORTD subroutine sorts data in descending order.
I also want to correct something:

Code: [Select]
Data(100^r,90^r,80^r,70^r,60^r,50^r,40^r,30^r,20^r,10^r,0^r)->GDB1HS
.later...
S->{GDB1HS+10}
sub(SORTD,GDB1HS,11)
.assume SORTD is a subroutine. # of items is 11.

Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Mirage OS usage
« Reply #10 on: July 02, 2012, 11:09:58 am »
And whats in the subroutine? sorry im just really confused because im new to this.
If you're new to Axe, I'd suggest using a simple appvar. They are super easy to use, and it's harder to accidentally mess up your calculator.
Check out this tutorial: http://www.omnimaga.org/index.php?action=articles;sa=view;article=58

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Mirage OS usage
« Reply #11 on: July 02, 2012, 11:11:58 am »
Assume that the SORTD subroutine sorts data in descending order.
I also want to correct something:

Code: [Select]
Data(100^r,90^r,80^r,70^r,60^r,50^r,40^r,30^r,20^r,10^r,0^r)->GDB1HS
.later...
S->{GDB1HS+10}
sub(SORTD,GDB1HS,11)
.assume SORTD is a subroutine. # of items is 11.
But then, a r is missing after the S->{GDB1HS+10}
Moreover, no need to make a routine if it is only used once. What I suspect is that you wrote sub(SORTD,GDB1HS,11) to say "you must sort it" without giving the proper code :P

I personally do it the other way round in MisterOops!
I check how many scores the current score beats, shift them, then insert the new highscore :)
« Last Edit: July 02, 2012, 11:12:41 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline danny90444

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +0/-0
  • Physics :)
    • View Profile
    • facebook
Re: Mirage OS usage
« Reply #12 on: July 02, 2012, 12:48:47 pm »
And whats in the subroutine? sorry im just really confused because im new to this.
If you're new to Axe, I'd suggest using a simple appvar. They are super easy to use, and it's harder to accidentally mess up your calculator.
Check out this tutorial: http://www.omnimaga.org/index.php?action=articles;sa=view;article=58

I already know how to use the appvar i just wanted to learn a different way to do it.

Data(100^r,90^r,80^r,70^r,60^r,50^r,40^r,30^r,20^r,10^r,0^r)->GDB1HS
.later...
S->{GDB1HS+10}
sub(SORTD,GDB1HS,11)
.assume SORTD is a subroutine. # of items is 11.

So first 11 items are sent to GDBHS , then the users score is sent to the list and the list is sorted ? And why does r need to be included?
« Last Edit: July 02, 2012, 12:50:42 pm by danny90444 »
Schrodinger's cat walks into a bar... and doesn't.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Mirage OS usage
« Reply #13 on: July 02, 2012, 01:25:42 pm »
^r needs to be included if you are using 16-bit integers (0 to 65535) for your score.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Mirage OS usage
« Reply #14 on: July 02, 2012, 02:09:45 pm »
If you're new to Axe, I'd suggest using a simple appvar. They are super easy to use, and it's harder to accidentally mess up your calculator.
Nope, it is easier to mess the calc up with apppvars since you can only write to the appvar when it exists (else, you don't know where you are writing) while the program always exists if it wants to save a score.
Of course, checking if the appvar exists is not hard, but writeback is a lot easier.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s