home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
decus
/
RB140
/
grlib03b.arj
/
GRLIB.ARC
Wrap
Text File
|
1988-06-28
|
233KB
|
7,477 lines
+ARCHIVE+ asmc.h 1496 12/05/1984 13:46:38
; **********************************************
; * CI86 MODEL.H simulation *
; * define big or small model *
; * for library assembly code *
; **********************************************
FALSE equ 0 ;for small model
TRUE equ 1 ;for big model
@bigmodel equ FALSE ;Small model for Graphics library
.XLIST
; **********************************************
; * PROCEDURE ENVELOPE DEFINITION *
; **********************************************
PROCDEF macro name
IF @bigmodel
name PROC FAR
ELSE
name PROC NEAR
ENDIF
endm
PROCEND macro name
name ENDP
endm
; **********************************************
; * SEGMENT ENVELOPE DEFINITION *
; **********************************************
SEGDEF macro name
IFIDN <name>,<CODE>
IF @bigmodel
@CODE SEGMENT
ELSE
@CODE SEGMENT
ENDIF
ASSUME CS:@CODE,DS:DGROUP,ES:DGROUP,SS:NOTHING
ENDIF
IFIDN <name>,<DATA>
@DATAB SEGMENT
ENDIF
IFIDN <name>,<CONST>
@DATAI SEGMENT
ENDIF
endm
SEGEND macro name
IFIDN <name>,<CODE>
IF @bigmodel
@CODE ENDS
ELSE
@CODE ENDS
ENDIF
ENDIF
IFIDN <name>,<DATA>
@DATAB ENDS
ENDIF
IFIDN <name>,<CONST>
@DATAI ENDS
ENDIF
endm
; **********************************************
; * C86 REQUIRED PROLOGUE DONE HERE *
; **********************************************
include prologue.h
.LIST
+ARCHIVE+ asmd.h 4033 12/13/1984 15:53:54
;asmd.h
;******************************************************************
; REFERENCES TO GRAPHICS DATA FIELDS IN openws.asm *
;******************************************************************
.XLIST
EXTRN ws_data_:BYTE ;All the bytes needed to initialise
;the work station. DO NOT CHANGE.
EXTRN p1_:BYTE ;param table for PRAM & FIGS cmnds.
EXTRN ws_number_:BYTE ;work station ident. 1 to 6
EXTRN ws_wmo_:BYTE ;write mode. 0 to 3
EXTRN gbmod_:BYTE ;GO's mode register.
EXTRN fgbg_:BYTE ;defines fore_grnd/back_grnd colour.
EXTRN alups_:BYTE ;defines the writing mode.
EXTRN gbmskl_:BYTE ;GO's write mask, split into low and
EXTRN gbmskh_:BYTE ;high bytes.
EXTRN gdcml_:BYTE ;GDC's write mask, as above.
EXTRN gdcmh_:BYTE
EXTRN curl0_:BYTE ;three bytes which define the GDC's
EXTRN curl1_:BYTE ;cursor position.
EXTRN curl2_:BYTE ;curl2 only uses it's high nibble.
EXTRN ymax_:WORD ;max pixels on 'y' axis. 0 to ymax
EXTRN xmax_:WORD ;max pixels on 'x' axis. 0 to xmax
EXTRN twdir_:BYTE ;direct'n for word & vector drawing.
EXTRN nmritl_:BYTE ;# words to write. used by FIGS
EXTRN nmrith_:BYTE
EXTRN sh_p_lin_:WORD ;number of shifts to do to convert a
;line number to an absolute address.
EXTRN wd_p_lin_:WORD ;number of words per line.
EXTRN x_start_:WORD ;four gen. purpose variables, mainly
EXTRN y_start_:WORD ;used for line drawing to defined the
EXTRN x_stop_:WORD ;start and stop vectors.
EXTRN y_stop_:WORD
EXTRN g_strtx_:WORD ;defines current 'x' offset from the
;start of line to 1st pix. displayed
EXTRN scr_top_:BYTE ;define the top & bottom lines for
EXTRN scr_bot_:BYTE ;vertical scrolling.
EXTRN scrltb_:BYTE ;mirror of line number sequence.
EXTRN clmpda_:BYTE ;defines the colour intensities.
EXTRN pattbl_:BYTE ;defines patterns & repeat factors
; for drawing lines.
;***** LINE VARIABLES *****
EXTRN l_col_:BYTE ;line colour.
EXTRN l_type_:BYTE ;line type, indexes "pattbl".
EXTRN l_wid_:BYTE ;line width. (not used currently).
;***** FILL VARIABLES *******
EXTRN f_col_:BYTE ;fill colour.
EXTRN f_type_:BYTE ;fill type. 0 to 3
EXTRN f_style_:BYTE ;fill style. 0 to 7
EXTRN f_patrn_:BYTE ;table of patterns for filling:
;f_patrn[0] solid. f_type = 1.
;f_patrn[1-8] patterns. f_type = 2.
;f_patrn[9-16] hatches. f_type = 3.
;***** TEXT VARIABLES *****
EXTRN t_col_:BYTE ;text colour.affects "text"&"gtext."
EXTRN t_font_:BYTE ;text font. affects "gtext" only.
EXTRN t_sca_:BYTE ;text scale. affects "text" only.
EXTRN t_dir_:BYTE ;direction that text is written.
; affects "text" only.
EXTRN t_x_:WORD ;define the bottom left of the char.
EXTRN t_y_:WORD ;cell in which char. is displayed.
;***** MARKER VARIABLES *****
EXTRN m_col_:BYTE ;marker colour.
EXTRN m_type_:BYTE ;marker type. 0 to 15
EXTRN m_sca_:BYTE ;marker scale.
EXTRN m_tab_:BYTE ;vector table for markers.
;***** TEXT FONT TABLES *****
EXTRN tfonts_:BYTE ;table of 4 user definable fonts for
;may be changed.
;***** WORK AREAS *****
EXTRN old_int_off:WORD ;saved Graphics board int vector offset
EXTRN old_int_seg:WORD ;saved Graphics board int vector segment
EXTRN int_done:BYTE
EXTRN gintvect_:WORD ;Graphics board interrupt vector location
;***** SWITCHES *****
EXTRN swisg_:BYTE ;1= graphics option present
EXTRN sw100a_:BYTE ;1= 100a, 0= 100b
EXTRN swgopen_:BYTE ;1= workstation opened
EXTRN swgon_:BYTE ;1= graphics open for business
;***** GP Work area ****
EXTRN gp_buff_:WORD ;4k gen. purpose array for 'xy' points.
;gives max 1024 'xy'points for polylines.
;Used heavily by "circle","segment",
;"arc" and "rectangle", therefore
;don't use it for these functions.
SEGEND DATA
SEGDEF CODE
EXTRN dseg_sav:WORD ;Save of DS for later use
EXTRN eseg_sav:WORD ;Save of ES for later use
SEGEND CODE
SEGDEF DATA
.LIST
+ARCHIVE+ asmk.h 1718 11/16/1984 13:27:16
;/*------------------------------------------------------------------------
;
; K E Y B O A R D D E F I N I T I O N S
;
;--------------------------------------------------------------------------*/
FUNCTION equ 100h ;/* pertinent bit in 16-bit key return */
;#define FUNKEY(keyval) (keyval & FUNCTION ? TRUE : FALSE)
;/* important function keys */
K_PSCR equ (FUNCTION OR 2)
K_F4 equ (FUNCTION OR 4)
K_BRK equ (FUNCTION OR 5)
K_INT equ (FUNCTION OR 6)
K_RES equ (FUNCTION OR 7)
K_CANC equ (FUNCTION OR 8)
BS equ 8
K_MAIN equ (FUNCTION OR 9)
TAB equ 9
K_EXIT equ (FUNCTION OR 10)
LF equ 10
RET equ 13
K_ADDO equ (FUNCTION OR 14)
K_HELP equ (FUNCTION OR 15)
K_DO equ (FUNCTION OR 16)
K_F17 equ (FUNCTION OR 17)
K_F18 equ (FUNCTION OR 18)
K_F19 equ (FUNCTION OR 19)
K_F20 equ (FUNCTION OR 20)
K_FIND equ (FUNCTION OR 21)
K_INS equ (FUNCTION OR 22)
K_REM equ (FUNCTION OR 23)
K_SEL equ (FUNCTION OR 24)
K_PREV equ (FUNCTION OR 25)
K_NEXT equ (FUNCTION OR 26)
K_UP equ (FUNCTION OR 27)
ESC equ 27
K_LEFT equ (FUNCTION OR 28)
K_DOWN equ (FUNCTION OR 29)
K_RGHT equ (FUNCTION OR 30)
K_K0 equ (FUNCTION OR 31)
K_KP1 equ (FUNCTION OR 32)
K_KP2 equ (FUNCTION OR 33)
K_KP3 equ (FUNCTION OR 34)
K_KP4 equ (FUNCTION OR 35)
K_KP5 equ (FUNCTION OR 36)
K_KP6 equ (FUNCTION OR 37)
K_KP7 equ (FUNCTION OR 38)
K_KP8 equ (FUNCTION OR 39)
K_KP9 equ (FUNCTION OR 40)
K_KQUO equ (FUNCTION OR 41)
K_KMIN equ (FUNCTION OR 42)
K_KDOT equ (FUNCTION OR 43)
K_PF1 equ (FUNCTION OR 44)
K_PF2 equ (FUNCTION OR 45)
K_PF3 equ (FUNCTION OR 46)
K_PF4 equ (FUNCTION OR 47)
K_ENTER equ (FUNCTION OR 48)
DEL equ 0x7f
+ARCHIVE+ asmms.h 2630 11/24/1984 21:36:46
;***************************************************************************
; *
; Copyright (C) 1983,1984 by Microsoft Inc. *
; *
;***************************************************************************
;***************************************************************************
; *
; Header file for Microsoft mouse device driver. Contains all machine *
; specific constant and data structure definitions. *
; *
;***************************************************************************
;-----------------------------------------------------------------------;
;
; Mouse equates
mbfr struc ;local buffer for comm input
count dw 0
size dw 128-16
ipntr dw ?
opntr dw ?
highw dw ?
loww dw ?
head dw ?
tail dw ?
mdata dw 128-16 dup (?)
mbfr ends
ctl_head struc ;packet for IOCTL calls
funct db ? ;function
stat db ? ;returned status
char db ? ;character
cstat db ? ;character status
ctl_head ends
cpkt struc ;MOUSE interrupt condition packet "CONDITION_PACKET"
Movement dw ? ;TRUE = movement has occurred
S_button_rel dw 0 ;secondary button release count
S_button_dep dw 0 ;secondary button depress count
P_button_rel dw 0 ;primary button release count
P_button_dep dw 0 ;primary button depress count
Delta_x dw 0 ;x delta factor (horizontal)
Delta_y dw 0 ;y delta factor (vertical)
Cpkt ends ;
mpkt struc ;MOUSE control packet "MOUSE_PACKET"
P_button dw ? ;TRUE = left or primary button act
S_button dw ? ;TRUE = right or secondary button
T_button dw ? ;TRUE = middle or tertiary button
Deltax dw 0 ;x delta factor (horizontal)
X_ratio dw 0 ;x magnification factor (OPEN)
X_threshold dw 0 ;x speed limit (OPEN)
Deltay dw 0 ;y delta factor (vertical)
Y_ratio dw 0 ;y magnification factor (OPEN)
Y_threshold dw 0 ;y speed limit (OPEN)
Immediate dw ? ;TRUE = wait for input
Enabled dw ? ;TRUE = mouse OK to use
Type dw 0 ;mouse type - see MOUSETYPE
Device dw 0 ;port number MDM, PRT or AUX
Port_name db 5 dup(0);port name
Handle dw 0 ;device handle
Bstate dw 0 ;button state storage
Programmed dw ? ;TRUE = port programmed for Mouse
New_vectors dw ? ;TRUE = RCI vectored in
Trace dw ? ;TRUE = trace mode
Mpkt ends
+ARCHIVE+ assert.asm 11047 12/27/1984 16:19:58
PAGE ,132
TITLE ASSERT.ASM
;UPDATE HISTORY:
;===============
;14/11/84 convert to v2 ci86
;29/11/84 fix bug in repl mode
; 4 dec 84 move PATTERN.ASM into this program
;27 Dec 84 move delay loop from gdc_nb_ to fifo_mt_
include asmc.h
SEGEND CODE
SEGDEF DATA
include asmd.h
SEGEND DATA
SEGDEF CODE
PUBLIC gdc_nb_, fifo_mt_, g_off_, g_on_, a_mode_
PUBLIC a_fgbg_, a_alups_, a_gbmsk_, a_wmode_
PUBLIC a_patrn_
;********************************************************************
;* *
;* f u n c t i o n gdc_nb() *
;* *
;* gdc_not_busy will put a harmless command into the GDC and *
;* wait for the command to be read out of the command FIFO. *
;* This means that the GDC is not busy doing a write or read *
;* operation. *
;* *
;* entry: none *
;* exit: ax = 0 if more than approx 74ms elapsed *
;* without "gdc not busy" *
;********************************************************************
PROCDEF gdc_nb_
call fifo_mt_ ;wait for fifo to empty
L2: in al,56H ;wait for vert. or horiz. sync
and al,60H
jz L2
in al,56H
and al,8 ;is GDC still drawing ?
jnz L2
ret ;ax = 1 == TRUE
PROCEND gdc_nb_
;This routine is in as a fast check that the GDC's fifo is empty but does
;not check anything else.
PROCDEF fifo_mt_
push cx ;use cx as a time-out loop counter.
mov cx,8000H ;wait for FIFO not full or reasonable time.
L0: in al,56H ;first check if the FIFO is full.
and al,2
loopnz L0
mov ax,40DH
out 57H,al
L5: in al,56H
test al,ah
jz L5
pop cx
ret
PROCEND fifo_mt_
;********************************************************************
;* *
;* f u n c t i o n g_off_() *
;* *
;* purpose: disable graphics output *
;* *
;********************************************************************
PROCDEF g_off_
exit_graf_:
and BYTE PTR gbmod_,7FH ;disable graphics output in gbmod
call a_mode_ ;assert new mode register
mov al,83H
out 0AH,al ;turn off graphics on monochrome line
ret
PROCEND g_off_
;********************************************************************
;* *
;* f u n c t i o n g_on_() *
;* *
;* purpose: enable graphics output *
;* *
;********************************************************************
PROCDEF g_on_
enter_graf_:
mov al,BYTE PTR ws_number_ ;chk work_station loaded
or al,al
jz Lam
mov al,87H
out 0AH,al ;enable graphics on monochrome line
or BYTE PTR gbmod_,80H ;enable graphics output in gbmod
PROCEND g_on_
;********************************************************************
;* *
;* f u n c t i o n s a_mode_() *
;* *
;* purpose: set mode register to the value held in *
;* gbmod *
;* *
;********************************************************************
PROCDEF a_mode_
mov al,0BFH ;address the mode register through
out 53H,al ;the indirect register
mov al,BYTE PTR gbmod_
out 51H,al ;load the mode register
Lam: ret
PROCEND a_mode_
;*****************************************************************************
;* *
;* f u n c t i o n a_fgbg_() *
;* *
;* purpose: Load the Foreground;Background Register *
;* *
;*****************************************************************************
PROCDEF a_fgbg_
mov al, 0F7H ;select the Foreground;Background Register
out 53H, al
mov al, BYTE PTR fgbg_
out 51H, al ;load the Foreground;Background Register
ret
PROCEND a_fgbg_
;*****************************************************************************
;* *
;* F U N C T I O N a_alups_() *
;* *
;* purpose: Set the ALU ; Plane Select Register *
;* *
;*****************************************************************************
PROCDEF a_alups_
mov al,0EFH ;select the ALU;PS Register
out 53H,al
mov al, BYTE PTR alups_ ;move ALU;PS value to al
out 51H,al ;load value into ALU;PS Register
ret
PROCEND a_alups_
;*****************************************************************************
;* *
;* F U N C T I O N a_gbmsk_() *
;* *
;* purpose: Set the graphics board mask to values held *
;* in gbmskl_ and gbmskh_ *
;* *
;*****************************************************************************
PROCDEF a_gbmsk_
mov ax,WORD PTR gbmskl_ ;get the mask value to load
out 54H,al
mov al, ah
out 55H,al
ret
PROCEND a_gbmsk_
;*****************************************************************************
;* *
;* F U N C T I O N a_wmode_() *
;* *
;* purpose: Juggle fgbg reg. & alups reg. to make GDC *
;* write the correct colours in the correct *
;* manner to the bit map. *
;* *
;*****************************************************************************
PROCDEF a_wmode_
push bp
mov bp,sp
call gdc_nb_
mov al,BYTE PTR ws_wmo_ ;get the write mode requested.
cmp al,3 ;check for erase mode.
jz La0
mov cl,4
shl al,cl
mov ah,BYTE PTR alups_ ;get old alups
and ah,0FH ;mask off plane writes
or al,ah ;add to new write mode
mov BYTE PTR alups_,al ;and save.
call a_alups_
mov al,0F0H ;enable fore_ground writes in case the last
jmp La1 ;write mode was erase.
La0: mov BYTE PTR alups_,0 ;put alu into replace mode, all planes.
call a_alups_
xor al,al ;write zero's to all planes no matter what.
La1: mov BYTE PTR fgbg_,al
call a_fgbg_
pop bp
ret
PROCEND a_wmode_
;*****************************************************************************
; *
; f u n c t i o n a_patrn_() *
; *
; purpose: Load the Pattern Multiplier and Pattern Register *
; for line drawing. *
; *
; caution: You must load the Pattern Multiplier before *
; loading the Pattern Register *
; *
;*****************************************************************************
;
;The following are some register values and the corresponding output patterns
;when the repeat factor is:
;
; 1 2 3
; 0FFh |--------| |----------------| |------------------------|
; 0AAh |- - - - | |-- -- -- -- | |--- --- --- --- |
; 0F0h |---- | |-------- | |------------ |
; 0CDh |-- -- -| |---- ---- --| |------ ------ ---|
;
PROCDEF a_patrn_
push bx
push cx
mov cl,BYTE PTR l_type_
xor ch,ch
add cx,cx
lea bx, pattbl_
add bx,cx
mov al,0FDH ;select the Pattern Multiplier
out 53H, al
mov al, 1[bx]
dec al ;adjust bl to be zero-relative
not al ;invert it [remember Pattern Register is
;multiplied by 16 minus multiplier value]
and al,0FH ;load the Pattern Multiplier
out 51H, al
mov al,0FBH ;select the Pattern Register
out 53H, al
mov al, [bx] ;get the pattern data
out 51H, al ;load the Pattern Register
pop cx
pop bx
ret
PROCEND a_patrn_
include epilogue.h
END
+ARCHIVE+ cio.asm 1239 10/01/1983 0:01:30
TITLE Comms port interrupt handler
PAGE ,132
;***********************************************
;CIO.ASM character processor for Mioctl
;***********************************************
MBFR STRUC ;local buffer header for comm input
count dw 0
size dw ?
ipntr dw ?
opntr dw ?
highw dw ?
loww dw ?
head dw ?
tail dw ?
MBFR ENDS
CTL_HEAD STRUC ;packet for IOCTL calls
funct db ? ;function
stat db ? ;returned status
char db ? ;character
cstat db ? ;character status
CTL_HEAD ENDS
include asmc.h ;***V2***
PUBLIC _Chaddr,_Chint
ASSUME ES:NOTHING
;***********************************************
; Receive Character Interrupt handler
;***********************************************
_Chint PROC FAR
Cld ;preserve machine state
Push DS
Push ES
Push AX
Push BX
Push CX
Push DX
Push DI
Push SI
Nop ;NOWT
Pop SI ;restore state
Pop DI
Pop DX
Pop CX
Pop BX
Pop AX
Pop ES
Pop DS
Ret
_Chint ENDP
;***********************************************
;Return Address for C program
;***********************************************
PROCDEF _Chaddr
Mov AX, CS:Cloc
Ret
Cloc Dw _Chint
PROCEND _Chaddr
include epilogue.h ;***V2***
end
+ARCHIVE+ circle.asm 14456 10/01/1983 0:46:58
PAGE ,132
;CIRCLE.ASM
;14/11/84 convert to CI86 V2.2
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN gp_buff_:BYTE, gbmod_:BYTE
Lsin_cos_table DW 0
DW 0FFFFH, 00477H,0FFF5H, 008EFH,0FFD7H, 00D65H,0FFA5H
DW 011DBH,0FF5FH, 0164FH,0FF05H, 01AC2H,0FE97H, 01F32H,0FE16H
DW 023A0H,0FD81H, 0280BH,0FCD8H, 02C74H,0FC1BH, 030D8H,0FB4AH
DW 03539H,0FA66H, 03996H,0F96FH, 03DEEH,0F864H, 04241H,0F745H
DW 0468FH,0F614H, 04AD8H,0F4CFH, 04F1BH,0F377H, 05358H,0F20CH
DW 0578EH,0F08EH, 05BBDH,0EEFEH, 05FE5H,0ED5AH, 06406H,0EBA5H
DW 0681FH,0E9DDH, 06C30H,0E802H, 07038H,0E616H, 07438H,0E418H
DW 0782EH,0E207H, 07C1BH,0DFE6H, 07FFFH,0DDB2H, 083D9H,0DB6EH
DW 087A8H,0D918H, 08B6CH,0D6B2H, 08F26H,0D43AH, 092D5H,0D1B3H
DW 09678H,0CF1AH, 09A0FH,0CC72H, 09D9BH,0C9BAH, 0A11AH,0C6F2H
DW 0A48DH,0C41AH, 0A7F2H,0C133H, 0AB4BH,0BE3EH, 0AE96H,0BB39H
DW 0B1D4H,0B825H, 0B504H,0B504H
;enough room for 91 'xy' co-ordinates.
Lpnts DQ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DQ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DQ 0,0,0,0,0,0,0,0,0,0,0,0,0
DD 0
Lc_flag DB 1 ;set to '1' for circles & '0' for arcs & segs.
SEGEND DATA
SEGDEF CODE
PUBLIC circle_, arc_, segment_
IF @bigmodel
EXTRN polyfill_:FAR
ELSE
EXTRN polyfill_:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N circle_(centre_x, centre_y, radius) *
;* *
;* purpose: draw a circle in either high or medium res *
;* by computing 'xy' points and then use *
;* polyfill[] to join them all up. *
;* *
;* entry: 8[bp] 'x' centre co-ordinate. *
;* 10[bp] 'y' centre co-ordinate. *
;* 12[bp] radius of circle on the 'y' axis. *
;* *
;************************************************************************
PROCDEF circle_
push si
push di
push bp
mov bp,sp
sub sp,6 ;make working space
mov Lc_flag,1
call Lmake_seg
lea di, gp_buff_
mov bx,8[bp] ;'x' centre.
mov dx,10[bp] ;'y' centre.
call Lquad0
call Lquad1
call Lquad2
call Lquad3
lea si, gp_buff_
lodsw
stosw
lodsw
stosw
lea ax, gp_buff_
push ax
mov ax,-2[bp] ;number of 'xy' points in a segment.
shl ax,1
shl ax,1
inc ax
push ax
call polyfill_
mov sp,bp
pop bp
pop di
pop si
ret
Lquad0: lea si, Lpnts
mov cx,-2[bp]
Lq0: lodsw
add ax,bx
stosw
lodsw
add ax,dx
stosw
loop Lq0
ret
Lquad1:
mov cx,-2[bp]
mov ax,cx
shl ax,1
shl ax,1
lea si, Lpnts-4
add si,ax
Lq1: lodsw
add ax,bx
stosw
mov ax,dx
sub ax,[si]
stosw
sub si,6
loop Lq1
ret
Lquad2: lea si, Lpnts
mov cx,-2[bp]
Lq2: mov ax,bx
sub ax,[si]
stosw
add si,2
mov ax,dx
sub ax,[si]
stosw
add si,2
loop Lq2
ret
Lquad3:
mov cx,-2[bp]
mov ax,cx
shl ax,1
shl ax,1
lea si, Lpnts-4
add si,ax
Lq3: mov ax,bx
sub ax,[si]
stosw
mov ax,dx
add ax,2[si]
stosw
sub si,4
loop Lq3
ret
PROCEND circle_
;************************************************************************
;* *
;* F U N C T I O N arc_(x, y, radius, start_deg, end_deg) *
;* *
;* purpose: draw the ARC specified. Start & end degrees *
;* are specified as integers in the range: *
;* 0 to 359 *
;* *
;* entry: 8[bp] centre 'x' *
;* 10[bp] centre 'y' *
;* 12[bp] radius *
;* 14[bp] arc starting vector *
;* 16[bp] arc ending vector *
;* *
;************************************************************************
PROCDEF arc_
push si
push di
push bp
mov bp,sp
sub sp,6
call Larc
push di
push bx
call polyfill_
mov sp,bp
pop bp
pop di
pop si
ret
PROCEND arc_
;************************************************************************
;* *
;* F U N C T I O N segment_(x, y, radius, start_deg, end_deg) *
;* *
;* purpose: draw the SEGMENT as in arc() above but join *
;* the ends of the arc to the centre point. *
;* *
;************************************************************************
PROCDEF segment_
push si
push di
push bp
mov bp,sp
sub sp,6
call Larc
mov cx,bx ;CX = # of points to plot.
add cx,2
mov si,di ;DI points to the start of the array, so
shl bx,1 ;make SI point to the end of the array.
shl bx,1
add si,bx
sub di,4
mov ax,8[bp] ;get centre 'x'.
mov [di],ax ;put at start & end of array.
mov [si],ax
mov ax,10[bp] ;get centre 'y'.
mov 2[di],ax ;put at start & end of array.
mov 2[si],ax
push di
push cx
call polyfill_
mov sp,bp
pop bp
pop di
pop si
ret
PROCEND segment_
;************************************************************************
;* *
;* The following are the various common subroutines used by *
;* circle(), arc() and segment(). *
;* *
;************************************************************************
; Subroutine to fill 'Lpnts' with a 0,0 origined segment.
; This allows for aspect ratio differences between high & medium res.
PROCDEF Lmake_seg
mov cx,46 ;length of sin_cos_table
inc WORD PTR 12[bp]
mov bx,12[bp] ;get radius.
lea di, Lpnts ;set destination as 'Lpnts' array.
lea si, Lsin_cos_table ;set source as look-up table.
cld
Lm0: lodsw ;get look-up table 'x' value. 16
mul bx ;multiply by radius. 133 max
mov ax,dx ;get integer part 2
stosw ;and place in 'Lpnts' array. 15
lodsw ;get look-up table 'y' value. 16
mul bx ;multiply by radius. 133 max
mov ax,dx ;get integer part 2
stosw ;and place in 'Lpnts' array. 15
loop Lm0 ; 17
; ------------------
; TOTAL LOOP TIME = 3.280ms max [351 x 45] ; 4.815
;
; Juggle the octant to make a quadrant.
mov cx,90 ;number of 'x' and 'y' co-ords. in 2nd. octant.
mov si,di
sub si,2
Lm3: sub si,4 ;point SI to 44 deg. entry in 'Lpnts'.
lodsw ;'shadow image' octant 0 into octant 1.
stosw
loop Lm3
test Lc_flag,1 ;are we drawing a circle 0
jnz Lm1 ;remove common points if we are.
mov bx,91
jmp Lm2 ;number of 'xy' points in 'Lpnts'.
; We now have the first octant computed with an origin at 0,0 so
; now remove any common points in the 'Lpnts' array
Lm1: lea si, Lpnts
mov di,si ;point di to start of 'Lpnts' array.
add si,4 ;point si to second 'xy' pair.
mov cx,90 ;number of pairs in one quadrant minus 1.
mov bx,1 ;take account of first pair.
call Lreduce
Lm2: mov -2[bp],bx
test BYTE PTR gbmod_,1 ;are we in high res. mode 0
jz Lm5 ;skip if in medium res.
mov cx,bx
lea si, Lpnts ;point to begining of 'xy' array.
Lm4: shl WORD PTR [si],1 ;multiply 'x' value by 2.
add si,4
loop Lm4
Lm5: ret
PROCEND Lmake_seg
; Common subroutine for segment[] & arc[] to generate the specified arc using
; the circle drawing routines. Nothing set up on entry. Leaves with the arc
; reduced to a minimum number of points & BX = #points, DI = start_offset in
; gp_buff.
PROCDEF Larc
mov Lc_flag,0
call Lmake_seg
call Lgen_arc
xor dx,dx ;set up for division.
mov ax,14[bp]
mov bx,90
div bx
mov ax,dx ;AX = start_deg % 90
lea di, gp_buff_+4
shl ax,1
shl ax,1
add di,ax ;DI now points at the starting deg.
mov ax,16[bp] ;get end deg.
cmp ax,14[bp]
jns La0 ;skip if end is > start.
mov ax,14[bp]
sub ax,360
neg ax
add ax,16[bp]
jmp La1
La0: sub ax,14[bp]
La1: mov cx,ax ;CX now has the absolute number of points to
;plot for the arc.
; Having done all the hard parts, we can now reduce the number of points to
; a minimum.
push di ;save the starting offset .
mov si,di
add si,4
mov bx,1
call Lreduce ;reduce bp_buff array. BX returns the number
;of points in the array.
pop di
ret
PROCEND Larc
; This subroutine enters with the destination for the 'xy' points in DI
; and leaves with DI pointing past the end of the array.
PROCDEF Lgen_arc
lea di, gp_buff_+4
mov ax,16[bp] ;get end deg.
cmp ax,14[bp]
jns Lg0 ;skip if end is > start.
mov ax,14[bp]
sub ax,360
neg ax
add ax,16[bp]
jmp Lg1
Lg0: sub ax,14[bp] ;find the number of segments to plot.
Lg1: xor dx,dx
mov bx,90
div bx
inc ax
mov cx,ax
mov ax,14[bp] ;where do we start ?
mov bx,8[bp] ;'x' centre.
mov dx,10[bp] ;'y' centre.
Lg2: push ax
push cx
cmp ax,90
jns Lg3
call Lquad0 ;do the first quadrant points.
jmp Lg6
Lg3: cmp ax,180
jns Lg4
call Lquad1 ;do the second quadrant.
jmp Lg6
Lg4: cmp ax,270
jns Lg5
call Lquad2 ;do the third quadrant.
jmp Lg6
Lg5: call Lquad3 ;do the last quadrant.
Lg6: pop cx
pop ax
add ax,90
cmp ax,360
js Lg7
neg ax
Lg7: loop Lg2
ret
PROCEND Lgen_arc
; Subroutine to take an array of 'xy' points and remove any common points.
; Enters with: DI = first 'x' co-ordinate
; SI = second 'x' co-ordinate
; Exits with: BX = number of points left in the array
PROCDEF Lreduce
mov ax,[si] ;get second 'x' value.
cmp ax,[di] ;compare it with first 'x' value.
jnz Lr0 ;skip if not the same.
mov ax,2[si] ;get second 'y' value.
cmp ax,2[di] ;compare it with first 'y' value.
jnz Lr0 ;skip if not the same.
add si,4 ;advance si to next 'xy' pair.
loop Lreduce
ret
Lr0: add di,4
lodsw
stosw
lodsw
stosw
sub di,4
inc bx ;once more into the array dear friends!
loop Lreduce
ret
PROCEND Lreduce
include epilogue.h
END
+ARCHIVE+ color.asm 12977 10/01/1983 1:13:02
PAGE ,132
;COLOR.ASM
;UPDATE HISTORY
;==============
; 27-sep-84 add 100a support [1]
; 14-NOV-84 Convert to CI86 V2.2
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN clmpda_:BYTE, gbmod_:BYTE, ws_number_:BYTE, ws_wmo_:BYTE, fgbg_:BYTE
EXTRN gintvect_:WORD ;[1]
EXTRN old_int_off:WORD, old_int_seg:WORD, int_done:BYTE
L0 DW L1, L2, L3, L4, L5, L6, L7, L8
DW L9, L10, L11, L12, L13, L14, L15, L16
SEGEND DATA
SEGDEF CODE
PUBLIC color_, grey_, a_cmap_, chk_col_
IF @bigmodel
EXTRN gdc_nb_:FAR, a_mode_:FAR, a_fgbg_:FAR
EXTRN dseg_sav:FAR, eseg_sav:FAR
ELSE
EXTRN gdc_nb_:NEAR, a_mode_:NEAR, a_fgbg_:NEAR
EXTRN dseg_sav:NEAR, eseg_sav:NEAR
ENDIF
;************************************************************************
;* *
;* f u n c t i o n color_(index, red, green, blue) *
;* *
;* purpose: change a color in the colormap. *
;* entry: 8[bp] colour index -- 0 to 15 *
;* 10[bp] red value 0 to 15 *
;* 12[bp] green value 0 to 15 *
;* 14[bp] blue value 0 to 15 *
;* *
;* exit: none *
;* *
;************************************************************************
PROCDEF color_
push si
push di
push bp
mov bp,sp
mov ax,cs:WORD PTR eseg_sav
mov es,ax
lea di, clmpda_ ;colormap shadow.
mov bx,8[bp] ;get colour number.
test BYTE PTR gbmod_,1 ;high res?
jz L17a ;jump if not.
and bx,3 ;only allow colours 0 - 3 in high res.
L17a: add di, bx ;get offset
lea bx, L0
mov al,BYTE PTR ws_number_ ;make ws_number zero relative.
dec al
and al,7
shl al,1 ;convert to WORD offset.
xor ah,ah
add bx,ax ;make offset into jump table.
jmp [bx] ;returns with red;green in cl - grey;blue in ch
L17: cld
mov al,cl
stosb
add di,15 ;adjust pointer
mov al,ch
stosb
call a_cmap_
L18: pop bp
pop di
pop si
ret
;************************************************************************
;* *
;* MEDIUM & HIGH RES. MONOCHROME *
;* *
;* Monochrome value becomes the logical OR of red, green & blue *
;* *
;************************************************************************
L1:
L2: mov ax,10[bp] ;get red value
or al,BYTE PTR 12[bp] ;add in green value
or al,BYTE PTR 14[bp] ;and then blue value
mov cx,08[bp] ;get grey index
push ax
push cx
call grey_
add sp,4
jmp L18
;************************************************************************
;* *
;* MEDIUM & HIGH RES. COLOUR *
;* *
;* Green value is mapped into grey slot. Grey scale is unused. *
;* *
;************************************************************************
L3:
L4: mov al,BYTE PTR 12[bp] ;get green value
xor al,0FFH
add al,16
mov cl,4 ;move it to color_maps grey position.
shl al,cl
mov ah,BYTE PTR 14[bp] ;get blue value.
xor ah,0FFH
add ah,16
or al,ah
mov ch,al
mov al,BYTE PTR 10[bp] ;get red value
xor al,0FFH
add al,16
mov cl,4
shl al,cl
or al,0FH ;fill grey scale to reduce RFI.
mov cl,al
jmp L17 ;return with values adjusted.
;************************************************************************
;* *
;* MEDIUM & HIGH RES. DUAL MONITOR *
;* *
;* All colours are mapped to their correct slots but grey scale *
;* needs to be set independently. offset see grey() } *
;* *
;************************************************************************
L5:
L6: mov al,BYTE PTR 10[bp] ;get red value
xor al,0FFH
add al,16
mov cl,4
shl al,cl
mov ah,BYTE PTR 12[bp] ;get green value.
xor ah,0FFH
add ah,16
or al,ah
mov cl,al
mov ch,BYTE PTR 14[bp] ;get blue value
xor ch,0FFH
add ch,16
mov al,BYTE PTR 16[di] ;get old grey;blue data
and al,0F0H ;remove old blue
or ch,al ;mix grey & new blue
jmp L17 ;return with values adjusted.
;************************************************************************
;* *
;* EXPANSION SLOTS FOR PRINTER AND PLOTTER DRIVERS *
;* *
;************************************************************************
L7:
L8:
L9:
L10:
L11:
L12:
L13:
L14:
L15:
L16: jmp L17
PROCEND color_
;************************************************************************
;* *
;* f u n c t i o n grey_(index, value) *
;* *
;* purpose: Change the colour maps grey scale. This is provided for *
;* dual monitor systems which need to vary the grey scale *
;* independently from the colour scales. *
;* Also used to set grey levels on monochrome only systems. *
;* *
;* entry: 08[bp] colour index....0 to 15 *
;* 10[bp] grey value......0 to 15 *
;* *
;************************************************************************
PROCDEF grey_
push di
push bp
mov bp,sp
mov ax,cs:WORD PTR eseg_sav
mov es,ax
cld
lea di, clmpda_ ;colormap shadow.
add di, 16
add di, 6[bp] ;get index offset
mov ax, 8[bp] ;get new grey value
xor al,0FFH
add al,16
mov cl,4
shl al, cl ;mov to upper nibble.
mov ah,BYTE PTR [di] ;get old grey;blue values.
and ah,0FH ;remove grey value
or al,ah ;and replace with the new value.
stosb
call a_cmap_
pop bp
pop di
ret
PROCEND grey_
;********************************************************************
; *
; s u b r o u t i n e a s s e r t _ c o l o r m a p *
; *
; colormap is located at clmpda which is defined in *
; openws() *
; *
; entry: clmpda holds new colour data to be loaded *
; exit: none *
; *
;********************************************************************
PROCDEF a_cmap_
cld
push es
xor ax,ax
mov es,ax
mov bx,WORD PTR gintvect_ ;fetch address of "giv" [1]
cli ;temp. disable interrupts
mov ax,es:[bx] ;read the old offset
mov WORD PTR old_int_off,ax
mov ax,es:2[bx] ;read the old segment
mov WORD PTR old_int_seg,ax
mov es:WORD PTR [bx],OFFSET color_int ;load new offset.
mov ax,cs
mov es:WORD PTR 2[bx],ax ;load new int segment
sti ;re-enable interrupts
pop es
mov BYTE PTR int_done,0 ;clear interrupt flag
or BYTE PTR gbmod_,40H ;enable graphics interrupt
call gdc_nb_
call a_mode_
L20: test BYTE PTR int_done,0FFH ;has interrupt routine run?
jz L20
push es ;restore interrupt vectors
xor ax,ax
mov es,ax
mov bx,WORD PTR gintvect_ ;fetch graphics vector offset [1]
cli
mov ax,WORD PTR old_int_off ;restore old interrupt vector
mov es:WORD PTR [bx],ax
mov ax,WORD PTR old_int_seg
mov es:WORD PTR 2[bx],ax
sti
pop es
cld ;make lods inc si
ret
PROCEND a_cmap_
;************************************************************************
;* *
;* colour interupt handler *
;* *
;************************************************************************
colourint PROC FAR
color_int:
push es
push ds
push si
push cx
push ax
mov ax,cs:WORD PTR dseg_sav ;can't depend on es or ds
mov ds,ax ;reload segment registers
mov ax,cs:WORD PTR eseg_sav
mov es,ax
cld
and BYTE PTR gbmod_,0BFH ;disable graphics interrupts
call a_mode_
lea si, clmpda_ ;fetch color source
mov al,0DFH ;get the color map's attention
out 53H,al
mov cx,16 ;32 color map entries
L21: lodsw ;fetch current color map data
out 51H,al ;load color map
mov al,ah
out 51H,al
loop L21 ;loop until all color map data loaded
mov BYTE PTR int_done,0FFH ;set "interrupt done" flag
pop ax
pop cx
pop si
pop ds
pop es
iret
colourint ENDP
;************************************************************************
;* *
;* s u b r o u t i n e chk_col_ *
;* *
;* purpose: check and set line, text, fill or marker *
;* colours. *
;* *
;* entry: al contains colour to be set to. *
;* *
;************************************************************************
PROCDEF chk_col_
cmp BYTE PTR ws_wmo_,3 ;check to see if we are in ERASE mode.
jz L30 ;quit if yes.
mov cl,4
shl al,cl
mov BYTE PTR fgbg_,al
call a_fgbg_
L30: ret
PROCEND chk_col_
include epilogue.h
END
+ARCHIVE+ creq.c 6641 12/13/1984 17:25:56
/***********************************************************/
/* */
/* I/O requests - use host language */
/* */
/***********************************************************/
#include <stdio.h>
#include <graph.h>
static char *notice =
"MSDOS Graphics Library 2.10 13-Dec-84 (c) Digital Equipment Co. Ltd.\n";
static char *wsdrivers[] = {
/*01*/ "SMIDMON.GRA",
/*02*/ "SHIGHMON.GRA",
/*03*/ "SMIDCOL.GRA",
/*04*/ "SHIGHCOL.GRA",
/*05*/ "DMID.GRA",
/*06*/ "DHIGH.GRA"
};
/************************************************************************/
/* */
/* F U N C T I O N ld_font_(font_fn, font_number) */
/* char *font_fn; */
/* int font_number; */
/* */
/* purpose: load data in a file into one of the graphics */
/* font arrays. */
/* */
/* entry: font_fn is the name of the file. */
/* font_number number to be loaded. [0 to 3] */
/* */
/* exit: NULL if font loaded OK. */
/* EOF if font data file could not be found. */
/* */
/************************************************************************/
ld_font_(font_fn,font_number)
char *font_fn;
int font_number;
{ FILE *ffile;
int i;
fprintf(stderr,"LD_FONT #%-d %s\n",font_fn);
if( (ffile = fopen(font_fn,"rb")) == NULL) {
fprintf(stderr,"cannot open font file %s\n",font_fn);
return(EOF);
}
if ( (i = fread(tfonts_[font_number][0][0],96,10,ffile)) == NULL
|| i < 10) {
fprintf(stderr,"Incomplete read %2d font file %s\n",i,font_fn);
return(EOF);
}
fclose(ffile);
return(NULL);
}
/************************************************************************/
/* */
/* F U N C T I O N ld_wsdets_() */
/* */
/* purpose: load workstation data from file */
/* */
/* entry: <ws_number_> number to be loaded. [1 to 6] */
/* */
/* exit: NULL workstation loaded OK. */
/* EOF if workstation file could not be found. */
/* */
/************************************************************************/
ld_wsdets_()
{ FILE *wfile;
int i,ws;
fprintf(stderr,notice);
if ( (ws = ws_number_) ==0 || ws > 6) {
fprintf(stderr,"Workstation %d out of range\n",ws);
return(EOF);
}
if ( (wfile = fopen(wsdrivers[--ws],"rb")) == NULL) {
fprintf(stderr,"Cannot open Workstation file %s\n",wsdrivers[ws]);
return(EOF);
}
i = fread(ws_data_,1792,1,wfile);
fclose(wfile);
return(NULL);
}
/************************************************************************/
/* */
/* F U N C T I O N malloc_(bytes) */
/* int bytes; */
/* */
/* purpose: allocate temp memory in stack space */
/* */
/* entry: bytes #bytes to alloc */
/* */
/* exit: NULL no core. */
/* offset (in DS) of allocated memory. */
/* */
/************************************************************************/
char *malloc_(bytes)
unsigned int bytes;
{ char *temp;
if( (temp = malloc(bytes)) == NULL)
fprintf(stderr,"Cannot allocate memory\n");
return(temp);
}
/************************************************************************/
/* */
/* F U N C T I O N free_(area) */
/* */
/* purpose: release stack space memory after malloc_ call */
/* */
/* entry: area mem pointer of area given by malloc_ */
/* */
/* exit: none. */
/* */
/************************************************************************/
free_(area)
unsigned char *area;
{
free(area);
}
/************************************************************************/
/* */
/* F U N C T I O N conout_(char) */
/* */
/* purpose: output character to console */
/* */
/* entry: char to be output */
/* */
/* exit: none. */
/* */
/************************************************************************/
conout_(c)
unsigned char c;
{
fprintf(stderr,"%c",c);
}
+ARCHIVE+ cxy2cp.asm 2899 12/27/1984 15:56:38
PAGE ,132
title CXY2CP.ASM
;UPDATE HISTORY
;==============
;14 nov 84 Convert to CI86 V2.2
;29 nov 84 adjust list format to 132 width
;27 dec 84 clear DX for big maths
include asmc.h
SEGEND CODE
SEGDEF DATA
include asmd.h
SEGEND DATA
SEGDEF CODE
PUBLIC cxy2cp_, a_cur_
IF @bigmodel
EXTRN fifo_mt_:FAR
ELSE
EXTRN fifo_mt_:NEAR
ENDIF
;********************************************************************
;* *
;* f u n c t i o n s cxy2cp_() a_cur_() *
;* *
;* CXY2CP takes the x_start and y_start values and converts *
;* them to a GDC cursor position and sends it to the GDC. *
;* The computed values are stored at curl0 to curl2. *
;* *
;* A_CUR takes the values at curl0 to curl2 and sends them *
;* to the GDC. *
;* *
;* entry: x_start = x pixel location *
;* y_start = y pixel location *
;* exit: curl0 to curl2 set to GDC cursor values *
;* *
;********************************************************************
PROCDEF cxy2cp_
push bx
push cx
push dx
mov cl, BYTE PTR sh_p_lin_
mov bx, WORD PTR y_start_ ;get line number
shl bx, cl ;and convert to a start of line offset
xor dx,dx ;clear DX for 16/32 bit maths
mov ax, WORD PTR x_start_
mov cl,4
sar ax, cl ;convert x_start to a WORD offset in ax
add ax, bx ;and leave pixel position in dl.
mov WORD PTR curl0_, ax
mov ax, WORD PTR x_start_
and ax, 0FH
mov cl,4
shl al, cl ;move pixel value to high nibble.
mov BYTE PTR curl2_, al
call a_cur_
pop dx
pop cx
pop bx
ret
PROCEND cxy2cp_
PROCDEF a_cur_
call fifo_mt_
mov al,49H ;set cursor location to that in curl0,1,2
out 57H,al ;issue the GDC cursor location command
mov ax,WORD PTR curl0_ ;fetch WORD low address
out 56H,al
mov al,ah ;middle address
out 56H,al
mov al,BYTE PTR curl2_ ;dot address [top 4 bits] and highDW addr
out 56H,al
ret
PROCEND a_cur_
include epilogue.h
END
+ARCHIVE+ fglib.asm 17049 12/10/1984 13:10:42
PAGE ,132
TITLE FGLIB.ASM
;*************************************************************
; Microsoft fortran interface into GRLIB *
; (Computer Innovations C Graphics library) *
;*************************************************************
;
; This is really a interface between the LARGE Fortran and
; small C model.
;
; Fortran Parameters are passed by far reference, left to right
;
; C parameters are passed right to left; arrays & strings by
; near reference, integers & chars by value.
;
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN f_col_:BYTE, f_style_:BYTE, f_type_:BYTE
EXTRN l_col_:BYTE, l_type_:BYTE, l_wid_:BYTE
EXTRN m_col_:BYTE, m_sca_:BYTE, m_type_:BYTE
EXTRN t_col_:BYTE, t_dir_:BYTE, t_font_:BYTE
EXTRN t_sca_:BYTE, ws_number_:BYTE, ws_wmo_:BYTE
public F_WORK_BUF_
ARRAY DW ?
ARRAY4 DW ?
BLUE DW ?
CENTRX DW ?
CENTRY DW ?
CHAR DW ?
COUNT DW ?
ENDDEG DW ?
GREEN DW ?
INDEX DW ?
RADIUS DW ?
RED DW ?
STARTD DW ?
X DW ?
XEND DW ?
XSTART DW ?
Y DW ?
YEND DW ?
YSTART DW ?
ZERO DW 0
F_WORK_BUF_ LABEL BYTE ;external name
STRING LABEL BYTE ;ASCIZ local copy
WORK DW 2048 DUP(?) ;for circles etc
SEGEND DATA
SEGDEF CODE
Extrn a_wmode_:NEAR, arc_:NEAR, bar_:NEAR, circle_:NEAR
Extrn color_:NEAR, ltext_:NEAR, g_off_:NEAR, g_on_:NEAR
Extrn openws_:NEAR, point_:NEAR, polyfill_:NEAR
Extrn polyline_:NEAR, polymark_:NEAR, rectangle_:NEAR
Extrn rq_locator_:NEAR, segment_:NEAR, gtext_:NEAR
PUBLIC GRARC, GRBAR, GRCIRC, GRCLOS, GRCOLR, GRFCOL
PUBLIC GRFSTY, GRFTYP, GRGON, GRGOFF, GRGTXT, GRHSCR
PUBLIC GRLCOL, GRLTYP, GRLWID, GRMCOL, GRMSCA, GRMTYP
PUBLIC GROPEN, GRPFIL, GRPLIN, GRPMAR, GRPOIN, GRRECT
PUBLIC GRRQLO, GRSEGM, GRTCOL, GRTDIR, GRTEXT, GRTFON
PUBLIC GRTSCA, GRVSCR, GRWMOD
;make a local ASCIZ copy of string
;ES:SI must point to source
;CX must contain count
movc PROC NEAR
PUSH DS
PUSH ES
POP DS ;DS=ES
POP ES ;ES=DS
LEA DI, STRING
REP MOVSB
MOV AL,0 ;add ASCIZ terminator
STOSB
PUSH DS
PUSH ES
POP DS ;DS=ES
POP ES ;ES=DS
RET
movc ENDP
;***********************************
;* SUBROUTINE GROPEN()
;***********************************
GROPEN PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL openws_ ;open workstation
ADD SP,2 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GROPEN ENDP
;***********************************
;* SUBROUTINE GRGON()
;***********************************
GRGON PROC FAR
PUSH BP
MOV BP,SP
PUSH DS ;call with ES set to DS
POP ES
CALL g_on_ ;turn Graphics ON
MOV SP,BP
POP BP
RET
GRGON ENDP
;***********************************
;* SUBROUTINE GRCIRC()
;***********************************
GRCIRC PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].0EH ;p1
MOV AX,ES:[BX]
MOV CENTRX,AX
LES BX,[BP].0AH ;p2
MOV AX,ES:[BX]
MOV CENTRY,AX
LES BX,[BP].06H ;p3
MOV AX,ES:[BX]
MOV RADIUS,AX
MOV AX,RADIUS
PUSH AX
MOV AX,CENTRY
PUSH AX
MOV AX,CENTRX
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL circle_
ADD SP,6 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRCIRC ENDP
;***********************************
;* SUBROUTINE GRARC()
;***********************************
GRARC PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].16H
MOV AX,ES:[BX]
MOV CENTRX,AX
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV CENTRY,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV RADIUS,AX
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV STARTD,AX
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV ENDDEG,AX
MOV AX,ENDDEG
PUSH AX
MOV AX,STARTD
PUSH AX
MOV AX,RADIUS
PUSH AX
MOV AX,CENTRY
PUSH AX
MOV AX,CENTRX
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL arc_
ADD SP,10 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRARC ENDP
;***********************************
;* SUBROUTINE GRSEGM()
;***********************************
GRSEGM PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].16H
MOV AX,ES:[BX]
MOV CENTRX,AX
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV CENTRY,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV RADIUS,AX
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV STARTD,AX
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV ENDDEG,AX
MOV AX,ENDDEG
PUSH AX
MOV AX,STARTD
PUSH AX
MOV AX,RADIUS
PUSH AX
MOV AX,CENTRY
PUSH AX
MOV AX,CENTRX
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL segment_
ADD SP,10 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRSEGM ENDP
;***********************************
;* SUBROUTINE GRCOLR()
;***********************************
GRCOLR PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV INDEX,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV RED,AX
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV GREEN,AX
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BLUE,AX
MOV AX,BLUE
PUSH AX
MOV AX,GREEN
PUSH AX
MOV AX,RED
PUSH AX
MOV AX,INDEX
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL color_
ADD SP,8 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRCOLR ENDP
;***********************************
;* SUBROUTINE GRBAR()
;***********************************
GRBAR PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
PUSH BX
PUSH DS ;call with ES set to DS
POP ES
CALL bar_
ADD SP,2 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRBAR ENDP
;***********************************
;* SUBROUTINE GRPLIN()
;***********************************
GRPLIN PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV COUNT,AX
LES BX,[BP].06H
MOV ARRAY,BX
MOV AX,ARRAY
PUSH AX
MOV AX,COUNT
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL polyline_
ADD SP,4 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRPLIN ENDP
;***********************************
;* SUBROUTINE GRPMAR()
;***********************************
GRPMAR PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV COUNT,AX
LES BX,[BP].06H
MOV ARRAY,BX
MOV AX,ARRAY
PUSH AX
MOV AX,COUNT
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL polymark_
ADD SP,4 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRPMAR ENDP
;***********************************
;* SUBROUTINE GRPFIL()
;***********************************
GRPFIL PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV COUNT,AX
LES BX,[BP].06H
MOV ARRAY,BX
MOV AX,ARRAY
PUSH AX
MOV AX,COUNT
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL polyfill_
ADD SP,4 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRPFIL ENDP
;***********************************
;* SUBROUTINE GRGTXT()
;***********************************
GRGTXT PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV X,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV Y,AX
LES SI,[BP].0AH ;character string addr
LES BX,[BP].06H ;count
MOV CX,ES:[BX]
CALL movc
LEA AX, STRING
PUSH AX
MOV AX,Y
PUSH AX
MOV AX,X
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL gtext_
ADD SP,6 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRGTXT ENDP
;***********************************
;* SUBROUTINE GRTEXT()
;***********************************
GRTEXT PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV X,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV Y,AX
LES SI,[BP].0AH
LES BX,[BP].06H
MOV CX,ES:[BX]
CALL movc
LEA AX, STRING
PUSH AX
MOV AX,Y
PUSH AX
MOV AX,X
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL ltext_
ADD SP,6 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRTEXT ENDP
;***********************************
;* SUBROUTINE GRRQLO()
;***********************************
GRRQLO PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].16H
MOV AX,ES:[BX]
MOV XSTART,AX
LES BX,[BP].12H
MOV AX,ES:[BX]
MOV YSTART,AX
LES BX,[BP].0EH
MOV AX,ES:[BX]
MOV CHAR,AX
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV XEND,AX
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV YEND,AX
MOV AX,YEND
PUSH AX
MOV AX,XEND
PUSH AX
MOV AX,CHAR
PUSH AX
MOV AX,YSTART
PUSH AX
MOV AX,XSTART
PUSH AX
MOV AX,ZERO
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL rq_locator_
ADD SP,12 ;C convention remove params from stack
LES BX,[BP].0EH
MOV AX,CHAR
MOV ES:[BX],AL
LES BX,[BP].0AH
MOV AX,XEND
MOV ES:[BX],AX
LES BX,[BP].06H
MOV AX,YEND
MOV ES:[BX],AX
MOV SP,BP
POP BP
RET
GRRQLO ENDP
;***********************************
;* SUBROUTINE GRVSCR()
;***********************************
GRVSCR PROC FAR
; PUSH BP
; MOV BP,SP
; MOV SP,BP
; POP BP
RET
GRVSCR ENDP
;***********************************
;* SUBROUTINE GRHSCR()
;***********************************
GRHSCR PROC FAR
; PUSH BP
; MOV BP,SP
; MOV SP,BP
; POP BP
RET
GRHSCR ENDP
;***********************************
;* SUBROUTINE GRPOIN()
;***********************************
GRPOIN PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].0AH
MOV AX,ES:[BX]
MOV X,AX
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV Y,AX
MOV AX,Y
PUSH AX
MOV AX,X
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL point_
ADD SP,4 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRPOIN ENDP
;***********************************
;* SUBROUTINE GRRECT()
;***********************************
GRRECT PROC FAR
PUSH BP
MOV BP,SP
LES AX,[BP].06H
MOV ARRAY4,AX
MOV AX,ARRAY4
PUSH AX
PUSH DS ;call with ES set to DS
POP ES
CALL rectangle_
ADD SP,2 ;C convention remove params from stack
MOV SP,BP
POP BP
RET
GRRECT ENDP
;***********************************
;* SUBROUTINE GRTSCA()
;***********************************
GRTSCA PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR t_sca_,AL
MOV SP,BP
POP BP
RET
GRTSCA ENDP
;***********************************
;* SUBROUTINE GRCLOS()
;***********************************
GRCLOS PROC FAR
PUSH BP
MOV BP,SP
MOV BYTE PTR ws_number_,0
PUSH DS ;call with ES set to DS
POP ES
CALL g_off_
MOV SP,BP
POP BP
RET
GRCLOS ENDP
;***********************************
;* SUBROUTINE GRGOFF()
;***********************************
GRGOFF PROC FAR
PUSH BP
MOV BP,SP
PUSH DS ;call with ES set to DS
POP ES
CALL g_off_
MOV SP,BP
POP BP
RET
GRGOFF ENDP
;***********************************
;* SUBROUTINE GRTDIR()
;***********************************
GRTDIR PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR t_dir_,AL
MOV SP,BP
POP BP
RET
GRTDIR ENDP
;***********************************
;* SUBROUTINE GRFCOL()
;***********************************
GRFCOL PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR f_col_,AL
MOV SP,BP
POP BP
RET
GRFCOL ENDP
;***********************************
;* SUBROUTINE GRFSTY()
;***********************************
GRFSTY PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR f_style_,AL
MOV SP,BP
POP BP
RET
GRFSTY ENDP
;***********************************
;* SUBROUTINE GRFTYP()
;***********************************
GRFTYP PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR f_type_,AL
MOV SP,BP
POP BP
RET
GRFTYP ENDP
;***********************************
;* SUBROUTINE GRLCOL()
;***********************************
GRLCOL PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR l_col_,AL
MOV SP,BP
POP BP
RET
GRLCOL ENDP
;***********************************
;* SUBROUTINE GRLTYP()
;***********************************
GRLTYP PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR l_type_,AL
MOV SP,BP
POP BP
RET
GRLTYP ENDP
;***********************************
;* SUBROUTINE GRLWID()
;***********************************
GRLWID PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR l_wid_,AL
MOV SP,BP
POP BP
RET
GRLWID ENDP
;***********************************
;* SUBROUTINE GRMCOL()
;***********************************
GRMCOL PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR m_col_,AL
MOV SP,BP
POP BP
RET
GRMCOL ENDP
;***********************************
;* SUBROUTINE GRMSCA()
;***********************************
GRMSCA PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR m_sca_,AL
MOV SP,BP
POP BP
RET
GRMSCA ENDP
;***********************************
;* SUBROUTINE GRMTYP()
;***********************************
GRMTYP PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR m_type_,AL
MOV SP,BP
POP BP
RET
GRMTYP ENDP
;***********************************
;* SUBROUTINE GRWMOD()
;***********************************
GRWMOD PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR ws_wmo_,AL
PUSH DS ;call with ES set to DS
POP ES
CALL a_wmode_
MOV SP,BP
POP BP
RET
GRWMOD ENDP
;***********************************
;* SUBROUTINE GRTCOL()
;***********************************
GRTCOL PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR t_col_,AL
MOV SP,BP
POP BP
RET
GRTCOL ENDP
;***********************************
;* SUBROUTINE GRTFON()
;***********************************
GRTFON PROC FAR
PUSH BP
MOV BP,SP
LES BX,[BP].06H
MOV AX,ES:[BX]
MOV BYTE PTR t_font_,AL
MOV SP,BP
POP BP
RET
GRTFON ENDP
include epilogue.h
END
+ARCHIVE+ fill.asm 10815 10/01/1983 0:12:10
PAGE ,132
title FILL.ASM
;UPDATE HISTORY
;==============
; 14 nov 84 Convert to CI86 V2.2
; 4 Dec 84 New version to correct idiosyncrosy in graphics option
; in which REPlace & COMPlement modes didn't work properly.
; The pattern write is now done external to the Graphics option.
; 11 Dec 84 Bugfix - free memory after single point or hollow fill.
include asmc.h
SEGEND CODE
RELEASE MACRO addr
mov ax,addr
push ax
call free_
add sp,2
ENDM
SEGDEF DATA
EXTRN f_col_:BYTE, f_type_:BYTE, f_patrn_:BYTE, f_style_:BYTE
EXTRN gbmod_:BYTE, ymax_:WORD, gp_buff_:WORD, y_start_:WORD
EXTRN x_start_:WORD, x_stop_:WORD, y_stop_:WORD, l_type_:BYTE
EXTRN l_col_:BYTE, sh_p_lin_:BYTE, curl0_:BYTE, nmritl_:BYTE, gbmskl_:BYTE
Lymin DW 0
Lymin1 DW 0
Lymax DW 0
Lydif DW 0
Lcntr DW 0
Lcnt1 DW 0
Lnpnt DW 0
Lfpat DW 0
Lbuff DW 0
SEGEND DATA
SEGDEF CODE
PUBLIC polyfill_, bar_
IF @bigmodel
EXTRN gdc_nb_:FAR, a_mode_:FAR, malloc_:FAR, cxy2cp_:FAR, fifo_mt_:FAR
EXTRN free_:FAR, polyline_:FAR, line_:FAR, a_gbmsk_:FAR, a_cur_:FAR
EXTRN chk_col_:FAR, a_patrn_:FAR, eseg_sav:FAR
ELSE
EXTRN gdc_nb_:NEAR, a_mode_:NEAR, malloc_:NEAR, cxy2cp_:NEAR, fifo_mt_:NEAR
EXTRN free_:NEAR, polyline_:NEAR, line_:NEAR, a_gbmsk_:NEAR, a_cur_:NEAR
EXTRN chk_col_:NEAR, a_patrn_:NEAR, eseg_sav:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N polyfill(count, array) *
;* int count, *array; *
;* *
;* purpose: Fill an area with a pattern specified by *
;* f_type and f_style which is defined as a *
;* series of 'xy' points [array] whose length *
;* is 'count' 'xy' pairs. *
;* *
;* entry: 8[bp] number of 'xy' pairs in 'array'. *
;* A[bp] pointer to the 'xy' pairs. *
;* *
;************************************************************************
PROCDEF polyfill_
push si
push di
push bp
mov bp,sp
mov ax,cs:WORD PTR eseg_sav
mov es,ax
mov ax,0400H ;allocate a 1k area for temporary storage.
push ax
call malloc_
add sp,2
or ax,ax
jnz Lv
jmp Lexit1
Lv:
mov Lbuff,ax
call gdc_nb_
mov al,BYTE PTR f_col_ ;change the colour to that specified for
call chk_col_ ;area filling.
test BYTE PTR gbmod_,2 ;are we in vector mode ?
jnz Lv1
or BYTE PTR gbmod_,12H
call a_mode_
Lv1: mov cx,8[bp]
dec cx
jnz L0a ;finished if it is a single point.
RELEASE Lbuff
jmp Lexit
L0a: mov Lnpnt,cx
mov al,BYTE PTR f_type_ ;get the fill type.
xor ah,ah
cmp ax,0 ;is it HOLLOW ?
jnz L0b
RELEASE Lbuff
jmp L9 ;finished if yes.
L0b: lea dx, f_patrn_
mov bx,0
cmp ax,1 ;fill_type solid ?
jz L0c
add dx,8
mov bl,BYTE PTR f_style_
cmp ax,2 ;fill_type PATTERN ?
jz L0c
add bx,8 ;offset f_style for HATCH.
L0c: mov cl,3
shl bx,cl
add dx,bx
mov Lfpat,dx
mov bx,WORD PTR ymax_
mov si,10[bp]
lea di, gp_buff_
mov cx,8[bp]
L0d: lodsw ;move all the 'xy' pairs to temporary storage
stosw ;in 'gp_buff_' and convert all 'y' values to a
mov ax,bx ;bottom left origin.
sub ax,[si]
stosw
add si,2
loop L0d
mov Lymin,3E8H
mov Lymax,0
lea si, gp_buff_
mov cx,8[bp]
L1: add si,2
lodsw
cmp ax,Lymin
jnl L2
mov Lymin,ax
L2: cmp ax,Lymax
jle L2a
mov Lymax,ax
L2a: loop L1
mov ax,Lymin
mov Lymin1,ax
mov bx,Lymax
sub bx,ax
mov Lydif,bx
jnz L2b
jmp L7
L2b: mov al,78H
out 57H,al
mov al,0ffH
out 56H,al
out 56H,al
L3: mov Lcntr,0
mov cx,Lnpnt
lea si, gp_buff_
L4: push cx
mov di,si
add di,4
push si
call L10
pop si
add si,4
pop cx
loop L4
lea di, gp_buff_
call L10
mov ax,Lcntr
shr ax,1
jnz L4a
jmp L6
L4a: mov Lcnt1,ax
mov si,Lymin1
mov WORD PTR y_start_,si
and si,7
neg si
add si,7
add si,Lfpat
mov al,BYTE PTR [si]
mov ah,al
mov bx,Lbuff
L5: push ax
push bx
mov cx,[bx]
mov WORD PTR x_start_,cx
push cx
push ax
call gdc_nb_
call cxy2cp_
mov al,0fdH ;select the PATTERN MULTIPLIER.
out 53H,al
mov al,0fH ;x1 pattern.
out 51H,al
mov al,0fbH ;select the PATTERN REGISTER.
out 53H,al
pop ax
pop cx
and cx,000fH
ror ax,cl
out 51H,al
mov al,4CH ;issue the FIGS command.
out 57H,al
mov al,02H
out 56H,al
mov ax,2[bx]
sub ax,WORD PTR x_start_
out 56H,al
xchg al,ah
out 56H,al
xchg al,ah
neg ax
out 56H,al
xchg al,ah
out 56H,al
xchg al,ah
shl ax,1
out 56H,al
xchg al,ah
out 56H,al
mov al,6CH ;issue the DRAW command.
out 57H,al
pop bx
pop ax
add bx,4
dec Lcnt1
jz L6
jmp L5
L6: inc Lymin1
dec Lydif
jz L7
jmp L3
L7: RELEASE Lbuff
mov bx,WORD PTR ymax_
lea di, gp_buff_+2
mov si,di
mov cx,8[bp]
L8: mov ax,bx
sub ax,[si]
stosw
add si,4
add di,2
loop L8
L9: call gdc_nb_
mov al,BYTE PTR l_type_ ;get current line type.
push ax
mov BYTE PTR l_type_,0 ;make it a solid line.
call a_patrn_ ;assert it.
mov al,BYTE PTR l_col_
call chk_col_
pop ax
mov BYTE PTR l_type_,al ;restore the old line type.
mov ax,10[bp] ;join all the points with a polyline.
push ax
mov ax,8[bp]
push ax
call polyline_
pop cx
pop si
lodsw ;now join the first point to the last point.
mov WORD PTR x_start_,ax
lodsw
mov WORD PTR y_start_,ax
sub cx,2
jz Lexit ;finished if it was a straight line.
shl cx,1
shl cx,1
add si,cx
lodsw
mov WORD PTR x_stop_,ax
lodsw
mov WORD PTR y_stop_,ax
lea ax, x_start_
push ax
call line_
add sp,2
Lexit: mov ax,0001H
Lexit1: pop bp
pop di
pop si
ret
L10: mov bx,2[di]
sub bx,2[si]
jz L17
mov ax,Lymin1
mov cx,ax
sub cx,2[si]
sub ax,2[di]
xor ax,cx
jns L17
mov ax,[di]
sub ax,[si]
shl cx,1
imul cx
idiv bx
inc ax
sar ax,1
add ax,[si]
mov bx,[si]
mov cx,[di]
cmp bx,cx
jle L11
xchg bx,cx
L11: cmp ax,bx
jnl L12
mov ax,bx
L12: cmp ax,cx
jle L13
mov ax,cx
L13: mov di,Lbuff
mov cx,Lcntr
jcxz L16
L14: scasw
jl L15
loop L14
jmp L16
L15: mov di,Lcntr
shl di,1
add di,Lbuff
mov si,di
sub si,2
std
rep movsw
cld
L16: stosw
inc Lcntr
L17: ret
PROCEND polyfill_
;************************************************************************
;* *
;* F U N C T I O N bar[array] int *array; *
;* *
;* purpose: set a user defined screen rectangle to a user *
;* defined color. *
;* entry: 0x06[bp] has the pointer to the 'xy' array *
;* *
;* 0[array] has the start x in pixels *
;* 6[array] has the start y in scan lines *
;* 4[array] has the stop x in pixels *
;* 2[array] has the stop y in scan lines *
;* f_col is the color to fill the bar with. *
;* *
;* NOTE: both 'y' values are relative to a bottom left origin *
;* *
;************************************************************************
PROCDEF bar_
push si
push bp
mov bp,sp
sub sp,4 ;make room for local y start and y stop
mov si,6[bp] ;get the array pointer
mov ax,WORD PTR ymax_ ;adjust both 'y' values for top left origin
sub ax,2[si]
mov -2[bp],ax
mov ax,WORD PTR ymax_
sub ax,6[si]
mov -4[bp],ax
mov ax,[si] ;turn bl_x address into word address.
mov cl,4
shr ax,cl
mov dx,-4[bp] ;turn tr_y into words per line * y.
mov cx,WORD PTR sh_p_lin_ ;high res = 6, medium res = 5.
shl dx,cl
add dx,ax ;combine x and y word addresses.
mov WORD PTR curl0_,dx ;first curl0.
mov ax,-2[bp] ;find number of lines to write by:
sub ax,-4[bp] ; bl_y - tr_y
mov WORD PTR nmritl_,ax
call gdc_nb_
mov al,BYTE PTR f_col_ ;check for correct colour.
call chk_col_
test BYTE PTR gbmod_,2
jz Lb0
and BYTE PTR gbmod_,0fdH ;put into word mode.
or BYTE PTR gbmod_,010H ;put into write-enable mode.
call a_mode_
Lb0: mov al,0FEH ;reset write buffer counter.
out 53H,al
out 51H,al
mov cx,10H
xor al,al
Lba: out 52H,al ;fill buffer with zero's.
loop Lba
;
;program the text mask:
;there are four possible write conditions:
;a]partially write disabled to theleft
;b]completely write enabled
;c]partially write disabled to the right
;d]partially write disabled to both left and right
Lb1: mov bx,0ffffH ;calculate the current write mask.
mov cx,[si] ;get bl_x
and cx,0fH ;eliminate all but pixel information.
shr bx,cl ;shift in a 0 for each left pixel to disable.
mov ax,[si] ;test to see if word tr_x is equal
and ax,0fff0H ;to word bl_x.
mov cx,4[si]
and cx,0fff0H
cmp ax,cx ;below?
jb Lb3 ;jump if yes.
je Lb2 ;jump if equal. do last write.
add sp,4
pop bp ;exit.
pop si
ret
Lb2: mov cx,4[si] ;get pixel info out of tr_x.
and cx,0fH
inc cx ;make endpoint inclusive of write.
mov ax,0ffffH ;shift the disable mask.
shr ax,cl ;wherever there is a one, we want to
xor ax,0ffffH ;enable writes.
and bx,ax ;combine right and left masks.
Lb3: xor bx,0ffffH ;invert so where there is a 1 we write disable.
mov WORD PTR gbmskl_,bx ;make sure that the GDC isn't busy
call gdc_nb_
call a_gbmsk_ ;and assert the write mask.
call a_cur_ ;assert the GDC cursor address.
mov al,4cH ;assert figs to GDC.
out 57H,al
xor al,al ;direction is down.
out 56H,al
mov ax,WORD PTR nmritl_
out 56H,al ;assert number of write operations to perform.
mov al,ah
out 56H,al
mov al,22H ;assert write data command.
out 57H,al
mov al,0ffH
out 56H,al
out 56H,al
and [si],0fff0H ;strip off pixel info.
add WORD PTR [si],16 ;address the next word.
inc WORD PTR curl0_
jmp Lb1 ;check for another column to clear.
PROCEND bar_
include epilogue.h
END
+ARCHIVE+ getkey.asm 3162 12/03/1984 13:47:46
PAGE ,132
TITLE GETKEY.ASM
;UPDATE HISTORY
;==============
; 3-dec-1984 convert from c to assembler
include asmc.h
include asmk.h
public CAPITAL
public INKEY
public GETKEY
extrn KBD16:near, KBDIN:near
; convert character to uppercase if lower case */
; if('a'<=c && c<='z')c+=('A'-'a');
; return c;
ucase PROC NEAR
push BP
mov BP,SP
mov AL,+4[BP]
cbw
cmp AX,97
jl ucasex
mov AL,+4[BP]
cbw
cmp AX,122
jg ucasex
mov AX,-32
push AX
pop DX
mov AL,+4[BP]
cbw
add AX,DX
mov +4[BP],AL
ucasex:
mov AL,+4[BP]
cbw
mov SP,BP
pop BP
ret
ucase ENDP
;******************************************************
;convert non-function key to upper case *
;capital(key_pressed) *
;unsigned int key_pressed; *
;******************************************************
PROCDEF CAPITAL
push BP
mov BP,SP
; if ( !FUNKEY(key_pressed) )
mov AX,+4[BP]
and AX,256
or AX,AX
je .012
mov AX,1
jmp SHORT .014
.012: ;11
xor AX,AX
.014: ;11
or AX,AX
je .01A
jmp SHORT .027
; return(toupper(key_pressed));
.01A: ;11
push WORD PTR +4[BP]
call ucase
add SP,2
mov SP,BP
pop BP
ret
; else
; return(key_pressed);
.027: ;13
mov AX,+4[BP]
mov SP,BP
pop BP
ret
PROCEND CAPITAL
;******************************************************
;wait for a key to be pressed and return it to caller *
; inkey() *
;******************************************************
INKEY PROC NEAR
.032: ;19
push BP
mov BP,SP
sub SP,2
; while ((key = getkey()) == 0);
.038: ;22
call GETKEY
mov -2[BP],AX
cmp AX,0
jne .045
jmp SHORT .038
; return(key);
.045: ;22
mov AX,-2[BP]
mov SP,BP
pop BP
ret
INKEY ENDP
;***********************************************************
;see if a key was pressed and return 16-bit char to caller *
;if function key, bit 0x0100 = 1 *
; else, bit 0x0100 = 0 *
;return 0 if no key pressed *
;getkey() *
;***********************************************************
; };
;}
GETKEY PROC NEAR
.04C: ;27
push BP
mov BP,SP
sub SP,6
; j = kbd16(&i);
lea SI,-6[BP]
push SI
call KBD16
add SP,2
; while (j == LEV2) { /* lose L2 chars */
; j = kbdin(k);
; j = kbd16(&i);
mov -4[BP],AX
.05F: ;31
cmp WORD PTR -4[BP],1
jne .081
push WORD PTR -2[BP]
call KBDIN
add SP,2
mov -4[BP],AX
lea SI,-6[BP]
push SI
call KBD16
add SP,2
mov -4[BP],AX
jmp SHORT .05F
; if (j == AKEY) return(i & FUNCTION ? i & FUNMASK : i & 0xFF);
.081: ;34
cmp WORD PTR -4[BP],-1
jne .0A4
mov AX,-6[BP]
and AX,256
or AX,AX
je .09A
mov AX,-6[BP]
and AX,319
jmp SHORT .0A0
.09A: ;35
mov AX,-6[BP]
and AX,255
.0A0: ;35
mov SP,BP
pop BP
ret
; return(0);
.0A4: ;36
xor AX,AX
mov SP,BP
pop BP
ret
GETKEY ENDP
include epilogue.h
END
+ARCHIVE+ gopt.asm 2875 10/01/1983 0:52:00
PAGE ,132
;GOPT.ASM
;UPDATE HISTORY
;==============
; 15 nov 1984 Convert to CI86 V2.2
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN swisg_:BYTE, sw100a_:BYTE, gintvect_:WORD
SEGEND DATA
SEGDEF CODE
PUBLIC gropt_
;********************************************************************
; *
; p r o c e d u r e gropt_() *
; *
; purpose: test if Graphics Option is present. *
; entry: none. *
; exit: ax = 0 option present. *
; dax = -1 option not present. *
; register usage: ax *
; the following globals are set:- *
; swisg_ 1 = graphics option present *
; 0 = no *
; sw100a_ 1 = this is Rainbow model 100a *
; 0 = no, 100b *
; gintvect_ = appropriate hardware interrupt vector *
;********************************************************************
PROCDEF gropt_
mov byte ptr swisg_,0 ;flag graphics board not present
in al,8 ;input from port 8
test al,04h ;test bit 2 to see if option present
jz opt1 ;if option is present, continue
mov ax,-1 ;else, set AX for option not present
jmp optx ;& exit
;===============
;option present
;===============
opt1: mov byte ptr swisg_,1 ;flag graphics board present
;
;Find out what the interupt vector is for the graphics option & set gintvect_.
; For a Model 100-A, the graphics interrupt vector is 22 Hexadecimal.
; For a Model 100-B, the interrupt vector is relocated up to A2H.
; If EE00:0F44h and 04<>0, we have the relocated vectors of a Model 100-B
; and need to OR the msb of our vector.
;
push es ;save valid es
mov ax,0ee00h ;test if vectors are relocated
mov es,ax
mov ax,88h ;100-A int. vector base addr
mov byte ptr sw100a_,0 ; & set provisional flag
test es:byte ptr 0f44h,4 ;relocated vectors?
jz g0 ;jump if yes
mov ax,288h ;100-B int. vector base addr
mov byte ptr sw100a_,1 ; & reset 100b flag
g0: mov word ptr gintvect_,ax
pop es
xor ax,ax ;set AX for option present
optx: ret
PROCEND gropt_
include epilogue.h
END
+ARCHIVE+ graph.h 6994 9/01/1984 0:20:56
#define HIRES (gbmod_ & 0x01 ? TRUE : FALSE)
#define MEDRES (gbmod_ & 0x01 ? FALSE : TRUE )
#define F_HOLLOW 0 /* Interior Fill Types */
#define F_SOLID 1
#define F_PATTERN 2
#define F_HATCH 3
#define REPLACE 0 /* Write Modes */
#define COMPLIMENT 1
#define OVERLAY 2
#define ERASE 3
/***** WORK STATION VARIABLES *****/
#define ws_data ws_data_
#define p1 p1_
#define ws_number ws_number_
#define ws_wmo ws_wmo_
#define gbmod gbmod_
#define fgbg fgbg_
#define alups alups_
#define gbmskl gbmskl_
#define gbmskh gbmskh_
#define gdcml gdcml_
#define gdcmh gdcmh_
#define curl0 curl0_
#define curl1 curl1_
#define curl2 curl2_
#define ymax ymax_
#define xmax xmax_
#define twdir twdir_
#define nmritl nmritl_
#define nmrith nmrith_
#define sh_p_lin sh_p_lin_
#define wd_p_lin wd_p_lin_
#define x_start x_start_
#define y_start y_start_
#define x_stop x_stop_
#define y_stop y_stop_
#define g_strtx g_strtx_
#define scr_top scr_top_
#define scr_bot scr_bot_
#define scrltb scrltb_
#define clmpda clmpda_
extern unsigned char ws_data_[28]; /*All the bytes needed to initialise*/
/*the work station. DO NOT CHANGE.*/
extern unsigned char p1_[16]; /*param table for PRAM & FIGS cmnds.*/
extern unsigned char ws_number_; /*work station ident. 1 to 6*/
extern unsigned char ws_wmo_; /*write mode. 0 to 3*/
extern unsigned char gbmod_; /*GO's mode register.*/
extern unsigned char fgbg_; /*defines fore_grnd/back_grnd colour.*/
extern unsigned char alups_; /*defines the writing mode.*/
extern unsigned char gbmskl_; /*GO's write mask, split into low and*/
extern unsigned char gbmskh_; /*high bytes.*/
extern unsigned char gdcml_; /*GDC's write mask, as above.*/
extern unsigned char gdcmh_;
extern unsigned char curl0_; /*three bytes which define the GDC's*/
extern unsigned char curl1_; /*cursor position.*/
extern unsigned char curl2_; /*curl2 only uses it's high nibble.*/
extern unsigned int ymax_; /*max pixels on 'y' axis. 0 to ymax*/
extern unsigned int xmax_; /*max pixels on 'x' axis. 0 to xmax*/
extern unsigned char twdir_; /*direct'n for word & vector drawing.*/
extern unsigned char nmritl_; /*# words to write. used by FIGS*/
extern unsigned char nmrith_;
extern unsigned int sh_p_lin_; /*number of shifts to do to convert a*/
/*line number to an absolute address.*/
extern unsigned int wd_p_lin_; /*number of words per line.*/
extern unsigned int x_start_; /*four gen. purpose variables, mainly*/
extern unsigned int y_start_; /*used for line drawing to defined the*/extern unsigned int x_stop_; /*start and stop vectors.*/
extern unsigned int y_stop_;
extern unsigned char g_strtx_; /*defines current 'x' offset from the*/
/*start of line to 1st pix. displayed*/
extern unsigned char scr_top_; /*define the top & bottom lines for*/
extern unsigned char scr_bot_; /*vertical scrolling.*/
extern unsigned char scrltb_[256]; /*mirror of line number sequence.*/
extern unsigned char clmpda_[32]; /*defines the colour intensities.*/
/****** TEXT VARIABLES ******/
#define t_col t_col_
extern unsigned char t_col_; /*text colour.affects "text"&"gtext."*/
#define t_font t_font_
extern unsigned char t_font_; /*text font. affects "gtext" only.*/
#define t_sca t_sca_
extern unsigned char t_sca_; /*text scale. affects "text" only.*/
#define t_dir t_dir_
extern unsigned char t_dir_; /*direction that text is written.*/
/* affects "text" only.*/
#define t_x t_x_
extern unsigned int t_x_; /*define the bottom left of the char.*/
#define t_y t_y_
extern unsigned int t_y_; /*cell in which char. is displayed.*/
#define tfonts tfonts_
extern unsigned char tfonts_[4][256][10]; /*table of 4 user definable fonts*/
/*for gtext characters.*/
/****** LINE VARIABLES ******/
#define l_col l_col_
extern unsigned char l_col_; /*line colour.*/
#define l_type l_type_
extern unsigned char l_type_; /*line type, indexes "pattbl".*/
#define l_wid l_wid_
extern unsigned char l_wid_; /*line width. (not used currently).*/
#define pattbl pattbl_
extern unsigned char pattbl_[16][2]; /*defines patterns & repeat factors*/
/* for drawing lines.*/
/****** FILL VARIABLES ********/
#define f_col f_col_
extern unsigned char f_col_; /*fill colour.*/
#define f_type f_type_
extern unsigned char f_type_; /*fill type. 0 to 3*/
#define f_style f_style_
extern unsigned char f_style_; /*fill style. 0 to 7*/
#define f_patrn f_patrn_
extern unsigned char f_patrn_[17][8]; /*table of patterns for filling:*/
/*f_patrn[0] solid. f_type = 1.*/
/*f_patrn[1-8] patterns. f_type = 2.*/
/*f_patrn[9-16] hatches. f_type = 3.*/
/****** MARKER VARIABLES ******/
#define m_col m_col_
extern unsigned char m_col_; /*marker colour.*/
#define m_type m_type_
extern unsigned char m_type_; /*marker type. 0 to 15*/
#define m_sca m_sca_
extern unsigned char m_sca_; /*marker scale.*/
#define m_tab m_tab_
extern unsigned char m_tab_[16][16]; /*vector table for markers.*/
#define gp_buff gp_buff_
extern unsigned int gp_buff_[2048]; /*gen. purpose array for 'xy' points.*/
/*Used heavily by "circle","segment",*/
/*"arc" and "rectangle", therefore*/
/*don't use it for these functions.*/
/***************************************************************/
/* FUNCTION CALLS */
/***************************************************************/
#define arc arc_
#define bar bar_
#define chk_col chk_col_
#define circle circle_
#define clearws clearws_
#define color color_
#define g_off() g_off_()
#define g_on() g_on_()
#define gchar gchar_
#define grey grey_ /*INTERNAL CALL*/
#define gtext gtext_
#define hscroll hscroll_
#define init_scrol init_scrol_
#define int_done int_done_
#define line line_
#define openws openws_
#define point point_
#define polyfill polyfill_
#define polyline polyline_
#define polymark polymark_
#define rd_cell rd_cell_ /*read bitmap*/
#define rectangle rectangle_
#define rq_locator rq_locator_
#define segment segment_
#define st_locator st_locator_
#define text ltext_
#define vscroll vscroll_
#define wr_cell wr_cell_ /*write bitmap*/
/***************************************************************/
/* Read/write bitmap cell structure */
/***************************************************************/
struct g_cell {
int c_corner[4]; /*defines bottom-left & top right*/
int c_plane; /*plane number read*/
int c_rows; /*#rows read*/
int c_bytes; /*#bytelength of each row element*/
unsigned char *c_segment; /*opt segment addr of temp area*/
unsigned char *c_offset; /*opt offset addr of temp area*/
};
+ARCHIVE+ greq.asm 7552 10/01/1983 0:04:16
PAGE ,132
TITLE GREQ.ASM
;***********************************************************
;* *
;* I/O requests - use host language *
;* *
;***********************************************************
;UPDATE HISTORY
;==============
; 3-dec-84 Make general purpose host requirements program
; convert CREQ.C to assembler
include asmc.h
SEGEND CODE
SEGDEF DATA
extrn WS_NUMBER_:byte, WS_DATA_:byte, TFONTS_:byte, _CARRY:word
extrn F_WORK_BUF_:byte
m1 db 'MSDOS FORTRAN Graphics Library 2.00.2 29-nov-84'
db ' (c) Digital Equipment Co. Ltd.',0AH,0
m2 db 'SMIDMON.GRA',0
m3 db 'SHIGHMON.GRA',0
m4 db 'SMIDCOL.GRA',0
m5 db 'SHIGHCOL.GRA',0
m6 db 'DMID.GRA',0
m7 db 'DHIGH.GRA',0
el db 0AH,0Dh,0
Wsdrivers LABEL WORD ;static char *wsdrivers[]
dw DGROUP:m2
dw DGROUP:m3
dw DGROUP:m4
dw DGROUP:m5
dw DGROUP:m6
dw DGROUP:m7
Handle dw 0 ;Msdos file handle
SEGEND DATA
SEGDEF CODE
public LD_FONT_, LD_WSDETS_, MALLOC_, FREE_, CONOUT_
EXTRN msdos:NEAR
; print ASCIZ message in DS:SI
pmsg_ PROC NEAR
cld ;left->right
pmsg1: lodsb ;get next char
and ax,255 ;ensure char only
or al,al
jz pmsgx ;Q. all dun
push SI ;save pointer
push AX
call conout_ ;write char
add sp,2
pop SI
jmp SHORT pmsg1
pmsgx: ret
pmsg_ ENDP
;***************************************
;* Process a file into a named area *
;***************************************
;*ld_file_(fn,where,cnt) *
;*char *fn,*where; *
;*unsigned int cnt; *
;***************************************
;{ unsigned int handle, chk;
ld_file_ PROC NEAR
push BP
mov BP,SP
sub SP,4
; handle = msdos(0x3D00,0,0,fn); /*open fn*/
push WORD PTR +4[BP]
xor AX,AX
push AX
push AX
mov AX,15616
push AX
call MSDOS
add SP,8
mov -4[BP],AX
; if(_carry) {return(handle);}
mov AX,_CARRY
or AX,AX
je .07C5
mov AX,-4[BP]
mov SP,BP
pop BP
ret
; chk = msdos(0x3F00,handle,cnt,where); /*read fn cnt bytes*/
.07C5: ;192
push WORD PTR +6[BP]
push WORD PTR +8[BP]
push WORD PTR -4[BP]
mov AX,16128
push AX
call MSDOS
add SP,8
mov -2[BP],AX
; if (_carry) {return(chk);}
mov AX,_CARRY
or AX,AX
je .07EA
mov AX,-2[BP]
mov SP,BP
pop BP
ret
; if (chk < cnt) {return(EOF);}
.07EA: ;194
mov AX,-2[BP]
cmp AX,+8[BP]
jae .07F9
mov AX,-1
mov SP,BP
pop BP
ret
; chk = msdos(0x3E00,handle,0,0); /* close fn*/
.07F9: ;195
xor AX,AX
push AX
push AX
push WORD PTR -4[BP]
mov AX,15872
push AX
call MSDOS
add SP,8
mov -2[BP],AX
; if (_carry) {return(chk);}
mov AX,_CARRY
or AX,AX
je .081C
mov AX,-2[BP]
mov SP,BP
pop BP
ret
; return(NULL);
.081C: ;197
xor AX,AX
mov SP,BP
pop BP
ret
ld_file_ ENDP
;************************************************************************
;* F U N C T I O N ld_font_(font_fn, font_number) *
;* char *font_fn; *
;* int font_number; *
;* purpose: load data in a file into one of the graphics *
;* font arrays. *
;* entry: font_fn is the name of the file. *
;* font_number number to be loaded. [0 to 3] *
;* exit: NULL if font loaded OK. *
;* EOF if font data file could not be found. *
;************************************************************************
;ld_font_(font_fn,font_number)
;char *font_fn;
;int font_number;
PROCDEF LD_FONT_
push BP
mov BP,SP
sub SP,4
;i = ld_file_(font_fn,960,tfonts_[font_number][0][0]);
lea SI,TFONTS_ ;calc base addr of tfonts_
mov BX,960
mov AX,+6[BP] ;indexed by font_number
imul BX
add SI,AX
add SI,0
add SI,0
mov AL,[SI]
and AX,255
push AX ;P3 = buffer address addr
mov AX,960
push AX ;P2 = text font length
push WORD PTR +4[BP] ;P1 = pathname
call ld_file_
add SP,6
mov SP,BP ;return(i);
pop BP
ret
PROCEND LD_FONT_
;************************************************************************
;* F U N C T I O N ld_wsdets_() *
;* purpose: load workstation data from file *
;* entry: <ws_number_> number to be loaded. [1 to 6] *
;* exit: NULL workstation loaded OK. *
;* EOF if workstation file could not be found. *
;************************************************************************
;ld_wsdets_()
PROCDEF LD_WSDETS_
push BP
mov BP,SP
sub SP,6
lea SI,WORD PTR m1 ;fprintf(stderr,notice);
call pmsg_
lea SI,el
call pmsg_
mov AL,BYTE PTR WS_NUMBER_ ;if ( (ws = ws_number_) == 0
and AX,255
mov -2[BP],AX
cmp AX,0
jne .0D2
jmp SHORT .0D9
.0D2: ;75
cmp WORD PTR -2[BP],6 ;... or ws > 6)
jle .0F2
.0D9:
mov AX,-1 ;...return(EOF);
mov SP,BP
pop BP
ret
.0F2: ;i = ld_file_(Wsdrivers[ws],ws_data_,1792)
mov AX,1792
push AX
lea AX,WS_DATA_
push AX
lea SI,Wsdrivers ;get pointer to pathname
dec WORD PTR -2[BP]
mov AX,-2[BP]
shl AX,1
add SI,AX
push WORD PTR [SI] ;P1 = *pathname
call ld_file_
add SP,6
mov SP,BP ;return(i);
pop BP
ret
PROCEND LD_WSDETS_
;************************************************************************
;* F U N C T I O N malloc_(bytes) *
;* int bytes; *
;* purpose: allocate temp memory in stack space *
;* entry: bytes #bytes to alloc *
;* exit: NULL no core. *
;* offset (in DS) of allocated memory. *
;************************************************************************
PROCDEF MALLOC_
lea AX,F_WORK_BUF_
ret
PROCEND MALLOC_
;************************************************************************
;* F U N C T I O N free_(area) *
;* purpose: release stack space memory after malloc_ call *
;* entry: area mem pointer of area given by malloc_ *
;* exit: none. *
;************************************************************************
PROCDEF FREE_
ret
PROCEND FREE_
;************************************************************************
;* F U N C T I O N conout_(char) *
;* purpose: output character to console *
;* entry: char to be output *
;* exit: none. *
;************************************************************************
PROCDEF CONOUT_
push BP
mov BP,SP
mov DL,+4[BP]
and DX,255
push DX ;DX = char
push DX ;CX = dummy
push DX ;BX = dummy
mov ah,06H
push AX ;AX = direct console I/O
call msdos
add SP,8
mov SP,BP
pop BP
ret
PROCEND CONOUT_
include epilogue.h
end
+ARCHIVE+ gsx86.c 1228 11/16/1984 12:31:28
/***************************************************************/
/* GSX86MWC COMPATABLE FUNCTION CALLS */
/***************************************************************/
#include "graph.h"
charht(tscale)
unsigned char tscale;
{ t_sca_ = tscale; }
closews()
{ ws_number_ = 0; g_off_(); }
direction(tdir)
unsigned char tdir;
{ t_dir_ = tdir; }
fillcolor(fcol)
unsigned char fcol;
{ f_col_ = fcol; }
fillstyle(fstyle)
unsigned char fstyle;
{ f_style_ = fstyle;}
filltype(ftype)
unsigned char ftype;
{ f_type_ = ftype; }
linecolor(lcolor)
unsigned char lcolor;
{ l_col_ = lcolor; }
linetype(ltype)
unsigned char ltype;
{ l_type_ = ltype; }
linewidth(lwidth)
unsigned char lwidth;
{ l_wid_ = lwidth; }
markercolor(mcolor)
unsigned char mcolor;
{ m_col_ = mcolor; }
markerscale(mscale)
unsigned char mscale;
{ m_sca_ = mscale; }
markertype(mtype)
unsigned char mtype;
{ m_type_ = mtype; }
setwmode(mode)
unsigned char mode;
{ ws_wmo_ = mode; a_wmode_(); }
textcolor(tcolor)
unsigned char tcolor;
{ t_col_ = tcolor; }
textfont(tfont)
unsigned char tfont;
{ t_font_ = tfont; }
updatews()
{ return; }
+ARCHIVE+ gtext.asm 9872 12/21/1984 17:19:22
PAGE ,132
TITLE GTEXT.ASM
;UPDATE HISTORY
;==============
;15 nov 84 Convert to C86 V2.2
;21-dec-84 fix some things
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN t_x_:WORD, t_y_:WORD, t_col_:BYTE, gbmod_:BYTE, sh_p_lin_:BYTE
EXTRN ymax_:WORD, xmax_:WORD, curl0_:BYTE, curl2_:BYTE
EXTRN y_start_:WORD,x_start_:WORD
EXTRN tfonts_:BYTE, t_font_:BYTE, gbmskl_:BYTE
SEGEND DATA
SEGDEF CODE
PUBLIC gtext_, gchar_
IF @bigmodel
EXTRN gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, a_gbmsk_:FAR, a_cur_:FAR
EXTRN fifo_mt_:FAR, cxy2cp_:FAR
ELSE
EXTRN gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, a_gbmsk_:NEAR, a_cur_:NEAR
EXTRN fifo_mt_:NEAR, cxy2cp_:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N gtext_(x, y, string) *
;* int x, y; *
;* char *string; *
;* *
;* purpose: print a string of text at a specific 'xy' *
;* position. X & Y are defined as pixel locations *
;* at the bottom left of the character cell. *
;* *
;* entry: 6[bp] 'x' position *
;* 8[bp] 'y' position *
;* 10[bp] pointer to NULL terminated string *
;* *
;************************************************************************
PROCDEF gtext_
push si
push bp
mov bp,sp
mov ax,6[bp] ;get 'x' position
mov WORD PTR t_x_,ax ;and save.
mov ax,8[bp] ;get 'y' position
mov WORD PTR t_y_,ax ;and save.
call gdc_nb_
mov al,BYTE PTR t_col_
call chk_col_
mov si,10[bp] ;point to start of string
cld ;make sure we inc 'si'.
test BYTE PTR gbmod_,2
jz Lt0 ;jump if already in text mode else
and BYTE PTR gbmod_,0FDH ;assert text mode.
call a_mode_
Lt0: lodsb
or al,al ;check for the end of string.
jz Lt1 ;quit if it is.
push ax
call gchar_
add sp,2
jmp Lt0
Lt1: pop bp
pop si
ret
PROCEND gtext_
;************************************************************************
;* *
;* f u n c t i o n gchar_(char) *
;* *
;* purpose: write graphics text *
;* entry: 6[bp] character to be written *
;* *
;* conditions: 1) text cursor is correctly placed *
;* 2) fgbg and alups already defined *
;* 3) text font has been selected *
;************************************************************************
PROCDEF gchar_
push si
push bp
mov bp,sp
mov ax,6[bp]
cmp al,1FH ;unprintable character0
ja L0 ;jump if not.
call L20 ;see if it's one of the control chars
jmp L11 ; we can handle, then exit.
L0: test al,80H ;is character within table0
jz L1 ;jump if not.
jmp L11 ;if yes just exit.
;adjust co-ordinates in t_x_ & t_y_ and assert the cursor.
L1: mov ax,WORD PTR t_x_ ;get column number
and ax,0FFF0H
mov WORD PTR x_start_,ax
mov ax,WORD PTR ymax_
sub ax,WORD PTR t_y_ ;t_y_ specified as bot_left of ch cell.
sub ax,9 ;move 'y' to top left of character cell.
jns L1a
xor ax,ax
L1a: mov WORD PTR y_start_,ax
call cxy2cp_
mov ax, 6[bp]
sub al,20H ;table starts with a space at 0.
xor ah,ah
shl ax,1
mov bx,ax ;bx = al * 2
shl ax,1
shl ax,1 ;ax = al * 8
add bx,ax ;bx = al * 10
lea si, tfonts_ ;point to start of font table
mov al,BYTE PTR t_font_ ;get font type
inc al
L4: dec al
jz L5
add si,960 ;add font table size to table offset
jmp L4
L5: add si,bx ;si now points to the 10DB table entry
test WORD PTR t_x_,8
jnz L3a
mov WORD PTR gbmskl_,000FFH
jmp L3b
L3a: mov WORD PTR gbmskl_,0FF00H
L3b: call gdc_nb_
call a_gbmsk_ ;assert the graf board mask
cld ;make sure lodsb incs si.
mov al,0FEH ;reset the char ram counter.
out 53H,al
out 51H,al
lodsw ;fetch both bytes.
out 52H,al ;put the byte into both 1 and 2 char ram bytes.
out 52H, al
mov al,ah
out 52H, al ;put theDB into both 1 and 2 char ram bytes.
out 52H, al
mov al,0FEH ;reset the char ram counter.
out 53H,al
out 51H,al
call a_cur_ ;assert the cursor command.
mov al,4CH ;assert the {04c command.
out 57H,al
xor al,al ;assert the down directinon to write.
out 56H,al
inc al ;do it 2 write cycles.
out 56H,al
dec al
out 56H,al
mov al,22H ;assert the wdat command.
out 57H,al
mov al,0FFH
out 56H,al
out 56H,al
call gdc_nb_
mov cx,8 ;eight scan lines.
L8: lodsb ;fetch theDB.
out 52H, al ;put theDB into both 1 and 2 char ram bytes.
out 52H, al
loop L8
mov al,4CH ;assert the figs command.
out 57H,al
mov al,00 ;assert the down directinon to write.
out 56H,al
mov ax,7 ;do 8 write cycles.
out 56H,al
mov al,ah
out 56H,al
mov al,22H ;assert the wdat command.
out 57H,al
mov al,0FFH
out 56H,al
out 56H,al
;Now adjust the text character position & test for word wrapping
mov ax, WORD PTR t_x_
add ax,8 ;character width
cmp WORD PTR xmax_,ax ;have we gone past the end of the line0
jns L9
xor ax,ax ;back to start of line
L9: mov WORD PTR t_x_,ax
jnz L11 ;exit if we don't have to go to a new line.
mov ax,WORD PTR t_y_
sub ax,10 ;move to next character line
or ax,ax ;are we on last line already0
jns L10
xor ax,ax
L10: mov WORD PTR t_y_,ax
L11: pop bp
pop si
ret
;Control character handler [ax contains the character]:
; 007 bell
; 008 back_space
; 009 tab
; 00a line_feed [also does a carriage_return]
; 00c clear_screen [********* not yet *********]
; 00d carriage_return
L20: cmp al,7 ;is it a bell ?
jnz L30
L21: mov cl,2
mov dl, al
int 0E0H
ret
L30: cmp al,8 ;is it back_space ?
jnz L40
cmp WORD PTR t_x_, 0
jnz L31
mov ax,7
jmp L21
L31: sub WORD PTR t_x_,8
ret
L40: cmp al,9 ;is it tab ?
jnz L50
mov ax, WORD PTR t_x_
and ax, 0FFC0H ;go back to last multiple of 64
add ax,64 ;next tab position
cmp WORD PTR xmax_,ax
jns L41
mov ax,7
jmp L21
L41: mov WORD PTR t_x_,ax
ret
L50: cmp al,0AH ;is it line_feed ?
jnz L60
L51: mov ax,WORD PTR t_y_
sub ax, 10
or ax,ax
jns L52
mov ax,7
jmp L21
L52: mov WORD PTR t_y_, ax
ret
L60: cmp al,0CH ;is it clear_screen ?
jnz L70
mov WORD PTR t_y_,10 ;for now, just home cursor.
mov WORD PTR t_x_,10
L61: ret
L70: cmp al,0DH ;is it carriage_return ?
jnz L61 ;exit if not.
mov WORD PTR t_x_,0
jmp L51
PROCEND gchar_
include epilogue.h
END
+ARCHIVE+ key.h 1850 11/16/1984 13:01:28
/*************************************************/
/* K E Y . H */
/* G L O B A L D E F I N I T I O N S */
/*************************************************/
#define TRUE 1 /* truth value */
#define FALSE 0 /* falsehood */
#define FUNCTION 0x100 /* pertinent bit in 16-bit key return */
#define FUNKEY(keyval) (keyval & FUNCTION ? TRUE : FALSE)
/* important function keys */
#define PSCR (FUNCTION | 2)
#define F4 (FUNCTION | 4)
#define BRK (FUNCTION | 5)
#define INT (FUNCTION | 6)
#define RES (FUNCTION | 7)
#define CANC (FUNCTION | 8)
#define BS 8
#define MAIN (FUNCTION | 9)
#define TAB 9
#define EXIT (FUNCTION | 10)
#define LF 10
#define RET 13
#define ADDO (FUNCTION | 14)
#define HELP (FUNCTION | 15)
#define DO (FUNCTION | 16)
#define F17 (FUNCTION | 17)
#define F18 (FUNCTION | 18)
#define F19 (FUNCTION | 19)
#define F20 (FUNCTION | 20)
#define FIND (FUNCTION | 21)
#define INS (FUNCTION | 22)
#define REM (FUNCTION | 23)
#define SEL (FUNCTION | 24)
#define PREV (FUNCTION | 25)
#define NEXT (FUNCTION | 26)
#define UP (FUNCTION | 27)
#define ESC 27
#define LEFT (FUNCTION | 28)
#define DOWN (FUNCTION | 29)
#define RGHT (FUNCTION | 30)
#define K0 (FUNCTION | 31)
#define K1 (FUNCTION | 32)
#define K2 (FUNCTION | 33)
#define K3 (FUNCTION | 34)
#define K4 (FUNCTION | 35)
#define K5 (FUNCTION | 36)
#define K6 (FUNCTION | 37)
#define K7 (FUNCTION | 38)
#define K8 (FUNCTION | 39)
#define K9 (FUNCTION | 40)
#define KQUO (FUNCTION | 41)
#define KMIN (FUNCTION | 42)
#define KDOT (FUNCTION | 43)
#define PF1 (FUNCTION | 44)
#define PF2 (FUNCTION | 45)
#define PF3 (FUNCTION | 46)
#define PF4 (FUNCTION | 47)
#define KENT (FUNCTION | 48)
#define DEL 0x7f
+ARCHIVE+ ltext.asm 13316 10/01/1983 0:53:44
PAGE ,132
;LTEXT.ASM
;UPDATE HISTORY
;==============
; 15 nov 84 Convert to CI86 V2.2
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN l_type_:BYTE, t_col_:BYTE, gbmod_:BYTE, t_sca_:BYTE
Lflag DB 1
Lxs DW 1
Lys DW 1
Lxf DW 1
Lyf DW 1
;******************************************************************
;* *
;* stroke font character set *
;* *
;******************************************************************
;
;the following tables are vertice information for a stroked character
;set the x,y coordinate information is represented by 4 bit 2's
;complement numbers in the range of +-7 x, +-7 y. end of character
;is represented by -8 x, -8 y and dark vector is represented by -8 x,
; 0 y.
;
; bit 7 6 5 4 3 2 1 0
; | | | |
; \ ; \ ;
; x y
;
;characters are currently mapped into the positive quadrant,
;with the origin at the lower left corner of an upper case character,
;therfore, lowercase characters will descend below the line specified
;for the character.
Lf_20 DB 88H
Lf_21 DB 20H,21H,80H,23H,26H,88H
Lf_22 DB 24H,26H,80H,54H,56H,88H
Lf_23 DB 20H,26H,80H,40H,46H,80H,04H,64H,80H,02H,62H,88H
Lf_24 DB 2fH,27H,80H,01H,10H,30H,41H,42H,33H,13H,04H,05H
DB 16H,36H,45H,88H
Lf_25 DB 11H,55H,80H,14H,15H,25H,24H,14H,80H,41H,51H,52H
DB 42H,41H,88H
Lf_26 DB 50H,14H,15H,26H,36H,45H,44H,11H,10H,30H,52H,88H
Lf_27 DB 34H,36H,88H
Lf_28 DB 4eH,11H,14H,47H,88H
Lf_29 DB 0eH,31H,34H,07H,88H
Lf_2a DB 30H,36H,80H,11H,55H,80H,15H,51H,80H,03H,63H,88H
Lf_2b DB 30H,36H,80H,03H,63H,88H
Lf_2c DB 11H,20H,2fH,0dH,88H
Lf_2d DB 03H,63H,88H
Lf_2e DB 00H,01H,11H,10H,00H,88H
Lf_2f DB 00H,01H,45H,46H,88H
Lf_30 DB 01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
Lf_31 DB 04H,26H,20H,80H,00H,40H,88H
Lf_32 DB 05H,16H,36H,45H,44H,00H,40H,41H,88H
Lf_33 DB 05H,16H,36H,45H,44H,33H,42H,41H,30H,10H,01H,80H
DB 13H,33H,88H
Lf_34 DB 06H,03H,43H,80H,20H,26H,88H
Lf_35 DB 01H,10H,30H,41H,42H,33H,03H,06H,46H,88H
Lf_36 DB 02H,13H,33H,42H,41H,30H,10H,01H,05H,16H
DB 36H,45H,88H
Lf_37 DB 06H,46H,44H,00H,88H
Lf_38 DB 01H,02H,13H,04H,05H,16H,36H,45H,44H,33H,42H,41H
DB 30H,10H,01H,80H,13H,23H,88H
Lf_39 DB 01H,10H,30H,41H,45H,36H,16H
DB 05H,04H,13H,33H,44H,88H
Lf_3a DB 15H,25H,24H,14H,15H,80H,12H,22H,21H,11H,12H,88H
Lf_3b DB 15H,25H,24H,14H,15H,80H
DB 21H,11H,12H,22H,20H,1fH,88H
Lf_3c DB 30H,03H,36H,88H
Lf_3d DB 02H,42H,80H,04H,44H,88H
Lf_3e DB 10H,43H,16H,88H
Lf_3f DB 06H,17H,37H,46H,45H,34H,24H,22H,80H,21H,20H,88H
Lf_40 DB 50H,10H,01H,06H,17H,57H,66H,63H,52H,32H,23H,24H
DB 35H,55H,64H,88H
Lf_41 DB 00H,04H,26H,44H,40H,80H,03H,43H,88H
Lf_42 DB 00H,06H,36H,45H,44H,33H,42H,41H,30H
DB 00H,80H,03H,33H,88H
Lf_43 DB 45H,36H,16H,05H,01H,10H,30H,41H,88H
Lf_44 DB 00H,06H,36H,45H,41H,30H,00H,88H
Lf_45 DB 40H,00H,06H,46H,80H,03H,23H,88H
Lf_46 DB 00H,06H,46H,80H,03H,23H,88H
Lf_47 DB 45H,36H,16H,05H,01H,10H,30H,41H,43H,23H,88H
Lf_48 DB 00H,06H,80H,03H,43H,80H,40H,46H,88H
Lf_49 DB 10H,30H,80H,20H,26H,80H,16H,36H,88H
Lf_4a DB 01H,10H,30H,41H,46H,88H
Lf_4b DB 00H,06H,80H,02H,46H,80H,13H,40H,88H
Lf_4c DB 40H,00H,06H,88H
Lf_4d DB 00H,06H,24H,46H,40H,88H
Lf_4e DB 00H,06H,80H,05H,41H,80H,40H,46H,88H
Lf_4f DB 01H,05H,16H,36H,45H,41H,30H,10H,01H,88H
Lf_50 DB 00H,06H,36H,45H,44H,33H,03H,88H
Lf_51 DB 12H,30H,10H,01H,05H,16H,36H,45H,41H,30H,88H
Lf_52 DB 00H,06H,36H,45H,44H,33H,03H,80H,13H,40H,88H
Lf_53 DB 01H,10H,30H,41H,42H,33H,13H,04H,05H,16H,36H
DB 45H,88H
Lf_54 DB 06H,46H,80H,20H,26H,88H
Lf_55 DB 06H,01H,10H,30H,41H,046H,88H
Lf_56 DB 06H,02H,20H,42H,46H,88H
Lf_57 DB 06H,00H,22H,40H,46H,88H
Lf_58 DB 00H,01H,45H,46H,80H,40H,41H,05H,06H,88H
Lf_59 DB 06H,24H,20H,80H,24H,46H,88H
Lf_5a DB 06H,46H,45H,01H,00H,40H,88H
Lf_5b DB 37H,17H,1fH,3fH,88H
Lf_5c DB 06H,05H,41H,40H,88H
Lf_5d DB 17H,37H,3fH,2fH,88H
Lf_5e DB 04H,26H,44H,88H
Lf_5f DB 0fH,7fH,88H
Lf_60 DB 54H,36H,88H
Lf_61 DB 40H,43H,34H,14H,03H,01H,10H,30H,41H,88H
Lf_62 DB 06H,01H,10H,30H,41H,43H,34H,14H,03H,88H
Lf_63 DB 41H,30H,10H,01H,03H,14H,34H,043H,88H
Lf_64 DB 46H,41H,30H,10H,01H,03H,14H,34H,43H,88H
Lf_65 DB 41H,30H,10H,01H,03H,14H,34H,43H,42H,02H,88H
Lf_66 DB 20H,25H,36H,46H,55H,80H,03H,43H,88H
Lf_67 DB 41H,30H,10H,01H,03H,14H,34H,43H,4fH
DB 3eH,1eH,0fH,88H
Lf_68 DB 00H,06H,80H,03H,14H,34H,43H,40H,88H
Lf_69 DB 20H,23H,80H,25H,26H,88H
Lf_6a DB 46H,45H,80H,43H,4fH,3eH,1eH,0fH,88H
Lf_6b DB 00H,06H,80H,01H,34H,80H,12H,30H,88H
Lf_6c DB 20H,26H,88H
Lf_6d DB 00H,04H,80H,03H,14H,23H,34H,43H,40H,88H
Lf_6e DB 00H,04H,80H,03H,14H,34H,43H,40H,88H
Lf_6f DB 01H,03H,14H,34H,43H,41H,30H,10H,01H,88H
Lf_70 DB 04H,0eH,80H,01H,10H,30H,41H,43H,34H,14H,03H,88H
Lf_71 DB 41H,30H,10H,01H,03H,14H,34H,43H,80H,44H,4eH,88H
Lf_72 DB 00H,04H,80H,03H,14H,34H,88H
Lf_73 DB 01H,10H,30H,41H,32H,12H,03H,14H,34H,43H,88H
Lf_74 DB 04H,44H,80H,26H,21H,30H,40H,51H,88H
Lf_75 DB 04H,01H,10H,30H,41H,80H,44H,40H,88H
Lf_76 DB 04H,02H,20H,42H,44H,88H
Lf_77 DB 04H,00H,22H,40H,44H,88H
Lf_78 DB 00H,44H,80H,04H,40H,88H
Lf_79 DB 04H,01H,10H,30H,41H,80H,44H,4fH,3eH,1eH,0fH,88H
Lf_7a DB 04H,44H,00H,40H,88H
Lf_7b DB 40H,11H,32H,03H,34H,15H,46H,88H
Lf_7c DB 20H,23H,80H,25H,27H,88H
Lf_7d DB 00H,31H,12H,43H,14H,35H,06H,88H
Lf_7e DB 06H,27H,46H,67H,88H
Lf_7f DB 07H,77H,88H
Llf_tabl equ $
DW Lf_20, Lf_21, Lf_22, Lf_23, Lf_24, Lf_25, Lf_26, Lf_27, Lf_28, Lf_29
DW Lf_2a, Lf_2b, Lf_2c, Lf_2d, Lf_2e, Lf_2f, Lf_30, Lf_31, Lf_32, Lf_33
DW Lf_34, Lf_35, Lf_36, Lf_37, Lf_38, Lf_39, Lf_3a, Lf_3b, Lf_3c, Lf_3d
DW Lf_3e, Lf_3f, Lf_40, Lf_41, Lf_42, Lf_43, Lf_44, Lf_45, Lf_46, Lf_47
DW Lf_48, Lf_49, Lf_4a, Lf_4b, Lf_4c, Lf_4d, Lf_4e, Lf_4f, Lf_50, Lf_51
DW Lf_52, Lf_53, Lf_54, Lf_55, Lf_56, Lf_57, Lf_58, Lf_59, Lf_5a, Lf_5b
DW Lf_5c, Lf_5d, Lf_5e, Lf_5f, Lf_60, Lf_61, Lf_62, Lf_63, Lf_64, Lf_65
DW Lf_66, Lf_67, Lf_68, Lf_69, Lf_6a, Lf_6b, Lf_6c, Lf_6d, Lf_6e, Lf_6f
DW Lf_70, Lf_71, Lf_72, Lf_73, Lf_74, Lf_75, Lf_76, Lf_77, Lf_78, Lf_79
DW Lf_7a, Lf_7b, Lf_7c, Lf_7d, Lf_7e, Lf_7f
SEGEND DATA
SEGDEF CODE
PUBLIC ltext_
IF @bigmodel
EXTRN gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, line_:FAR, a_patrn_:FAR
EXTRN eseg_sav:FAR
ELSE
EXTRN gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, line_:NEAR, a_patrn_:NEAR
EXTRN eseg_sav:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N ltext_(x, y, string) *
;* int x, y; char *string; *
;* *
;* entry: 8[bp] 'x' co-ordinate *
;* 10[bp] 'y' co-ordinate *
;* 12[bp] pointer to string array. *
;* *
;************************************************************************
PROCDEF ltext_
push si
push di ;-2[bp] temp x.
push bp ;-4[bp] temp y.
mov bp,sp ;-6[bp] loop constant.
sub sp,0AH ;-8[bp] 'x' loop counter.
;-10[bp] 'y' loop counter.
mov ax,cs:WORD PTR eseg_sav
mov es,ax
call gdc_nb_
mov al,BYTE PTR l_type_ ;get and save old line type.
push ax
mov BYTE PTR l_type_,0 ;set up line type for solid lines.
call a_patrn_ ;set pattern multiplier.
pop ax ;restore old line type.
mov BYTE PTR l_type_,al
mov al,BYTE PTR t_col_ ;check for correct colour.
call chk_col_
test BYTE PTR gbmod_,2 ;are we in vector mode.
jnz L0a
or BYTE PTR gbmod_,12H
call a_mode_
L0a: mov al,BYTE PTR t_sca_
xor ah,ah
dec ax
shr ax,1
mov -6[bp],ax ;set up loop counters.
mov -8[bp],ax
mov -10[bp],ax
cld
Lstrg: mov ax,08[bp]
mov -2[bp],ax
mov ax,10[bp]
mov -4[bp],ax
mov si,12[bp] ;point to string array.
Ldo_strg:
lodsb ;get character.
or al,al
jz L0 ;exit if end of string.
cmp al,1FH
ja Ldo_1 ;loop if control character.
cmp al,7FH
jbe Ldo_1 ;loop if > DEL.
jmp Ldo_strg
Ldo_1: push si
call Lsho_char ;display it
pop si
mov cl,BYTE PTR t_sca_ ;adjust 'x' position by scale factor.
xor ch,ch
inc cx
test BYTE PTR gbmod_,1 ;are we in high res ?
jnz Ldo_2
shr cx,1
Ldo_2: mov ax,8
imul cx
add -2[bp],ax
jmp Ldo_strg ;loop until done
L0: inc WORD PTR 8[bp] ;add 1 to the x axis.
dec WORD PTR -8[bp] ;and decrement the x count.
jns Lstrg
mov ax,-6[bp] ;get loop constant
mov -8[bp],ax ;and reset 'x' loop counter.
mov ax,8[bp] ;get current x position
sub ax,-6[bp] ;and reset to start position.
dec ax
mov 8[bp],ax
inc WORD PTR 10[bp] ;add 1 to the y axis
dec WORD PTR -10[bp] ;and decrement the y count.
jns Lstrg
add sp,10
pop bp
pop di
pop si
ret
Lsho_char:
mov BYTE PTR Lflag,0 ;set FLAG to first vector.
xor ah,ah
sub al,20H ;make character zero relative.
shl ax,1
mov si,ax
mov si,WORD PTR Llf_tabl[si] ;point into font vectors.
L1: mov al,[si] ;get vector.
test al,80H ;is it an end ?
jz L3 ;skip if not.
mov BYTE PTR Lflag,0
test al,8 ;is it END OF CHAR ?
jz L2
ret ;quit if yes.
L2: inc si ;point to next vector and start again.
jmp L1
L3: test BYTE PTR Lflag,1 ;is this the first vector ?
jz L4 ;jump if it is.
lea di, Lxf
jmp L5
L4: lea di, Lxs
L5: call Llvect ;work out and add in the offset s.
test BYTE PTR Lflag,1 ;is it the first vector ?
jnz L6 ;skip if not.
mov BYTE PTR Lflag,1 ;set FLAG to indicate first vector set
jmp L1 ;and start again.
L6: lea ax, Lxs
push ax
call line_ ;at last the line can be drawn.
add sp,2
mov ax,Lxf ;make the end of the last line
mov Lxs,ax ;the start of the next line.
mov ax,Lyf
mov Lys,ax
jmp L1
Llvect:
mov ax,-2[bp] ;get x value.
mov [di],ax
mov ax,-4[bp] ;get y value.
mov 2[di],ax
lodsb ;get stroke info
mov bx,ax ;and duplicate in bx for x offset .
and ax,0FH ;mask to y value
test al,8 ;negative ?
jz L7
or ax,0FFF0H ;sign extend
L7: mov cl,BYTE PTR t_sca_
xor ch,ch
inc cx
push cx
imul cx ;multiply by scale value
mov cx,2
idiv cx ;and divide by two.
add 2[di],ax ;subtract to y offset
and bx,0F0H ;mask to x value
mov cl,4 ;shift to 4 lsb
shr bx,cl
test bl,8 ;negative ?
jz L8
or bx,0FFF0H ;sign extend
L8: mov ax,bx
pop cx
imul cx ;multiply by scale value
test BYTE PTR gbmod_,1 ;are we in high res ?
jnz L9 ;skip if we are.
mov cx,2
idiv cx ;and divide by two.
L9: add [di],ax ;add to x offset
ret
PROCEND ltext_
include epilogue.h
END
+ARCHIVE+ marker.asm 14450 10/01/1983 0:54:52
PAGE ,132
TITLE MARKER.ASM
;UPDATE HISTORY
;==============
;
; 10 sep 1984 FT1a Fix bug in st_locator - getkey lost SI/DI
; - return character lost
; 14 sep 1984 FT1a Allow Function keys to be passed back as well
; as characters in rq_locator, st_locator.
; Arrow keys & SEL keys are still trapped out in
; rq_locator cos they're used.
; 15 nov 1984 Convert to C86 V2.2
; 4 nov 1984 2.00.2 fix bug - pass function key bit back in rq-locator
; Special key defines
; ===================
SEL equ 118h ;Select Key [10-sep-84]
UP equ 11Bh ;Up Arrow Key [10-sep-84]
LEFT equ 11Ch ;Left Arrow Key [10-sep-84]
DOWN equ 11Dh ;Down Arrow Key [10-sep-84]
RIGHT equ 11Eh ;Right Arrow Key [10-sep-84]
include asmc.h
SEGEND CODE
SEGDEF DATA
;The x,y coordinate information is represented by 3 bit 2's
;complement numbers in the range of +-3 x, +-3 y. end of character
;is represented by bit 8 being set on the last vector byte.
;
; bit 7 6 5 4 3 2 1 0
; | | | | |
; | \ / \ /
; end x y
EXTRN l_type_:BYTE, m_col_:BYTE, gbmod_:BYTE, m_type_:BYTE
EXTRN m_tab_:BYTE, x_start_:WORD, x_stop_:WORD, m_sca_:BYTE, ws_wmo_:BYTE
EXTRN y_start_:WORD, ymax_:WORD, xmax_:WORD
Lmmul DW 1
Lmx DW 0
Lmy DW 0
fkey_flag DW 0 ;arrow key pressed [10-sep-84]
SEGEND DATA
SEGDEF CODE
PUBLIC polymark_, rq_locator_, st_locator_
IF @bigmodel
EXTRN gdc_nb_:FAR, chk_col_:FAR, a_mode_:FAR, line_:FAR, a_wmode_:FAR
EXTRN getkey:FAR, conout_:FAR, a_patrn_:FAR, eseg_sav:FAR
ELSE
EXTRN gdc_nb_:NEAR, chk_col_:NEAR, a_mode_:NEAR, line_:NEAR, a_wmode_:NEAR
EXTRN getkey:NEAR, conout_:NEAR, a_patrn_:NEAR, eseg_sav:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N polymark_(count, array) *
;* int count, *array; *
;* *
;* entry: 8[bp] number of markers to show *
;* 10[bp] pointer to array of 'xy' points at *
;* which to place markers. *
;* *
;************************************************************************
;The x,y coordinate information is represented by 3 bit 2's
;complement numbers in the range of +-3 x, +-3 y. end of character
;is represented by bit 8 being set on the last vector byte.
;
; bit 7 6 5 4 3 2 1 0
; | | | | |
; | \ / \ /
; end x y
Lsho_mark PROC NEAR
mov al,BYTE PTR m_type_ ;get marker type and use to
and al,0FH ;point into marker table.
xor ah,ah ;clear highDB.
mov cl,4 ;table length.
shl ax,cl
lea si, m_tab_
add si,ax ;point si to marker table.
L1: lea di, x_start_
call Lvect ;find start of line.
lea di, x_stop_
call Lvect ;find end of line.
lea ax, x_start_
push ax
call line_ ;draw stroke.
add sp,2
test BYTE PTR -1[si],80H ;test for end of line bit.
jz L1
ret
Lsho_mark ENDP
Lvect PROC NEAR
mov ax,-2[bp] ;get x value.
mov [di],ax
mov ax,-4[bp] ;get y value.
mov 2[di],ax
lodsb ;get stroke info
mov bx,ax
and ax,7 ;mask to y value
test al,4 ;negative ?
jz L2
or ax,0FFF8H ;sign extend
L2: mov cl,BYTE PTR m_sca_
xor ch,ch
push cx
imul cx ;multiply by scale value
mov cx,2
idiv cx ;and divide by two.
add 2[di],ax ;subtract to y offset
and bx,38H ;mask to x value
shr bx,1 ;shift to 3 lsb
shr bx,1
shr bx,1
test bl,4 ;negative ?
jz L3
or bx,0FFF8H ;sign extend
L3: mov ax,bx
pop cx ;recover scale
imul cx ;multiply by scale value
test BYTE PTR gbmod_,1 ;are we in high res ?
jnz L3a ;skip if we are.
mov cx,2
idiv cx ;and divide by two.
L3a: add [di],ax ;add to x offset
ret
Lvect ENDP
;
PROCDEF polymark_
push si
push di
push bp
mov bp,sp
sub sp,4 ;reserve space for xad offset -2[bp]} & yad {-4[bp]}
mov ax,cs:WORD PTR eseg_sav
mov es,ax
call gdc_nb_
mov al,BYTE PTR l_type_ ;get and save old line type.
push ax
mov BYTE PTR l_type_,00 ;set up line type for solid lines.
call a_patrn_ ;set pattern multiplier.
pop ax ;restore old line type.
mov BYTE PTR l_type_,al
mov al,BYTE PTR m_col_ ;check for correct colour.
call chk_col_
test BYTE PTR gbmod_,2 ;are we in vector mode ?
jnz L0a
or BYTE PTR gbmod_,12H
call a_mode_
L0a: mov cx,8[bp] ;get number of markers.
mov si,10[bp] ;point to marker array elements.
cld
Ldo_marks:
lodsw ;get initial x
mov -2[bp],ax ;save it.
lodsw ;get initial y
mov -4[bp],ax ;save it.
push cx
push si
call Lsho_mark ;display it
pop si
pop cx
loop Ldo_marks ;loop until done
mov sp,bp ;restore stack position
pop bp
pop di
pop si
ret
PROCEND polymark_
;**************************************************************************
;* *
;* F U N C T I O N rq_locator_(dev, x_strt, y_strt, char, x_end, y_end) *
;* int dev, x_strt, y_strt; *
;* int *char; *
;* int *x_end, *y_end; *
;* *
;* purpose: Place a moveable cross_hair on the display at *
;* [x_strt, y_strt] and move it around with the *
;* arrow keys until a character is typed or a *
;* Function key pressed (not arrow or SEL). *
;* The keystroke and the final 'xy' positions are *
;* returned in 'char', 'x_end' & 'y_end'. *
;* The cross_hair is then removed. *
;* The cross_hair is assumed to be marker type 1 *
;* *
;* entry: 8[bp] included for GSX86MWC.OLB compatibility. *
;* 10[bp] starting 'x' co-ordinate *
;* 12[bp] starting 'y' co-ordinate *
;* 14[bp] pointer to returned character *
;* 16[bp] pointer to ending 'x' co-ordinate *
;* 18[bp] pointer to ending 'y' co-ordinate *
;* *
;**************************************************************************
Lmsh_m PROC NEAR
mov ax,[si] ;show the marker at 'xy' end.
mov WORD PTR x_start_,ax
mov ax,[di]
mov WORD PTR y_start_,ax
lea ax, x_start_
push ax
mov ax,1
push ax
call polymark_
add sp,4
ret
Lmsh_m ENDP
PROCDEF rq_locator_
push si
push di
push bp
mov bp,sp
sub sp,8 ;make room to save the old marker info.
mov ax,cs:WORD PTR eseg_sav
mov es,ax
mov al,BYTE PTR m_type_ ;save all the marker info on the stack.
mov -2[bp],ax
mov al,BYTE PTR m_col_
mov -4[bp],ax
mov al,BYTE PTR m_sca_
mov -6[bp],ax
mov al,BYTE PTR ws_wmo_
mov -8[bp],ax
mov BYTE PTR m_type_,1 ; '+'
mov BYTE PTR m_col_,3
mov BYTE PTR m_sca_,3
mov BYTE PTR ws_wmo_,1 ;COMPLIMENT mode.
mov ax,10[bp] ;get starting 'x' and copy to 'x_end' & 'Lmx'.
mov di,16[bp]
mov si,di
mov Lmx,ax
stosw
mov ax,12[bp] ;get starting 'y' and copy to 'y_end' & 'Lmy'.
mov di,18[bp]
mov [di],ax
mov Lmy,ax
call gdc_nb_
call a_wmode_
Lm0: call Lmsh_m ;show marker at 'x_end', 'y_end'.
Lm1: lea ax, Lmy
push ax
lea ax, Lmx
push ax
call st_locator_
add sp,4
or ax,ax
jz Lm1
test fkey_flag,100H ;was an arrow key pressed ? [10-sep-84]
jnz Lm2 ;yup [14-sep-84]
mov bx,14[bp] ;get character pointer and save character.
mov WORD PTR [bx],ax ;allow function bit return ********
call Lmsh_m ;remove marker and exit.
jmp Lmexit
Lm2: call Lmsh_m ;remove old marker.
mov ax,Lmx ;update x_end.
mov [si],ax
mov ax,Lmy ;update y_end.
mov [di],ax
jmp Lm0
Lmexit: mov ax,-8[bp]
mov BYTE PTR ws_wmo_,al
call a_wmode_
mov ax,-6[bp] ;restore all the marker info from the stack.
mov BYTE PTR m_sca_,al
mov ax,-4[bp]
mov BYTE PTR m_col_,al
mov ax,-2[bp]
mov BYTE PTR m_type_,al
mov sp,bp
pop bp
pop di
pop si
ret
PROCEND rq_locator_
;************************************************************************
;* *
;* F U N C T I O N st_locator_(x, y) *
;* int *x, *y; *
;* *
;* purpose: Updates 'x' &;or 'y' if an arrow key was *
;* pressed. Updates Lmul if SELECT was pressed. *
;* Returns '\0' in AX if SELECT or no character *
;* was typed, otherwise, returns the character. *
;* *
;************************************************************************
PROCDEF st_locator_
push si
push di
push bp
mov bp,sp
call getkey ;get keystroke (if any) [10-sep-84]
mov di,10[bp] ;addr of y coordinate
mov si,8[bp] ;addr of x coordinate
mov bx,cs:WORD PTR eseg_sav
mov es,bx
push ax ;save keystroke value for exit [10-sep-84]
or ax,ax ;was keystoke entered
jnz Ls1 ;yup
jmp Lsexit
Ls1: mov fkey_flag,ax ;save in case function key [10-sep-84]
and fkey_flag,100H
test fkey_flag,100H ;q. function key
jnz ls2 ;yup
jmp lsexit1
Ls2: cmp ax,SEL ;SELECT ? [10-sep-84]
jnz Ls4
mov ax,Lmmul
dec ax
jz Ls3
mov Lmmul,1
jmp Lsexit
Ls3: mov Lmmul,10
jmp Lsexit
Ls4: cmp ax,UP ;UP ? [10-sep-84]
jnz Ls5
mov ax,[di]
add ax,Lmmul
cmp WORD PTR ymax_,ax
jns Ls4a
mov ax,WORD PTR ymax_
Ls4a: mov [di],ax
jmp Lsexit1
Ls5: cmp ax,DOWN ;DOWN ? [10-sep-84]
jnz Ls6
mov ax,[di]
sub ax,Lmmul
or ax,ax
jns Ls5a
xor ax,ax
Ls5a: mov [di],ax
inc ax
jmp Lsexit1
Ls6: cmp ax,LEFT ;LEFT ? [10-sep-84]
jnz Ls7
mov ax,[si]
sub ax,Lmmul
or ax,ax
jns Ls6a
xor ax,ax
Ls6a: mov [si],ax
inc ax
jmp Lsexit1
Ls7: cmp ax,RIGHT ;RIGHT ? [10-sep-84]
jnz Ls8
mov ax,[si]
add ax,Lmmul
cmp WORD PTR xmax_,ax
jns Ls7a
mov ax,WORD PTR xmax_
Ls7a: mov [si],ax
jmp Lsexit1
Ls8: mov fkey_flag,0 ;unknown function key pressed [14-sep-84]
jmp Lsexit1 ;turn off flag & continue [14-sep-84]
Lsexit: pop ax ;retrieve keystroke ... [10-sep-84]
xor ax,ax ;.. then lose it [10-sep-84]
mov fkey_flag,0
jmp Lsexit2 ;continue [10-sep-84]
Lsexit1:
pop ax ;retrieve keystroke [10-sep-84]
Lsexit2: ; [10-sep-84]
pop bp
pop di
pop si
ret
PROCEND st_locator_
include epilogue.h
END
+ARCHIVE+ mouse.h 4441 11/25/1984 22:14:32
/*********************************************************/
/* MOUSE header file for Rainbow */
/*********************************************************/
/* You must #define MOUSETYPE with one of the following */
/* before mouse.h to actually achieve anything */
/* Mouse types */
#define NOMOUSE 0
#define MICROSOFT 1
#define PCMOUSE 2
/* default is NO MOUSE*/
#ifndef MOUSETYPE
#define MOUSETYPE NOMOUSE
#endif
#if MOUSETYPE - MICROSOFT
#define MICROSOFTMOUSEIND
#endif
#if MOUSETYPE - PCMOUSE
#define PCMOUSEMOUSEIND
#endif
/* logical truthfulness */
#define TRUE 1
#define FALSE 0
/*Available Mouse port definitions */
#define MDM 1 /*Comms port*/
#define PRT 2 /*printer port*/
#define AUX 3 /*Aux. Comms port*/
/*MOUSE interrupt condition packet (why) */
typedef struct {
unsigned int Movement; /*TRUE movement occurred*/
int S_button_rel; /*secondary button release count*/
int S_button_dep; /*secondary button depress count*/
int P_button_rel; /*primary button release count*/
int P_button_dep; /*primary button depress count*/
int Delta_x; /*x delta factor (horizontal)*/
int Delta_y; /*y delta factor (vertical)*/
} CONDITION_PACKET;
CONDITION_PACKET *msdecode();
/*MOUSE control packet */
typedef struct {
int P_button, /*TRUE = left or primary button act*/
S_button, /*TRUE = right or secondary button*/
T_button, /*TRUE = middle or tertiary button */
Deltax, /*x acc. delta factor (horizontal)*/
X_ratio, /*x magnification factor (OPEN)*/
X_threshold, /*x speed limit (OPEN)*/
Deltay, /*y acc. delta factor (vertical)*/
Y_ratio, /*y magnification factor (OPEN)*/
Y_threshold; /*y speed limit (OPEN)*/
int Mouse_immediate; /*TRUE = wait for input*/
int Mouse_enabled; /*TRUE = mouse OK to use*/
int Mouse_type; /*mouse type - see MOUSETYPE*/
int Mouse_device; /*port number MDM, PRT or AUX*/
char Mouse_port_name[5]; /*port name*/
unsigned int Mouse_handle; /*device handle*/
unsigned char Mouse_bstate; /*button state storage*/
int Mouse_programmed; /*TRUE = port programmed for Mouse*/
int Mouse_new_vectors; /*TRUE = RCI vectored in*/
int Trace; /*TRUE = trace mode*/
} MOUSE_PACKET;
/* Local buffer for port I/O (std Dos structure*/
typedef struct {
int count,
size,
ipntr,
opntr,
highw,
loww,
head,
tail;
unsigned char mdata[128-16];
} MOUSE_PORT_BUFFER;
/*MOUSE control*/
#if MOUSETYPE
/*NOMOUSE*/
#define Mouse_x_threshold 0
#define Mouse_x_speed 0
#define Mouse_y_threshold 0
#define Mouse_y_speed 0
#define Mouse_num_buttons 0
#define Mouse_packet_size 0
#undef MICROSOFTMOUSEIND
#undef PCMOUSEMOUSEIND
#endif
#ifdef MICROSOFTMOUSEIND
/*MICROSOFT*/
#define Mouse_x_threshold 0x040 /* Threshold in Mickeys/sec */
#define Mouse_x_speed 2
#define Mouse_y_threshold 0x080 /* Threshold in Mickeys/sec */
#define Mouse_y_speed 2
#define Mouse_num_buttons 2
#define Mouse_packet_size 3
#undef MICROSOFTMOUSEIND
#endif
#ifdef PCMOUSEMOUSEIND
/*PCMOUSE*/
#define Mouse_x_threshold 0x040 /* Threshold in ??*/
#define Mouse_x_speed 2
#define Mouse_y_threshold 0x080 /* Threshold in ??*/
#define Mouse_y_speed 2
#define Mouse_num_buttons 3
#define Mouse_packet_size 5
#undef PCMOUSEMOUSEIND
#endif
/* PKT/CCB for Dos ioctl calls*/
struct COMM_BLOCK {
unsigned char cb_function; /*PKT function */
unsigned char cb_func_retc; /*PKT return code*/
unsigned char cb_character; /*PKT character in/out*/
unsigned char cb_char_stat; /*PKT character status*/
unsigned char cb_device; /*CCB device number */
unsigned char cb_control; /*CCB mode */
unsigned char cb_stop_bits; /*CCB stop bits*/
unsigned char cb_data_bits; /*CCB data bits*/
unsigned char cb_parity_out; /*CCB tx parity*/
unsigned char cb_rcv_baud; /*CCB rx speed*/
unsigned char cb_xmit_baud; /*CCB tx speed*/
unsigned char cb_xon_char; /*CCB XON char*/
unsigned char cb_xoff_char; /*CCB XOFF char*/
unsigned char cb_in_xon; /*CCB rx XON/XOFF*/
unsigned char cb_out_xon; /*CCB tx XON/XOFF*/
unsigned int cb_buffer_size; /*CCB user buffer size*/
unsigned char *cb_buffer_offset; /*CCB user buffer offset*/
unsigned int cb_buffer_segment; /*CCB user buffer segment*/
};
+ARCHIVE+ msdos.asm 8702 10/01/1983 0:31:50
PAGE 60,132
title MSDOS.ASM
;UPDATE HISTORY
;==============
; 29-11-84 Preserve ES register across int 18 in kbd calls
;---------------------------------------------------------------+
; |
; Definitions for 'C' Modules |
; |
;---------------------------------------------------------------+
include asmc.h
include asmk.h
SEGEND CODE
.xlist
; Parameter offsets
param1 EQU @ab+[BP]
param2 EQU @ab+2[BP]
param3 EQU @ab+4[BP]
param4 EQU @ab+6[BP]
param5 EQU @ab+8[BP]
param6 EQU @ab+10[BP]
param7 EQU @ab+12[BP]
param8 EQU @ab+14[BP]
param9 EQU @ab+16[BP]
param10 EQU @ab+18[BP]
; macros
ldata macro
?dptr = -2
endm
lvar macro nam
nam equ ?dptr
?dptr = ?dptr-2
endm
enter macro lvars
push bp
mov bp,sp
ifnb <lvars>
sub sp,(lvars+1)/2
endif
endm
leave macro
pop bp
ret
endm
?genp macro pnum
ifnb <p&pnum>
push p&pnum
endif
endm
ccall macro p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
?p = 10
rept 10
?genp %?p
?p = ?p-1
endm
endm
.list
;---------------------------------------------------------------
;
; Interface to stranger MSDOS functions:
;
; ax = msdos(ax, bx, cx, dx);
; if carry set: _carry = 1 else 0
;
;----------------------------------------------------------------
SEGDEF DATA
PUBLIC _carry ;global carry flag
_carry dw 0
SEGEND DATA
SEGDEF CODE
PUBLIC msdos ;entry point
PROCDEF msdos
enter
mov ax,param1
mov bx,param2
mov cx,param3
mov dx,param4
mov _carry,0
Push ES ;save es
int 21h ;call msdos
Pop ES ;save es
jnc nocarry
mov _carry,1
nocarry: leave
PROCEND msdos
SEGEND CODE
;---------------------------------------------------------------+
; |
; Fast Video Put Line and Attributes |
; |
; Vers. 1.0 9/13/83 A.F. |
; |
; History: |
; |
; 9/13/83 Created AF |
; |
;---------------------------------------------------------------+
;
; putline (line, col, string)
; putattr (line, col, len, array)
;
; int line,col; /* place to put string or attribs */
; char *string; /* string to write */
; char array[]; /* array of attributes */
; int len /* length of attribute array */
;
SEGDEF CODE
public putline,putattr
PROCDEF putline
enter ;initialize stack
push es ;gets clobbered
mov si,param3 ;si=> string
; get the string length in cx
push ds ;es=ds
pop es
mov di,si ;set =>
cld ;going up!
mov cx,-1 ;set count
xor al,al ;look for null
repne scasb
inc cx
not cx ;cx now has the length
mov ax,2 ;set move characters
; Putline and Putattr common code
put:
mov bl,param1 ;get line
mov bh,param2 ;and col
cmp bl,1 ;make sure line is in range 1-24
jl exit
cmp bl,24
jg exit
push ax ;save
mov al,bh ;check to make sure we don't
add ax,cx ;exceed the end of the line
cmp ax,81 ;assuming 80 chars single width
pop ax
ja exit
mov bp,ds ;the call requires bp=ds
mov di,14h ;function #
int 18h ;do it
exit:
pop es
leave
PROCEND putline
PROCDEF putattr
enter ;initialize stack
push es
mov dx,param4 ;dx=> attributes
mov cx,param3 ;length
mov ax,1 ;set attributes
jmp put ;go to common part of routines
PROCEND putattr
SEGEND CODE
SEGDEF DATA
; TRANSLATION TabLE TO CONVERT FIRMWARE 16-BIT KEYCODES INTO 'FINAL' KEYCODES
;
; FINAL KEYCODE KEY ID FIRMWARE FINAL
keytbl db 15 ;HELP 00 TO 15.
db 16 ;DO 01 TO 16.
db 0 ;COMPOSE 02 TO 0
db 2 ;PRINT SCREEN 03 TO 2
db 0FFh ; 04
db 4 ;F4 05 TO 4
db 0FFh ; 06
db 6 ;INTERRUPT 07 TO 6
db 0FFh ; 08
db 7 ;RESUME 09 TO 7
db 0FFh ; 0A
db 8 ;CANCEL 0B TO 8
db 0FFh ; 0C
db 9 ;MAIN SCREEN 0D TO 9
db 0FFh ; 0E
db 10 ;EXIT 0F TO 10.
db 0FFh ; 10
db 14 ;ADDTNL OPTIONS 11 TO 14.
db 0FFh ; 12
db 17 ;F17 13 TO 17.
db 0FFh ; 14
db 18 ;F18 15 TO 18.
db 0FFh ; 16
db 19 ;F19 17 TO 19.
db 0FFh ; 18
db 20 ;F20 19 TO 20.
db 0FFh ; 1A
db 21 ;FIND 1B TO 21.
db 0FFh ; 1C
db 22 ;INSERT HERE 1D TO 22.
db 0FFh ; 1E
db 23 ;REMOVE 1F TO 23.
db 0FFh ; 20
db 24 ;SELECT 21 TO 24.
db 0FFh ; 22
db 25 ;PREV SCREEN 23 TO 25.
db 0FFh ; 24
db 26 ;NEXT SCREEN 25 TO 26.
db 0FFh ; 26
db 27 ;UP-ARROW 27 TO 27.
db 0FFh ; 28
db 29 ;DOWN-ARROW 29 TO 29.
db 0FFh ; 2A
db 30 ;RIGHT-ARROW 2B TO 30.
db 0FFh ; 2C
db 28 ;LEFT-ARROW 2D TO 28.
db 0FFh ; 2E
db 31 ;KEYPAD 0 2F TO 31.
db 0FFh ; 30
db 0FFh ; 31
db 32 ;KEYPAD 1 32 TO 32.
db 0FFh ; 33
db 0FFh ; 34
db 33 ;KEYPAD 2 35 TO 33.
db 0FFh ; 36
db 0FFh ; 37
db 34 ;KEYPAD 3 38 TO 34.
db 0FFh ; 39
db 0FFh ; 3A
db 35 ;KEYPAD 4 3B TO 35.
db 0FFh ; 3C
db 0FFh ; 3D
db 36 ;KEYPAD 5 3E TO 36.
db 0FFh ; 3F
db 0FFh ; 40
db 37 ;KEYPAD 6 41 TO 37.
db 0FFh ; 42
db 0FFh ; 43
db 38 ;KEYPAD 7 44 TO 38.
db 0FFh ; 45
db 0FFh ; 46
db 39 ;KEYPAD 8 47 TO 39.
db 0FFh ; 48
db 0FFh ; 49
db 40 ;KEYPAD 9 4A TO 40.
db 0FFh ; 4B
db 0FFh ; 4C
db 42 ;KEYPAD DASH 4D TO 42.
db 0FFh ; 4E
db 0FFh ; 4F
db 41 ;KEYPAD COMMA 50 TO 41.
db 0FFh ; 51
db 0FFh ; 52
db 43 ;KEYPAD PERIOD 53 TO 43.
db 0FFh ; 54
db 0FFh ; 55
db 48 ;KEYPAD ENTER 56 TO 48.
db 0FFh ; 57
db 0FFh ; 58
db 44 ;KEYPAD PF1 59 TO 44.
db 0FFh ; 5A
db 0FFh ; 5B
db 45 ;KEYPAD PF2 5C TO 45.
db 0FFh ; 5D
db 0FFh ; 5E
db 46 ;KEYPAD PF3 5F TO 46.
db 0FFh ; 60
db 0FFh ; 61
db 47 ;KEYPAD PF4 62 TO 47.
db 0FFh ; 63
db 0FFh ; 64
db 5 ;BREAK 65 TO 5.
SEGEND DATA
;******************************************************************
;* character I/O
;*
; int kbd16(&i) /* level 1 console in */
; int *i;
;
; int kbdin(&i); /* level 2 console in */
; int *i;
;
; kbdout(c); /* level 2 character out */
; unsigned char c;
;
SEGDEF CODE
public kbd16,kbdin,kbdout
PROCDEF kbd16
push bp ;Computer Innovations says ax,bc,cx,dx,si & di free
mov bp,sp ; [bp+0] = old bp
; [bp+2] = return address
; [bp+4] = first (only) argument
mov di,06 ; 16 bit console function
Push ES ;save es
int 18h ; msdos equivalent of int 40
; cl = 0, 1 or FF
; ax = 16 bit character.
pop es
xchg ax,cx ; al = 0, 1 or FF, cx = char.
cbw ; ax = 0, 1 or FFFF
and ax,ax ; if ax != FFFF, don't translate...
jns nochar ; ... just return status (in ax).
test ch,01 ; ch bit 0 is 1 for function keys.
jz nofunc ; if not a function key, skip translation.
lea bx, keytbl ; address of translate table.
xchg cx,ax ; swap character and status (ax = character)
xlat ; translate char in al to one in table.
xchg ax,cx ; swap character and status (ax = status)
nofunc: mov bx,param1 ; get parameter (address of buffer)
mov [bx],cx ; put char in the buffer
nochar: pop bp ; status is in ax
ret
PROCEND kbd16
PROCDEF kbdin
push bp ;Computer Innovations says ax,bc,cx,dx,si & di free
mov bp,sp ; [bp+0] = old bp
; [bp+2] = return address
; [bp+4] = first (only) argument
mov di,02 ; 8 bit console in function
Push ES ;save es
int 18h ; msdos equivalent of int 40
; cl = 0 or FF
; al = 8 bit character.
pop es
xchg ax,cx ; al = 0 or FF, cx = char.
cbw ; ax = 0 or FFFF
and ax,ax ; if ax != FFFF ...
jns kin1 ; ... just return status (in ax).
mov bx,param1 ; get parameter (address of buffer)
mov [bx],cx ; put char in the buffer
kin1: pop bp ; status is in ax
ret
PROCEND kbdin
PROCDEF kbdout
push bp ;Computer Innovations says ax,bc,cx,dx,si & di free
mov bp,sp ; [bp+0] = old bp
; [bp+2] = return address
; [bp+4] = first (only) argument
mov ax,param1 ; get char for output
mov di,02 ; 8 bit console out function
Push ES ;save es
int 18h ; msdos equivalent of int 40
pop es
ret
PROCEND kbdout
SEGEND CODE
;---------------------------------------------------------------+
; |
; Enable and Disable Cursor |
; |
;---------------------------------------------------------------+
;
; enb_cur()
; dis_cur()
;
SEGDEF CODE
public enb_cur,dis_cur
PROCDEF enb_cur
enter ;initialize stack
push es ;gets clobbered
mov di,0Ah ;function #
int 18h ;do it
pop es
leave
PROCEND enb_cur
PROCDEF dis_cur
enter ;initialize stack
push es
mov di,08h
int 18h
pop es
leave
PROCEND dis_cur
SEGEND CODE
END
+ARCHIVE+ msint.asm 7882 10/01/1983 1:09:16
TITLE MSINT.ASM Microsoft Mouse interrupt service
PAGE ,132
;***********************************************
; *
; Microuse Mouse hardware dependent code *
; Copyright (C) 1983,1984 by Microsoft Inc. *
; Copyright (C) 1984 by Digital Equipment Co.*
; *
;***********************************************
include asmms.h
include asmc.h
;**********************************************
; Static data internal to interrupt handler *
;**********************************************
int_cond DW 0 ; temp store - state check
tdelta_x DB 0
tdelta_y DB 0
mstate DB 0 ; zero means looking for sync bit
m_buffer DD 0 ; ADR Communications input circular buffer
Mpacket DD 0 ; ADR MOUSE control packet "MOUSE_PACKET"
Cpacket DD 0 ; ADR MOUSE int. cond. "CONDITION_PACKET"
SUBTTL Comms Port Interrupt Handler
PAGE
;**********************************************
; Serial Mouse hardware interrupt service *
;**********************************************
PUBLIC MSint_, _Chaddr
Msint_ PROC FAR
Cld ;preserve machine state
Push DS
Push ES
Push AX
Push BX
Push CX
Push DX
Push DI
Push SI
;
; get a delta x in bx, delta y in cx
;
call getchar ;get a character from ring buffer
Lds SI,CS:Mpacket ;DS:SI = MOUSE_PACKET
Les DI,CS:Cpacket ;ES:DI = CONDITION_PACKET
test al,01000000b ;sync bit set?
jnz first_byte
jmp xory
;------------------------------------
; first byte of new 3 byte packet
; process button information
;------------------------------------
;
; first byte
;
; +----+----+----+----+----+----+----+----+
; | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
; +----+----+----+----+----+----+----+----+
; | | | | | | | |
; | | | | | | | +---- X6
; | | | | | | +--------- X7
; | | | | | +-------------- Y6
; | | | | +------------------- Y7
; | | | +------------------------ RIGHT MOUSE BUTTON
; | | +----------------------------- LEFT MOUSE BUTTON
; | +---------------------------------- 1 = FIRST BYTE (SYNCHRONIZE)
; +--------------------------------------- 7 BIT ASCII (MUST MASK)
;
first_byte:
xor dx,dx ; indicate primary button up
mov CS:[int_cond],dx ; zero interrupt conditions
mov dl,al ; get local copy of button state
mov cl,5 ; isolate the left mouse button
shr dl,cl ; low bit has p button state
mov cx,1 ; set up mask
and dx,cx ; mask off low bit
not cx ; invert
and cx,[SI].Bstate ; get all other bits
or dx,cx ; dx = new button states
xchg [SI].Bstate,dx ; move in current state get old state
cmp [SI].Bstate,dx ; has it changed?
sti ;INTS OFF while we update
jz no_pb_change
ja pb_down
;
; primary button just released
;
or CS:byte ptr [int_cond],00000100b
inc ES:WORD PTR [DI].P_button_rel
jmp short no_pb_change
;
; primary button just pressed
;
pb_down:
or CS:byte ptr [int_cond],00000010b
inc ES:WORD PTR [DI].P_button_dep
no_pb_change:
cli ;INTS ON now done
mov dl,al ; get local copy of button state
mov cl,3
shr dl,cl ; low bit has s button state
mov cx,2 ; mask off low bit
and dx,cx
not cx ; invert
and cx,[SI].Bstate ; get all other bits
or dx,cx ; dx = new button states
xchg [SI].Bstate,dx ; move in current state get old state
cmp [SI].Bstate,dx ; has it changed
sti ;INTS OFF while we update
jz no_sb_change
ja sb_down
;
; secondary button just released
;
or CS:byte ptr [int_cond],00010000b
inc ES:WORD PTR [DI].S_button_rel
jmp short no_sb_change
;
; secondary button just pressed
;
sb_down:
or CS:byte ptr [int_cond],00001000b
inc ES:WORD PTR [DI].S_button_dep
no_sb_change:
cli ;INTS ON now done
mov bx,ax ; save first byte info
mov cl,4
shl ax,cl
and al,11000000b
mov CS:[tdelta_y],al ; save hibits of delta Y
mov cl,6
shl bx,cl
and bl,11000000b
mov CS:[tdelta_x],bl ; save hibits of delta X
mov CS:[mstate],1 ; now we are looking for x...
jmp short ignore
;------------------------------------
;Process non SYNC byte
;------------------------------------
xory:
and al,00111111b
cmp CS:[mstate],1 ; are we looking for x (byte 2)
jb ignore ; if zero, ignore, we want sync
ja do_tdelta_y ; if above, must be for y (byte 3)
or CS:[tdelta_x],al
mov CS:[mstate],2 ; now we are looking for y...
ignore:
xor ax,ax
jmp short ack
;------------------------------------
;Process end of packet
;------------------------------------
do_tdelta_y:
or al,CS:[tdelta_y]
cbw
mov cx,ax ;Delta Y in CX
mov al,CS:[tdelta_x]
cbw
mov bx,ax ;Delta X in BX
mov CS:[mstate],0
mov ax,bx ; get horizontal motion
or ax,cx ; or in vertical motion
jz nomove ; if zero, cursor didnt move
sti ;INTS OFF while we update
add [SI].Deltax,bx ; update Delta X
add [SI].Deltay,cx ; update delta Y
or CS:byte ptr [int_cond],00000001b ; cursor moved..remember
cli ;INTS ON now done
nomove: mov ax,CS:[int_cond] ; ax=reason for calling MS-WIN
ack:
Pop SI ;restore state
Pop DI
Pop DX
Pop CX
Pop BX
Pop AX
Pop ES
Pop DS
ret
;GETCHAR - routine to fetch next character out of m_buffer
getchar PROC NEAR
Lds SI,CS:m_buffer ;DS:SI = M_buffer
mov ax,[SI].count ;pick up char count
and ax,ax ;any char avail?
jz getcha3
sti ;INTS OFF while we update
dec ax ;decrement char count
mov [SI].count,ax ;update buffer count
mov BX,[SI].opntr ;character pntr
mov ax,[BX]
cmp BX,[SI].tail ;at end?
jnz getcha1
mov BX,[SI].head ;yes - point at head
jmp short getcha2
getcha1:
inc BX ;step to next char
inc BX
getcha2:
mov [SI].opntr,BX ;save new pntr
cli ;INTS ON now done
getcha3:
ret ;return (char in AX)
getchar ENDP
MSint_ ENDP
SUBTTL establish links with C program
PAGE
ASSUME ES:NOTHING
;***********************************************
;Return Address for C program
;***********************************************
; CS:OFFSET = _Chaddr(mptr,cptr,buffer);
; CONDITION_PACKET *mptr;
; MOUSE_PACKET *cptr
; char *buffer;
PROCDEF _Chaddr
Push BP
Mov BP,SP
Mov AX,@AB[BP] ; Mpacket = mptr
Mov CS:WORD PTR Mpacket,AX
Mov CS:WORD PTR Mpacket+2, DS
Mov AX,@AB+2[BP] ; Cpacket = cptr
Mov CS:WORD PTR Cpacket,AX
Mov CS:WORD PTR Cpacket+2, DS
Mov AX,@AB+4[BP] ; m_buffer = buffer
Mov CS:WORD PTR m_buffer,AX
Mov CS:WORD PTR m_buffer+2, DS
Mov AX, CS:Cloc ; return interrupt offset
Mov SP,BP
Pop BP
Ret
Cloc Dw MSint_
PROCEND _Chaddr
include epilogue.h
END
+ARCHIVE+ msmouse.c 10884 12/18/1984 16:27:10
/***************************************************/
/* MOUSE SUPPORT mouse.c */
/***************************************************/
#include "stdio.h"
#include "mouse.h"
#define MODEM_OFF 0 /*drop dtr/rts*/
#define MODEM_ON 0x0C /*raise dtr/rts*/
extern int _carry; /*dos flag*/
struct Rci_block {
unsigned char rb_function; /*PKT function */
unsigned char rb_func_retc; /*PKT return code*/
unsigned char rb_character; /*PKT character in/out*/
unsigned char rb_char_stat; /*PKT character status*/
unsigned char rb_device; /*RCI device number*/
unsigned int rb_offset, /*RCI offset*/
rb_segment; /*RCI segment*/
};
static char *Mouse_port[] = {
"NUL",
"AUX", /* port = MDM */
"PRN", /* port = PRT */
"AUX2" /* port = AUX */
};
static struct COMM_BLOCK save_config_; /*save current values*/
static CONDITION_PACKET /* action_ conditions*/
action_ = {FALSE,0,0,0,0,0,0},
noaction_ = {FALSE,0,0,0,0,0,0};
/*************************************************/
/* MSOPEN */
/* msopen(device,control_packet,buffer, */
/* buffer_byte_size,mouse_type); */
/* returns TRUE if mouse avail, else FALSE */
/*************************************************/
msopen(device,mptr,bptr,bcnt,mtype)
int device; /*= port number*/
MOUSE_PACKET *mptr; /*= Mouse control block*/
unsigned char *bptr; /*= new circ. buffer for comms*/
int bcnt; /*= size of buffer in bytes*/
int mtype; /*= mouse type */
{ struct COMM_BLOCK config;
int i, temp;
unsigned int getds_(), getcs_();
unsigned char c, *testbyte_();
if (mptr->Mouse_enabled == TRUE)
msclose(mptr);
mptr->Mouse_programmed = mptr->Mouse_enabled = FALSE;
mptr->Mouse_type = mtype;
mptr->Mouse_bstate = mptr->Deltax = mptr->Deltay = 0;
mptr->X_ratio = Mouse_x_speed;
mptr->X_threshold = Mouse_x_threshold;
mptr->Y_ratio = Mouse_y_speed;
mptr->Y_threshold = Mouse_y_threshold;
mptr->Mouse_device = device; /*see if port is there & open I/O*/
strcpy(mptr->Mouse_port_name,Mouse_port[device]);
mptr->Mouse_handle = msdos((0x3D02), 0, 0, mptr->Mouse_port_name);
if (_carry)
return FALSE;
Msioctl_(mptr, 3, &save_config_); /*save what went on before*/
config.cb_character = MODEM_OFF; /*turn off DTR-RTS*/
Msioctl_(mptr, 14, &config); /*drop modem lines & wait*/
for (i=0; i<10000; i++);
Msioctl_(mptr, 5, &config); /*disable rec interrupts*/
config.cb_control = 1; /*mode (data leads)*/
config.cb_stop_bits = 1; /*stop bits*/
config.cb_data_bits = 3; /*7 data bits*/
config.cb_parity_out = 3; /*no parity*/
config.cb_rcv_baud = 9; /*rx 1200 baud*/
config.cb_xmit_baud = 9; /*tx 1200 baud*/
config.cb_xon_char = config.cb_xoff_char = 0; /*XON/XOFF chars*/
config.cb_in_xon = config.cb_out_xon = 2; /*disable XON/XOFF*/
config.cb_buffer_size = bcnt; /*user buffer*/
config.cb_buffer_offset = bptr;
config.cb_buffer_segment = getds_();
if(Msioctl_(mptr, 0, &config) != 0) /*reprogram Mouse port*/
mptr->Mouse_programmed = TRUE;
Msioctl_(mptr, 4, &config); /*enable rec interrupts*/
config.cb_character = MODEM_ON; /*turn on DTR-RTS*/
Msioctl_(mptr, 14, &config); /*raise modem lines & wait*/
for (i=0; i<64; i++);
if( (temp = msack(mptr)) == TRUE);
rci_attach(mptr,&action_,bptr);
return temp;
}
/***********************************************/
/* Mouse close */
/***********************************************/
msclose(mptr)
MOUSE_PACKET *mptr;
{ struct COMM_BLOCK config;
int ret=TRUE;
Msioctl_(mptr, 5, &config); /*disable rec interrupts*/
if (mptr->Mouse_new_vectors == TRUE) /*reset system vectors*/
rci_detach(mptr);
Msioctl_(mptr, 2, &config); /*reset to defaults Buffer*/
Msioctl_(mptr, 1, &config); /*reset to 'NVM'
& enable rec interrupts*/
Msioctl_(mptr, 5, &config); /*disable rec interrupts*/
if(!Msioctl_(mptr, 0, &save_config_)) /*reprogram Mouse port*/