1985-03-18 12:46:51 +00:00
|
|
|
.define .dup
|
1987-01-28 18:57:04 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
.sect .text
|
1985-03-18 12:46:51 +00:00
|
|
|
|
|
|
|
! Duplicate top bytes of stack
|
|
|
|
! Expects in de-registers: number of bytes to duplicate
|
|
|
|
|
|
|
|
.dup: mov a,e !trap if number is odd
|
|
|
|
rar
|
|
|
|
cc eoddz
|
|
|
|
|
|
|
|
pop h
|
|
|
|
shld .retadr
|
|
|
|
mov h,b
|
|
|
|
mov l,c
|
|
|
|
shld .bcreg
|
|
|
|
|
|
|
|
mov h,d
|
|
|
|
mov l,e
|
|
|
|
dad sp
|
|
|
|
1: dcx h
|
|
|
|
mov b,m
|
|
|
|
dcx h
|
|
|
|
mov c,m
|
|
|
|
push b
|
|
|
|
dcx d
|
|
|
|
dcx d !number of bytes must be a word-multiple i.e. even
|
|
|
|
mov a,d
|
|
|
|
ora e
|
|
|
|
jnz 1b
|
|
|
|
|
|
|
|
lhld .bcreg
|
|
|
|
mov b,h
|
|
|
|
mov c,l
|
|
|
|
lhld .retadr
|
|
|
|
pchl
|