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

Pages: 1 ... 62 63 [64] 65 66 ... 153
946
The Axe Parser Project / Re: The Axe Issue Tracker (sort of)
« on: December 18, 2011, 08:03:18 pm »
Updated for the past week of bug reports, feature requests, and optimization suggestions. Also updated for the release of Axe 1.1.1! ;D

947
The Axe Parser Project / Re: Bug Reports
« on: December 18, 2011, 06:09:36 pm »
I think in the process of fixing replacements in Axioms in 1.1.0, another bug was introduced. Now, if I reference an Axe command or another Axiom command in my Axiom, I get two copies of the referenced command in the compiled code. D:

948
Axe / Re: Axe Q&A
« on: December 17, 2011, 01:08:11 pm »
Yes. X?Y produces the same code as If X : Y : End, and X?Y,Z produces the same code as If X : Y : Else : Z : End.

949
Axe / Re: Axe Q&A
« on: December 17, 2011, 01:01:04 pm »
The general rule is, if the command token starts with a capital letter, it has to be at the start of a line.

950
Axe / Re: Axe Q&A
« on: December 17, 2011, 12:57:26 pm »
getKey(2)?X--
Evidently not, when I tried something like that it threw an error at compile-time. :/

I get no such error, and there should be no difference between the two syntaxes. You mentioned something about Pt-X commands not working in them, and this is true, but not because of a syntax difference. It's because Axe requires that some comamnds start a line, and the Pt-X commands are among them, so you can't use them mid-line in an inline conditional.

951
Axe / Re: Axe Q&A
« on: December 16, 2011, 07:55:41 pm »
That's one of the advantages of compiled languages. Larger source code does not mean larger compiled code. You can add line breaks and comments and long-named labels all you want; the compiled code will always be the same size.

952
Axe / Re: [Mini Tutorial] How to flip around 8x8 sprite data
« on: December 16, 2011, 11:54:07 am »
It's probably worth mentioning that, for flipping sprites during program execution, you don't have to implement those algorithms yourself. Just use the built-in flipH() and flipV() commands. :)

953
The Axe Parser Project / Re: Bug Reports
« on: December 15, 2011, 07:32:34 pm »
Sorry to say it, but it is your code's fault. :P This line is the problem:

:0→{T+L₄}ʳ→{P+L₅}ʳ

The value left in hl after storing a number to a constant pointer is the original value you stored. But when storing a 2-byte number to a non-constant pointer, the value left in hl is pointer+1.

954
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 13, 2011, 03:04:07 am »
That edit was helpful, it gave me a hunch as to what the problem was and (I think) that hunch was correct. Unfortunately, the fix for this problem will cost a byte and about 70 cycles. It will still be about 20% faster than the small routine though. And it still relies on the more common p_Mul instead of p_MulFull, so being 17 bytes larger might still be worth it.


Faster routine: 35 bytes, ~900 cycles
Code: [Select]
p_88Mul:
.db __88MulEnd-1-$
push hl
ld c,l
ld a,h
ld l,0
ld b,b \ .db 8 \ call $3F00+sub_Mul
ld b,8
__88MulNext:
add hl,hl
rla
rl c
jr nc,__88MulSkip
add hl,de
adc a,0
__88MulSkip:
djnz __88MulNext
pop bc
bit 7,b
jr z,$+3
sub e
ld l,h
ld h,a
bit 7,d
ret z
sub c
ld h,a
ret
__88MulEnd:

955
Other Calculators / Re: Interesting TI-84+ Screen Behavior
« on: December 13, 2011, 01:47:24 am »
Per request, I have attached the program that I used to the original post.

956
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 13, 2011, 01:38:30 am »
I think I can explain the asymmetry of the size-optimized version. Because it adjusts signs differently, I think it now rounds down instead of towards zero like the old routine.

However, I have no clue what is going on with the speed-optimized routine. Can you look at the debugger and confirm that the call to sub_Mul is actually entering where it's supposed to be entering, at __MulByte? Because I wouldn't be surprised if the fact that you probably had to add the offset call macro for call nz,__MulByte in p_Mul is messing up the offset calls due to its own size.

