home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
171.lha
/
SupLib
/
bcmp.asm
< prev
next >
Wrap
Assembly Source File
|
1988-04-28
|
1KB
|
54 lines
public _bcmp ; compare two blocks of memory
; BCMP(src, dst, len)
_bcmp: move.l 4(sp),A0
move.l 8(sp),A1
move.l 12(sp),D0
beq .bcsucc
cmp.w D0,D0 ; set Z bit.
bra .bc2
.bc1 cmpm.b (A0)+,(A1)+
.bc2 dbne D0,.bc1
bne .bcfail
sub.l #$10000,D0
bcc .bc1
.bcsucc moveq.l #1,D0
rts
.bcfail moveq.l #0,D0
rts
; OLD BCMP HAD BUGS ... alignment problems.
;
; move.w D0,D1 ;longword align address
; neg.w D1
; and.w #3,D1
; cmp.w D0,D0 ;force Z bit
; bra .bc2
;.bc1 cmpm.b (A0)+,(A1)+
;.bc2 dbne D1,.bc1
; bne .bcfail
; move.l D0,D1
; lsr.l #2,D1 ;# of longwords to compare
; cmp.w D0,D0 ;force Z bit
; bra .bc11
;.bc10 cmpm.l (A0)+,(A1)+
;.bc11 dbne D1,.bc10
; bne .bcfail
; sub.l #$10000,D0
; bcc .bc10
; and.w #3,D0 ;remaining bytes to compare
; cmp.w D0,D0 ;force Z bit
; bra .bc21
;.bc20 cmpm.b (A0)+,(A1)+
;.bc21 dbne D0,.bc20
; bne .bcfail
; moveq.l #1,D0 ;success!
; rts
;.bcfail moveq.l #0,D0 ;failure!
; rts