📄 blkcopy.s
字号:
;********************************************************************************
; Copyright 2004, ZiLOG Inc. *
; All Rights Reserved *
; *
; This is UNPUBLISHED PROPRIETARY SOURCE CODE of ZiLOG Inc., and might *
; contain proprietary, confidential and trade secret information of *
; ZiLOG, our partners and parties from which this code has been licensed. *
; *
; The contents of this file may not be disclosed to third parties, copied or *
; duplicated in any form, in whole or in part, without the prior written *
; permission of ZiLOG Inc. *
; *
; Copyright 2001, Metro Link, Inc. *
; All Rights Reserved *
; *
; This is UNPUBLISHED PROPRIETARY SOURCE CODE of Metro Link, Inc. and may *
; contain proprietary, confidential and trade secret information of *
; Metro Link, Inc. and/or its partners. *
; *
; The contents of this file may not be disclosed to third parties, copied or *
; duplicated in any form, in whole or in part, without the prior written *
; permission of Metro Link, Inc. *
;********************************************************************************
.assume adl=1
.def _blkcopy
;*** C Function Prototype:
; void blkcopy( BYTE * p_dest, BYTE * p_source, WORD Length );
_blkcopy:
push ix
ld ix, 0
add ix, sp
ld de, (ix+6)
ld hl, (ix+9)
ld bc, (ix+12)
;*** Clear upper byte of BC
inc.s bc
dec.s bc
;*** Save (Length mod 256) in IYL
ld iyl, c ; 2
;*** A = number of 256 byte transfers
ld a, b ; 1
ld b, 0 ; 2
and a, a ; 1
jr loop_test ; 3
blkcopy_loop:
;*** To reduce interrupt latency, break each 256 byte transfer
; into 2 transfers of 128 bytes
ld c, 80h ; 2
ldir ; 2+3x
ld c, 80h ; 2
ldir ; 2+3x
dec a ; 1
loop_test:
jr nz, blkcopy_loop ;2/3
;*** Transfer the remaining bytes (<= 255), if 0, exit
ld c, iyl ; 2
cp a, c ; 1
jr z, done_copy ; 2/3
;*** Transfer C bytes of data (C > =1) in 2 steps
; Each will be less <= 128 bytes
srl c ; 2
ld a, c ; 1
jr z, second_half ; 2/3
ldir ; 2+3x
second_half:
adc a, c ; 1
ld c, a ; 1
ldir ; 2+3x
done_copy:
ld sp,ix
pop ix
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -