;Library Name: ARRAYLIB ;Module Name: ABITOP ;Author: Al Hawley ;Date: 31 Mar 1987 ;Version number: 1.0c ;Version History: ;Program Function: ARRAYLIB is a collection of subroutines which ; implement the management of byte arrays in programs written ; for Z80 or HD64180 based computers. This module is one of the ; set, and may require the presence of others. ;*************************************************** ; COPYRIGHT NOTICE ;ARRAYLIB is copyright by A. E. Hawley on March 4, 1987. ;It may be freely distributed, but it must not be sold ;either separately or as part of a package without the ;written consent of the author. The author may be reached ;via electronic mail at the Ladera Z-Node in Los Angeles, ;213-670-9465, or by Voice Phone at: 213-649-3575 ; ;*************************************************** MACLIB ARRHDR name abitop ;This module contains the following routines: public arresbit,arsetbit,artstbit ;routines to set, reset, or test a bit. ;on entry: ; a = bit number (0-7) ; hl = address of the byte ;on exit: ; hl, de are preserved ; b = 46h(test) or 0c6h(set) or 86h(res) ;if z, c = a = 0 ;if nz, c = a = 0ffh ; the z/nz returns are significant only when ; the test operation is performed. ;these routines work by synthesizing the opcode ;for a z80 'cb' instruction. arresbit: ;entry point to reset a bit ld b,86h jr makop arsetbit: ;entry point to set a bit ld b,0c6h makop: rlc a ;rotate the bit number rlc a ;into the 3-4-5 rlc a ;position in the accumulator or a,b ld (opcode),a ;install the opcode db 0cbh ;and execute the instruction opcode: db 0 ;..to do a bit, res, or set ret artstbit: ;entry point to test a bit ld b,46h call makop ;do the test ld c,0ffh ;adjust regs c and a ld a,c ret nz inc c ld a,c ret ;************************************* end