0 Members and 3 Guests are viewing this topic.
p_Nib1: .db __Nib1End-$-1 scf rr h rr l ld a,(hl) jr c,__Nib1Skip rrca rrca rrca rrca__Nib1Skip: and %00001111 ld l,a ld h,0 ret__Nib1End:
p_Nib1: .db __Nib1End-$-1 xor a scf rr h rr l ld b,(hl)__Nib1Loop: rrd ccf jr c,__Nib1Loop ld (hl),b ld l,a ld h,0 ret__Nib1End:
p_Nib2: .db __Nib2End-$-1 srl h rr l ld a,(hl) jr c,__Nib2Skip rrca rrca rrca rrca__Nib2Skip: and %00001111 ld l,a ld h,0 ret__Nib2End:
p_Nib2: .db __Nib2End-$-1 xor a srl h rr l rrd jr c,__Nib2Skip rld__Nib2Skip: ld l,a ld h,0 ret__Nib2End:
p_NibSto: .db __NibStoEnd-$-1 pop bc pop de push bc scf rr h rr l ld b,(hl) ex de,hl ;hl = byte ;de = addr ld a,%11110000 jr c,__NibStoSkip add hl,hl add hl,hl add hl,hl add hl,hl cpl__NibStoSkip: and b or l ld (de),a ret__NibStoEnd:
p_NibSto: .db __NibStoEnd-$-1 pop bc pop de push bc scf rr h rr l jr c,__NibStoHigh rrd ld a,e rld ret__NibStoHigh: rld ld a,e rrd ret__NibStoEnd:
p_InvBuff: .db __InvBuffEnd-1-$ ld hl,plotSScreen ld bc,768__InvBuffLoop: ld a,(hl) cpl ld (hl),a inc hl dec bc ld a,b or c jr nz,__InvBuffLoop ret__InvBuffEnd:
p_InvBuff: .db __InvBuffEnd-1-$ ld hl,plotSScreen ld bc,3__InvBuffLoop: ld a,(hl) cpl ld (hl),a inc hl djnz __InvBuffLoop dec c jr nz,__InvBuffLoop ret__InvBuffEnd:
p_Unarchive: .db __UnarchiveEnd-1-$ MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 ret c inc b dec b ret z B_CALL(_Arc_Unarc) ld hl,1 ret__UnarchiveEnd:
p_Unarchive: .db __UnarchiveEnd-1-$ MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 ret c dec b ret m inc b B_CALL(_Arc_Unarc) ld hl,1 ret__UnarchiveEnd:
p_Archive: .db __ArchiveEnd-1-$ MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 ret c inc b dec b ret nz B_CALL(_Arc_Unarc) ld hl,1 ret__ArchiveEnd:
p_Archive: .db __ArchiveEnd-1-$ MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 ret c dec b ret p inc b B_CALL(_Arc_Unarc) ld hl,1 ret__ArchiveEnd:
p_GetArc: .db __GetArcEnd-1-$ push de MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 jr c,__GetArcFail ld a,(OP1) cp ListObj jr z,__GetArcName cp ProgObj jr z,__GetArcName cp AppvarObj jr z,__GetArcName cp GroupObj jr z,__GetArcName__GetArcStatic: ld hl,14 jr __GetArcDone__GetArcName: ld hl,9 add hl,de B_CALL(_LoadDEIndPaged) ld d,0 inc hl inc hl__GetArcDone: add hl,de__GetArcFail: ex de,hl pop hl ld (hl),e inc hl ld (hl),d inc hl ld (hl),b ex de,hl ret__GetArcEnd:
p_GetArc: .db __GetArcEnd-1-$ push de MOV9TOOP1() B_CALL(_ChkFindSym) ld hl,0 jr c,__GetArcFail and %00011111 ld d,b ld hl,__GetArcVarTypes ld bc,__GetArcEnd-__GetArcVarTypes cpir ld b,d ld hl,14 jr nz,__GetArcDone ld l,9 add hl,de B_CALL(_LoadDEIndPaged) ld d,0 inc e inc e__GetArcDone: add hl,de__GetArcFail: ex de,hl pop hl ld (hl),e inc hl ld (hl),d inc hl ld (hl),b ex de,hl ret__GetArcVarTypes: .db ListObj,ProgObj,AppvarObj,GroupObj__GetArcEnd:
p_GetBit: .db 13 ld a,e and %00000111 inc a ld b,a ld a,l__GetBitLoop: add a,a djnz __GetBitLoop ld h,b ld l,b rl l
p_GetBit: .db 12 ld a,e and %00000111 inc a ld b,a xor a__GetBitLoop: ld h,a add hl,hl djnz __GetBitLoop ld l,h ld h,a
p_FlipV: .db __FlipVEnd-1-$ ex de,hl ld hl,vx_SptBuff+8 ld b,8__FlipVLoop: dec hl ld a,(de) ld (hl),a inc de djnz __FlipVLoop ret__FlipVEnd:
p_FlipV: .db __FlipVEnd-1-$ ex de,hl ld hl,vx_SptBuff+8 ld b,8__FlipVLoop: dec l ld a,(de) ld (hl),a inc de djnz __FlipVLoop ret__FlipVEnd:
p_FlipH: .db __FlipHEnd-1-$ ld de,vx_SptBuff push de ld b,8__FlipHLoop1: ld c,(hl) ld a,1__FlipHLoop2: rr c rla jr nc,__FlipHLoop2 ld (de),a inc hl inc de djnz __FlipHLoop1 pop hl ret__FlipHEnd:
p_FlipH: .db __FlipHEnd-1-$ ld de,vx_SptBuff push de ld b,8__FlipHLoop1: ld c,(hl) ld a,1__FlipHLoop2: rr c rla jr nc,__FlipHLoop2 ld (de),a inc hl inc e djnz __FlipHLoop1 pop hl ret__FlipHEnd:
p_RotC: .db __RotCEnd-1-$ ex de,hl ld hl,vx_SptBuff ld c,8__RotCLoop1: push hl ld b,8 ld a,(de)__RotCLoop2: rla rr (hl) inc hl djnz __RotCLoop2 pop hl inc de dec c jr nz,__RotCLoop1 ret__RotCEnd:
p_RotC: .db __RotCEnd-1-$ ex de,hl ld c,8+1__RotCLoop1: ld hl,vx_SptBuff dec c ret z ld b,8 ld a,(de)__RotCLoop2: rla rr (hl) inc l djnz __RotCLoop2 inc de jr __RotCLoop1__RotCEnd:
p_RotCC: .db __RotCCEnd-1-$ ex de,hl ld hl,vx_SptBuff ld c,8__RotCCLoop1: push hl ld b,8 ld a,(de)__RotCCLoop2: rra rl (hl) inc hl djnz __RotCCLoop2 pop hl inc de dec c jr nz,__RotCCLoop1 ret__RotCCEnd:
p_RotCC: .db __RotCCEnd-1-$ ex de,hl ld c,8+1__RotCCLoop1: ld hl,vx_SptBuff dec c ret z ld b,8 ld a,(de)__RotCCLoop2: rra rl (hl) inc l djnz __RotCCLoop2 inc de jr __RotCCLoop1__RotCCEnd:
However, these are the concerns I have: First, the sprite rotation commands, why did you move the ret to the middle of the routine? It looks like that's just going to add more cycles since a conditional jr takes the same amount of cycles as a regular jr anyway.
Next, is it really a safe assumption that all ROM pages are between $7F and $FF for all current models and potentially future models?
And lastly, are you sure trying to modifying rom (unsuccessfully) has no potential side effects to things like flags and registers?
EDIT: By the way Quigibo, the reason I was looking at every source routine for Axe is because I'm documenting the size and (at least approximate) speed of every Axe command. If I finish it, would you want to bundle it with future Axe releases? If not I'd probably post it somewhere on the forums anyway, so people could still see it.
Faster buffer inversion routine. 9951 cycles saved.
By the way Quigibo, the reason I was looking at every source routine for Axe is because I'm documenting the size and (at least approximate) speed of every Axe command. If I finish it, would you want to bundle it with future Axe releases? If not I'd probably post it somewhere on the forums anyway, so people could still see it.