• Axe Q&A 5 5
Currently:  

Author Topic: Axe Q&A  (Read 590979 times)

0 Members and 3 Guests are viewing this topic.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Axe Q&A
« Reply #1530 on: June 27, 2012, 02:54:10 pm »
Well, what I would do is creating a str/gdb/pic (w/e) and store the highscore in that since when you write to a string/ w/e ya chose (basically it's the same) you use writeback. I have never really used it, tho.
That's currently what it's using, it stores the highscore to GDB3 if i'm not mistaken. I could do it some other way, but the only thing holding me back is how to tell if it is the user's first time running the program, and then to initalize the data respectively, or don't if it isn't their first time.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Q&A
« Reply #1531 on: June 27, 2012, 03:57:58 pm »
(This question is directed toward Deep Thought, but if anybody could answer it, that would be great)

I was trying to figure out how to save a highscore within the program, rather than in an appvar, so I looked at the snakecaster source to try to figure it out.
I'm pretty sure that I got everything else working, except for this one line of code.
Code: [Select]
:GetCalc(E8478)+GDB3-E9D93->Q     //Where E is the little E on calc (2ND + , )
This is what 'gets' the highscore at the beginning of the program, but I'm unsure of exactly what all the stuff is for. (and why it's not working for me)

If I recall correctly Deep Thought said it was just a fancy optimization. You can still easily just reference GDB3 the normal way.
In-progress: Graviter (...)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1532 on: June 27, 2012, 04:55:55 pm »
When the TI-OS runs an ASM program, it copies it to $9D95 and deletes the copy when it's done. Thus, any changes to the running copy don't do anything. What Deep's code does is find the original program (not the running copy) and get the address of the high score from there.
Note that this has the possibility of not working as intended when running from a shell.
If you're curious how Deep's code works, here's a quick outline:
GetCalc( takes the address of a string with a variable name and returns the address of the variable's data. When the TI-OS runs a program, the name of the program is copied to OP1, whose address is $8478. GDB3-E9D93 is the offset to the high-score value from the start of the ASM program header. This is added to the address given by GetCalc(, and the sum is the location of the high-score value in the original copy of the program.
« Last Edit: June 27, 2012, 09:38:29 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Axe Q&A
« Reply #1533 on: June 27, 2012, 07:24:24 pm »
If I recall correctly Deep Thought said it was just a fancy optimization. You can still easily just reference GDB3 the normal way.
If I did do that, wouldn't it not work because of
When the TI-OS runs an ASM program, it copies it to $9D95 and deletes the copy when its done. Thus, any changes to the running copy don't do anything.
this? ^^^
GDB3-E9D93 is the offset to the high-score value from the start of the ASM program header.
So, in my program, I would need a different offset, right? And how would I figure that offset out?
« Last Edit: June 27, 2012, 07:25:26 pm by parserp »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1534 on: June 27, 2012, 09:41:59 pm »
A shell manages this for you; you change it in the running copy and the change gets copied back. Most people will at least have Ion, if not MirageOS, DCS, zStart, or something else. Just use GDB3 or whatever the equivalent is in you program.
If for some reason you want it to work without a shell (and not to work with a shell), to get the appropriate offset you just select the appropriate address (i.e., replace GDB3 with whatever is applicable); that's it.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Axe Q&A
« Reply #1535 on: June 27, 2012, 11:07:24 pm »
So basically, the fancy GetCalc statement is just to save the highscore in both the origional copy and the temporary RAM copy? (So that whichever one is copied back to the original program, the highscore still saves) ?
« Last Edit: June 27, 2012, 11:08:04 pm by parserp »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1536 on: June 27, 2012, 11:59:28 pm »
The "fancy GetCalc statement" calculates the corresponding address in the original. So yes, it can be used to update in the original, and you can also update in the running copy. There shouldn't be a need to always keep the two in sync, though.
I'm not sure how this works when running from a shell. I'm under the impression that most shells will copy (from Archive) or move (from RAM) the program to the appropriate location, and this would yield the program's (or the copy's, if from Archive) name in OP1. Thus, it will just update in-place. However, I'm not sure if this is documented, so unless you can confirm it in Ion, MirageOS, DoorsCS, etc., it would be best not to have code like Deep's in shell versions.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1537 on: July 02, 2012, 03:19:55 pm »
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
« Last Edit: July 02, 2012, 03:20:01 pm 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 MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Axe Q&A
« Reply #1538 on: July 02, 2012, 03:27:06 pm »
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
Sadly, no. The text command is an OS routine by TI, so it isn't possible to write text to any other buffer than the main. You have to write it to the front buffer and copy the part you want to the back buffer. If it is a whole line, the copy() function is the right one, otherwise you might have to make your one routine or use the pt-Get() function several times (lot of size and takes some time).
The last possibility would be to use your own font and just 'sprite' it there.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1539 on: July 02, 2012, 03:32:00 pm »
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
Sadly, no. The text command is an OS routine by TI, so it isn't possible to write text to any other buffer than the main. You have to write it to the front buffer and copy the part you want to the back buffer. If it is a whole line, the copy() function is the right one, otherwise you might have to make your one routine or use the pt-Get() function several times (lot of size and takes some time).
The last possibility would be to use your own font and just 'sprite' it there.
Ok. Then could an Axiom be written to add a fast text routine that would support any buffer ?
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 aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #1540 on: July 02, 2012, 03:34:04 pm »
You don't even need an axiom for that. I wrote text routines that were as fast as the OS routine in plain axe. (tho I'm not doing it for ya, sorry: I hate creating 255 sprites for the single purpose of a text routine :p)
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1541 on: July 02, 2012, 03:37:58 pm »
You don't even need an axiom for that. I wrote text routines that were as fast as the OS routine in plain axe. (tho I'm not doing it for ya, sorry: I hate creating 255 sprites for the single purpose of a text routine :p)
Yes, but why making it as fast as the OS routine when it can be faster ? ;)
And an Axiom would be perfect. It could have all the options everyone could want :)
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 leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Q&A
« Reply #1542 on: July 02, 2012, 03:57:54 pm »
I think the reason this hasn't been done already is the huge size it would take to store all the letter sprites that aren't built into the OS; I brought it up with Runer once or twice and he might be able to help you out.
In-progress: Graviter (...)

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Axe Q&A
« Reply #1543 on: July 02, 2012, 04:00:13 pm »
Actually I asked that same question earlier in this thread. ^.^

This is what Quigibo said:

Blame TI for that.  If you want to draw directly to the back-buffer, you'd have to make your own font routine, which is easy, but takes forever to get all those letter/number/symbol sprites as well as a lot of space in the program itself.  But sometimes a kick-ass font can really improve a game's look! :D

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1544 on: July 02, 2012, 04:56:12 pm »
Wouldn't it be possible to get the font sprites directly from the OS? I have no idea where they are located in the OS ROM, but they're surely there.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.