home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / tktools.zip / TKTOOLS.ASM < prev    next >
Assembly Source File  |  1990-02-26  |  24KB  |  556 lines

  1. ; BOF TkTools.ASM 
  2.     .XALL
  3.     PAGE     60,120
  4.     ;╒═══════════════════════════════════════════════════════════════════════╕
  5.     ;│                    Module Notes                 │
  6.     ;├───────────────────────────────────────────────────────────────────────┤
  7.     ;│ Module    : TKTools.asm                             │
  8.     ;│ Purpose    : Miscellaneous DOS/BIOS functiions and procedures         │
  9.     ;│ Notice    : Copyright (c) 1989, Anthony M. Kirk                 │
  10.     ;│          Duly noted herein if portions copyright by other authors.  │
  11.     ;│          (Face it, there are only so many ways to do some things.)  │
  12.     ;│ Rights    : This module is hereby placed into the PUBLIC DOMAIN.         │
  13.     ;│ No blame : This module has no WARRANTY, either express or implied.    │
  14.     ;│ Warning? : Use it at your own risk.  I have been without problems.    │
  15.     ;│                                         │
  16.     ;│ Appology?: Since I've picked up what I know about Assembly by having  │
  17.     ;│          flashbacks of 370 Assembler, reading other's code, and by  │
  18.     ;│          purchasing "Norton's Guide to Assembly" (something I will  │
  19.     ;│          recommend to any programmer!), it probably "ain't purty"!  │
  20.     ;│          This module does what I need it to, but I can't say it'll  │
  21.     ;│          do what you need.  I hope you can get some use out of it.  │
  22.     ;╞═══════════════════════════════════════════════════════════════════════╡
  23.     ;│                Function and Procedure List                 │
  24.     ;├───────────────────────────────────────────────────────────────────────┤
  25.     ;│ Interrupt(RegisterGroup) ... Perform Interrupt Using Passed Registers │
  26.     ;│ DosVer() ................................. Return Current Dos Version │
  27.     ;│ GetDriveChar() .......................... Return Current Drive Letter │
  28.     ;│ GetDriveNmbr() .......................... Return Current Drive Number │
  29.     ;│ GetDriveCap(DriveNumber) ............ Return Capacity of Passed Drive │
  30.     ;│ GetDriveFree(DriveNumber) ......... Return Free Bytes of Passed Drive │
  31.     ;│ SetDriveChar(DriveLetter) ........ Set Current Drive to Passed Letter │
  32.     ;│ SetDriveNmbr(DriveNumber) ........ Set Current Drive to Passed Number │
  33.     ;│ GetActivFlop() .............. Get Active Floppy on Single Drive Units │
  34.     ;│ SetActivFlop() .............. Set Active Floppy on Single Drive Units │
  35.     ;│ FloppyCount() .............. Return number of Floppy Drives Installed │
  36.     ;│ SetBlkToHigh  ............ Sets blinking to high intensity background │
  37.     ;│ SetHighToBlk  ............ Sets high intensity background to blinking │
  38.     ;│                                         │
  39.     ;╞═══════════════════════════════════════════════════════════════════════╡
  40.     ;│                Function and Procedure Notes             │
  41.     ;├───────────────────────────────────────────────────────────────────────┤
  42.     ;│ Procedure: Interrupt(RegisterGroup)                     │
  43.     ;│ Purpose    : Perform interrupt with passed registers             │
  44.     ;│                                         │
  45.     ;│ Parms    : Registers    GROUP,PRE(Reg)                     │
  46.     ;│          AX         GROUP                         │
  47.     ;│          AL           BYTE                         │
  48.     ;│          AH           BYTE                         │
  49.     ;│                 . ! End AX                     │
  50.     ;│          BX         GROUP                         │
  51.     ;│          BL           BYTE                         │
  52.     ;│          BH           BYTE                         │
  53.     ;│                 . ! End BX                     │
  54.     ;│          CX         GROUP                         │
  55.     ;│          CL           BYTE                         │
  56.     ;│          CH           BYTE                         │
  57.     ;│                 . ! End CX                     │
  58.     ;│          DX         GROUP                         │
  59.     ;│          DL           BYTE                         │
  60.     ;│          DH           BYTE                         │
  61.     ;│                 . ! End DX                     │
  62.     ;│          SI         SHORT                         │
  63.     ;│          DI         SHORT                         │
  64.     ;│          DS         SHORT                         │
  65.     ;│          ES         SHORT                         │
  66.     ;│          INT         BYTE                         │
  67.     ;│          FLAGS         SHORT                         │
  68.     ;│                   . ! End GROUP Registers                 │
  69.     ;│                                         │
  70.     ;│ Returns    : None (Register group, passed by address, changed directly) │
  71.     ;├───────────────────────────────────────────────────────────────────────┤
  72.     ;│ Function : DosVer()                             │
  73.     ;│ Purpose    : Get current DOS version                     │
  74.     ;│                                         │
  75.     ;│ Parms    : None                                 │
  76.     ;│                                         │
  77.     ;│ Returns    : DOS Version                             │
  78.     ;│    Type    : STRING                             │
  79.     ;│    Format    : 'x.xx'                             │
  80.     ;│    Example : DOS 3.30 returns "3.30"                     │
  81.     ;├───────────────────────────────────────────────────────────────────────┤
  82.     ;│ Function : GetDriveChar()                         │
  83.     ;│ Purpose    : Character of current drive                     │
  84.     ;│                                         │
  85.     ;│ Parms    : None                                 │
  86.     ;│                                         │
  87.     ;│ Returns    : Character of current drive                     │
  88.     ;│    Type    : STRING                             │
  89.     ;│    Format    : 'A'                                 │
  90.     ;├───────────────────────────────────────────────────────────────────────┤
  91.     ;│ Function : GetDriveNmbr()                         │
  92.     ;│ Purpose    : Number of current drive                     │
  93.     ;│                                         │
  94.     ;│ Parms    : None                                 │
  95.     ;│                                         │
  96.     ;│ Returns    : Number of current drive                     │
  97.     ;│    Type    : LONG                                 │
  98.     ;│    Example : A returns 0, B returns 1, etc.                 │
  99.     ;├───────────────────────────────────────────────────────────────────────┤
  100.     ;│ Function : GetDriveCap(DriveNumber)                     │
  101.     ;│ Purpose    : Capacity of passed drive                     │
  102.     ;│                                         │
  103.     ;│ Parms    : Drive Number (0=default, 1=A, 2=B, etc.)             │
  104.     ;│          (NOTE: numbers are "+1" of other drive numbers)         │
  105.     ;│                                         │
  106.     ;│ Returns    : Capacity of passed drive number                 │
  107.     ;│    Type    : LONG                                 │
  108.     ;├───────────────────────────────────────────────────────────────────────┤
  109.     ;│ Function : GetDriveFree(DriveNumber)                     │
  110.     ;│ Purpose    : Free bytes on passed drive                     │
  111.     ;│                                         │
  112.     ;│ Parms    : Drive Number (0=default, 1=A, 2=B, etc.)             │
  113.     ;│            (NOTE: numbers are "+1" of other drive numbers)         │
  114.     ;│                                         │
  115.     ;│ Returns    : Free bytes on passed drive number                 │
  116.     ;│    Type    : LONG                                 │
  117.     ;├───────────────────────────────────────────────────────────────────────┤
  118.     ;│ Function : SetDriveChar(DriveChar)                     │
  119.     ;│ Purpose    : Setting current drive by letter                 │
  120.     ;│                                         │
  121.     ;│ Parms    : Drive Letter (A,B, etc.)                     │
  122.     ;│                                         │
  123.     ;│ Returns    : 1=Okay, 0=Error                         │
  124.     ;│          (Allows use of "IF SetDriveChar('C')" for True/False)         │
  125.     ;│    Type    : LONG                                 │
  126.     ;├───────────────────────────────────────────────────────────────────────┤
  127.     ;│ Function : SetDriveNmbr(DriveNumber)                     │
  128.     ;│ Purpose    : Setting current drive by number                 │
  129.     ;│                                         │
  130.     ;│ Parms    : Drive Number (0=A, 2=B, etc.)                     │
  131.     ;│                                         │
  132.     ;│ Returns    : 1=Okay, 0=Error                         │
  133.     ;│          (Allows use of "IF SetDriveNmbr(2)" for True/False)         │
  134.     ;│    Type    : LONG                                 │
  135.     ;├───────────────────────────────────────────────────────────────────────┤
  136.     ;│ Function : GetActivFlop()                         │
  137.     ;│ Purpose    : Determine active floppy on single floppy drive units         │
  138.     ;│                                         │
  139.     ;│ Parms    : None                                 │
  140.     ;│                                         │
  141.     ;│ Returns    : Drive Number (00h = A, 01h = B, FFh = not determined = A ) │
  142.     ;│    Type    : LONG                                 │
  143.     ;├───────────────────────────────────────────────────────────────────────┤
  144.     ;│ Function : SetActivFlop(DriveNumber)                     │
  145.     ;│ Purpose    : Sets active floppy on single floppy drive units         │
  146.     ;│                                         │
  147.     ;│ ********************************************************************* │
  148.     ;│ **     This function VERY useful to insure that users do      ** │
  149.     ;│ **     NOT get the "Insert diskette in drive A" message.      ** │
  150.     ;│ **     You can force DOS to think A: is the active drive      ** │
  151.     ;│ ********************************************************************* │
  152.     ;│                                         │
  153.     ;│ Parms    : Drive Number (00h = A, 01h = B)                 │
  154.     ;│                                         │
  155.     ;│ Returns    : 1=Okay, 0=Error                         │
  156.     ;│          (Allows use of "IF SetActivFlop(0)" for True/False)         │
  157.     ;│    Type    : LONG                                 │
  158.     ;├───────────────────────────────────────────────────────────────────────┤
  159.     ;│ Function : FloppyCount()                             │
  160.     ;│ Purpose    : Determines the number of floppy drives installed         │
  161.     ;│                                         │
  162.     ;│ Parms    : None                                 │
  163.     ;│                                         │
  164.     ;│ Returns    : Number of floppy drives installed                 │
  165.     ;│    Type    : LONG                                 │
  166.     ;├───────────────────────────────────────────────────────────────────────┤
  167.     ;│ Procedure: SetBlkToHigh                             │
  168.     ;│ Purpose    : Changes blinking on EGA/VGA to high intensity background   │
  169.     ;│                                         │
  170.     ;│ Parms    : None                                 │
  171.     ;├───────────────────────────────────────────────────────────────────────┤
  172.     ;│ Procedure: SetHighToBlk                             │
  173.     ;│ Purpose    : Changes high intensity background to blinking on EGA/VGA   │
  174.     ;│                                         │
  175.     ;│ Parms    : None                                 │
  176.     ;└───────────────────────────────────────────────────────────────────────┘
  177.  
  178. ; Clarion LEM Equates 
  179.  
  180. TString         EQU  0                 ; String
  181. TShort         EQU  1                 ; Signed Word (16 bits)
  182. TLong         EQU  2                 ; Signed Double Word (32 bits)
  183. TReal         EQU  4                 ; Double Precision Float (8087)
  184.  
  185. Procedure    EQU  0                 ; LEM Procedure
  186. Function     EQU  1                 ; LEM Function
  187.  
  188.  
  189. ; LEM Macro - Routine 'RtnName', RtnLabel, RtnType, ParmCount 
  190.  
  191. Routine         MACRO    RNAME, RPROC, RTYPE, RPARMS
  192.          LOCAL    LBLSTRT, X1         ;* Macro local symbol defs
  193. LBLSTRT         DB          &RNAME             ; Routine name
  194. NAMELTH         =          $-LBLSTRT             ;* Len of Routine name - 13
  195. X1         EQU      13-NAMELTH         ;* Store number of nulls needed
  196.          DB          &X1 DUP (0)         ; Pad rest of name with nulls
  197.          DW          &RPROC             ; Offset of proc within module
  198.          DB          &RTYPE             ; Type, Proc(0) or Func(1)
  199.          DB          &RPARMS             ; Number of parameters
  200.          ENDM                 ; End of macro
  201.  
  202. ; LEM Macro - Parameter ParmLabel, ParmType 
  203.  
  204. Parameter    MACRO   PLBL, PTYPE
  205.          DB         &PTYPE             ; Parameter Type
  206. &PLBL         DD         0                 ; Parameter Address
  207. &PLBL&L         DW         0                 ; Parameter Length
  208.          ENDM
  209.  
  210. ; LEM Setup 
  211.  
  212. TKTools         SEGMENT BYTE             ; Load on a BYTE boundary
  213.          ASSUME CS:TKTools,DS:TKTools     ; Reg used for effective addr
  214.  
  215. ; LEM Module Header 
  216.  
  217.          DB      'BIO'                 ; LEM signature
  218. LIBVEC         DD      0                 ; Reserved, runtime lib vector
  219.          DW      TKEnd                 ; Length of LEM Module
  220.          DB      13                 ; Number of proc/funcs in LEM
  221.  
  222.  
  223. ; Interrupt Procedure Definition 
  224.  
  225.     Routine 'INTERRUPT',INTERRUPT,Procedure,1
  226.     Parameter PIntRegs,TString
  227.  
  228. ; DosVer Function Definition 
  229.  
  230.     Routine 'DOSVER',DOSVER,Function,0
  231.  
  232. ; GetDriveChar Function Definition 
  233.  
  234.     Routine 'GETDRIVECHAR',GETDRIVECHAR,Function,0
  235.  
  236. ; GetDriveNmbr Function Definition 
  237.  
  238.     Routine 'GETDRIVENMBR',GETDRIVENMBR,Function,0
  239.  
  240. ; GetDriveCap Function Definition 
  241.  
  242.     Routine 'GETDRIVECAP',GETDRIVECAP,Function,1
  243.     Parameter PDrvCap,TShort
  244.  
  245. ; GetDriveFree Function Definition 
  246.  
  247.     Routine 'GETDRIVEFREE',GETDRIVEFREE,Function,1
  248.     Parameter PDrvFree,TShort
  249.  
  250. ; SetDriveChar Function Definition 
  251.  
  252.     Routine 'SETDRIVECHAR',SETDRIVECHAR,Function,1
  253.     Parameter PSetDrChr,TString
  254.  
  255. ; SetDriveNmbr Function Definition 
  256.  
  257.     Routine 'SETDRIVENMBR',SETDRIVENMBR,Function,1
  258.     Parameter PSetDrNum,TShort
  259.  
  260. ; GetActivFlop Function Definition 
  261.  
  262.     Routine 'GETACTIVFLOP',GETACTIVFLOP,Function,0
  263.  
  264. ; SetDriveNmbr Function Definition 
  265.  
  266.     Routine 'SETACTIVFLOP',SETACTIVFLOP,Function,1
  267.     Parameter PSetActNum,TShort
  268.  
  269. ; FloppyCount Function Definition 
  270.  
  271.     Routine 'FLOPPYCOUNT',FLOPPYCOUNT,Function,0
  272.  
  273. ; SetBlkToHigh Procedure Definition 
  274.  
  275.     Routine 'SETBLKTOHIGH',SETBLKTOHIGH,Procedure,0
  276.  
  277. ; SetHighToBlk Procedure Definition 
  278.  
  279.     Routine 'SETHIGHTOBLK',SETHIGHTOBLK,Procedure,0
  280.  
  281. ; Work Area 
  282.  
  283. XRetLong     LABEL DWORD             ; Long      return value
  284. XRetShort    LABEL WORD                 ; Short  return value
  285. XRetByte     DB       0                 ; Byte      return value
  286.          DB       3 DUP(0)             ;  Fill area for return value
  287.  
  288. ; Interrupt Procedure Code 
  289.  
  290. Interrupt    PROC  FAR
  291.          LES   BX,DWORD PTR PIntRegs     ; Load address of passed regs
  292.          MOV   AL,BYTE PTR ES:[BX+16]     ; Get Interrupt Number passed
  293.          LEA   SI,IntVec             ; Make an int instruction
  294.          MOV   BYTE PTR [SI],AL         ; Move
  295.          PUSH  WORD PTR ES:[BX+2]         ; Push passed BX onto stack
  296.          PUSH  WORD PTR ES:[BX+14]         ; Push passed ES onto stack
  297.          MOV   AX,WORD PTR ES:[BX+0]     ;
  298.          MOV   CX,WORD PTR ES:[BX+4]     ;
  299.          MOV   DX,WORD PTR ES:[BX+6]     ;
  300.          MOV   SI,WORD PTR ES:[BX+8]     ;
  301.          MOV   DI,WORD PTR ES:[BX+10]     ;
  302.          MOV   DS,WORD PTR ES:[BX+12]     ;
  303.          POP   ES                 ; Pop ES
  304.          POP   BX                 ; POp BX
  305.          DB       0CDh                 ; Interrupt OPCode
  306. IntVec:         DB       10h                 ; Interrupt Vector
  307.          PUSHF                 ; Push Flags
  308.          PUSH  ES                 ; Save Registers: Push ES
  309.          PUSH  DS                 ; Push DS onto stack
  310.          PUSH  BX                 ; Push BX onto stack
  311.          PUSH  CS                 ; Push CS onto stack
  312.          POP   DS                 ; Pop CS into DS
  313.          LES   BX,DWORD PTR PIntRegs     ; Load address of group
  314.          MOV   WORD PTR ES:[BX+0],AX     ; Move AX value into group
  315.          POP   WORD PTR ES:[BX+2]         ; Pop BX value into group
  316.          MOV   WORD PTR ES:[BX+4],CX     ; Move CX into group
  317.          MOV   WORD PTR ES:[BX+6],DX     ; Move DX into group
  318.          MOV   WORD PTR ES:[BX+8],SI     ; Move SI into group
  319.          MOV   WORD PTR ES:[BX+10],DI     ; Move DI into group
  320.          POP   WORD PTR ES:[BX+12]         ; Pop DS
  321.          POP   WORD PTR ES:[BX+14]         ; Pop ES
  322.          POP   WORD PTR ES:[BX+17]         ; Pop flags into group
  323.          RET                 ; Return to Clarion
  324. Interrupt    ENDP
  325.  
  326. ; DosVer Function Code 
  327.  
  328. DosVer         PROC  FAR
  329.          MOV   AH,30h             ; Set for DOSVer func
  330.          INT   21H                 ; Perform interrupt
  331.          ADD   AL,'0'             ; Make major an ascii number
  332.          MOV   BYTE PTR XRetLong,AL         ; Move Major
  333.          MOV   BYTE PTR XRetLong+1,'.'     ; Move Decimal place
  334.          MOV   AL,AH             ; Move to low byte
  335.          SUB   AH,AH             ; Clear high byte
  336.          MOV   BX,0Ah             ; Get ready to divide by 10
  337.          DIV   BX                 ; Divide Minor by 10 (into AX)
  338.          ADD   AL,'0'             ; Make it an ascii number
  339.          ADD   AH,'0'             ; Make it an ascii number
  340.          MOV   BYTE PTR XRetLong+2,AL     ; Move third char to string
  341.          MOV   BYTE PTR XRetLong+3,AH     ; Move fourth char to string
  342.          MOV   AL,TString             ; Set to string return val
  343.          MOV   BX,OFFSET TKTools:XRetLong     ; Set address
  344.          MOV   CX,4                 ; Set length of string
  345.          RET                 ; Return to Clarion
  346. DosVer         ENDP
  347.  
  348. ; GetDriveChar Function Code 
  349.  
  350. GetDriveChar PROC  FAR
  351.          MOV   AH,19h             ; Set for current drive
  352.          INT   21H                 ; Perform interrupt
  353.          ADD   AL,'A'             ; Returns A=0, so add 65 (A)
  354.          MOV   XRetByte,AL             ; Move to return string
  355.          MOV   AL,TString             ; Set return type to string
  356.          MOV   CX,1                 ; Set length to 1
  357.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of value
  358.          RET                 ; Return to Clarion
  359. GetDriveChar ENDP
  360.  
  361. ; GetDriveNmbr Function Code 
  362.  
  363. GetDriveNmbr PROC  FAR
  364.          CALL  ClrRetLong             ; Clear return value
  365.          MOV   AH,19h             ; Set for current drive
  366.          INT   21H                 ; Perform interrupt
  367.          MOV   XRetByte,AL             ; Move to return string
  368.          MOV   AL,TLong             ; Set return type to long
  369.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of value
  370.          RET                 ; Return to Clarion
  371. GetDriveNmbr ENDP
  372.  
  373. ; GetDriveCap Function Code 
  374.  
  375. GetDriveCap  PROC  FAR
  376.          CALL  ClrRetLong             ; Clear return value
  377.          LES   DI,PDrvCap             ; Point to passed disk
  378.          MOV   DL,ES:[DI]             ; Move passed disk
  379.          MOV   AH,36h             ; Set for disk free space
  380.          INT   21h                 ; Perform interrupt
  381.          PUSH  DX                 ; Push DX (clusters)
  382.          SUB   DX,DX             ; Clear DX
  383.          MUL   CX                 ; Multiply AX by CX
  384.          POP   CX                 ; Pop old DX into CX
  385.          MUL   CX                 ; Multiply AX by CX (old DX)
  386.          MOV   WORD PTR XRetLong,AX         ; Move to return string
  387.          MOV   WORD PTR XRetLong+2,DX     ; Move to return string
  388.          MOV   AL,TLong             ; Set return type to long
  389.          MOV   BX,OFFSET TKTools:XRetLong     ; Set address of value
  390.          RET                 ; Return to Clarion
  391. GetDriveCap  ENDP
  392.  
  393. ; GetDriveFree Function Code 
  394.  
  395. GetDriveFree PROC  FAR
  396.          CALL  ClrRetLong             ; Clear return value
  397.          LES   DI,PDrvCap             ; Point to passed disk
  398.          MOV   DL,ES:[DI]             ; Move passed disk
  399.          MOV   AH,36h             ; Set for disk free space
  400.          INT   21h                 ; Perform interrupt
  401.          SUB   DX,DX             ; Clear DX
  402.          MUL   CX                 ; Multiply AX by CX (bytes)
  403.          MUL   BX                 ; Multiply AX by BX (free cl)
  404.          MOV   WORD PTR XRetLong,AX         ; Move to return string
  405.          MOV   WORD PTR XRetLong+2,DX     ; Move to return string
  406.          MOV   AL,TLong             ; Set return type to long
  407.          MOV   BX,OFFSET TKTools:XRetLong     ; Set address of value
  408.          RET                 ; Return to Clarion
  409. GetDriveFree ENDP
  410.  
  411. ; SetDriveChar Function Code 
  412.  
  413. SetDriveChar PROC  FAR
  414.          CALL  ClrRetLong             ; Clear return value
  415.          MOV   XRetByte,01h             ; Set return val to OKAY
  416.          MOV   AH,19h             ; Set for current drive
  417.          INT   21h                 ; Perform interrupt
  418.          LES   DI,PSetDrChr             ; Point to passed drive ltr
  419.          MOV   DL,ES:[DI]             ; Move passed disk
  420.          CMP   DL,'a'                        ; Compare character to 'a'
  421.          JL       NotLower1             ; Skip lower to upper section
  422.          SUB   DL,32             ; Make it upper case
  423. NotLower1:   SUB   DL,'A'             ; Make char a number
  424.          CMP   AL,DL             ; Compare current to passed
  425.          JE       EndSetDrChr             ; Skip setting if same
  426.          MOV   AH,0Eh             ; Set for set default disk
  427.          INT   21h                 ; Perform interrupt
  428.          MOV   AH,19h             ; Set for current drive
  429.          INT   21h                 ; Perform interrupt
  430.          CMP   AL,DL             ; Check current same as passed
  431.          JE       EndSetDrChr             ; Leave OKAY in return code
  432.          MOV   XRetByte,00h             ; Move error to return code
  433. EndSetDrChr: MOV   AL,TLong             ; Set return type to long
  434.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of value
  435.          RET                 ; Return to Clarion
  436. SetDriveChar ENDP
  437.  
  438. ; SetDriveNmbr Function Code 
  439.  
  440. SetDriveNmbr PROC  FAR
  441.          CALL  ClrRetLong             ; Clear return value
  442.          MOV   XRetByte,01h             ; Clear return val to OKAY
  443.          MOV   AH,19h             ; Set for current drive
  444.          INT   21h                 ; Perform interrupt
  445.          LES   DI,PSetDrNum             ; Point to passed drive ltr
  446.          MOV   DL,ES:[DI]             ; Move passed disk
  447.          CMP   AL,DL             ; Compare current to passed
  448.          JE       EndSetDrNum             ; Skip setting if same
  449.          MOV   AH,0Eh             ; Set for set default disk
  450.          INT   21h                 ; Perform interrupt
  451.          MOV   AH,19h             ; Set for current drive
  452.          INT   21h                 ; Perform interrupt
  453.          CMP   AL,DL             ; Check current same as passed
  454.          JE       EndSetDrNum             ; Leave OKAY in return code
  455.          MOV   XRetByte,00h             ; Move error to return code
  456. EndSetDrNum: MOV   AL,TLong             ; Set return type to long
  457.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of value
  458.          RET                 ; Return to Clarion
  459. SetDriveNmbr ENDP
  460.  
  461. ; GetActivFlop Function Code 
  462.  
  463. GetActivFlop PROC  FAR
  464.          CALL  ClrRetLong             ; Clear return value
  465.          PUSH  SI                 ; Save SI
  466.          PUSH  DS                 ; Save DS
  467.          SUB   AX,AX             ; Clear register (00h)
  468.          MOV   DS,AX             ;  And move it to DS
  469.          MOV   SI,0504h             ; Store Offset     (504h)
  470.          MOV   BL,[SI]             ; PEEK byte into BL
  471.          POP   DS                 ; Restore DS
  472.          POP   SI                 ; Restore SI
  473.          MOV   XRetByte,BL             ; Store in CurDrv retn area
  474.          MOV   AL,TLong             ; Set return type to long
  475.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of value
  476.          RET                 ; Return to Clarion
  477. GetActivFlop ENDP
  478.  
  479. ; SetActivFlop Function Code 
  480.  
  481. SetActivFlop PROC  FAR
  482.          CALL  ClrRetLong             ; Clear return value
  483.          MOV   XRetByte,00h             ; Clear return val to ERROR
  484.          LES   DI,PSetActNum         ; Point to passed disk
  485.          MOV   BL,ES:[DI]             ; Move passed disk
  486.          CMP   BL,01h             ; Compare passed to 01 (B)
  487.          JG       EndSetActFl             ; Skip around the poke
  488.          MOV   XRetByte,01h             ; Set return val to OKAY
  489.          PUSH  SI                 ; Save SI
  490.          PUSH  DS                 ; Save DS
  491.          SUB   AX,AX             ; Clear register (00h)
  492.          MOV   DS,AX             ;  And move it to DS
  493.          MOV   SI,0504h             ; Store Offset     (504h)
  494.          MOV   [SI],BL             ; POKE byte from BL
  495.          POP   DS                 ; Restore DS
  496.          POP   SI                 ; Restore SI
  497. EndSetActFl: MOV   AL,TLong             ; Set return type to long
  498.          MOV   BX,OFFSET TKTools:XRetByte     ; Set address of ret code
  499.          RET                 ; Return to Clarion
  500. SetActivFlop ENDP
  501.  
  502. ; FloppyCount Function Code 
  503.  
  504. FloppyCount  PROC  FAR
  505.          CALL  ClrRetLong             ; Clear return value
  506.          INT   11H                 ; Perform equip-list int
  507.          MOV   BX,AX             ; Store AX in BX
  508.          AND   BX,01h             ; See if ANY floppies
  509.          CMP   BX,01h             ; If ANY floppies, True
  510.          JNE   RetFloppy             ; No floppies, return
  511.          MOV   CL,6                 ; Set to shift 6 bits
  512.          SHR   AX,CL             ; Shift right by 6 bits
  513.          AND   AX,00000011b             ; Pull out floppy count bits
  514.          ADD   AX,1                 ; Subtract one from AX
  515.          MOV   XRetShort,AX             ; Move to return string
  516. RetFloppy:   MOV   AX,TLong             ; Set return type to long
  517.          MOV   BX,OFFSET TKTools:XRetShort     ; Set address of value
  518.          RET                 ; Return to Clarion
  519. FloppyCount  ENDP
  520.  
  521. ; SetBlkToHigh Function 
  522. SetBlkToHigh PROC  FAR
  523.          MOV   AH,10h             ;
  524.          MOV   AL,03h             ;
  525.          MOV   BL,00h             ; 00h in BL makes high-intens
  526.          INT   10h                 ; Call interrupt
  527.          RET
  528. SetBlkToHigh ENDP
  529.  
  530. ; SetBlkToHigh Function 
  531. SetHighToBlk PROC  FAR
  532.          MOV   AH,10h
  533.          MOV   AL,03h
  534.          MOV   BL,01h             ; 01h in BL makes blinking
  535.          INT   10h                 ; Call interrupt
  536.          RET
  537. SetHighToBlk ENDP
  538.  
  539. ; ClrRetLong Procedure (LOCAL) 
  540. ClrRetLong   PROC  NEAR                 ; Clear return val to nulls
  541.          MOV   AX,DS             ; Save DS to give to ES
  542.          MOV   ES,AX             ; Now get AX into ES
  543.          MOV   DI,OFFSET XRetLong         ; Get address of val (ES:DI)
  544.          CLD                 ; Clear dir flag (forward)
  545.          SUB   AX,AX             ; Init value to 0
  546.          MOV   CX,2                 ; Set to length (2*2)
  547.          REPNZ STOSW             ; Store 0 in all 128 bytes
  548.          RET                 ; Return to caller
  549. ClrRetLong   ENDP
  550.  
  551. ; Ending Labels
  552. TKEnd    LABEL BYTE
  553. TKTools ENDS
  554.     END
  555. ; EOF TkTools.ASM 
  556.