
/ZERO FILE MAP BIT SUBROUTINE
/ENTER WITH AC = BLOCK#
/EXTERNAL: MAPAD
ZFLBT  0
       DAC ZFLBT0   /SAVE BLOCK NUMBER
       AND (1760    /GET MAP WORD POINTER
       CLL!RTR
       RTR
       TAD MAPAD
       DAC ZFLBT1   /SAVE MAP WORD POINTER
       LAC ZFLBT0   /GET BIT POSITION
       AND (17
       CMA
       DAC ZFLBT0
       CLA!CLL!CML   /SET AC = 0, L = 1
       RAR           /SHIFT RIGHT
       ISZ ZFLBT0
       JMP .-2
       CMA
       AND* ZFLBT1
       DAC* ZFLBT1   /REPLACE MAP WORD
       JMP* ZFLBT
ZFLBT0 0
ZFLBT1 0
/ZERO DIR.MAP BIT SUBROUTINE
/ENTER WITH AC = POINTER TO DIR. BIT
/EXTERNAL: MAPAD
ZDYBT  0
       DAC ZDYBT0   /SAVE POINTER
       SWHA
       AND (17
       TAD (100
       TAD MAPAD
       DAC ZDYBT1   /SAVE MAP WORD POINTER
       LAC ZDYBT0   /GET BIT POINTER
       AND (17
       CMA
       DAC ZDYBT0
       CLA!CLL!CML
       RAR
       ISZ ZDYBT0
       JMP .-2
       CMA
       AND* ZDYBT1
       DAC* ZDYBT1   /REPLACE MAP WORD
       JMP* ZDYBT
ZDYBT0 0
ZDYBT1 0
/SET DIR.MAP BIT SUBROUTINE
/ENTER WITH AC = POINTER TO DIR.MAP BIT
/EXTERNAL: MAPAD
SDYBT  0
       DAC SDYBT0   /SAVE BIT POINTER
       SWHA
       AND (17
       TAD (100
       TAD MAPAD
       DAC SDYBT1   /SAVE MAP WORD POINTER
       LAC SDYBT0   /GET BIT POINTER
       AND (17
       CMA
       DAC SDYBT0
       CLA!CLL!CML
       RAR
       ISZ SDYBT0
       JMP .-2
       DAC SDYBT0   /SAVE
       CMA
       AND* SDYBT1  /ZERO DIR.MAP BIT
       TAD SDYBT0   /NOW SET IT
       DAC* SDYBT1  /REPLACE MAP WORD
       JMP* SDYBT
SDYBT0 0
SDYBT1 0
/FIND FREE BLOCK SUBROUTINE
/RETURN WITH AC = BLOCK#
/            AC = 0 , NO FREE BLOCKS
/EXTERNALS:MAPAD, LOC17
FRBLK  0
       LAW -1
       TAD MAPAD
       DAC 17     /SET UP MAP POINTER
       LAW -100
       DAC FRBLK1  /SET UP MAP WORD COUNTER
FRBLK0 LAC* 17    /GET ONE MAP WORD
       CMA
       AND (777774  /NULL BITS 16,17
       SZA
       JMP .+5
       ISZ FRBLK1
       JMP FRBLK0    /NOT END YET
       CLA           /NO FREE BLOCKS
       JMP* FRBLK
       DZM FRBLK2   /SET UP BIT COUNTER
       SPA
       JMP .+4      /BIT FOUND
       RAL
       ISZ FRBLK2
       JMP .-4
       LAC FRBLK1   /GET WORD POINTER
       TAD (100
       CLL!RTL      /MULTIPLY BY 16
       RTL
       TAD FRBLK2   /ADD BIT POSITION
       JMP* FRBLK
FRBLK1 0
FRBLK2 0
    .END
