Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jacobly

Pages: 1 ... 12 13 [14]
196
The Axe Parser Project / Re: Features Wishlist
« on: October 26, 2011, 02:43:00 pm »
  • The ability to include token strings as data. I thought about a possible syntax for this, and I came up with ["String goes here"]. Perhaps there's a better syntax, but that's just what I came up with.
I was going to make the same exact request, with the same suggestion for syntax. O.O
Ninja'd before I even made the post.

197
According the the almighty Quigibo ;), that doesn't work yet.
Quote from: Quigibo
Unfortunately, you cannot re-define current Axe tokens in Axioms which is why you're getting that error, you can only overwrite unused tokens.

EDIT:
Oh, and I originally did use solve( for everything instead of Select(. The code may have been slightly unreadable. D:
Besides, Select( takes a string and float{ takes a pointer...

198
The Axe Parser Project / [Axiom] Floating Point Math (and other stuff)
« on: October 25, 2011, 07:18:09 pm »
This axiom allows you to access the os variables and do floating point math with them!
Feel free to ask questions instead of trying to read and understand this entire post.

Did you ever want to store the value of the real/complex variable A into the real/complex variable B inside of an axe program? Now it is easier than ever!
Code: [Select]
:A→B
Code: [Select]
:#Axiom(CPLXMATH) .varA could be complex
:Select("varA")→Select("varB") .Select( is in the 2nd List Ops menu
:solve() .optional but suggested, frees used memory

But maybe you wanted to store A + B to C.  Well that is almost as simple.
Code: [Select]
:A+B→C
Code: [Select]
:#Axiom(CPLXMATH) .varA or varB could be complex
:solve(ᵀ+,Select("varA"),Select("varB"))→Select("varC") .solve( is on the Math Math menu
:solve() .optional, but suggested - frees used memory
In general, solve(ᵀ<op>,<args>) applies <op> to <args>. <op> can be be almost anything from ^, dim( to inString(!
Note: even though Axe changes inString( to inData(, it still does its original function when used in this command. Also, don't close the ( in <op>!

Well that's cool, but can I use Lists you ask? Of course!
Code: [Select]
:L₁∗A→L₂
Code: [Select]
:#Axiom(CPLXMATH) .L₁ or L₂ could be complex lists
:solve(ᵀ∗,Select("L₁"),Select("varA"))→Select("L₂")
:solve() .optional but suggested, frees used memory

But I only wanted to used the 42nd number in L₁ you ask? Well, why not!
Code: [Select]
:L₁(42)‒A→L₂(42)
Code: [Select]
:#Axiom(CPLXMATH) ... see above
:solve(ᵀ‒,Select("L₁",42),Select("varA"))→Select("L₂",42)
:solve() ... see above
Notice how Select( loads or saves to a variable, and solve( applies an operation to loaded variables.

The above code doesn't work if L₁ is too small, you say? Well why don't we resize L₁.
Code: [Select]
:42→dim(L₁)
Code: [Select]
:#Axiom(CPLXMATH) ...you know
:dim("L₁",42) .notice the slight difference in syntax
Note that solve() is unnecessary because dim does not currently use any memory.

I'll bet you forgot about matricies, you say... Nope!
Code: [Select]
:{5,5}→dim([A])
:For(A,1,5)
:For(B,1,5)
:10A+B→[A](A,B)
:End
:End
Code: [Select]
:#Axiom(REALMATH) .only real numbers used AND no arbitrary variable access
:Buff(9)→GDB1 .a temp floating point - they are 9 bytes large
:dim("[A]",5,5)
:For(A,1,5) .remember, A and B are still Axe variables
:For(B,1,5)
:A∗10+B→float{GDB1} .load temp with A∗10+B converted to a floating point
:GDB1→Select("[A]",A,B) .see, I didn't forget matrix support
:solve() .especially important inside loops
:End
:End
Or, if you are familiar with the format of floating point numbers:
Code: [Select]
:#Axiom(REALMATH) .see above
:"[A]"→Str1
:[008100000000000000]→GDB1 .floating point zero, prepared for 2 digit numbers
:dim(Str1,5,5)
:For(A,1,5)
:For(B,1,5)
:A∗16+B→{GDB1+2} .A and B are between 0 and 10 exclusive, treat as bcd digits
:GDB1→Select(Str1,A,B)
:End
:solve() .delete temp memory at least moderately often (~100 bytes at this point!)
:End

Now for an example that actually does something useful.
Code: [Select]
:(-B+√(B²‒4AC))/(2A)→C
:(-B‒√(B²‒4AC))/(2A)→D
Code: [Select]
:#Axiom(CPLXMATH) .obviously
:Buff(9)→GDB2 .declare constants
:Buff(9)→GDB4
:2→float{GDB2} .initialize constants
:4→float{GDB4}
:solve(ᵀ/,solve(ᵀ+,solve(ᵀ-,Select("varB")),solve(ᵀ√(,solve(ᵀ‒,solve(ᵀ²,Select("varB")),solve(ᵀ∗,GDB4,solve(ᵀ∗,Select("varA"),Select("varB")))))),solve(ᵀ∗,GDB2,Select("varA")))→Select("varC")
:solve()
:solve(ᵀ/,solve(ᵀ‒,solve(ᵀ-,Select("varB")),solve(ᵀ√(,solve(ᵀ‒,solve(ᵀ²,Select("varB")),solve(ᵀ∗,GDB4,solve(ᵀ∗,Select("varA"),Select("varB")))))),solve(ᵀ∗,GDB2,Select("varA")))→Select("varC")
:solve()
JK, it doesn't have to be that unreadable. I just wanted to show what you could do if you really wanted to. (Yes, that means you can nest as much as you want, limited only by the amount of memory available.) A normal person might do something more like this:
Code: [Select]
:#Axiom(CPLXMATH) .obviously
:Buff(9)→GDB2 .declare constants
:Buff(9)→GDB4
:2→float{GDB2} .initialize constants
:4→float{GDB4}
:Select("varA")→A .yes you can do that
:Select("varB")→B
:Select("varC")→C
:solve(ᵀ√(,solve(ᵀ‒,solve(ᵀ²,B),solve(ᵀ∗,GDB4,solve(ᵀ∗,A,C))))→D
:solve(ᵀ-,B)→B .pre-calculate stuff
:solve(ᵀ∗,GDB2,A)→A
:solve(ᵀ/,solve(ᵀ+,B,D),A)→Select("varD")
:solve(ᵀ/,solve(ᵀ‒,B,D),A)→Select("varE")
:solve()

Let's return the result in Ans instead of D and E.
Code: [Select]
:(-B+{1,-1}√(B²+i²4AC))/(2A)
i²=-1, but it allows the result to be complex regardless of mode. Similarly, complex constants are used below, with no i component, in order to allow complex answers in any mode.
Code: [Select]
:#Axiom(CPLXMATH)
:[015D]"TEMP"→Str1LT .[015D] must be used instead of the ᴸ before a list in the current version of Axe
:[0C80200000000000000C8000000000000000]→GDB2 .still 2, but complex
:[0C80400000000000000C8000000000000000]→GDB4 .complex floating point 4
:Select("varA")→A
:Select("varB")→B
:Select("varC")→C
:solve(ᵀ√(,solve(ᵀ‒,solve(ᵀ²,B),solve(ᵀ∗,GDB4,solve(ᵀ∗,A,C))))→C .we don't need C anymore
:solve(ᵀ-,B)→B .pre-calculate stuff
:solve(ᵀ∗,GDB2,A)→A
:DelVar Str1LT .Delete ᴸTemp in case it already exists
:solve(ᵀ/,solve(ᵀ+,B,C),A)→Select(Str1LT,1)
:solve(ᵀ/,solve(ᵀ‒,B,C),A)→Select(Str1LT,2)
:Select(Str1LT)→Select("varAns") .yep, that's right
:DelVar Str1LT .no one needs ᴸTemp anymore
:solve() .we are done

Strange OP codes (used instead of ᵀ<token>)
ECEECFED0ED1ED2ED3ED4ED5ED6ED7ED8ED9EDAEDB
npv(irr(bal(∑Prn(∑Int➤Nom(➤Eff(dbd(lcm(gcd(randInt(randBin(sub(stdDev(
EDCEDDEDEEDFEE0EE1EE2EE3EE4EE5EE6EE7EE8EE9
variance(inString(normalcdf(invNorm(tcdf(Χ²cdf(Ϝcdf(binompdf(binomcdf(poissonpdf(poissoncdf(geometpdf(geometcdf(normalpdf(
EEAEEBEECEEDE89E8AE8BE8CE8DE8EE8FE90E91E92E93
tpdf(Χ²pdf(Ϝpdf(randNorm(conj(real(imag(angle(cumSum(expr(length(ΔList(ref(rref(Fill(

Update 0.1: Tutorial added.
Update 0.2: Major bugfix.
Update 0.3: Select( is replaced with get(. Key: seq(

*Warning: Please do not use RealMath unless you are absolutely sure that your code will never see anything that could posibly be complex. (unless you want corrupted mem, etc.) However, use it if you can, since it is smaller and faster.

199
The Axe Parser Project / Re: Bug Reports
« on: October 24, 2011, 02:52:12 am »
jacobly, what do you mean by that?  Do you mean it doesn't display correctly?  How do you think it should be displayed? o.O

What I mean is that GetCalc("LBLAH") does not currently work, because GetCalc requires .db ListObj,tVarLst,"BLAH",0 instead of .db LlistL,"BLAH",0 to be able to find named lists.

EDIT:
In the mean time, "LA" can be replaced with [015D]"A".

And by this I mean that GetCalc([015D]"BLAH") does work correctly.

200
The Axe Parser Project / Re: Bug Reports
« on: October 24, 2011, 01:05:51 am »
Here is an easy one. :)
L appearing inside of a string should expand to db ListObj,tVarLst, not itself.
In the mean time, "LA" can be replaced with [015D]"A".

201
The Axe Parser Project / Re: Bug Reports
« on: October 21, 2011, 11:14:09 pm »
Compiling a program containing only the line (or possibly ending in the line):
Code: [Select]
Copy(L₆,GetCalc("Pic0"),756)
Fails when peep-hole opts are enabled:
Code: (Zooming...) [Select]
ld   hl,plotSScreen
 push hl
 ld   hl,Pic0
 call p_GetCalc
 push hl
 ld   hl,756
 pop  de
 ex   (sp),hl
 pop  bc
 ldir
 ret
p_GetCalc:
 ; ...
Pic0:
 .db PictObj,tVarPict,tPic0
Code: (Compiling...) [Select]
ld   hl,plotSScreen
 push hl
 ld   hl,Pic0
 call p_GetCalc
 push hl
 ld   hl,756
 pop  de
 ex   (sp),hl
 pop  bc
 .db $ed ; ???
p_GetCalc:
 ; ...
Pic0:
 .db PictObj,tVarPict,tPic0
The second one is missing half the ldir and the ret! Also o_PushPop6 was not applied...

202
Axe / Re: Storing Pics
« on: October 21, 2011, 10:11:54 pm »
Just do this Copy(L₆,GetCalc("Pic1",756),756) :)

203
Axe / Re: Axe Q&A
« on: October 21, 2011, 08:04:24 pm »
Going by Axe.inc, {oY1}r is the address and {oY1+2} is the page.
So to answer your question, the pointer comes first.

204
The Axe Parser Project / Re: Bug Reports
« on: October 20, 2011, 09:00:14 pm »
Here is a strange bug:
Code: (axm.z80) [Select]
#include "Axe.inc"
.dw AXM_HEADER

.dw 3
.db AXM_ALL
.dw tok_Load
.db AXM_INLINE
.db AXM_1ARG
 call sub_Axiom2

.dw 1
.db AXM_ALL
.dw 0
.db AXM_SUB
.db AXM_0ARGS
 ret

.dw 0
Code: (A) [Select]
:.AA
:#Axiom(AXM)
:Pic0
:Load()
:Data(255)->Pic0
Code: (B) [Select]
:.BB
:#Axiom(AXM)
:Data(255)->Pic0
:Pic0
:Load()
When A and B are compiled and disassembled:
Code: (AA) [Select]
ld   hl,$9d9c
 call $9d9c
 ret
 ret
 .db $ff
Code: (BB) [Select]
ld   hl,$9d9c
 call $9d9d
 ret
 .db $ff
 ret
In AA the data pointer is wrong, and in BB the second axiom comes after the data. ???

205
The Axe Parser Project / Re: Axiom Requests
« on: October 20, 2011, 12:19:14 pm »
Cool! Will try it out. Also, is there a way to edit a mimas program's appvar in text on a pc? I know that sort of defeats the purpose of using mimas in the first place, but it would be nice to transfer asm code that you were working on from your pc to the calc so you can code on the go.

Check out tools/8xvtoasm.exe and tools/asmto8xv.exe in the mimas folder, assuming you know command line.
EDIT: which you obviously do, if you are compiling assembly ;)

206
The Axe Parser Project / Re: Axiom Requests
« on: October 20, 2011, 03:22:47 am »
I actually was doing that at one point, so it is possible, but I kept forgetting the axiom format :P
Anyway, since I can't upload files yet, here is a link to a Mimas version of Axe.inc.

I changed axv_Theta to axv_θ since Mimas supports the theta character.
Also, since Mimas doesn't support macros:
Code: [Select]
;REP_NEXT becomes:
 DB   REP_NEXT
 RORG PC-1
;REP_NEXT(x) becomes:
 DB   REP_NEXT_OFF,x
 RORG PC-2

207
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: October 09, 2011, 10:16:40 am »
Speed optimization for p_CheckSum by using an absolute jump.
Code: (Old Code: 19 bytes, 63.5*n+37 cycles) [Select]
p_CheckSum:
.db __CheckSumEnd-$-1
ld b,h
ld c,l
pop af
pop hl
push af
xor a
ld d,a
__CheckSumLoop:
add a,(hl)
ld e,a
jr nc,$+3
inc d
cpi
ex de,hl
ret po
ex de,hl
jr __CheckSumLoop
__CheckSumEnd:
Code: (New Code: 19 bytes, 44.5*n+65 cycles) [Select]
p_CheckSum:
.db __CheckSumEnd-$-1
ld b,h
ld c,l
pop af
pop hl
push af
xor a
ld d,a
__CheckSumLoop:
add a,(hl)
jr nc,$+3
inc d
cpi
jp pe,__CheckSumLoop
ld h,d
ld l,a
ret
__CheckSumEnd:

208
The Axe Parser Project / Re: Features Wishlist
« on: October 09, 2011, 12:49:52 am »
Yeah, I actually started calc programming 6 years ago.
I didn't even know there was a calc programming community until I found revsoft 2 years later.

209
Axe / Re: Modifying real numbers from ram ---AXE PARSER
« on: October 09, 2011, 12:42:23 am »
try 5 > float{B}
that way, it converts 5 to a real number before storing it to address B

210
The Axe Parser Project / Re: Features Wishlist
« on: October 08, 2011, 11:29:52 pm »
If you really need line clipping, you can use this 449 byte routine (not including the subroutines used).
The routine uses the full signed 16-bits of each parameter, however it fails for large |x2-x1| and/or large |y2-y1| due to overflow
Code: [Select]
:Lbl LineC
:If r4<<r2
:r1->r5:r3->r1:r5->r3
:r2->r6:r4->r2:r6->r4
:End
:ReturnIf r4<<0
:ReturnIf r2>=>=64
:r1-r3->r5
:r4-r2->r6
:If r2<<0
:r4*r5//r6+r3->r1:0->r2
:End
:If r4>=>=64
:r2-63*r5//r6+r1->r3:63->r4
:End
:If r3<<r1
:r1->r5:r3->r1:r5->r3
:r2->r6:r4->r2:r6->r4
:End
:ReturnIf r3<<0
:ReturnIf r1>=>=96
:r2-r4->r5
:r3-r1->r6
:If r1<<0
:r3*r5//r6+r4->r2:0->r1
:End
:If r3>=>=96
:r1-95*r5//r6+r2->r4:95->r3
:End
:Line(r1,r2,r3,r4)
:Return

Pages: 1 ... 12 13 [14]