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

0 Members and 2 Guests 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 #105 on: February 23, 2011, 11:28:01 am »
{L1+A} is slightly faster than {P+A}, but not by a lot, only 6 cycles.

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 #106 on: February 23, 2011, 11:46:55 am »
Ok, thanks :D
I'm guessing reading from the archive takes longer, but is it a large slowdown?
Vy'o'us pleorsdti thl'e gjaemue

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 #107 on: February 23, 2011, 11:49:13 am »
Yeah it is slower, but unfortunately it seems Runners documentation is lacking in that regards D:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #108 on: February 23, 2011, 11:58:09 am »
A helpful optimization hint: always put constants last!

{P+A}: 11 bytes, 61 cycles
{L1+A}: 11 bytes, 55 cycles
{A+L1}: 10 bytes, 51 cycles


Ok, thanks :D
I'm guessing reading from the archive takes longer, but is it a large slowdown?

Reading a single byte or word from the archive is about 30 times slower; it takes about 1600 cycles. If your program regularly reads from a relatively small amount of archived data at any one time, like the tilemap for a level, the best thing to do is Copy() the data from archive into RAM somewhere and read it from there. You can then access this data from RAM much more quickly during gameplay, and copy new level data from archive as necessary.


Yeah it is slower, but unfortunately it seems Runners documentation is lacking in that regards D:

You are right, I have not documented the speed of the archive reading commands. Reading from the archive uses OS routines so it is a bit harder to calculate the speed of, as I can't look at the code and simply calculate speed based on the instructions that make it up.
« Last Edit: February 23, 2011, 12:00:16 pm by 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: Axe Q&A
« Reply #109 on: February 24, 2011, 09:45:57 am »
A helpful optimization hint: always put constants last!

{P+A}: 11 bytes, 61 cycles
{L1+A}: 11 bytes, 55 cycles
{A+L1}: 10 bytes, 51 cycles

And so always put variables before constants :) (L1 is a constant. It's just a number. {L1} is exactly the same to Axe as {86EC}.)




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #110 on: February 26, 2011, 11:02:27 am »
Added a quick FAQ/random answers section to the first post for things that I see many users having problems with :P

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #111 on: March 02, 2011, 05:23:42 am »
How can you display a variable number like 12.34?
I mean, if Ans is 12.34, how to display that?
I'm not a nerd but I pretend:

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 #112 on: March 02, 2011, 05:38:15 am »
Axe doesn't support decimals, so you can't unless you wrote your own routine to display a 9-byte floating point number. It's possible but gets a bit complicated because of the way a float is structured: the first byte determines if it's real or complex and if it's positive or negative, the second byte subtracted by $80 (128) gives you the exponent (floating points are always in scientific notation), and the other seven bytes are the digits.

Each nibble in the last seven bytes is a digit. The first nibble in particular is the digit to the left of the decimal when written in scientific notation (the first non-zero digit from the left). Each digit is stored as a decimal digit, so the full 9-byte floating point for "1337" is

Code: (Floating point format) [Select]
00 83 13 37 00 00 00 00 00

(all in hex).
« Last Edit: March 02, 2011, 05:38:44 am by Deep Thought »




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #113 on: March 02, 2011, 07:00:04 am »
Okay, thanks.
Another question: How can you use the Parser hook in an Axe program (In other words, what is the hex opcode?)

EDIT:
I used memkit to get the name of a program in L1. How do I now do a GetCalc( for that program? I can't get a "prgm" before the name :S
« Last Edit: March 02, 2011, 07:10:18 am by aeTIos »
I'm not a nerd but I pretend:

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 #114 on: March 02, 2011, 09:24:38 am »
Okay, thanks.
Another question: How can you use the Parser hook in an Axe program (In other words, what is the hex opcode?)

First of all, the hook needs to be stored in the form of hex. Just grab the opcodes for your parser hook and stick it in your program as data (stored in []→GDB1 or something similar). Make sure it starts with the byte $83, because that's what the OS uses as a signal for the start of a hook.

Then you need to copy the code somewhere in RAM where it won't be destroyed easily. A good choice is smallEditRAM, so to use it do Copy(GDB1,E90D3,LEN) where LEN is the length of your parser code.

To actually start the hook, use this code:

Code: (Axe) [Select]
:E90D3
:Asm(EF2650)

That's all you need to do. To disable the hook, it's simply

Code: (Axe) [Select]
:Asm(EF2950)

You'll have to write the hook code yourself in ASM, of course. See http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9BAC for information on how to use this hook.

EDIT:
I used memkit to get the name of a program in L1. How do I now do a GetCalc( for that program? I can't get a "prgm" before the name :S

Just store a 5 in before the program name and it should work.
« Last Edit: March 02, 2011, 09:24:50 am by Deep Thought »




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #115 on: March 02, 2011, 09:27:06 am »
:w00t: Thanx for this!
+1
I think this can be useful for making Shells...
(hint hint :P)

So, how can you run a Basic prog with this?
Or am I missing the point with this hook? :x
« Last Edit: March 02, 2011, 09:57:30 am by aeTIos »
I'm not a nerd but I pretend:

Offline ee511

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #116 on: March 02, 2011, 08:44:42 pm »
is there a way to turn an "input" string of tokens into a normal string? in this particular situation, I want the user to be able to input a file name (for use with getcalc()

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 #117 on: March 02, 2011, 08:46:46 pm »
Capital letters and numbers are the same between token format and character format, so you don't have to worry about that there :)




Offline ee511

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #118 on: March 02, 2011, 09:22:49 pm »
so i can treat it as a string? is there any way to store the output of "input" directly to a string?

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Q&A
« Reply #119 on: March 02, 2011, 10:10:02 pm »
It is already stored as a string. If you do:
Code: [Select]
input->S
it will ask for input, and store a pointer to that input in S. S can then be used as a string.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results: