1985-03-18 12:46:51 +00:00
|
|
|
.define .inn2
|
1987-01-28 15:03:39 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
.sect .text
|
1985-03-18 12:46:51 +00:00
|
|
|
|
|
|
|
! Bit test on 16 bits set
|
|
|
|
! Expects on stack: bit number
|
|
|
|
! set to be tested
|
|
|
|
! Yields in de-registers: 0 if bit is reset or bit number out of range
|
|
|
|
! 1 if bit is set
|
|
|
|
|
|
|
|
.inn2: pop h
|
|
|
|
shld .retadr
|
|
|
|
|
|
|
|
pop d !bit number
|
|
|
|
pop h !set to be tested
|
|
|
|
mov a,e
|
|
|
|
cpi 16
|
|
|
|
jnc 3f
|
|
|
|
cpi 8
|
|
|
|
jnc 1f
|
|
|
|
mov e,a
|
|
|
|
mov a,l !l-reg contains the wanted bit
|
|
|
|
jmp 2f
|
|
|
|
|
|
|
|
1: sbi 8
|
|
|
|
mov e,a
|
|
|
|
mov a,h !h-reg contains the wanted bit
|
|
|
|
|
|
|
|
2: dcr e
|
|
|
|
jm 4f
|
|
|
|
rar
|
|
|
|
jmp 2b
|
|
|
|
|
|
|
|
3: xra a !return 0 if bit number out of range
|
|
|
|
4: ani 1
|
|
|
|
mov e,a
|
|
|
|
mvi d,0
|
|
|
|
|
|
|
|
lhld .retadr
|
|
|
|
pchl
|