957
Other Calculators / Re: Interesting TI-84+ Screen Behavior
« on: December 13, 2011, 01:33:27 am »
Perhaps I should give more information about what is going on here. The screen is split into 4 columns, each being updated at almost exactly the LCD's refresh rate (about 58Hz). It's pretty obvious what I'm doing with the left and right columns; they're being set to white and black respectively each frame. The middle two columns are each being toggled between white and black each frame and are always opposite colors of each other. From other testing I know that the fact that these two columns are always opposite colors is not the source of the strange behavior.

I find it very odd that this only happens when trying to produce perfect 3-color grayscale without dithering. When sending dithered 3-color grayscale or 4-color grayscale that is either dithered or undithered at the same update rate, you get just what you would expect, solid and correct colored columns.

958
Other Calculators / Interesting TI-84+ Screen Behavior
« on: December 13, 2011, 01:21:44 am »
Well I was messing around with grayscale, and this happened. I have no idea what is going on here. Does the screen have some strange physical quality that is causing this? Left is supposed to be white, middle is supposed to be gray, right is supposed to be black. However, the middle appears to be cycling between dark gray and super-white. Also the center of the screen has more wild contrast changes than areas further away from the center. O.O








EDIT: I have attached the program I used to observe this strange effect. It will only work on 15MHz calculators. Use +/- to tune the frequency, CLEAR to quit. Don't press - too much or it will probably crash! I can't easily give the source because it is part Axe, part Axiom, and part raw hex edited. But if you do look at the disassembly of it, please don't mind any unoptimized code or code that seems out of place, I never actually meant to release this. ::)


EDIT 2: PLEASE READ THIS BEFORE DOWNLOADING

Alternating pixels between black and white at the same speed as the LCD controller alternates between positive and negative voltages means that those pixels receive only the positive pulses or only the negative pulses, effectively creating direct current just like the controller is supposed to prevent.
In summary: Don't use this effect unless you want to screw up your screen.

959
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 12, 2011, 11:57:46 pm »
Yeah, I see no way to optimize the full 32-bit multiplication... But fixed-point multiplication, now that's an entirely different story! First, here's a totally different approach to sign handling that reduces p_88Mul to less than half of its current size! ;D


Original routine: 38 bytes, ~1128 cycles
Code: [Select]
p_88Mul:
.db __88MulEnd-1-$
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 $3F00+sub_MulFull
ld l,h
ld h,a
pop af
xor h
ret p
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ret
__88MulEnd:
   Smaller routine: 18 bytes, ~1089 cycles
Code: [Select]
p_88Mul:
.db __88MulEnd-1-$
push hl
call $3F00+sub_MulFull
pop bc
bit 7,b
jr z,$+3
sub e
ld l,h
ld h,a
bit 7,d
ret z
sub c
ld h,a
ret
__88MulEnd:


20 bytes saved? Not bad at all! But what if you're more interested in shaving off cycles than bytes? Don't worry, I covered that base too. Instead of using the slower p_MulFull, this final routine uses my faster p_Mul for 8 bits of the multiplication and an inlined, slightly different version of faster multiplication for the other 8 bits. End result: it's about 260 cycles faster than the smaller solution, or about 30% faster! ;D It's 16 bytes larger than my smaller method, but actually it would often end up resulting in smaller programs because it relies on the much more popular p_Mul instead of p_MulFull.


Faster routine: 34 bytes, ~831 cycles
Code: [Select]
p_88Mul:
.db __88MulEnd-1-$
push hl
ld c,l
ld a,h
ld l,0
ld b,b \ .db 8 \ call $3F00+sub_Mul
ld a,c
ld bc,8<<8+0
__88MulNext:
add hl,hl
rla
jr nc,__88MulSkip
add hl,de
adc a,c
__88MulSkip:
djnz __88MulNext
pop bc
bit 7,b
jr z,$+3
sub e
ld l,h
ld h,a
bit 7,d
ret z
sub c
ld h,a
ret
__88MulEnd:

960
ASM / Re: ASM Optimized routines
« on: December 12, 2011, 03:46:00 pm »
Here's a very optimized way to convert a 16-bit signed number into an 8-bit signed number in a with overflow handling (if hl<-128, a=-128; if hl>127, a=127). Two added bonus to being super small and super fast are that it destroys nothing and that you could easily modify it to make the input a 16-bit register other than hl.

Code: [Select]
Signed16To8:
ld a,l
add a,a
sbc a,a
sub h
ld a,l
ret z
ld a,h
add a,a
sbc a,a
xor %01111111
ret

Pages: 1 ... 62 63 [64] 65 66 ... 153