0 Members and 5 Guests are viewing this topic.
H_Times_E:;Inputs:; H,E;Outputs:; HL is the product; D,B are 0; A,E,C are preserved;Size: 12 bytes;Speed: 311+6b, b is the number of bits set in the input H; average is 335 cycles; max required is 359 cycles ld d,0 ;1600 7 7 ld l,d ;6A 4 4 ld b,8 ;0608 7 7 ; add hl,hl ;29 11*8 88 jr nc,$+3 ;3001 12*8-5b 96-5b add hl,de ;19 11*b 11b djnz $-4 ;10FA 13*8-5 99 ; ret ;C9 10 10
H_Times_E:;Inputs:; H,E;Outputs:; HL is the product; D,B are 0; A,E,C are preserved;Size: 36 bytes;Speed: 191+6b+9p, b is the number of bits set in the input H, p is if it is odd; average is 229.5 cycles (105.5 cycles saved); max required is 258 cycles (101 cycles saved) ld d,0 ;1600 7 7 ld l,d ;6A 4 4 ; sla h ;CB24 8 jr nc,$+3 ;3001 12-1b ld l,e ;6B -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 jr nc,$+3 ;3001 12+6b add hl,de ;19 -- add hl,hl ;29 11 ret nc ;D0 11+15p add hl,de ;19 -- ret ;C9 --
ld hl,verticesTable ; points to 6-bytes vertices table (X, Y, Z) call setCurrentVertices ld a,OBJECT_DOT ld hl,23 ; which vertex of the table do we use ? call pushObject ld a,OBJECT_LINK ld hl,vertices2 ; points to string of 2 2-bytes offsets for vertices in the table call pushObject ld a,OBJECT_TRI ld b,RENDER_BLACK ; either black or solid white ld hl,vertices3 ; same as above with 3 offsets call pushObject call renderScene ; objects are drawn, then popped
HL_Times_A: ex de,hlDE_Times_A:;Inputs:; DE and A are factors;Outputs:; AHL is the product; B is 0; C is not changed; DE is not changed;Time:; 342+13x; ld b,8 ;7 7 ld hl,0 ;10 10aaa: add hl,hl ;11*8 88 adc a,a ;4*8 32 jr nc,rrr ;(12|25)*8 96+13x add hl,de ;-- -- adc a,0rrr: djnz aaa ;13*7+8 99 ret ;10 10
call AextendSignDE call multHL_DE
ld hl,0 or a jp p,$+5 sbc hl,de ld b,8mulloop: add hl,hl rla jr nc,$+5 add hl,de adc a,0 djnz mulloop ret
Yes, I keep repeating that I always work on projects at 6 MHz !