Author Topic: Axe Q&A  (Read 591350 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
Re: Axe Q&A
« Reply #1335 on: January 28, 2012, 05:22:02 pm »
writing to a static pointer would be the only way to safely write to your own program data, and that's as simple as, well, writing to the static pointer! ;D Just know that programs don't always get written back.  Homescreen games do not get written back, and Mirage/Doors games only get written back based on a user setting.  Appvars would be my way to go, any reason you don't want to use them?

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Axe Q&A
« Reply #1336 on: January 28, 2012, 07:48:51 pm »
I just looked at parser's rectangle drawing stuff, and I'm just curious.
How many cycles does this take? This still draws rectangle.
DrawInv
RectI(1,1,94,62
Sig wipe!

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1337 on: January 31, 2012, 11:23:02 pm »
Not sure, runer made a topic somewhere about the size/speed of the commands tho.
http://ourl.ca/8693 (attached pdfs)


When using Disp or Text, is there a command to have it display negative numbers properly?  Ie instead of displaying 32768 (or 32767?) it would display -1, etc.

Also is there a way to get the current pen location?  How about on the homescreen?
Vy'o'us pleorsdti thl'e gjaemue

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Axe Q&A
« Reply #1338 on: January 31, 2012, 11:43:05 pm »
To display a signed number, you can do:
Code: [Select]
:Lbl DspSI
:!If r₁≥≥0
:−r₁➔r₁
:Disp '⁻'▸Char
:End
:Disp r₁▸Dec
:Return

As for the cursor and pen locations, it's usually easier to keep track of them yourself. If you really need to get them, I guess you could do this:
Code: [Select]
:{ᴇ844B} .cursor row
:{ᴇ844C} .cursor column
:{ᴇ86D8} .pen row
:{ᴇ86D7} .pen column

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #1339 on: February 01, 2012, 09:18:40 pm »
Darl, if you really wanted to do smc, you'd have to put some extra space in your program, GetCalc("prgmSMC")->N and then look for the last C9h in the file.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1340 on: February 01, 2012, 09:33:09 pm »
Freyaday I'm unsure of what you mean?  All he has to do in order to do SMC in Axe is modify data already inserted into Axe.  Any old [Hex]->GDB0 will do, as long as the shell supports writeback.

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: Axe Q&A
« Reply #1341 on: February 02, 2012, 07:27:38 pm »
If the shell doesn't support writeback or if the user is running from the home screen (and the program isn't archived), you can ensure SMC by saving once to the pointer and then to the same pointer relative to the original copy of the program (the one not being run).

To do that, you'd first have to find the original copy. It's best to do it at the very beginning of your program, because there you can take advantage of the fact that the program name is stored at an address called OP1 ($8478), so this will work regardless of whether the user renames it. Use this as the first line of your program:
Quote from: Axe
GetCalc(E8478)-E9D93P
This finds the original copy of the currently running program, then subtracts $9D93; this number is where the running copy of the program is located, so P now holds the difference in address between the two programs.

Then, where you want SMC, you save to the local pointer (in the running copy, so it works with shells with writeback enabled) and to the appropriate spot in the original copy. For example, if you wanted to save 256 to a POINTER, you'd use something like this:
Quote from: Axe
256{POINTER}r
256{POINTER+GDB1)r
Spoiler For Optimizations:
Quote from: Axe
256{GDB1}r{P+GDB1)r
That line only works if the local pointer you're storing to—in this case GDB1—is constant, and you're storing two bytes. Otherwise, if you're storing to a two-byte variable address, use something like this:
Quote from: Axe
256{A}r{+P-1)r
The optimized version for a one-byte variable address, either variable or constant, is this:
Quote from: Axe
256{POINTER}{+P)
« Last Edit: February 02, 2012, 07:28:42 pm by Deep Thought »




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1342 on: February 02, 2012, 07:40:00 pm »
All this works only if the program isn't being run from archive though, correct?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Q&A
« Reply #1343 on: February 02, 2012, 10:17:57 pm »
All this works only if the program isn't being run from archive though, correct?
That's true, but in that case you can check if GetCalc() fails.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1344 on: February 02, 2012, 10:32:10 pm »
In general though, it's good to let the user decide through the settings of their shell whether or not they want writeback in their own programs right?

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: Axe Q&A
« Reply #1345 on: February 02, 2012, 11:04:03 pm »
In general though, it's good to let the user decide through the settings of their shell whether or not they want writeback in their own programs right?
My post is actually to make it work when people run the program from the homescreen, which would never write anything back otherwise since it makes a copy of the program to run. Shells almost always write back any program that's in RAM, anyway, and whether it writes back when the program's archived is still up to the user.
All this works only if the program isn't being run from archive though, correct?
That's true, but in that case you can check if GetCalc() fails.
I never check for that because unless the program's over 32 KB long, it would do anything since it's probably not writing to RAM. I guess it would help to tell the user that the modification failed, though.
« Last Edit: February 02, 2012, 11:04:33 pm by Deep Thought »




Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #1346 on: February 02, 2012, 11:34:34 pm »
My solution was w/o relying on shells and instead relied on a whole lot of stupid (on my part). I'm gonna go over there in that corner and beat myself with some SMC now.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

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 #1347 on: February 03, 2012, 12:17:27 am »
How would you get the size of an appvar?
such as:
Code: [Select]
GetCalc("appvSTUFF",Y0)
[see what the size of the appvar is]

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1348 on: February 03, 2012, 12:18:02 am »
{Y0-2}r

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 #1349 on: February 03, 2012, 12:27:08 am »
O.o I never thought it would be so easy. Thanks! :D