Author Topic: Axe Parser  (Read 496222 times)

0 Members and 2 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 #1515 on: November 17, 2010, 06:37:15 pm »
Unrelated, but I couldn't find the appropriate topic: Congrats to Quigibo for his Puyo Puyo feature!




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1516 on: November 18, 2010, 08:43:28 pm »
Yeah true, I think it might be best to have programmers learn to not close parhentesises and brackets when possible. Their code is more readable this way. Only leave them open if you're extremly tight on RAM (if you have a lot of comments, for example).

And yeah congrats for Puyo Puyo feature :D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Parser
« Reply #1517 on: November 19, 2010, 07:25:59 am »
If you want a really extreme optimization for or-ing the screen, here it is.  It will be noticeably faster and smaller:

Code: [Select]
.# represents the 16-bit or operation
L₆→A
While -768-L₆
{A}ʳ#{A+L₃-L₆}ʳ→{A}ʳ+1→A
End

This is old, but, what does or-ing two buffers do do each other?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1518 on: November 19, 2010, 08:13:49 am »
It's like TI-Basic Recallpic, where all the black pixels from the second buffer are combined with those in the first buffer.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1519 on: November 19, 2010, 09:39:44 am »
That can be useful sometimes, for example if you want to do a transition or animation where the entire grayscale turns black.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1520 on: November 25, 2010, 11:11:32 am »
Question relating to memory storage and displaying screen:
I want to store, display, and manipulate a 64x64 portion of the screen.
Specifically, I want to take data I have stored in L1, copy it over to the buffer or backbuffer, then use Dispgraph to update the screen, or take data from the buffer and copy to L1.
This part I'm fairly certain I can do, using the code below (which I haven't actually tested yet)
Code: [Select]
For(Z,0,15)
    Copy({Z*24+L6},{Z*16+L1},16)
End
but if anybody sees a problem (or has a better way of doing this), I'd be grateful.

Also, the data in L1, I want to be able to manipulate bit by bit.  So if I were to have this snippet of data:
F32C
I want to be able to treat it like this:
1111
0011
0010
1010
(Just to make sure I have my terminology down, this would be equal to 2 nibbles or 1 byte or 16 bits Edit: 4 nibbles, 2 bytes, 16 bits.)
In this format, I'd like to do things like check around a specific entry to see the total value of the bits 'surrounding' it (if it were treated like a matrix).
However, I don't know how I would do this.

In summary:
1) Request for possible better alternative to my routine
2) Request to take data stored in L1, and manipulated it on the bit level.

Sorry if this isn't making much sense.
« Last Edit: November 25, 2010, 11:20:15 am 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 FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Axe Parser
« Reply #1521 on: November 25, 2010, 11:17:51 am »
F32C
I want to be able to treat it like this:
1111
0011
0010
1010
(Just to make sure I have my terminology down, this would be equal to 2 nibbles or 1 byte or 16 bits, yes?)
Well that would actually be 2 bytes (so 4 nibbles and 16 bits). 1 bytes would be 8 bits. Otherwise, you were right.

And I believe there is a bit-reading command in Axe, but I haven't used it so I can't be of much help there.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1522 on: November 25, 2010, 11:25:02 am »
Ah, thanks, FinaleTI.  I knew I made a mistake somewhere...

Hmm, bit-reading command?
I'm not seeing it... (unless it's all those esoteric commands in the 'Advanced Math' section of the commands list...)
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 squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Parser
« Reply #1523 on: November 25, 2010, 11:27:31 am »
The bit reading command's syntax is as follows:

EXP1eEXP2 where EXP1 is the pointer (or it could be inline data) and EXP2 is the bit number (0-7) of the pointed to byte. So if you wanted to read the 1st bit of the byte in L1 you would use L1e1

As for writing to bits, this thread might help

