home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / DISPA.ASM < prev    next >
Assembly Source File  |  1991-08-16  |  5KB  |  155 lines

  1. ; File......: DISPA.ASM
  2. ; Author....: Mike Taylor
  3. ; Date......: $Date:   15 Aug 1991 23:06:48  $
  4. ; Revision..: $Revision:   1.2  $
  5. ; Log file..: $Logfile:   E:/nanfor/src/dispa.asv  $
  6. ; This is an original work by Mike Taylor and is placed in the
  7. ; public domain.
  8. ;
  9. ; Modification history:
  10. ; ---------------------
  11. ;
  12. ; $Log:   E:/nanfor/src/dispa.asv  $
  13. ;  
  14. ;     Rev 1.2   15 Aug 1991 23:06:48   GLENN
  15. ;  Forest Belt proofread/edited/cleaned up doc
  16. ;  
  17. ;     Rev 1.1   14 Jun 1991 19:54:28   GLENN
  18. ;  Minor edit to file header
  19. ;  
  20. ;     Rev 1.0   01 Apr 1991 01:03:14   GLENN
  21. ;  Nanforum Toolkit
  22. ;  
  23. ;
  24.  
  25. .MODEL LARGE
  26. .CODE
  27.  
  28.         PUBLIC  __ft_vconfig
  29. __ft_vconfig PROC
  30.  
  31.         XOR     AX,AX           ; CLEAR AX
  32.         MOV     AH,0FH          ; BIOS FUNCTION 0FH, GET VIDEO MODE
  33.         INT     10H
  34.  
  35.         CMP     AL,7            ; DID BIOS RETURN MONO (= 7)?
  36.         jnz     v1              ; if no, then color
  37.         mov     ax,0b000h       ; yes, switch to mono segment
  38.         jmp     v2              ; bypass color assignment
  39. v1:
  40.         mov     ax,0b800h       ; color segment
  41. v2:
  42.         ret                     ; return segment in ax to caller
  43. __ft_vconfig ENDP
  44.  
  45.  
  46.  
  47.         PUBLIC  __ft_gotoxy
  48. __ft_gotoxy PROC
  49.  
  50.         push    bp              ; save the caller's bp register
  51.         mov     bp,sp           ; establish our base pointer into the stack
  52.         push    bx              ; save bx and dx registers
  53.         push    dx
  54.  
  55.         xor     ax,ax           ; clear ax register
  56.         xor     bx,bx           ; bx = 0 means video page 0
  57.         mov     dh, [bp + 8]    ; get y coordinate
  58.         mov     dl, [bp + 6]    ; get x coordinate
  59.         mov     ah,2            ; bios function 02h, set cursor position
  60.         int     10h
  61.  
  62.         xor     ax,ax           ; clear ax register
  63.  
  64.         pop     dx              ; restore caller's registers
  65.         pop     bx
  66.         pop     bp
  67.         ret
  68. __ft_gotoxy ENDP
  69.  
  70.  
  71.  
  72.         PUBLIC  __ft_fileread
  73. __ft_fileread PROC
  74.  
  75.         push    bp              ; save the caller's bp register
  76.         mov     bp,sp           ; establish our base pointer into the stack
  77.  
  78.         push    bx              ; save caller's registers
  79.         push    cx
  80.         push    dx
  81.         push    ds
  82.  
  83.         mov     bx,[bp + 6]     ; file handle
  84.         mov     dx,[bp + 8]     ; offset of buffer
  85.         mov     ax,[bp + 10]    ; segment of buffer
  86.         push    ax              ; make buffer segment into default data segment
  87.         pop     ds
  88.         mov     cx,[bp + 12]    ; byte count to read in
  89.         xor     ax,ax           ; clear ax register
  90.         mov     ah,3fh          ; dos function 3fh, file block read
  91.         int     21h
  92.  
  93.         jnc     fr1             ; if carry flag set then error occured
  94.         xor     ax,ax           ;   and notify by returning 0 bytes
  95.                                 ; otherwise ax will contain the actual
  96.                                 ; bytes read in.
  97.  
  98. fr1:
  99.         pop     ds              ; restore caller's registers
  100.         pop     dx
  101.         pop     cx
  102.         pop     bx
  103.         pop     bp
  104.  
  105.         ret
  106.  
  107. __ft_fileread ENDP
  108.  
  109.  
  110.  
  111.         PUBLIC  __ft_fileseek
  112. __ft_fileseek PROC
  113.  
  114.         push    bp              ; save the caller's bp register
  115.         mov     bp,sp           ; establish our base pointer into the stack
  116.         push    bx              ; save bx and cx registers
  117.         push    cx
  118.  
  119.         mov     bx,[bp + 6]     ; file handle
  120.         mov     cx,[bp + 10]    ; msb of long offset parameter
  121.         mov     dx,[bp + 8]     ; lsb of long offset parameter
  122.         mov     al,[bp + 12]    ; seek direction code
  123.         mov     ah,42h          ; dos function 42h, set file pointer
  124.         int     21h
  125.  
  126.         jnc     fs1             ; if carry flag not set, no error
  127.         xor     ax,ax           ; if error, clear pointer msb and lsb
  128.         xor     dx,dx
  129. fs1:
  130.         pop     cx              ; restore caller's registers
  131.         pop     bx
  132.         pop     bp
  133.         ret
  134. __ft_fileseek ENDP
  135.  
  136.  
  137.  
  138.         PUBLIC  __ft_getkey
  139. __ft_getkey PROC
  140.  
  141.         xor     ax,ax           ; clear ax register
  142.         mov     ah,07h          ; dos function 07h, get key pressed
  143.         int     21h
  144.  
  145.         mov     ah,0            ; zero out msb of ax to make sure returned
  146.  
  147.         ret                     ;   value is only a byte value
  148.  
  149. __ft_getkey ENDP
  150.  
  151.  
  152.         END
  153. 
  154.