Author Topic: Axe Parser  (Read 554242 times)

0 Members and 11 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 #1320 on: October 03, 2010, 10:08:16 pm »
D'oh! I could have used that to save like fifty bytes off Simul :P




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 #1321 on: October 03, 2010, 11:58:35 pm »
I use DS<() a lot in Supersonic Ball, because the animation speed for sprites/tiles varies from a level to another.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1322 on: October 04, 2010, 03:54:38 pm »
While we're on the topic of optimizations... Would something like A-128≥≥0 be more optimized than A≥≥128? And if so, why is the ≥≥CONST entry in Auto Opts.txt listed as taking a whole 11 bytes more than ≥≥0?
« Last Edit: October 04, 2010, 03:55:35 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 Parser
« Reply #1323 on: October 04, 2010, 04:00:09 pm »
≥≥0 doesn't really require any code at all in ASM. Every other test really does what you did above: it subtracts the value to test for, and see how the answer compares to zero.




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1324 on: October 04, 2010, 04:21:53 pm »
≥≥0 definitely requires code, as it needs to check the sign bit and return it's inverse. And I'm also wondering why ≥≥CONST is 11 bytes larger than ≥≥0, because it seems to me that it could be optimized to just combine -CONST and ≥≥0 and only be 4 bytes larger.
« Last Edit: October 04, 2010, 04:23:42 pm by Runer112 »

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 #1325 on: October 04, 2010, 04:24:31 pm »
While we're on the topic of optimizations... Would something like A-128≥≥0 be more optimized than A≥≥128? And if so, why is the ≥≥CONST entry in Auto Opts.txt listed as taking a whole 11 bytes more than ≥≥0?
A-128≥≥0 will fail for 128 values close to -32768. That's because after you subtract 128, they become positive and then the comparison will think it is greater. The ≥≥CONST routine takes this into account.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1326 on: October 04, 2010, 04:55:57 pm »
Ah right, I didn't think of that...

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 #1327 on: October 08, 2010, 10:51:50 pm »
I'm kind of new to programming, and there are a few things I'm unfamiliar with.
1. What is a nibble?
2. What can you do with nibbles?
3. In what kind of situation would nibbles be useful?
4. How are nibbles used?
« Last Edit: October 08, 2010, 10:52:12 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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 #1328 on: October 08, 2010, 11:00:24 pm »
A one or zero is a bit.
4 bits = 1 nibble
8 bits = 1 byte
16 bits = 1 word

Get it!? Half of a bite!  ;D  It's hilarious how so many terms in computer and electrical engineering are either about food or sex.  It just shows what goes on in the mind of a programmer...

You can hold 2 nibbles in 1 byte so they're mostly used for compression if you don't need 256 possible values and can use just 16 then you're using half the memory.
« Last Edit: October 08, 2010, 11:02:22 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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 #1329 on: October 08, 2010, 11:04:40 pm »
So you could theoretically halve the space a variable takes?
4. How are nibbles used? commands list, right?
« Last Edit: October 08, 2010, 11:05:31 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline tloz128

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 324
  • Rating: +58/-6
  • I feel asleep.
    • View Profile
Re: Axe Parser
« Reply #1330 on: October 08, 2010, 11:18:30 pm »
Um... what computer terms get their names from sex?
Naaa... Na Nah Na Nana Na Nah... Hey Jude!

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 #1331 on: October 09, 2010, 05:08:25 am »
Its mostly electrical terms.  Like male and female connectors, wire strippers, tickler coil, screws, nuts, etc.

You don't "halve" a variable unless you can actually do it.  If the variable has to hold more than 16 possible unique values then a nibble is not sufficiently large enough to hold your data so you would have to use a byte or word instead.  Some tile mappers for instance might always use 16 or fewer tiles per room and so you can load a palette for each group of rooms and then compress the maps to half the size.

Another example is if your character is always aligned to an 8x8 grid, then the X,Y coordinates can be written to a single byte rather than a separate byte for each variable since there are only 12 X possibilities and 8 Y possibilities.  Keep in mind though, that you should only do this if memory is a problem.  Accessing bytes, and sometimes words, is actually fastest and smallest in the program when it comes to reading memory even though the actual data is bigger.
« Last Edit: October 09, 2010, 05:13:58 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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 #1332 on: October 09, 2010, 12:06:04 pm »
That makes sense.  Thanks!

quote author=tloz128 link=topic=1453.msg72139#msg72139 date=1286594310]
Um... what computer terms get their names from sex?
[/quote]
Can't say I've looked into that much...
« Last Edit: October 09, 2010, 12:06:19 pm 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 #1333 on: October 09, 2010, 06:35:02 pm »
FOOD ... j/k ;D

Btw, here's an example where nibbles are really useful.




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 #1334 on: October 14, 2010, 12:07:00 am »
Another question.
The game I've been working of, TWHG, currently has a basic and space-consuming way of naming the levels.
Code: [Select]
"appvWHGLVL1"→Str01
"appvWHGLVL2"→Str02
"appvWHGLVL3"→Str03
...And so on
"appvWHGLVL9"→Str09

.A is the level number
.↓Reference like this
Str01+(A*9)

I tried optimizing it.
Code: [Select]
"appvWHGLVL0"→Str0V
.A is the level number
A→{Str0V+7}
Ideally, this would change the number in the Str0V and so reference a different appvar.
So far, I haven't had much luck with it.
Does anybody have any ideas how to get this to work? ???
Vy'o'us pleorsdti thl'e gjaemue