0 Members and 1 Guest are viewing this topic.
p_Sqrt: .db __SqrtEnd-1-$ ld a,-1 ld d,a ld e,a__SqrtLoop: add hl,de inc a dec e dec de jr c,__SqrtLoop ld h,0 ld l,a ret__SqrtEnd:
p_Sqrt: .db __SqrtEnd-1-$ ld de,-1&$FF ld b,e ld c,e__SqrtLoop: add hl,bc inc e dec c dec bc jr c,__SqrtLoop ex de,hl ret__SqrtEnd:
p_Sin: .db __SinEnd-1-$ add a,a rr c ld d,a cpl ld e,a xor a ld b,8__SinLoop: rrc e jr nc,__SinSkip add a,d__SinSkip: rra djnz __SinLoop adc a,a ld l,a ld h,b rl c ret nc cpl inc a ret z ld l,a dec h ret__SinEnd:
p_Sin: .db __SinEnd-1-$ ld c,a add a,a ld d,a cpl ld e,a xor a ld b,8__SinLoop: rra rrc e jr nc,__SinSkip add a,d__SinSkip: djnz __SinLoop ld l,a ld h,b or c ret p xor a sub l ret z ld l,a dec h ret__SinEnd:
p_Log: .db 11 ld a,16 scf__LogLoop: adc hl,hl dec a jr nc,__LogLoop ld l,a ld h,0
p_Log: .db 10 ld de,16 scf__LogLoop: adc hl,hl dec e jr nc,__LogLoop ex de,hl
p_Log: .db 13 ld de,16__LogLoop: add hl,hl jr c,__LogLoopEnd dec e jr nz,__LogLoop__LogLoopEnd: ex de,hl ccf rr h
p_Exp: .db __ExpEnd-p_Exp-1 ld b,l ld a,l and %11110000 or h ld hl,0 ret nz inc b scf__ExpLoop: adc hl,hl djnz __ExpLoop ret__ExpEnd:
__DrawMskAligned: dec hl__DrawMskAlignedLoop: ld a,(ix+0) xor (ix+8) cpl ld c,a ld a,(hl) or (ix+0) and c ld (hl),a ld de,appBackUpScreen-plotSScreen add hl,de ld a,c and (hl) or (ix+0) ld (hl),a inc ix ld de,plotSScreen-appBackUpScreen+12 add hl,de djnz __DrawMskAlignedLoop
__DrawMskAligned: dec hl__DrawMskAlignedLoop: push hl ld de,appBackUpScreen-plotSScreen add hl,de ld a,(ix+0) ld d,a xor (ix+8) cpl ld e,a and (hl) or d ld (hl),a pop hl ld a,(hl) or d and e ld (hl),a inc ix ld de,12 add hl,de djnz __DrawMskAlignedLoop
p_Min: .db 8 pop de or a sbc hl,de add hl,de jr c,$+3 ex de,hl
p_Min: .db 8 pop de or a sbc hl,de ex de,hl jr nc,$+3 add hl,de
p_Max: .db 8 pop de or a sbc hl,de add hl,de jr nc,$+3 ex de,hl
p_Max: .db 8 pop de or a sbc hl,de ex de,hl jr c,$+3 add hl,de
p_FastCopy6MHz: .db __FastCopy6MHzEnd-1-$ in a,($02) rla in a,($20) push af xor a out ($20),a call sub_FastCpy pop af ret c out ($20),a ret__FastCopy6MHzEnd:
p_IntGt: .db 7 ex de,hl xor a sbc hl,de ld h,a rla ld l,a
p_IntGt: .db 6 scf sbc hl,de sbc hl,hl inc hl
p_Sqrt: .db __SqrtEnd-1-$ ex de,hl ld bc,$8000 ld h,c ld l,c__SqrtLoop: srl b rr c add hl,bc ex de,hl sbc hl,de jr nc,__SqrtNoOverflow add hl,de ex de,hl or a sbc hl,bc ;jr __SqrtOverflow ;Commented out in favor of super optimization .db $DA ;JP C opcode to skip next 2 bytes since carry is reset here.__SqrtNoOverflow: ex de,hl add hl,bc__SqrtOverflow: srl h rr l srl b rr c jr nc,__SqrtLoop ret__SqrtEnd:
How does it compare to this one? I suggested it a while ago but Quigibo either didn't see it or didn't seem to be interested in it.