home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug015.ark
/
ALLOC.ASM
next >
Wrap
Assembly Source File
|
1984-04-29
|
1KB
|
78 lines
;ALLOC.ASM - PRINT ALLOCATION VECTOR FOR A DISK
; AS A BIT MAP
;
;3/77 ORIGINALLY WRITTEN BY WARD CHRISTENSEN
;11/14/77 MODIFY TO ALLOW 'ALLOC B:'
ORG 100H
CALL START ;SKIP ID
DB 'ALLOC 11/14/77'
DB 0DH,0AH,'$'
;
;BDOS EQUATES USED IN THIS PROGRAM
;
BDOS EQU 5
PRINT EQU 9
SELDK EQU 14
FCB EQU 5CH
INQA EQU 1BH ;INQ ALLOC VECTOR
;
;TYPE ALLOCATION VECTOR
;
START POP D ;GET ID MESSAGE
MVI C,PRINT ;PRINT IT
CALL BDOS
LDA FCB ;SELECT DISK?
ORA A ;0 ==> LOGGED IN DISK
JZ NODK ;NO DISK SELECT
DCR A ;MAKE INTO DISK #
MOV E,A ;SETUP
MVI C,SELDK ;..FOR CALL
CALL BDOS ;SELECT DISK
NODK MVI C,INQA ;INQUIRE ALLOC
CALL BDOS ;GET POINTER TO IT IN B
MVI D,32 ;SET BYTE COUNT
CHAR MVI E,80H ;GET INITIAL BIT MASK
BIT LDAX B ;GET BIT MAP VALUE
ANA E ;ISOLATE BIT
MVI A,'0' ;GET 'NO BIT' VALUE
JZ ZERO
INR A ;MAKE '0' INTO '1'
ZERO CALL TYPE
MOV A,E ;GET MASK
RRC ;SHIFT RIGHT
MOV E,A ;MOVE MASK BACK
JC ENDBYT ;END OF BYTE?
;CHECK IF AT END
MOV A,D ;GET BYTE #
CPI 2
JNZ BIT ;NOT END BYTE
;IS END BYTE, SEE IF END BIT
MOV A,E
CPI 20H
JNZ BIT
ENDBYT INX B ;POINT TO NEXT BYTE
DCR D ;DONE?
MOV A,D
CPI 1
JZ CR ;..YES, TYPE CR, EXIT
MOV A,D ;GET CHAR COUNT
ANI 3 ;TIME TO C/R?
CZ CR ;YES
JMP CHAR
;C/R
CR MVI A,13 ;GET C/R
CALL TYPE ;TYPE IT
MVI A,10 ;GET L/F, TYPE IT
;TYPE CHAR IN A
TYPE PUSH B
PUSH D
PUSH H
MVI C,2
MOV E,A
CALL BDOS
POP H
POP D
POP B
RET
END 100H