### Author Topic: Random Questions  (Read 10832 times)

0 Members and 1 Guest are viewing this topic.

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Random Questions
« on: June 23, 2016, 02:51:13 pm »
Well... I have some random questions... I think I understand asm enough to take responses that way. (Write the code in mimas, decompile it to hex and insert it in my Axe program.)
I use the on key frequently, but that seems to break the equation evaluator since it counts as basic. Is there any way to clear the ON break error? (I already used runprgm's error handler to no avail.)
What are the arguments for the Axe compile B_CALL? Is it the program name in op1?
Is there anyway to tell for sure if you have memory corruption? The program behaves normally except when it is asked to create a new program. (It behaves weirdly like saying the prgm took up x bytes but displaying many more in the editor.)
In order to find custom tokens in axioms the program reads the compiled axiom. Is there a better way to do that?

That is all I can think of now...
Thanks for any help! (Even if is a link)
I'm still around... kind of.

#### Runer112

• Moderator
• LV11 Super Veteran (Next: 3000)
• Posts: 2289
• Rating: +639/-31
##### Re: Random Questions
« Reply #1 on: June 23, 2016, 03:28:54 pm »
I use the on key frequently, but that seems to break the equation evaluator since it counts as basic. Is there any way to clear the ON break error? (I already used runprgm's error handler to no avail.)

Perhaps res onInterrupt,(iy+onFlags)? Otherwise, I don't really know myself.

What are the arguments for the Axe compile B_CALL? Is it the program name in op1?

Quote
$# api_CompileOP1 # $
Inputs: OP1 = Name of program to compile
a = Compile Mode
bit 0-2:
0 = No shell
1 = Ion
2 = MirageOS
3 = DoorsCS
4 = Application
bit 3
0 = Regular compile
1 = Zoom compile
Outputs: none

Compiles the program and then returns

Is there anyway to tell for sure if you have memory corruption? The program behaves normally except when it is asked to create a new program. (It behaves weirdly like saying the prgm took up x bytes but displaying many more in the editor.)

If the memory management menu shows weird values, then your memory is probably corrupted and the calculator will likely crash soon. Should be fixed by a RAM clear (or crash), though.

In order to find custom tokens in axioms the program reads the compiled axiom. Is there a better way to do that?

No, unfortunately you do have to scan through the whole Axiom. Sticking them at the end was the most reasonable way Quigibo/I could think to add them while retaining backwards compatibility.

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Re: Random Questions
« Reply #2 on: June 30, 2016, 07:08:35 pm »
res onInterrupt works!
I guess before I start programming as too much I need to choose a compiler. Which compiler do you use/recommend?
I'm still around... kind of.

#### Runer112

• Moderator
• LV11 Super Veteran (Next: 3000)
• Posts: 2289
• Rating: +639/-31
##### Re: Random Questions
« Reply #3 on: June 30, 2016, 07:51:48 pm »
You mean an assembler? I use SPASM-ng, which has the nice bonus of being able to assemble eZ80. It's basically just a non-dead version of SPASM.

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Re: Random Questions
« Reply #4 on: July 01, 2016, 03:19:31 pm »
As I'm writing some test programs I found an error I can't figure out how to fix.
I am using SPASM-ng and when trying to compile it errors saying "unregistered opticode hl"
I am using it as "pop hl" Am I missing something?
It may just be the includes file, as I have already had to change bcall to b_call in the includes file.

The axiom readme says that the last argument is in hl. After that they are in the stack in descending order. That means if hl holds the nth argument, after pop-ing to hl, hl would hold the n-1th argument. Right?

Is there any way to compare 2  two byte numbers (without comparing each byte separately) My idea was to subtract them, but it doesn't seem to work...

Thanks for any help!
I'm still around... kind of.

#### Runer112

• Moderator
• LV11 Super Veteran (Next: 3000)
• Posts: 2289
• Rating: +639/-31
##### Re: Random Questions
« Reply #5 on: July 01, 2016, 04:09:22 pm »
As I'm writing some test programs I found an error I can't figure out how to fix.
I am using SPASM-ng and when trying to compile it errors saying "unregistered opticode hl"
I am using it as "pop hl" Am I missing something?
It may just be the includes file, as I have already had to change bcall to b_call in the includes file.

Without context, I don't have much of an idea of what could cause this... is the line not indented with at least one space or tab? That would be my only guess. Otherwise, could you post the snippet, or ideally the full program that is producing this error?

The axiom readme says that the last argument is in hl. After that they are in the stack in descending order. That means if hl holds the nth argument, after pop-ing to hl, hl would hold the n-1th argument. Right?

Correct. Commas in function calls are essentially just compiled to push hl.

Is there any way to compare 2  two byte numbers (without comparing each byte separately) My idea was to subtract them, but it doesn't seem to work...

Subtracting should work. But keep in mind that there's no 16-bit subtract instruction, only 16-bit subtract with carry, sbc hl,rr. To get the correct result, the carry flag must be unset. If you're sure that the code leading up to this will always unset the carry flag, you're all set. If not, you need to explicitly unset the carry flag with an instruction like or a.

If you want to restore the original value of hl after the comparison, follow the subtraction with add hl,rr. Note that this doesn't affect the zero or sign flag and will set carry only if sbc hl,rr set it as well, so all useful flags for comparisons should be unaffected.

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Re: Random Questions
« Reply #6 on: July 05, 2016, 03:39:15 pm »
Yes... I needed to indent...
*rage* no one can force me to organize my code!
I must write code in wall-of-text format! That is the only way!
*snif...* E37 goes to hide behind his wall-of-text Axe programs...
I'm still around... kind of.

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Re: Random Questions
« Reply #7 on: July 07, 2016, 02:33:41 pm »
I't trying to write a simple axiom that functions in a similar way to the pop and push instructions in SPASM.
Its arguments will be Pop(<start of stack>,<pointer to var location>) and example would be Pop(L1,oA) (the o is the angle character)
Push has the same arguments.
The structure will be: first 2 bytes: current end   3rd and 4th: 1st var 5th and 6th 2nd var.... and so on.
I'm having trouble getting the code to work, as Axe throws error:undocumented
Here is my asm code:

Code: [Select]

#### E37

• LV6 Super Member (Next: 500)
• Posts: 329
• Rating: +21/-0
• Trial and error is the best teacher
##### Re: Random Questions
« Reply #13 on: July 28, 2016, 02:34:51 pm »
I'm kinda embarrassed but I can't figure out how to reset z
I've tried:
res  z
res  z,0

And Spasm errored each time.
What am I doing wrong?

Is there a list of commands and BCALLs with what they affect? That would be really nice when programming.
I'm still around... kind of.

#### Sorunome

• Fox Fox Fox Fox Fox Fox Fox!
• Support Staff
• LV13 Extreme Addict (Next: 9001)
• Posts: 7920
• Rating: +374/-13
• Derpy Hooves
##### Re: Random Questions
« Reply #14 on: July 28, 2016, 03:47:58 pm »
if you know that a is non-zero then you can do
or a
 THE GAMEAlso, check out my websiteIf OmnomIRC is screwed up, blame me!Click here to give me an internet!