ack/mach/z80/libem/set.s
1985-03-29 21:44:50 +00:00

46 lines
449 B
ArmAsm

.define .set
! use .unimpld
! any size sets
! parameters:
! hl: size
! stack: bitnumber
! stack: result (out)
.set:
pop ix ! return address
pop de ! bit number
ld b,h
ld c,l
xor a
0: push af
inc sp
dec c
jr nz,0b
dec b
jp p,0b
ex de,hl
ld a,l
sra h
jp m,.unimpld
rr l
srl h
rr l
srl h
rr l
push hl
or a
sbc hl,de
pop hl
jp p,.unimpld
add hl,sp
ld (hl),1
and 7
jr 1f
0: sla (hl)
dec a
1: jr nz,0b
jp (ix)