Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Page     1-1


				;**********************************************
				**********************************
				; File: S_DISPLY.ASM
				;
				; This module contains a subroutine for setting
				 the mode of the display to
				; 80X25 text mode.
				;
				; If ANSI.SYS is loaded, then the calls to chan
				ge the mode go through it,
				; otherwise standard BIOS calls are performed.
				;
				; If ANSI.SYS is to be used, then a version dat
				ed July 15, 1987 or later must
				; be used.
				;
				;**********************************************
				**********************************
				.ALPHA					
					 ;AN000;
				.LIST					
					 ;AN000;
				
 0000				DATA	 SEGMENT   BYTE PUBLIC 'DATA'          
				  ;AN000;
				
				
				; Buffer for IOCTL calls
 0000				BUFFER	 LABEL	   BYTE 		
					 ;AN000;
 0000  00				      DB	0		
					 ;AN000; INFO LEVEL
 0001  00				      DB	0		
					 ;AN000; RESERVED
 0002  000E				      DW	14		
					 ;AN000; SIZE
 0004  0000			FLAGS	      DW	0		
					 ;AN000;
 0006  00			D_MODE	      DB	0		
					 ;AN000; 1 = TEXT, 2 = APA
 0007  00				      DB	0		
					 ;AN000; RESERVED
 0008  0000			COLORS	      DW	0		
					 ;AN000;
 000A  0000			B_WIDTH       DW	0		
					 ;AN000; PELS ==> -1 FOR TEXT
 000C  0000			B_LENGTH      DW	0		
					 ;AN000; PELS ==> -1 FOR TEXT
 000E  0000			COLS	      DW	0		
					 ;AN000;
 0010  0000			ROWS	      DW	0		
					 ;AN000;
				
 0012				DATA	 ENDS				
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Page     1-2


					 ;AN000;
				
 0000				CODE_FAR SEGMENT BYTE PUBLIC 'CODE'            
				  ;AN000;
				
				    ASSUME    CS:CODE_FAR, DS:DATA	
					 ;AN000;
				
				;**********************************************
				**********************************
				; SET_DISPLAY_MODE_ROUTINE: Set the display mod
				e to 80X25 text mode.
				;
				; INPUT:
				;    None.
				;
				; OUTPUT:
				;    If CY = 1, then an error was encountered m
				aking a IOCTL call.
				;    If CY = 0, there were no errors.
				;
				; Operation: If ANSY.SYS is loaded, then the mo
				de is set by calls to it,
				;    otherwise BIOS calls are used.
				;
				;**********************************************
				**********************************
				PUBLIC	 SET_DISPLAY_MODE_ROUTINE	
					 ;AN000;
 0000				SET_DISPLAY_MODE_ROUTINE     PROC FAR	
					 ;AN000;
				
				    ;******************************************
				****************************
				    ; See if ANSI.SYS is loaded
				    ;******************************************
				****************************
 0000  B8 1A00			    MOV  AX, 1A00H			
					 ;AC086;SEH changed from 1600h to avoid
				 MICROSOFT collision ;AN000; Fn. for determinin
				g ANSI.SYS state
 0003  CD 2F			    INT  2FH				
					 ;AN000; Returns AL = 0FFh if it is loa
				ded
				    .IF < AL NE 0FFH >			
					 ;AN000; Is it loaded?
 0005  3C FF                 3						cmp AL,
				0FFH 
 0007  74 18                 6						je $l2 
 0009  B4 0F				MOV  AH, 15			
					 ;AN000; No! Fn. number for getting the
				 current video state
 000B  CD 10				INT  10H			
					 ;AN000; Get the video state
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Page     1-3


					.IF < AL EQ 07H > OR		
					 ;AN000; If in monochrome mode,
 000D  3C 07                 3						cmp AL,
				07H 
 000F  74 04                 6						je $l6 
					.IF < AL EQ 0FH>		
					 ;AN000; or monochrome graphics mode,
 0011  3C 0F                 3						cmp AL,
				0FH 
 0013  75 05                 6						jne $l5
				 
 0015                        3	$l6: 
 0015  B8 0007				     MOV  AX, 07H		
					 ;AN000; Set monochrome mode
					.ELSE				
					 ;AN000; Otherwise...
 0018  EB 03                 3						jmp sho
				rt $l4 
 001A                        2	$l5: 
 001A  B8 0003				     MOV  AX, 03H		
					 ;AN000; Set mode 3: 80 column, color e
				nabled
					.ENDIF				
					 ;AN000;
 001D                        2	$l4: 
 001D  CD 10				INT  10H			
					 ;AN000; Set the mode
				    .ELSE				
					 ;AN000;
 001F  EB 51                 3						jmp sho
				rt $l1 
 0021                        2	$l2: 
 0021  B8 440C				 MOV  AX, 440CH 		
					 ;AN000; Get the info from ANSI.
 0024  BB 0000				 MOV  BX, 0			
					 ;AN000;
 0027  B9 037F				 MOV  CX, 037FH 		
					 ;AN000;
 002A  BA 0000 R			 MOV  DX, OFFSET BUFFER 	
					 ;AN000;
 002D  CD 21				 INT  21H			
					 ;AN000;
					 .IF < C >			
					 ;AN000; Was there an error?
 002F  73 03                 5						jnC $l9
				 
 0031  EB 42 90				      JMP  ERROR_SETTING	
					 ;AN000; Yes! Exit the subroutine.
					 .ENDIF 			
					 ;AN000;
 0034                        2	$l9: 
 0034  C6 06 0006 R 01			 MOV  D_MODE, 1 		
					 ;AN000; Set to text mode
 0039  C7 06 000A R FFFF		 MOV  B_WIDTH, -1		
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Page     1-4


					 ;AN000; -1 for text mode
 003F  C7 06 000C R FFFF		 MOV  B_LENGTH, -1		
					 ;AN000; -1 for text mode
 0045  C7 06 000E R 0050		 MOV  COLS, 80			
					 ;AN000; Number of columns
 004B  C7 06 0010 R 0019		 MOV  ROWS, 25			
					 ;AN000; Number of rows
					 .IF < COLORS NE 0 >		
					 ;AN000; If colors = 0, monochrome
 0051  83 3E 0008 R 00       3						cmp COL
				ORS,0 
 0056  74 06                 6						je $l12
				 
 0058  C7 06 0008 R 0010		      MOV  COLORS, 16		
					 ;AN000; Otherwise set 16 color mode
					 .ENDIF 			
					 ;AN000;
 005E                        2	$l12: 
 005E  B8 440C				 MOV  AX, 440CH 		
					 ;AN000; Set the new mode
 0061  BB 0000				 MOV  BX, 0			
					 ;AN000;
 0064  B9 035F				 MOV  CX, 035FH 		
					 ;AN000;
 0067  BA 0000 R			 MOV  DX, OFFSET BUFFER 	
					 ;AN000;
 006A  CD 21				 INT  21H			
					 ;AN000;
					 .IF < C >			
					 ;AN000; Was there en error?
 006C  73 03                 5						jnC $l1
				5 
 006E  EB 05 90				      JMP  ERROR_SETTING	
					 ;AN000; Yes! Exit the subroutine
					 .ENDIF 			
					 ;AN000;
 0071                        2	$l15: 
 0071  F8				 CLC				
					 ;AN000; Indicate there were no errors
				    .ENDIF				
					 ;AN000;
 0072                        2	$l1: 
 0072  EB 02 90			    JMP  EXIT_SET			
					 ;AN000;
 0075				ERROR_SETTING:				
					 ;AN000;
 0075  F9			    STC 				
					 ;AN000; Indicate that there were error
				s
 0076				EXIT_SET:				
					 ;AN000;
 0076  CB			    RET 				
					 ;AN000;
				
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Page     1-5


 0077				SET_DISPLAY_MODE_ROUTINE     ENDP	
					 ;AN000;
				
				
 0077				CODE_FAR ENDS				
					 ;AN000;
				
				END					
					 ;AN000;

Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Symbols-1


