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 - Quigibo

Pages: 1 ... 105 106 [107] 108 109 ... 135
1591
Axe / Re: Transitioning from TI-Basic to Axe Basic
« on: May 01, 2010, 12:14:29 pm »
Yeah, it must be a bug then, I'll look into it.

1592
ASM / Re: ASM Optimized routines
« on: May 01, 2010, 03:19:23 am »
Okay, turns out the condition testing was actually taking up more space then it was saving.  My brain hurts anyway, so I give up.

I did manage to improve my existing code by a couple bytes and it makes more sense now, but rounding is apparently still backwards.  Feel free to use it if anyone needs it.
Code: [Select]
SignedDivision:
ld a,h
xor d
push af

bit 7,h
jr z,$+8
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a

bit 7,d
jr z,$+8
xor a
sub e
ld e,a
sbc a,a
sub d
ld d,a

call RegularDivision

pop af
add a,a
ret nc

xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ret

1593
ASM / Re: ASM Optimized routines
« on: April 30, 2010, 10:41:52 pm »
I am.  But I found I can actually use a bit from one of the registers instead to hold the state of the operation instead of using SMC or even an app flag if I run out of registers.

1594
ASM / Re: ASM Optimized routines
« on: April 30, 2010, 10:09:03 pm »
Yeah, that's what the first 5 pages of Google said when I was looking, but I still have a feeling that there might be one that is rare or undiscovered that can do it faster.  I'm going to try experimenting.  Maybe I can use some SMC to sometimes add the quotient to the accumulator and sometimes subtract it depending on the sign of the numbers.

EDIT: Oooo! I just tried messing around with this!  It works!  I just need to work on a few details first.

1595
Miscellaneous / Re: English language reform
« on: April 30, 2010, 09:51:02 pm »
From what I've compared to with other languages, English is a relatively easy language to learn to speak, but is a hard language when it comes to spelling, proper grammar, ambiguous statements, and other technical details due to how many exceptions there really are.  Even native English speakers who see an unfamiliar word often have trouble trying to guess the proper pronunciation.

But despite this, there are a lot less exceptions when it comes to forming sentences than you might think.  English only has 4 or 5 different verb conjugations for instance while Spanish for instance has over 50 when you include the fact that you need to use a different verb when referring to different groups of people or objects.  Also, English doesn't have masculine or feminine noun conjugations.

Overall, I'd say its on the easier side of the language spectrum.

1596
ASM / Re: ASM Optimized routines
« on: April 30, 2010, 09:32:43 pm »
Ooooh, okay, then that means my regular signed division routine is wrong then x.x  I'll have to fix it somehow.

I'm just going to put a copy of it here in its current state if anyone sees any optimizations I can make.  I felt pretty ashamed when I made it because it feels like such a dirty work around.  There has to be some real algorithm that exists to perform signed division non-naively right?

Code: [Select]
;Divides HL by DE and stores to HL
SDiv:
ld a,h
add a,a
jr nc,$+9
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
scf

rra
xor d
push af
bit 7,d
jr z,$+8
xor a
sub e
ld e,a
sbc a,a
sub d
ld d,a

call Divide

pop af
add a,a
ret nc

xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ret

