.TITLE FCSSEK (FDBADR%,LWADR%) .MCALL .BLK.,.BLKW. ; In: FDBADR% is address of FDB first word ; LWADR% is word-aligned address of 32-bit number ; ; 32-bit absolute byte number position stored in (LWADR%) ; the first byte of a file is 0, the next 1, ... ; ; the low order word of the 32 bits is stored at the high- ; order address, which complies with FP11 hardware ; although not with balanced design. (The low word comes ; high so the high word comes low so the sign bit is still ; att +15.) ; +-------------------------------+ ; |* High-order | LWADR% ; +-- --+ ; | Low-Order | LWADR%+2% ; +-------------------------------+ ; ; * = sign bit ; ; Out: seeks to nominated byte ; ; .BLK. ; argument block (FTN standard) .BLKW. 1,ARGNUM ; number of arguments .BLKW. 1,FDBADR ; address of FDB .BLKW. 1,LWADR ; address of 1st (high-order-data) word ; of long word FCSSEK:: ; like C's seek() ; assume arg block is correct: NO CHECKS (!) MOV @LWADR(R5),R0 ; (R0) = [long word] MOV (R0)+,R1 ; high order MOV @R0,R2 ; low order MOV R2,R3 ; position within block BIC #^C777,R3 ; 9 bits long MOV #9.,R0 ; 10$: ASR R1 ; ROR R2 ; DEC R0 ; BGT 10$ ; ; (r1:r2) = LBN ; now remember that FCS addresses a FILE ; so decrement VBN to 0-origin ADD #1,R2 ; Gordon!! @#$%^&*\ ADC R1 ; ; (R1:R2) = VBN (starts at 1-origin) MOV @FDBADR(R5),R0 ; (R0) = [FDB] ; (CALL) ; jmp .POINT ; make FCS think ; assme no errors (!) ; have stored 32 bits in output buffer ; (RETURN) ; .END