Calculator Community > The Axe Parser Project
Assembly Programmers - Help Axe Optimize!
Xeda112358:
--- Quote from: Runer112 on February 15, 2013, 11:29:47 pm ---You do have an outdated version of Axe, I already added that optimizaion in 1.2.0. :P
--- End quote ---
Darn, I actually do have 1.2.1 in a different folder, I completely forgot about that .__. I am glad that I got something right, though :D
--- Quote from: calc84maniac on February 15, 2013, 11:18:31 pm ---I'm not so sure that would work, because there's a possible case where you could be running code from an app and finding the Nth string in a large appvar in RAM, for example (which could be more than 16KB in size).
--- End quote ---
I was worried about that, but I figured that it would be pretty rare. It would definitely be the only scenario that it would fail, too. .__.
Deep Toaster:
Don't know if it's been mentioned before (and maybe there's a reason it's this way), but p_SendByte starts by loading B and C individually where p_GetByte loads them together (saving a byte).
Runer112:
No reason whatsoever. Good catch.
Xeda112358:
EDIT: Jacobly pointed out the case HL = 8000h, so this doesn't work D:
Hopefully this file has the updated SDiv routine. I have this:
Original routine
--- Code: ---p_SDiv:
.db __SDivEnd-1-$
ld a,h
xor d
push af
xor d
jp p,__SDivSkip1-p_SDiv-1
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
__SDivSkip1:
bit 7,d
jr z,__SDivSkip2
xor a
sub e
ld e,a
sbc a,a
sub d
ld d,a
__SDivSkip2:
call $3F00+sub_Div
x_SDivEntry:
pop af
ret p
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ret
__SDivEnd:
--- End code ---
Smaller routine: 1 byte, 1|6 cycles saved
--- Code: ---p_SDiv:
.db __SDivEnd-1-$
ld a,h
xor d
push af
xor d
jp p,__SDivSkip1-p_SDiv-1
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
__SDivSkip1:
xor d
jp p,__SDivSkip2-p_SDiv-1
xor a
sub e
ld e,a
sbc a,a
sub d
ld d,a
__SDivSkip2:
call $3F00+sub_Div
x_SDivEntry:
pop af
ret p
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ret
__SDivEnd:
--- End code ---
And my only change is the two lines after __SDivSkip1.
Same size, save at least 1 cycle (up to 6 cycles).
EDIT: The same modification can be made to the fixed point signed division routine.
Matrefeytontias:
Seeing the discussion about Fill( in the axiom request thread, I was surprized that this wasn't implemented this way already :
--- Code: ---; Fill(ptr, amount, byte (not word))
; hl = ptr, de = byte, bc = amount
ld (hl),e
dec bc
ld a,c
or b
ret z ; or whatever to quit
ld e,l
ld d,h
inc de
ldir
ret ; ↑
--- End code ---
I don't think it's really optimized though >_>
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version