Oh and you don't need the curly brackets in the arguments of your Copy command
« Last Edit: November 25, 2010, 11:31:45 am by squidgetx »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1524 on: November 25, 2010, 11:30:34 am »
You work with bytes, not nibbles (A nibble is four bits. There are two nibbles to a byte.)
Also, Copy( works like "Copy(SOURCE,DESTINATION,SIZE)"
So your first code segment is actually this:
Code: [Select]
For(Z,0,63)
  Copy(Z*8+L1,Z*12+L6,8)
End
You have 64 rows, numbered 0-63. 64 bits are 8 bytes, so we multiply Z by 8 then add it to L1. A row on the screen is 96 bits (and therefore 96/8=12 bytes), so we multiply Z by 12 and add L6. The 8 is for the same reason as two sentences ago.

You cannot work directly with bits for the most part. [F32C] is like this, actually:
Code: [Select]
11110011
00101100
To manipulate bits, you need to use e (Euler's e) and e^(
e works like this:
Code: [Select]
b00100000e2which returns 1 because the 2nd bit, from left to right, indexed from 0, is a 1.
e^( works like this:
Code: [Select]
e^(5)which returns b00100000 because the 1 is in the 5th position, from right to left, indexed from 0.

Edit: ninja'd...
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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 #1525 on: November 26, 2010, 03:18:09 pm »
I'm in the process of writing menus for the Maxwell's Demon port, and I tried to make a sort of optimized, universal menu.  For some reason, it doesn't work.
Thing is, the loop is in a subroutine.
I was wondering if there is a size limit to a subroutine, or are there any commands that won't work in a subroutine.
I'll type out the code, just wanted to get the question out.
Vy'o'us pleorsdti thl'e gjaemue

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Axe Parser
« Reply #1526 on: November 26, 2010, 03:31:02 pm »
i'm pretty sure you could put your whole game into a subroutine and it'd still run correctly. since when a subroutine is called all it does is just change a pointer (well, actually a register)to point at the beginning of the subroutine and start executing the code there until it reaches a Return statement.


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 #1527 on: November 26, 2010, 03:48:55 pm »
A and B are used to select the options, C is the # of options.
Code: [Select]
PRGM:AMENUSRC
.AMENU
Lbl MM
ClrHome
Fix 3
Disp " A GENERIC MENU "
.has to be 16 chars
Fix 2
Disp " Play Game",i," Options",i," Quit"
3→C
Sub(SEL)

If A=1
Disp "GAME"

.Game content here

.End of game, go to main menu
Goto MM
End

.Can nest as so
If A=2
Lbl OPT
Fix 3
Disp "Options         "
Fix 2
Disp " Something",i," Something else",i," Get the point"
3→C
Sub(SEL)
.Responses, may contain more sub-menus
Goto MM
End

If A=3
.last option, has to be quit for it to work correctly
Return
End


Lbl SEL
1→A→B
Output(0,A,5►Char
Repeat getKey(54)
ReturnIfgetKey(15)
A+getKey(1)-getKey(4)→B
!If A=B
!IF B:C→B:End
If B=C+1:1→B:End
Output(0,A," "
.that's 1 space
Output(0,B,5►Char
B→A
Pause 475
End
End
ClrHome
.Return
It displays, I just can't get the ► to move up and down.
Vy'o'us pleorsdti thl'e gjaemue

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Parser
« Reply #1528 on: November 26, 2010, 05:08:06 pm »
Quote
Code: [Select]
If B=C+1:1→B:End

should be

Code: [Select]
If C+1=B:1→B:End
:P

Don't forget about (the lack of) order of operations :) You're old code added one to whatever the value of B=C was, so that If condition would ALWAYS be true; hence, why you couldn't move the cursor around (because B was getting reset to 1 every iteration)
« Last Edit: November 26, 2010, 05:46:08 pm by squidgetx »

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 #1529 on: November 26, 2010, 05:45:14 pm »
Quote
Code: [Select]
If B=C+1:1→B:End

should be

Code: [Select]
If C+1=B:1→B:End
:P

Don't forget about (the lack of) order of operations :) You're old code added one to whatever the value of B=C was, so that For loop would ALWAYS be true; hence, why you couldn't move the cursor around (because B was getting reset to 1 every iteration)
That might be it...I'll try it.

EDIT...
* Darl181 doesn't like RAM clears
Normally, it wouldn't be a problem, but the archive screwed up as well :(

Okay, back to normal, just lost the menu thing...which I pretty much have memorized anyway :P
« Last Edit: November 26, 2010, 06:46:58 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue