Author Topic: Axe Parser  (Read 565384 times)

0 Members and 3 Guests are viewing this topic.

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 Parser
« Reply #1695 on: February 01, 2011, 10:29:17 am »
So, that would be like Getcalc(Ans)?  The goal is to store a token, either two-byte or one-byte, into ans.

Oh, there's a command in Axe for that: →Ans. So if you want to store the prgm token to Ans, it's just Tprgm→Ans.




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 Parser
« Reply #1696 on: February 01, 2011, 10:53:11 am »
The goal, in the end, is to store a token defined by a number (either 1-byte or two-byte).
Letting A be the token #:  T{A}→Ans
Would that work?
« Last Edit: February 01, 2011, 10:53:52 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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 Parser
« Reply #1697 on: February 01, 2011, 11:57:11 am »
Well, no. If A is the number of the token, just do A→Ans. It's just EXP→Ans, where EXP is the expression (one-byte or two-byte, doesn't matter since it gets extended to two bytes anyway) you want stored.




Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1698 on: February 02, 2011, 10:18:43 pm »
Unfortunately I haven't really had time to add much more to Axe other than the Axioms, and I can't get my mode 7 engine working properly and I might have to rewrite it from scratch.  So I think I will instead release more betas since there are so many more features that need to be worked on before 1.0.0.  Instead I might just release a VAT based Axiom for reading from the VAT efficiently since that's both useful and quick to make.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1699 on: February 02, 2011, 11:23:19 pm »
Want these? They were for the InsertMem/DelMem axiom I made a short while ago, so if you're making VAT commands, they could be useful to you. I didn't heavily test them, but they looked pretty good to me.


Code: (InsertMem) [Select]
;---------> InsertMem <---------;
;B_CALL(_InsertMem) with checks to make sure there is enough RAM and the insertion address is okay
;
;INPUTS: Arg1: Pointer to start of variable according to GetCalc()
; Arg2: Offset in variable to insert RAM
; Arg3: Number of bytes to attempt to insert
;
;OUTPUTS: 0 if not enough RAM or Arg2 is out of range
; Nonzero if successful

p_InsertMem:
;REGISTERS: hl=Arg3
;STACK: | Ret | Arg2 | Arg1 | ...
B_CALL(_EnoughMem) ;Check if enough RAM
;REGISTERS: de=Arg3
;STACK: | Ret | Arg2 | Arg1 | ...
pop hl ;Rearrange arguments and stack
pop bc
ex (sp),hl
;REGISTERS: bc=Arg2 de=Arg3 hl=Arg1
;STACK: | Ret | ...
jr c,__InsertMemFail0Args ;Return failure if not enough RAM
dec hl ;Get current variable size
ld a,(hl)
dec hl
push hl
ld l,(hl)
ld h,a
;REGISTERS: bc=Arg2 de=Arg3 hl=current variable size
;STACK: | Arg1-2 | Ret | ...
sbc hl,bc ;Check if offset is outside of variable
jr c,__InsertMemFail1Arg ;Return failure if offset is outside of variable
add hl,bc
;REGISTERS: bc=Arg2 de=Arg3 hl=current variable size
;STACK: | Arg1-2 | Ret | ...
add hl,de ;Calculate final variable size
ex de,hl
ex (sp),hl
;REGISTERS: bc=Arg2 de=final variable size hl=Arg1-2
;STACK: | Arg3 | Ret | ...
ld (hl),e ;Store final variable size
inc hl
ld (hl),d
inc hl
;REGISTERS: bc=Arg2 de=final variable size hl=Arg1
;STACK: | Arg3 | Ret | ...
add hl,bc ;Calculate RAM insertion address
ex de,hl ;Prepare arguments for _InsertMem
pop hl
;REGISTERS: bc=Arg2 de=Arg1+Arg2 (RAM insertion address) hl=Arg3 (bytes to insert)
;STACK: | Ret | ...
B_CALL(_InsertMem) ;Insert memory
;REGISTERS: de=RAM insertion address hl=a lot (negative size of a VAT entry?)
;STACK: | Ret | ...
ret ;Result is always nonzero
__InsertMemFail1Arg:
pop hl
__InsertMemFail0Args:
ld hl,0
ret
__InsertMemEnd:

Code: (DelMem) [Select]
;---------> DelMem <---------;
;B_CALL(_DelMem) with checks to make sure that the deletion address and size are okay
;
;INPUTS: Arg1: Pointer to start of variable according to GetCalc()
; Arg2: Offset in variable to delete RAM
; Arg3: Number of bytes to attempt to delete
;
;OUTPUTS: 0 if Arg2+Arg3 is out of range
; Nonzero if successful

p_DelMem:
;REGISTERS: hl=Arg3
;STACK: | Ret | Arg2 | Arg1 | ...
pop af ;Rearrange arguments and stack
pop bc
pop de
push af
push hl
;REGISTERS: bc=Arg2 de=Arg1 hl=Arg3
;STACK: | Arg3 | Ret | ...
add hl,bc ;Calculate offset of end of deletion
jr c,__DelMemFail ;Return failure if offset+size was so big that it overflowed
ex de,hl
;REGISTERS: bc=Arg2 de=Arg2+Arg3 hl=Arg1
;STACK: | Arg3 | Ret | ...
dec hl ;Get current variable size
ld a,(hl)
dec hl
push hl
ld l,(hl)
ld h,a
;REGISTERS: bc=Arg2 de=Arg2+Arg3 hl=current variable size
;STACK: | Arg1-2 | Arg3 | Ret | ...
sbc hl,de ;Check if end is outside of variable
pop de ;Early pop to avoid having fail condition requiring 2 pops
;REGISTERS: bc=Arg2 de=Arg1-2 hl=current variable size - (Arg2+Arg3)
;STACK: | Arg3 | Ret | ...
jr c,__DelMemFail ;Return failure if end is outside of variable
add hl,bc ;Add back offset to get final variable size
;REGISTERS: bc=Arg2 de=Arg1-2 hl=final variable size
;STACK: | Arg3 | Ret | ...
ex de,hl ;Store final variable size
ld (hl),e
inc hl
ld (hl),d
inc hl
;REGISTERS: bc=Arg2 de=final variable size hl=Arg1
;STACK: | Arg3 | Ret | ...
add hl,bc ;Calculate RAM deletion address
pop de ;Prepare size argument for _DelMem
;REGISTERS: bc=Arg2 de=Arg3 (bytes to delete) hl=Arg1+Arg2 (RAM deletion address)
;STACK: | Ret | ...
B_CALL(_DelMem) ;Delete memory
;REGISTERS: de=Arg3 (bytes to delete) hl=a lot (negative size of a VAT entry?)
;STACK: | Ret | ...
ret ;Result is always nonzero
__DelMemFail:
pop hl
ld hl,0
ret
__DelMemEnd:

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1700 on: February 03, 2011, 10:58:17 pm »
Good luck quigibo!

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 Parser
« Reply #1701 on: February 04, 2011, 02:47:29 pm »
[noobish question]What are tilemaps, and how do I use them?[/noobish question]
The ultimate goal is to get a sort of smmothscrolling, specifically for Tio.
Vy'o'us pleorsdti thl'e gjaemue

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1702 on: February 04, 2011, 02:54:05 pm »
[noobish question]What are tilemaps, and how do I use them?[/noobish question]
The ultimate goal is to get a sort of smmothscrolling, specifically for Tio.

If you've ever played pokemon, you should have noticed how (for example) nearly every patch of grass is the same, the roads are fairly identical looking (at least in the older games), and that one patch of water is fairly identical to another patch of water.

A tilemap basically creates a grid, assigns a number to each square in that grid, and based on that number, displays a certain sprite.  It's just an efficent way to display large amounts of background.  Most RPGs use tilemaps, and I think all calculator RPGs use tilemaps of some sort.

It can also be used for level design -- if you look at the sliding games released recently (Psyche and CuBeS (did I capitalize that right?)) have a grid-like design, and use tilemaps.
« Last Edit: February 04, 2011, 02:55:24 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

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 Parser
« Reply #1703 on: February 04, 2011, 06:29:50 pm »
So, basically what I've been doing (TWHG, lightoff, tio)...I thought they were more complex than that...
For the second part.  Is there sone sort of built-in way to do them, or do I have to do the For( loop myself?  And what is the syntax for using the [Pic#]r thing?
Quote from: two posts up
The ultimate goal is to get a sort of smmothscrolling
« Last Edit: February 04, 2011, 06:31:52 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1704 on: February 04, 2011, 07:17:59 pm »
Really no built-in way to do tilemaps (as far as I know).  Basically, you have to create the 'for' loops yourself, and make your own drawing routines.

The [Pic#r]...  Hmm...
By that, do you mean the sort of 'import tilemap' thing?  I've never used it, so I can't really help, but I would think it would take the picture in a picvar, divide it up into 8x8 chunks, and return a pointer to the start of the tiles, which might aid in reusing tiles from hybrid Basic games.  Or something.
I would try something like this:
Code: [Select]
[Pic1r]->Pic000
Pt-On(10,10,Pic000)
Pt-On(18,10,Pic000+8)

For smoothscrolling, there are two ways I know:
1) Create a pixel-based offset for the start of the tilemap, and keep shifting the tilemap and redrawing it every time (this is a bad method, inefficent).
2) Use Horizontal or Vertical to shift the image over, and draw the bare minimum of tiles you need to refresh the screen (either the column or the row that needs to be filled).  Runer's uber tilemapper uses this method, or something similar - you should try looking for the thread elsewhere in this subforum.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

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 Parser
« Reply #1705 on: February 04, 2011, 09:51:02 pm »
If you're meaning this one ? it's kind of confusing to learn from, but I get what you mean.
http://ourl.ca/7765/137919


EDIT: just realized, axe is over a year old...
« Last Edit: February 05, 2011, 05:20:49 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1706 on: February 05, 2011, 11:29:44 pm »
Happy birthday Axe.

Not only Axe is 1 years old, it's the project that had the most attention in Omni history with 12000+ posts in its sub-forum. O.O (The second one was Ultima V, I think)

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Parser
« Reply #1707 on: February 05, 2011, 11:32:53 pm »
Happy B-day Axe!!!!!!!!!!!!!!  :hyper: :hyper: :hyper: :hyper: :hyper: :hyper:
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:





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 Parser
« Reply #1708 on: February 05, 2011, 11:50:38 pm »
Happy birthday Axe.

Not only Axe is 1 years old, it's the project that had the most attention in Omni history with 12000+ posts in its sub-forum. O.O (The second one was Ultima V, I think)

Epic. That's OVER 9000!!! By a lot O.O
* Deep Thought loves Axe




Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #1709 on: February 06, 2011, 12:17:36 am »
Thank you Quigibo!  I'm so glad you decided to share it with the community! ;D