home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / ASM32.ZIP / SYSTEM.DOC < prev    next >
Text File  |  1993-12-07  |  14KB  |  529 lines

  1.  
  2. *****************************  SYSTEM  *************************************
  3.  
  4. ASM32 system subroutines Copyright (C) 1993 Douglas Herr
  5. all rights reserved
  6.  
  7.  
  8. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  9.  
  10. COLOR16:     calculate color value for palette register
  11. Source:      color16.asm
  12.  
  13. Call with:   EBX pointing to red value (0-3), green value (0-3)
  14.              and blue value (0-3); see also Palette16
  15. Returns:     AH = color value for 16-color palette register
  16. Uses:        AH
  17. Supports:    VGA 16-color modes (text or graphics)
  18.              EGA 16-color modes, except with CGA monitor
  19. Example:
  20.  
  21. extrn   color16:near
  22.  
  23. include dataseg.inc
  24.  
  25. c16     db 3                  ; brightest red
  26.         db 1                  ; dim green
  27.         db 0                  ; no blue
  28.  
  29. @curseg ends
  30.  
  31. include codeseg.inc
  32.         .
  33.         .
  34.         .
  35.         lea   ebx,c16
  36.         call  color16
  37.  
  38.  
  39.  
  40. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  41.  
  42. EXENAME:     determine the full path and filename of the executing program
  43. Source:      exename.asm (strlen.asm)
  44.  
  45. Call with:   no parameters
  46. Returns:     EBX pointing to the the name of the executing program,
  47.              including drive and full path.
  48.              The filename returned is an ASCIIZ string in the low heap,
  49.              and may be mixed upper- and lower-case characters.  When you
  50.              are done with the string you may release the memory it
  51.              occupies with HFREE.
  52. Uses:        EBX, flags
  53. Example:
  54.  
  55. extrn   exename:near
  56.  
  57. include codeseg.inc
  58.  
  59.         .
  60.         .
  61.         .
  62.         call  exename         ; string returned at [EBX] in low heap
  63.  
  64.  
  65.  
  66. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  67.  
  68. FLOPPIES:    determine the number of floppy disk drives intalled
  69. Source:      floppies.asm
  70.  
  71. Call with:   no parameters
  72. Returns:     AX = number of floppy drives
  73. Uses:        AX; all other registers and flags are saved
  74. Example:
  75.  
  76. include model.inc
  77.  
  78. extrn   floppies:near
  79.  
  80. include codeseg.inc
  81.  
  82. myproc  proc   near
  83.         .
  84.         call   floppies
  85.  
  86.  
  87.  
  88. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  89.  
  90. FLOPPYTYPE:  determine the type of floppy disk drives intalled
  91. Source:      floptype.asm
  92.  
  93. Call with:   DL = drive number (0 = drive A:)
  94. Returns:     AX = floppy drive type
  95.               0 = invalid drive number
  96.               1 = 360k
  97.               2 = 1.2M
  98.               3 = 720k
  99.               4 = 1.44M
  100. Uses:        AX, flags
  101. Example:
  102.  
  103. include model.inc
  104.  
  105. public  myproc
  106. extrn   floppytype:near
  107.  
  108. .data
  109. drive_number   db 0
  110.  
  111. .code
  112. myproc  proc
  113.         .
  114.         mov    dl,drive_number
  115.         call   floppytype
  116.         or     ax,ax
  117.         jz     bad_drive_number
  118.  
  119. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  120.  
  121. GETCPU:      detects cpu type
  122. Source:      getcpu.asm
  123.  
  124. Call with:   no parameters
  125. Returns:     AX = 3 if 386 (SX or DX)
  126.              AX = 4 if 486 (SX or DX)
  127. Uses:        AX
  128. Example:     call   getcpu
  129.  
  130.  
  131.  
  132. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  133.  
  134. GETCRT:      determines active monitor type
  135. Source:      getcrt.asm ($herc.asm, isevga.asm)
  136.  
  137. Call with:   no parameters
  138. Returns:     AX = code for active video system
  139.              CGA = -1
  140.              MDA = 0
  141.              EGA mono = 0100h
  142.              VGA mono = 0300h
  143.              EGA color = 1
  144.              MCGA = 2
  145.              VGA color = 3
  146.              HGC = 128
  147.              HGC+ = 144
  148.              InColor = 208
  149.              Note: GetCRT may be re-assembled with the /DNOHERC switch
  150.              to eliminate code which detects Hercules equipment
  151. Uses:        AX
  152. Supports:    CGA, MCGA, MDA, HGC, HGC+, InColor, EGA, VGA
  153. Example:     call    getcrt
  154.  
  155.  
  156.  
  157. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  158.  
  159. ISANSI:      determines if ANSI or compatible is loaded and active
  160. Source:      isansi.asm
  161.  
  162. Call with:   no parameters
  163. Returns:     CF = 1 if no ANSI device driver loaded and active
  164.              CF = 0 if ANSI loaded and active
  165. Uses:        CF
  166. Example:
  167.  
  168. include codeseg.inc
  169.  
  170. extrn   isansi:near
  171.  
  172. ; code
  173.         .
  174.         .
  175.         .
  176.         call   isansi         ; let's see if ansi.sys is loaded
  177.         jc     no_ansi        ; jump if not
  178.  
  179.  
  180.  
  181. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  182.  
  183. ISATT:       determines if an ATT 6300-type display card is installed
  184.              this equipment is like a CGA except that it has an additional
  185.              640 x 400 2-color graphics mode (mode 40h)
  186. Source:      isatt.asm ($6845.asm, isevga.asm)
  187.  
  188. Call with:   no parameters
  189. Returns:     if CF = 1, ATT 6300 display not present
  190.              if CF = 0, ATT 6300 display is installed
  191. Uses:        flags
  192. Example:
  193.  
  194. public  cgamode
  195.  
  196. include codeseg.inc
  197.  
  198. extrn   isatt:near
  199.  
  200. ; code
  201. cgamode proc    near
  202.         mov     ax,06h             ; default: set CGA mode
  203.         call    isatt              ; see if mode 40h is available
  204.         jc      short set_mode     ;  nope
  205.         mov     ax,40h             ; use ATT 6300 mode 40h
  206. set_mode:
  207.         mov     v86r_ax,ax
  208.         mov     al,10h             ; use BIOS to set mode
  209.         int     30h
  210.         ret
  211.  
  212. cgamode endp
  213.  
  214. @curseg ends
  215.         end
  216.  
  217.  
  218. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  219.  
  220. ISEVGA:      determines if an EGA or VGA is installed
  221. Source:      isevga.asm
  222.  
  223. Call with:   no parameters
  224. Returns:     if CF = 1, no EGA or VGA
  225.              if CF = 0
  226.                DX = video memory in kbytes
  227.                AL = monitor type
  228.                 AL = -1 if monitor is CGA
  229.                 AL = 0 if monitor is monochrome
  230.                 AL = 1 if monitor is EGA or better
  231.  
  232.                AH = EGA/VGA flag
  233.                 AH = 1 if EGA
  234.                 AH = 3 if VGA
  235.  
  236. Uses:        AX, DX, CF
  237. Example:
  238.  
  239. include codeseg.inc
  240.  
  241. extrn   isevga:near
  242.  
  243. ; code
  244.         .
  245.         .
  246.         .
  247.         call   isevga
  248.         jc     no_evga
  249.  
  250.  
  251.  
  252. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  253.  
  254. ISHERC:      determines if a Hercules card or compatible is installed
  255.              and if so, determines if it is the active video system.
  256. Source:      isherc.asm ($herc.asm)
  257.  
  258. Call with:   no parameters
  259. Returns:     if CF = 1, no Hercules or compatible installed
  260.              if CF = 0, AX = Hercules model
  261.              128 = Hercules Graphics Card or compatible; active
  262.              144 = Hercules Graphics Card Plus; active
  263.              208 = Hercules InColor card; active
  264.              -128 = Hercules Graphics Card or compatible; not active
  265.              -144 = Hercules Graphics Card Plus; not active
  266.              -208 = Hercules InColor card; not active
  267. Uses:        AX, CF; all other flags and registers are saved
  268. Example:
  269.  
  270. include codeseg.inc
  271.  
  272. extrn   isherc:near
  273.  
  274. ; code
  275.         .
  276.         .
  277.         .
  278.         call  isherc
  279.         jc    no_herc
  280.  
  281.  
  282. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  283.  
  284. ISMONO:      detects a monochrome-compatible video card
  285.              this is handy in 2-monitor systems.
  286. Source:      $6845.asm
  287.  
  288. Call with:   no parameters
  289. Returns:     if CF = 1, no monochrome monitor
  290.              if CF = 0, monochrome monitor is installed
  291.                         including Hercules InColor
  292. Uses:        flags
  293. Supports:    MDA, EGA & VGA MONO, HGC, HGC+, InColor
  294. Example:
  295.  
  296. include codeseg.inc
  297.  
  298. extrn   ismono:near
  299.  
  300. ; code
  301.         .
  302.         .
  303.         .
  304.         call  ismono
  305.         jc    no_monochrome
  306.  
  307.  
  308.  
  309. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  310.  
  311. ISMOUSE:     determines if a mouse is installed
  312. Source:      ismouse.asm (asmflags.asm)
  313.  
  314. Call with:   no parameters
  315. Returns:     if CF = 0, AX = number of mouse buttons
  316.              if CF = 1, no mouse or mouse driver not installed
  317. Uses:        AX, flags
  318. Example:
  319.  
  320. include  codeseg.inc
  321.  
  322. extrn    ismouse:near
  323.  
  324. ; code
  325.         .
  326.         .
  327.         .
  328.         call    ismouse
  329.         jc      no_mouse
  330.  
  331.  
  332.  
  333. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  334.  
  335. ISSEVGA:     determines if a Super EGA or Super VGA is installed
  336. Source:      issevga.asm
  337.  
  338. Call with:   no parameters
  339. Returns:     if CF = 1, no Super EGA or Super VGA recognized by ASM32
  340.  
  341.              if CF = 0
  342.  
  343.               if AH = 1: (Super EGA)
  344.                AL = 1 if Paradise EGA 480
  345.                AL = 2 if Everex EGA
  346.  
  347.               if AH = 3: (Super VGA)
  348.                AL = 1 if Paradise VGA
  349.                AL = 3 if Tseng VGA chipset
  350.                AL = 4 if Oak VGA
  351.                AL = 5 if Western Digital VGA chipset
  352.  
  353.              See also IsEVGA and WhichVGA
  354. Uses:        AX, CF
  355. Example:
  356.  
  357. include codeseg.inc
  358.  
  359. extrn   issevga:near
  360.  
  361. ; code
  362.         .
  363.         .
  364.         .
  365.         call   issevga
  366.         jc     no_superevga
  367.  
  368.  
  369.  
  370. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  371.  
  372. MATHCHIP:    determines if x87 math coprocessor is installed
  373. Source:      mathchip.asm
  374.  
  375. Call with:   no parameters
  376. Returns:     AX = code for x87 model
  377.              0 = not installed
  378.              2 = 287                   ; earliest 386 computers used 287
  379.              3 = 387 (DX or SX)
  380.              4 = 487 (DX or SX)
  381.              If the coprocessor is present, it is initilaized by MathChip.
  382. Uses:        AX, all x87 registers
  383. Example:     call  mathchip
  384.  
  385.  
  386.  
  387.  
  388. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  389.  
  390. MOUSESAVE:   save mouse state
  391. Source:      moussave.asm
  392.  
  393. MOUSERESTORE:restore previously saved mouse state
  394. Source:      moussave.asm
  395.  
  396.              MouseSave and MouseRestore are handy when you have installed a
  397.              mouse event handler and you will be using the SYSTEM command,
  398.              where some other program may reset or otherwise change the
  399.              mouse event trapping.
  400.  
  401.              MouseSave allocates a buffer, saves the mouse state in the
  402.              buffer, resets the mouse driver and returns the buffer address.
  403.  
  404.              MouseRestore restores a specified mouse state and releases the
  405.              buffer.  Both MouseSave and MouseRestore assume that you already
  406.              know there is a mouse in the system.
  407.  
  408. Call with:   MouseSave: no paramerters
  409.              MouseRestore: AX = buffer address returned by MouseSave
  410. Returns:     if CF = 1, AH = DOS error code
  411.              if CF = 0, no error; MouseSave returns buffer address in AX
  412. Uses:        AX, flags
  413. Example:
  414.  
  415. include model.inc
  416. extrn   msave:near, mrestore:near
  417.  
  418. include dataseg.inc
  419. save_mouse dw 0
  420. @curseg    ends
  421.  
  422. include codeseg.inc
  423.  
  424.         .
  425.         .
  426.         .
  427.  
  428. ; save the mouse driver state
  429. ; I've already checked to see if there's a mouse
  430.         call    mousesave
  431.         jc      dos_error
  432.         mov     save_mouse,ax
  433.         .
  434.         .
  435. ; some other subroutine has messed with the mouse
  436.         mov     ax,save_mouse   ; buffer address from previous MSave
  437.         call    mouserestore
  438.         jc      dos_error
  439.  
  440.  
  441.  
  442. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  443.  
  444. PALETTE16:   change palette in EGA, VGA or SVGA 16-color mode
  445.              changing the palette changes the actual color associated
  446.              with a color attribute
  447. Source:      palet16.asm
  448.  
  449. Call with:   BH = color value (see Color16 in SYSTEM.DOC)
  450.              BL = color attribute to map color to (0-0Fh)
  451.              restore default palette with BX = 0FFFFh
  452. Returns:     nothing
  453. Uses:        nothing
  454. Supports:    EGA, VGA, SVGA 16-color modes, text or graphics
  455.              except EGA with CGA monitor
  456. Example:
  457.  
  458. include codeseg.inc
  459.  
  460. extrn   color16:near, palette16:near
  461.  
  462. ; data
  463. c16     db 3                  ; brightest red
  464.         db 1                  ; dim green
  465.         db 0                  ; no blue
  466.  
  467. ; code
  468.         .
  469.         .
  470.         .
  471.         lea   ebx,c16
  472.         call  color16
  473.         mov   bh,ah           ; color value in BH
  474.         mov   bl,15           ; color attribute 0Fh
  475.         call  palette16
  476.  
  477.  
  478.  
  479. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  480.  
  481. USE32K:      limit Hercules equipment to 32k memory (128k on InColor)
  482. USE64K:      allow full 64k on HGC and HGC+ (256k on InColor)
  483. Source:      $herc.asm
  484.  
  485. Requires Hercules or compatible
  486.  
  487. Call with:   no parameters
  488.              Use32k is equivalent to the Hercules "half" configuration
  489.              Use64k is equivalent to the Hercules "full" configuration
  490.              ASM32's default is "half".  Use this configuration if you
  491.              have a 2-monitor system, unless you are using the Hercules
  492.              CGA card. 
  493. Returns:     nothing
  494. Uses:        nothing
  495. Example:     ; in this example I'm determining if a Hercules is installed
  496.              ; and setting the configuration to "full"
  497.  
  498.  
  499. extrn   IsHerc:near
  500. extrn   Use64k:near
  501.  
  502. include codeseg.inc
  503.  
  504.         .
  505.         .
  506.         .
  507.         call  IsHerc
  508.         jc    no_herc
  509.         or    ax,ax
  510.  
  511. ; use_only_half if HGC is not default monitor
  512.         js    short use_only_half
  513.         call  use64k          ; else use all Hercules memory
  514. use_only_half:
  515.  
  516.  
  517. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  518.  
  519. WHICHVGA:    determine if VGAKIT-compatible SuperVGA is installed
  520.              See SVGA16 and SVGA256 in MODE.DOC.
  521. Source:      whichvga.asm ($banks.asm)
  522.  
  523. Call with:   no parameters
  524. Returns:     if VGAKIT-compatible Super VGA is installed, AX <> 0.
  525.              if no VGAKIT equipment is installed, AX = 0.
  526. Uses:        AX
  527. Example:     see SVGA16 in MODE.DOC
  528.  
  529.