Macros:

		N a m e			Lines

.ELSE  . . . . . . . . . . . . .  	  21
.ELSEIF  . . . . . . . . . . . .  	  16
.ENDIF . . . . . . . . . . . . .  	  11
.ENDSELECT . . . . . . . . . . .  	  15
.ENDWHILE  . . . . . . . . . . .  	  10
.FOR . . . . . . . . . . . . . .  	  23
.IF  . . . . . . . . . . . . . .  	  13
.LEAVE . . . . . . . . . . . . .  	   1
.LOOP  . . . . . . . . . . . . .  	  12
.NEXT  . . . . . . . . . . . . .  	  20
.OTHERWISE . . . . . . . . . . .  	  21
.REPEAT  . . . . . . . . . . . .  	   9
.SELECT  . . . . . . . . . . . .  	   4
.THEN  . . . . . . . . . . . . .  	   6
.UNTIL . . . . . . . . . . . . .  	   1
.WHEN  . . . . . . . . . . . . .  	  24
.WHILE . . . . . . . . . . . . .  	  14

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

CODE_FAR . . . . . . . . . . . .  	0077	BYTE	PUBLIC	'CODE'
DATA . . . . . . . . . . . . . .  	0012	BYTE	PUBLIC	'DATA'

Symbols:            

                N a m e         	Type	 Value	 Attr

