; * * * * * XALV -- EXAMINE THE ALLOCATION VECTOR ; MACLIB CPMEQU ; standard names MACLIB PROG ; prolog, service macros MACLIB DPSUB ; 16 bit routines MACLIB COSUB ; console output routines ; PROLOG 30,XALV ; DPB$DSM EQU 5 ; offset to 'DSM' in DPB HEADING DB 'Allocation vector of disk ' DRIVE DB 0,CR,LF,CR,LF+80H ; XALV EQU $ LDA CPMFCB ; see if a drivecode was given DCR A ; convert A=1 into A=0 JP XAL2 ; (result not FF -- code given) SERVICE 25 ; omitted, get current drive XAL2 MOV E,A ; save drive for service 14 ADI 'A' ; make printable, STA DRIVE ; ..put in message, LXI H,HEADING CALL COSTR ; ..print heading. SERVICE 14 ; select drive (code in reg E) ; SERVICE 31 ; HL --> disk parameters MVI A,DPB$DSM ; offset to DPB.DSM CALL DP$LDHA ; load that to DE MVI A,7 ; round DSM up to CALL DP$ADAD ; ..a multiple of 8 MVI B,3 ; ..then divide it by 8 XALSR CALL DP$SRLD ; ..by shifting DE right DCR B ! JNZ XALSR ; DE = Number of bytes in the allocation vector SERVICE 27 ; HL --> allocation vector MVI B,8 ; B = bytes per line ; XALOOP CALL XALBYTE ; display 8 bits, DCX D ; ..count it MOV A,E ! ORA D ; .. check for zero, RZ ; ..back to CCP if that's it DCR B ; see if that was 64 bits JNZ XALOOP ; (continue if not) CALL COCRLF ; new line after 64 bits MVI B,8 JMP XALOOP ; continue ; ; Subroutine to print the 8 bits of the byte at [HL] ; increments HL to next byte, alters [AF] ; XALBYTE PUSH B ; save a work register MVI C,8 ; [C] has the loop count MOV B,M ; ..[B] the byte itself INX H ; increment data pointer ; XB1 MOV A,B ; current bit to carry and RAL ! MOV B,A MVI A,'0' ; ..print a zero, or ACI 00 ; ..a one, depending on carry CALL COUT DCR C ! JNZ XB1 ; POP B RET ; ; COMMON SUBROUTINES ; DPSUBM COSUBM END