1597
Axe / Re: Transitioning from TI-Basic to Axe Basic
« on: April 30, 2010, 09:20:09 pm »
Interesting... Parentheses et al. can still cause errors if mismatched, though, (e.g. For(X,L3,L3+10:{X-1->X:End, w/new lines instead of just colons, causes an ERROR:BLOCK for me) Maybe you could document what is and isn't valid?
Really?  That should be proper syntax.  What you're telling the parser to do is to store the value X-1 into X and then read the data at that new location and do nothing with it.  If instead, you want the data at the location X-1 to store into X, then you need the closed parenthesis for this case.

If you're ever getting an error from not closing the parenthesis, let me know, becasue that should never happen, axe always adds the parenthesis at the end for you automatically like basic.  So when you type:

:{X-1->X

The parser should automatically put parenthesis at the end to make:

:{X-1->X}

And NOT this:

:{X-1}->X

As you use Axe more often, you find it is very convenient to use the arrow operator inline than it is to use it by itself.  It also optimizes the code size and speed significantly when used properly.  I can't make everything you typed so far just end every time you store, otherwise, you can't do these very efficient optimizations and coding tricks like for example: Fill(X->{L1},99) to fill ram at L1 with 100 copies of X.

1598
ASM / Re: ASM Optimized routines
« on: April 30, 2010, 08:31:55 pm »
Signed division by 2 is just sra h \ rr l.

But what about -1/2?  Shouldn't that give 0?  Because if you do that operation to %11111111 11111111 it remains -1.  Or does this routine always round up in magnitude instead of down?  It might throw some people off since it would be inconsistent with my regular unoptimized signed division routine.

1599
Axe / Re: Transitioning from TI-Basic to Axe Basic
« on: April 30, 2010, 08:19:14 pm »
Its actually far more lax than BASIC.  Its just the change of some of the operators that might be confusing you.  The store arrow in BASIC used to mean store everything that came before it to a variable.  Now, it means store the current expression stack into a variable so you now have the freedom to use it inline.  And Axe doesn't really care much about using the enter button.  These are the same:

:A->C
:E->D

:A->CE->D

And things like this:

:A+1->A
:If A=10
:End

can reduce to this:

:If A+1->A=10
:End

And another thing most people don't know about.  The answer always carries over to the first argument of the commands.

:X
:Pxl-On(,Y)

Is actually the same as Pxl-On(X,Y) since the last expression was X and carried over.

1600
ASM / Re: ASM Optimized routines
« on: April 30, 2010, 03:47:57 pm »
Axe Parser could improve with a option to make it optimize for speed instead of the size default.
Yeah, I'm planning to do that eventually.

Actually, I found out my optimized signed division by 2 doesn't work, so that's up in the air too now.  Also, would multiplying by negative 2 be do-able in 6 bytes?  It can certainly be done in 7 so it seems possible maybe using some trick?

EDIT: also, is the daa instruction ever useful for optimizations? I can't think of how I would use it other than floating point math.

1601
The Axe Parser Project / Re: Axe Parser
« on: April 30, 2010, 03:41:13 pm »
I had the file renamed in the update, so I think it reset the stats.

1602
ASM / Re: ASM Sound Routine
« on: April 29, 2010, 11:40:45 pm »
If you just want beeps and bloops to play a melody during a game, the Pyoro source code had a note reader and player that you can use and also kind of has some macros to simplify editing music.

On the other hand, if you want high quality sound or music that doesn't need to be rendered at the same time as the game, try Real Sound.

And on the third hand, if you want some medium quality music to play while the game is going, you'll have to ask calc83 becasue he's the only one I've seen actually pull it off well, or at least I trust he has, I haven't actually used it.  I think it requires 15MHz mode for this option.

1603
The Axe Parser Project / Re: The Axe Pages
« on: April 29, 2010, 11:19:00 pm »
It means that in addition to the bytes required for the command, there is also a subroutine that has to be added to the program.  The subroutines are shared though, so if you make 10 divisions by unoptimized constants in your code, and the division routine is 20 bytes (I don't know what it actually is offhand), then the amount of size it would take up would be 10*6 + 20 since every call uses 6 bytes and the subroutine itself is 20.

I've actually already updated that for the next version since I had so many optimizations to add to the list.

1604
ASM / Re: ASM Optimized routines
« on: April 29, 2010, 07:34:45 pm »
It's nothing big.  Mostly it just extend multiplication, modulus, and addition to higher powers of 2.  The big optimizations won't come for a long time unfortunately.  Functionality is more important right now.

By the way, is there a better way to display hl at the coordinates (xx,yy) than this?
Code: [Select]
B_CALL(_SetXXXXOP2)
B_CALL(_Op2ToOP1)
ld hl,$yyxx
ld (PenCol),hl
ld a,5
B_CALL(_DispOP1A)

Its seems really roundabout to me.  Is there a bcall I don't know about that does this automatically?

1605
ASM / Re: ASM Optimized routines
« on: April 29, 2010, 06:58:39 pm »
Okay, that's good.  I spent hours trying to optimize some of these using all the tricks I know.  That reassures me it was a wild goose chase.

Pages: 1 ... 105 106 [107] 108 109 ... 135