home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / ce331src.arj / BIOS.ASM < prev    next >
Assembly Source File  |  1990-11-24  |  2KB  |  91 lines

  1.                 page    60,132
  2.                 title    BIOS - Assembler BIOS calls for CodEd
  3. ; B I O S . A S M
  4. ;
  5. ; purpose:
  6. ;    Assembler level function calls for CodEd
  7. ;
  8. ; modification log:
  9. ;    7/14/88         John W. Grothman
  10. ;    2/7/89            jwg - mod for MASM 5.1
  11. ;    1/4/90            jwg - mod PcGetC for either the extended keyboard (EKBD
  12. ;                          defined) or the original keyboard (OKBD defined)
  13. ;    10/7            jwg - back to the C model
  14. ;
  15.  
  16. .MODEL LARGE,C
  17.  
  18. .CODE
  19.  
  20. CTRL        equ     1        ;MUST equal high byte of 'CTRL' #define in struct.h
  21. SPEC        equ     8        ;MUST equal high byte of 'SPEC' #define in struct.h
  22.  
  23.             public    PcGetC, PcPutC, PcMove
  24.  
  25. PcGetC      proc
  26.  
  27. IFDEF    EKBD
  28.             mov     ah,16                ;extended keyboard read
  29.             int     16h                 ;call keyboard BIOS
  30.             cmp     al,0                ;main byte = 0?
  31.             jne     chk4e0
  32.             cmp     ah,3                ;aux. byte = 3?
  33.             jne     addspec
  34.             xor        ax,ax                ;restore NUL's original value
  35.             jmp     short getout
  36.  
  37.   chk4e0:    cmp     al,0e0h             ;main byte = E0?
  38.             jne     normchar
  39.             cmp     ah,0                ;was E0 real?
  40.             jne     addspec
  41.             mov     ax,0e0h             ;restore real E0
  42.             jmp        short getexit        ;  and return
  43. ENDIF
  44.  
  45. IFDEF    OKBD
  46.             mov        ah,7                ; DOS direct console input
  47.             int        21h
  48.  
  49.             cmp        al,0                ; non-ascii char?
  50.             jne        normchar
  51.  
  52.             mov        ah, 7                ; get next aux. byte
  53.             int        21h
  54.  
  55.             cmp        al,3                ; aux. byte = 3?
  56.             jne        addspeco
  57.             xor        ax,ax                ; restore NUL's original value
  58.             jmp        short getout
  59. ENDIF
  60.  
  61.   normchar: xor     ah,ah                ;char was normal, so just return it with
  62.             jmp     short getout        ; no flag bits set (make sure ah = 0)
  63.  
  64.   addspec:    mov     al,ah                ;move aux. byte to main byte
  65.   addspeco:    mov     ah,SPEC
  66.  
  67.   getout:    cmp     ax,20h                ;check for a CTRL char
  68.             jae     getexit
  69.             or        al,40h                ;offset to CAP letters
  70.             mov     ah,CTRL
  71.   getexit:    ret
  72. PcGetC      endp
  73. ;
  74. PcPutC      proc    char:BYTE
  75.             mov     ah,14                ;write char with current attributes
  76.             mov     al,char             ;char to write
  77.             int     10h                 ;call video BIOS
  78.             ret
  79. PcPutC      endp
  80. ;
  81. PcMove      proc    row:BYTE, col:BYTE
  82.             mov     ah,2                ;set cursor position
  83.             mov     dh,row                ;row to move to
  84.             mov     dl,col                ;column to move to
  85.             mov     bh,0                ;video page 0
  86.             int     10h                 ;call video BIOS
  87.             ret
  88. PcMove      endp
  89.             end
  90.