view level2/modules/kernel/fdatlog.asm @ 3195:6eb2edad80d8

L2: Introduce symbol KrnBlk to define kernel block number This is the block number that the kernel is loaded into. This is platform-specific, a function of the behaviour of the platform MMU/DAT. CRCs are unaffected by this change.
author Neal Crook <foofoobedoo@gmail.com>
date Thu, 01 Jun 2017 22:13:49 +0100
parents 039ddb7c8ad7
children
line wrap: on
line source

**************************************************
* System Call: F$DATLog
*
* Function: Convert DAT block/offset to logical address
*
* Input:  B = DAT image offset
*         X = Block offset
*
* Output: X = Logical address
*
* Error:  CC = C bit set; B = error code
*
FDATLog  ldb   R$B,u          Get logical Block #
         ldx   R$X,u          Get offset into block
         bsr   CmpLBlk        Go modify X to be Logical address
         stx   R$X,u          Save in callers X register
         clrb                 No error & return
         rts

* Compute logical address given B=Logical Block # & X=offset into block
* Exits with B being logical block & X=logical address
CmpLBlk  pshs  b              Preserve logical block #
         tfr   b,a            Move log. block # to A
         lsla                 Multiply logical block by 32
         lsla
         lsla
         lsla
         lsla
         clrb                 D=8k offset value
         IFNE  H6309
         addr  d,x            X=logical address in 64k workspace
         ELSE
         leax  d,x
         ENDC
         puls  b,pc           Restore A, block # & return