0 Members and 1 Guest are viewing this topic.
p_Sqrt: .db __SqrtEnd-1-$ ld a,l ld l,h ld de,$0040 ld h,d ld b,8 or a__SqrtLoop: sbc hl,de jr nc,__SqrtSkip add hl,de__SqrtSkip: ccf rl d rla adc hl,hl rla adc hl,hl djnz __SqrtLoop ld h,0 ld l,d ret__SqrtEnd:
p_GetBit0: .db 5 ;5 bytes, 36 T-states add hl,hl ccf sbc hl,hl inc hlp_GetBit1: .db 6 ;6 bytes, 47 T-states add hl,hl add hl,hl ccf sbc hl,hl inc hlp_GetBit2: .db 7 ;7 bytes, 58 T-states add hl,hl add hl,hl add hl,hl ccf sbc hl,hl inc hlp_GetBit6: .db 7 ;7 bytes, 37 T-states ld a,h rra rra ccf sbc hl,hl inc hlp_GetBit7: .db 6 ;6 bytes, 33 T-states rr h ccf sbc hl,hl inc hlp_GetBit8: .db 6 ;6 bytes, 33 T-states rl l ccf sbc hl,hl inc hlp_GetBit9: .db 7 ;7 bytes, 37 T-states ld a,l rla rla ccf sbc hl,hl inc hlp_GetBit10: .db 8 ;8 bytes, 30/29 T-states bit 5,l ld hl,0 jr z,$+3 inc lp_GetBit14: .db 7 ;7 bytes, 37 T-states ld a,l rra rra ccf sbc hl,hl inc hlp_GetBit15: .db 6 ;6 bytes, 33 T-states rr l ccf sbc hl,hl inc hl
p_GetBit0: .db 5 ;5 bytes, 27 T-states xor a add hl,hl ld h,a rla ld l,ap_GetBit1: .db 6 ;6 bytes, 38 T-states xor a add hl,hl add hl,hl ld h,a rla ld l,ap_GetBit2: .db 7 ;7 bytes, 49 T-states xor a add hl,hl add hl,hl add hl,hl ld h,a rla ld l,ap_GetBit6: .db 7 ;7 bytes, 26 T-states ld a,%00000010 and h rrca ld h,0 ld l,ap_GetBit7: .db 6 ;6 bytes, 22 T-states ld a,%00000001 and h ld h,0 ld l,ap_GetBit8: .db 5 ;5 bytes, 27 T-states xor a ld h,a add hl,hl ld l,h ld h,ap_GetBit9: .db 6 ;6 bytes, 38 T-states xor a add hl,hl ld h,a add hl,hl ld l,h ld h,ap_GetBit10: .db 7 ;7 bytes, 49 T-states xor a add hl,hl add hl,hl ld h,a add hl,hl ld l,h ld h,ap_GetBit14: .db 7 ;7 bytes, 26 T-states ld a,%00000010 and l rrca ld h,0 ld l,ap_GetBit15: .db 5 ;5 bytes, 20 T-states xor a ld h,a inc a and l ld l,a
p_SIntGt: .db 13 ;13 bytes, 48 T-states ex de,hl xor a ld b,h sbc hl,de ld h,a rra xor b xor d rlca and 1 ld l,a
p_SIntGt: .db 12 ;12 bytes, 67 T-states ld bc,$8000 add hl,bc ex de,hl add hl,bc xor a sbc hl,de ld h,a rla ld l,a
Changing the high order bit does work, actually. It changes a comparison in the -32768 to 32767 range to a comparison in the 0 to 65535 range (effectively changing from a signed comparison to an unsigned comparison).
Yeah, I'm still reading all of this, even though I'm less active, I still visit just about every day I've even been able to do a little more progress with Axe even with my busy schedule.
It seemed to tell me that signed comparisons relied on an xor of the p/v and s flags. Which makes no sense, but that's what wabbitemu was telling me.
Cool, Quigibo added all my optimized auto-optimizations But I think you missed p_GetBit15, which can be optimized to be the same as p_Mod2.
Output(0,0,"Hello World")
Output(0,0,"Hello World