File:  [Witchaven II] / gcl520h / _dbg286.equ
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:58:10 2018 UTC (8 years, 1 month ago) by root
Branches: whavenII, MAIN
CVS tags: HEAD, Greenleaf
Greenleaf Comm Library

;
; _DBG286.EQU            5.20A  June 8, 1995
;
; The Greenleaf Comm Library
;
; Copyright (C) 1991-94 Greenleaf Software Inc.  All Rights Reserved.
;
; NOTES
;
; This file contains the macros used to provide debug output services
; for the protected mode ISR.  Debug output services are fully
; defined in DEBUG286.ASM.
;
; MODIFICATIONS
;
;  December 1, 1994   5.10A :  Initial release.
;

;
; Any routine that wants to use debug services can include this header
; file.  Unfortunately, if it gets included by DEBUG286.ASM, we are
; going to see a conflict between these EXTRN definitions and the
; PUBLIC definitions in the source module.  We avoid this conflict by
; simply defining _DEBUG286 in DEBUG286.ASM so that these guys won't get
; pulled in by
;
; Any routine that wants to use debug services can include this header
; file.  Unfortunately, if it gets included by DEBUG88.ASM, we are
; going to see a conflict between these EXTRN definitions and the
; PUBLIC definitions in the source module.  We avoid this conflict by
; simply defining _DEBUG88 in DEBUG88.ASM so that these guys won't get
; pulled in by that module.
;
; Note also that these externs don't get defined if ISR_DEBUG is not turned
; on.  This prevents this code from being linked in in a production release.
;
IFNDEF _DEBUG286

IFDEF ISR_DEBUG

DEBUG_ISR_CODE          SEGMENT 'CODE'
                        EXTRN C _VidGoto:FAR
                        EXTRN C _VidPutc:FAR
                        EXTRN C _VidPutDat:FAR
                        EXTRN C _VidPuts:FAR

DEBUG_ISR_CODE          ENDS

ENDIF

ENDIF

;
;  Macro: VIDPUTWORD data
;
;
;  ARGUMENTS
;
;   data : Any 16 bit value that can be moved into ax with
;          a mov ax, data instruction.
;
;  DESCRIPTION
;
;  This macro is used in the protected ISR to display a single binary
;  word in hex.  The real work is done by _VidPutDat, the macro just
;  takes care of setting things up to facilitate the call.
;
;  Note that the real mode ISR and the protected mode ISR are distinguished
;  by the presence or absence of the _REAL equate.  If we are in the real
;  mode ISR, we call a slightly different version of _VidPutDat.  Same
;  functionality, slightly different code.
;
;  SIDE EFFECTS
;
;   None.
;
;  RETURNS
;
;   Nothing.
;
;  AUTHOR
;
;   SM          October 17, 1994
;
;  MODIFICATIONS
;
;

VIDPUTWORD              MACRO dat  ; Tag: Debug private
                        push  ax
                        push  cx
                        mov   cl,8
                        mov   ax,dat   ; Get the data to display
                        ror   ax,cl    ; Shift upper byte to lower byte
                        push  ax       ; Pass it to _VidPutDat
IFDEF _REAL
                        call  _VidPutDatReal
ELSE
                        call  _VidPutDat
ENDIF
                        add   sp,2
                        mov   ax,dat
                        push  ax
IFDEF _REAL
                        call  _VidPutDatReal
ELSE
                        call  _VidPutDat
ENDIF
                        add   sp,2
                        pop  cx
                        pop  ax
                        ENDM

;
;  Macro: VIDGOTO row,col
;
;
;  ARGUMENTS
;
;   row : The row to go to on the screen.  This can be any sort
;         of identifier that can be accessed with a mov ax,row
;         instruction, loading 16 bits.
;
;   col : The column to go to on the screen. This can be any sort
;         of identifier that can be accessed witha mov ax,col
;         instruction, loading 16 bits.
;
;  DESCRIPTION
;
;  This macro is used in the protected ISR to move the cursor, or current
;  output location, to a specific location on the screen.
;
;  Note that the real mode ISR and the protected mode ISR are distinguished
;  by the presence or absence of the _REAL equate.  If we are in the real
;  mode ISR, we call a slightly different version of _VidGoto.  Same
;  functionality, slightly different code.
;
;  SIDE EFFECTS
;
;   None.
;
;  RETURNS
;
;  Nothing.
;
;  AUTHOR
;
;   SM          October 17, 1994
;
;  MODIFICATIONS
;
;

VIDGOTO                 MACRO   row,col  ; Tag: Debug private
                        push    ax
                        mov     ax,col
                        push    ax
                        mov     ax,row
                        push    ax
IFDEF _REAL
                        call    _VidGotoReal
ELSE
                        call    _VidGoto
ENDIF
                        add     sp,4
                        pop     ax
                        ENDM

;
;  Macro: VIDPUTC char
;
;
;  ARGUMENTS
;
;   char : A single character that needs to be displayed on the screen.
;
;  DESCRIPTION
;
;  This macro is used in the protected ISR to display a single character
;  at the current cursor position on the screen.  It does this with
;  a single call to _VidPutc.  Note that the argument can be anything
;  that can load a 16 bit value with mov ax,value.
;
;  Note that the real mode ISR and the protected mode ISR are distinguished
;  by the presence or absence of the _REAL equate.  If we are in the real
;  mode ISR, we call a slightly different version of _VidPutc.  Same
;  functionality, slightly different code.
;
;  SIDE EFFECTS
;
;   None.
;
;  RETURNS
;
;   Nothing.
;
;  AUTHOR
;
;   SM          October 17, 1994
;
;  MODIFICATIONS
;
;

VIDPUTC                 MACRO   Char  ; Tag: Debug private
                        push    ax
                        mov     ax,Char
                        push    ax
IFDEF _REAL
                        call    _VidPutcReal
ELSE
                        call    _VidPutc
ENDIF
                        add     sp,2
                        pop     ax
                        ENDM

;
;  Macro: VIDPUTS str
;
;
;  ARGUMENTS
;
;   str : A string that needs to be displayed on the screen.  Note
;         that this doesn't have to be a null terminated string, we
;         make a copy of it here and then null terminate the copy.
;
;  DESCRIPTION
;
;  This macro is used in the protected ISR to display an entire string
;  on the screen.  We make a local copy of the string in our code
;  segment, and null terminate it.  Then we push a pointer to the copy
;  on the stack and call _VidPuts.
;
;  Note that the real mode ISR and the protected mode ISR are distinguished
;  by the presence or absence of the _REAL equate.  If we are in the real
;  mode ISR, we call a slightly different version of _VidPuts.  Same
;  functionality, slightly different code.
;
;  SIDE EFFECTS
;
;   None.
;
;  RETURNS
;
;   Nothing.
;
;  AUTHOR
;
;   SM          October 17, 1994
;
;  MODIFICATIONS
;
;

VIDPUTS                 MACRO   s  ; Tag: Debug private
                        LOCAL   skip, string
                        jmp     short skip
string                  db      s, 0
skip:                   push    ax
                        mov     ax, offset string
                        push    ax
IFDEF _REAL
                        call    _VidPutsReal
ELSE
                        call    _VidPuts
ENDIF
                        add     sp,2
                        pop     ax
                        ENDM



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.