Calculator Community > The Axe Parser Project |
Assembly Programmers - Help Axe Optimize! |
(1/60) > >> |
Quigibo:
I'm going to post most of the assembly routines I use in Axe Parser here to see if any of you asm programmers can help me with their optimizations. * I am always trying to optimize for size, not speed, unless it is significantly faster and close to the same size. * I would greatly prefer that it does not use any extra RAM to store temporary variables, but that's not that big of a deal. * No self modifying code or undocumented commands because I need to make this compatible for Apps and with the Nspire TI-84 emulator. The most important thing right now is the clipped sprite routine since its really big. Here's what I got so far: p_DrawOr8x8: push hl pop ix ;Input hl = Sprite ld b,7 ;Input c = Sprite X Position ld d,0 ;Input e = Sprite Y Position ld h,d ld a,c add a,b jr c,__ClipLeft sub 96+7 ret nc cpl cp b jr nc,__NoClipH __ClipRight: inc d jr __ClipHDone __ClipLeft: add a,89 ld c,a __ClipHDone: inc d ;d,c,e are updated __NoClipH: ld a,e add a,b jr c,__ClipTop sub 64+7 ret nc cpl cp b jr nc,__NoClipV jr __ClipBottom __ClipTop: inc ix inc e jr nz,__ClipTop __ClipBottom: ld b,a __NoClipV: ;b,ix,e are updated. dec d jr z,__NoFix inc e __NoFix: push de ld l,e ld d,h add hl,hl add hl,de add hl,hl add hl,hl ld e,c ld a,e srl e srl e srl e add hl,de ld de,plotSScreen-11 add hl,de pop de inc b and %00000111 jr z,__DrawOr8x8Aligned ld c,a __DrawOr8x8Loop: push bc ld b,c ld c,(ix+0) xor a __DrawOr8x8Shift: srl c rra djnz __DrawOr8x8Shift dec d jr z,__SkipRight or (hl) ld (hl),a __SkipRight: dec hl inc d jr z,__SkipLeft ld a,c or (hl) ld (hl),a __SkipLeft: ld c,13 add hl,bc inc ix pop bc djnz __DrawOr8x8Loop ret __DrawOr8x8Aligned: dec hl ld de,12 __DrawOr8x8AlignedLoop: ld a,(ix+0) or (hl) ld (hl),a inc ix add hl,de djnz __DrawOr8x8AlignedLoop ret __DrawOr8x8End: If you spot anything that can be optimized, bold it so I can see what you changed, thanks! |
DJ Omnimaga:
I would prefer no extra RAM usage at all. Otherwise, games may not run on any TI-84+ manufactured after April 2007 and will not be compatible with the regular 83+, meaning a considerable drop in the author's audience. |
Galandros:
--- Quote from: DJ Omnimaga on February 26, 2010, 04:57:59 pm ---I would prefer no extra RAM usage at all. Otherwise, games may not run on any TI-84+ manufactured after April 2007 and will not be compatible with the regular 83+, meaning a considerable drop in the author's audience. --- End quote --- Generally ram usage is just the routine needs some temporary bytes to store data. (bytes in the program itself or inserted in the TI-OS available RAM or free ram zones of the TI-OS) Only when you need a good amount of memory you use the extra ram pages. |
Eeems:
Aldo if I'm not wrong there is a little extra ram in the newer calcs, but not that much. |
DJ Omnimaga:
Yeah. I'm not sure if it's accessed the same way, though. |
Navigation |
Message Index |
Next page |