BUFFER . . . . . . . . . . . . .  	L BYTE	0000	DATA
B_LENGTH . . . . . . . . . . . .  	L WORD	000C	DATA
B_WIDTH  . . . . . . . . . . . .  	L WORD	000A	DATA

COLORS . . . . . . . . . . . . .  	L WORD	0008	DATA
COLS . . . . . . . . . . . . . .  	L WORD	000E	DATA

D_MODE . . . . . . . . . . . . .  	L BYTE	0006	DATA

ERROR_SETTING  . . . . . . . . .  	L NEAR	0075	CODE_FAR
EXIT_SET . . . . . . . . . . . .  	L NEAR	0076	CODE_FAR

FLAGS  . . . . . . . . . . . . .  	L WORD	0004	DATA

ROWS . . . . . . . . . . . . . .  	L WORD	0010	DATA

SET_DISPLAY_MODE_ROUTINE . . . .  	F PROC	0000	CODE_FAR	Global	Length = 0077

$L1  . . . . . . . . . . . . . .  	L NEAR	0072	CODE_FAR
$L12 . . . . . . . . . . . . . .  	L NEAR	005E	CODE_FAR
$L15 . . . . . . . . . . . . . .  	L NEAR	0071	CODE_FAR
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:34
                                                             Symbols-2


$L2  . . . . . . . . . . . . . .  	L NEAR	0021	CODE_FAR
$L4  . . . . . . . . . . . . . .  	L NEAR	001D	CODE_FAR
$L5  . . . . . . . . . . . . . .  	L NEAR	001A	CODE_FAR
$L6  . . . . . . . . . . . . . .  	L NEAR	0015	CODE_FAR
$L9  . . . . . . . . . . . . . .  	L NEAR	0034	CODE_FAR
$LL1 . . . . . . . . . . . . . .  	NUMBER	0001	
$LL12  . . . . . . . . . . . . .  	NUMBER	000C	
$LL15  . . . . . . . . . . . . .  	NUMBER	000F	
$LL4 . . . . . . . . . . . . . .  	NUMBER	0004	
$LL9 . . . . . . . . . . . . . .  	NUMBER	0009	
@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  s_disply		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    814 Source  Lines
   2999 Total   Lines
    154 Symbols

  47216 + 176181 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
