home *** CD-ROM | disk | FTP | other *** search
- ; ADD_LONG_MULT for Turbo-ARC, TR 061189
- ; procedure add_long_mult(var sum,lw:longword; m:byte);
-
- .z80
- extrn sum,lw,m
-
- ld ix,(sum) ; ^dest
- ld hl,(lw) ; ^src1
- ld e,(hl)
- inc hl
- ld d,(hl)
- inc hl
- push de
- ld e,(hl)
- inc hl
- ld d,(hl)
- pop hl ; DEHL = src1
- ld a,(m) ; A = src2
- loop: srl a
- jr nc,loop1
- push af
- ld a,(ix)
- add a,l
- ld (ix),a
- ld a,(ix+1)
- adc a,h
- ld (ix+1),a
- ld a,(ix+2)
- adc a,e
- ld (ix+2),a
- ld a,(ix+3)
- adc a,d
- ld (ix+3),a ; add src1 to dest
- pop af
- loop1: ret z ; nothing else to do: leave
- sla l
- rl h
- rl e
- rl d ; shift src1 left (*2)
- jr loop
-
- end
-