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


				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				;
				;
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				.ALPHA					;AN000;
				.LIST					;AN000;
									;
					PUBLIC	MONO, CGA, EGA, LCD	;AN000;
					PUBLIC	 ACTIVE, ALTERNATE	;AN000;
									;
					EXTRN  IN_CURNOR:WORD		;AN000;
				JW
									;
 0000				DATA	SEGMENT BYTE PUBLIC 'DATA'      ;AN000;
 = 0001				MONO	EQU    1			;AN000;
 = 0002				CGA	EQU    2			;AN000;
 = 0003				EGA	EQU    3			;AN000;
 = 0004				LCD	EQU    4			;AN000;
									;
 = 001A				READ_DISPLAY   EQU   1AH		;AN000;
 = 0012				ALT_SELECT     EQU   12H		;AN000;
 = 0010				EGA_INFO       EQU   10H		;AN000;
 = 0001				MONOCHROME     EQU   1			;AN000;
 = B800				BASE_COLOR     EQU   0B800H		;AN000;
 = B000				BASE_MONO      EQU   0B000H		;AN000;
 = 00C0				GET_SYS_ID     EQU   0C0H		;AN000;
 = 00F9				LCD_MODEL      EQU   0F9H		;AN000;
 = 0043				GET_STATUS     EQU   43H		;AN000;
 = 0001				ON	       EQU   1			;AN000;
									;
				SYSTEM_ID      STRUC			;AN000;
 0000  0000				       DW    ?			;AN000;
 0002  00			MODEL_BYTE     DB    ?			;AN000;
 0003				SYSTEM_ID      ENDS			;AN000;
									;
 0000  00			ACTIVE	   DB	0			;AN000;
 0001  00			ALTERNATE  DB	0			;AN000;
									;
 0002				DATA	       ENDS			;AN000;
				DATA
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				;
				;
				;
				;
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 0000				SERVICE SEGMENT PARA PUBLIC 'SERVICE'        ;A
				N000;segment for far routine
					ASSUME	CS:SERVICE,DS:DATA	     ;A
				N000;
									     ;
					PUBLIC	VIDEO_CHECK		     ;A
				N000;
 0000				VIDEO_CHECK PROC   FAR			     ;A
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-2


				N000;
 0000  50				    PUSH   AX			     ;A
				N000;
 0001  53				    PUSH   BX			     ;A
				N000; save all registers
 0002  51				    PUSH   CX			     ;A
				N000;
 0003  52				    PUSH   DX			     ;A
				N000;
 0004  56				    PUSH   SI			     ;A
				N000;
 0005  57				    PUSH   DI			     ;A
				N000;
 0006  06				    PUSH   ES			     ;A
				N000;
 0007  32 C0				    XOR    AL,AL		     ;A
				N000;
 0009  B4 1A				    MOV    AH,READ_DISPLAY	     ;A
				N000; check for VGA first.
 000B  CD 10				    INT    10H			     ;A
				N000;
					    .IF <AL EQ READ_DISPLAY>	     ;A
				N000; VGA present?
 000D  3C 1A                 3						cmp AL,
				READ_DISPLAY 
 000F  75 4A                 6						jne $l2
				 
					      .SELECT			     ;A
				N000; yes....BL contains active..
					      .WHEN <BL EQ MONO>	     ;A
				N000; display code.
 0011  80 FB 01              3						cmp BL,
				MONO 
 0014  75 08                 6						jne $l5
				 
 0016  C6 06 0000 R 01				MOV    ACTIVE,MONO	     ;A
				N000;
					      .WHEN <BL EQ CGA> 	     ;A
				N000;
 001B  EB 18                 3						jmp sho
				rt $l4 
 001D  90                    3						nop 
 001E                        2	$l5: 
 001E  80 FB 02              3						cmp BL,
				CGA 
 0021  75 08                 6						jne $l7
				 
 0023  C6 06 0000 R 02				MOV    ACTIVE,CGA	     ;A
				N000;
					      .WHEN <BL A CGA>		     ;A
				N000;
 0028  EB 0B                 3						jmp sho
				rt $l4 
 002A  90                    3						nop 
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-3


 002B                        2	$l7: 
 002B  80 FB 02              3						cmp BL,
				CGA 
 002E  76 05                 5						jnA $l4
				 
 0030  C6 06 0000 R 03				MOV    ACTIVE,EGA	     ;A
				N000;
					      .ENDSELECT		     ;A
				N000;
 0035                        2	$l4: 
					      .SELECT			     ;A
				N000; ...and BH contains alternate..
					      .WHEN <BH EQ MONO>	     ;A
				N000; display code.
 0035  80 FF 01              3						cmp BH,
				MONO 
 0038  75 08                 6						jne $l1
				2 
 003A  C6 06 0001 R 01				MOV    ALTERNATE,MONO	     ;A
				N000;
					      .WHEN <BH EQ CGA> 	     ;A
				N000;
 003F  E9 00D0 R             3						jmp $l1
				 
 0042                        2	$l12: 
 0042  80 FF 02              3						cmp BH,
				CGA 
 0045  75 08                 6						jne $l1
				4 
 0047  C6 06 0001 R 02				MOV    ALTERNATE,CGA	     ;A
				N000;
					      .WHEN <BH A CGA>		     ;A
				N000;
 004C  E9 00D0 R             3						jmp $l1
				 
 004F                        2	$l14: 
 004F  80 FF 02              3						cmp BH,
				CGA 
 0052  76 7C                 5						jnA $l1
				 
 0054  C6 06 0001 R 03				MOV    ALTERNATE,EGA	     ;A
				N000;
					      .ENDSELECT		     ;A
				N000;
					    .ELSE			     ;A
				N000; VGA not there..check for EGA.
 0059  EB 75                 3						jmp sho
				rt $l1 
 005B                        2	$l2: 
 005B  B4 12				      MOV    AH,ALT_SELECT	     ;A
				N000;
 005D  B3 10				      MOV    BL,EGA_INFO	     ;A
				N000;
 005F  CD 10				      INT    10H		     ;A
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-4


				N000;
					      .IF <BL NE EGA_INFO>	     ;A
				N000; EGA present?
 0061  80 FB 10              3						cmp BL,
				EGA_INFO 
 0064  74 2C                 6						je $l20
				 
 0066  C6 06 0000 R 03				MOV    ACTIVE,EGA	     ;A
				N000; yes....set as active.
						.IF <BH EQ MONOCHROME>	     ;A
				N000; if monochrome attached to EGA then..
 006B  80 FF 01              3						cmp BH,
				MONOCHROME 
 006E  75 11                 6						jne $l2
				3 
 0070  B8 B800					  MOV	 AX,BASE_COLOR	     ;A
				N000; check if CGA is an alternate.
 0073  E8 00D8 R				  CALL	 CHECK_BUFF	     ;A
				N000;
						  .IF <AH EQ AL>	     ;A
				N000; CGA there?
 0076  3A E0                 3						cmp AH,
				AL 
 0078  75 56                 6						jne $l1
				 
 007A  C6 06 0001 R 02				    MOV    ALTERNATE,CGA     ;A
				N000; yes....alternate display.
						  .ENDIF		     ;A
				N000;
						.ELSE			     ;A
				N000; if color attached to EGA then...
 007F  EB 4F                 3						jmp sho
				rt $l1 
 0081                        2	$l23: 
 0081  B8 B000					  MOV	 AX,BASE_MONO	     ;A
				N000; check if monochrome is an alternate.
 0084  E8 00D8 R				  CALL	 CHECK_BUFF	     ;A
				N000;
						  .IF <AH EQ AL>	     ;A
				N000; MONO there?
 0087  3A E0                 3						cmp AH,
				AL 
 0089  75 45                 6						jne $l1
				 
 008B  C6 06 0001 R 01				    MOV    ALTERNATE,MONO    ;A
				N000; yes....alternate display.
						  .ENDIF		     ;A
				N000;
						.ENDIF			     ;A
				N000;
					      .ELSE			     ;A
				N000; EGA not present so...
 0090  EB 3E                 3						jmp sho
				rt $l1 
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-5


 0092                        2	$l20: 
 0092  B4 C0					MOV    AH,GET_SYS_ID	     ;A
				N000; check for LCD.
 0094  CD 15					INT    15H		     ;A
				N000;
						.IF <ES:[BX].MODEL_BYTE EQ LCD_
				MODEL> AND ;AN000; if model byte says convertib
				le..
 0096  26: 80 7F 02 F9       3						cmp ES:
				[BX].MODEL_BYTE,LCD_MODEL 
 009B  75 0F                 6						jne $l3
				4 
 009D  B4 43					MOV    AH,GET_STATUS	     ;A
				N000; and..
 009F  CD 15					INT    15H		     ;A
				N000;
						.IF <BIT AL NAND ON>	     ;A
				N000; if LCD screen attached..then
 00A1  A8 01                 3						test AL
				,ON 
 00A3  75 07                 6						jnz $l3
				4 
 00A5  C6 06 0000 R 04				  MOV	 ACTIVE,LCD	     ;A
				N000; set LCD as active display.
						.ELSE			     ;A
				N000;
 00AA  EB 24                 3						jmp sho
				rt $l1 
 00AC                        2	$l34: 
 00AC  B8 B000					  MOV	 AX,BASE_MONO	     ;A
				N000; not LCD...check for..
 00AF  E8 00D8 R				  CALL	 CHECK_BUFF	     ;A
				N000; MONO....
						  .IF <AH EQ AL>	     ;A
				N000;
 00B2  3A E0                 3						cmp AH,
				AL 
 00B4  75 0B                 6						jne $l3
				7 
 00B6  C6 06 0000 R 01				    MOV    ACTIVE,MONO	     ;A
				N000; MONO found...set as active.
 00BB  C7 06 0000 E 0B0C			    MOV    IN_CURNOR,0B0CH   ;A
				N000;JW set mono cursor size
						  .ENDIF		     ;A
				N000;
 00C1                        2	$l37: 
 00C1  B8 B800					  MOV	 AX,BASE_COLOR	     ;A
				N000; ..and check for color.
 00C4  E8 00D8 R				  CALL	 CHECK_BUFF	     ;A
				N000;
						  .IF <AH EQ AL>	     ;A
				N000;
 00C7  3A E0                 3						cmp AH,
				AL 
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-6


 00C9  75 05                 6						jne $l1
				 
 00CB  C6 06 0001 R 02				    MOV    ALTERNATE,CGA     ;A
				N000; color found...set CGA as alternate.
						  .ENDIF		     ;A
				N000;
						.ENDIF			     ;A
				N000;
					      .ENDIF			     ;A
				N000;
					    .ENDIF			     ;A
				N000;
 00D0                        2	$l1: 
 00D0  07				    POP    ES			     ;A
				N000;
 00D1  5F				    POP    DI			     ;A
				N000; restore registers.
 00D2  5E				    POP    SI			     ;A
				N000;
 00D3  5A				    POP    DX			     ;A
				N000;
 00D4  59				    POP    CX			     ;A
				N000;
 00D5  5B				    POP    BX			     ;A
				N000;
 00D6  58				    POP    AX			     ;A
				N000;
 00D7  CB				    RET 			     ;A
				N000;
 00D8				VIDEO_CHECK ENDP			     ;A
				N000;
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				;
				;
				;
				;
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 00D8				CHECK_BUFF  PROC   NEAR 	;AN000; write t
				o video buffer to see if it is present
 00D8  1E				    PUSH   DS		;AN000;
 00D9  8E D8				    MOV    DS,AX	;AN000; load DS
				 with address of buffer
 00DB  8A 2E 0000			    MOV    CH,DS:0	;AN000; save bu
				ffer information (if present)
 00DF  B0 55				    MOV    AL,55H	;AN000; prepare
				 to write sample data
 00E1  A2 0000				    MOV    DS:0,AL	;AN000; write t
				o buffer
 00E4  53				    PUSH   BX		;AN000; termina
				te the bus so that lines..
 00E5  5B				    POP    BX		;AN000; are res
				et
 00E6  8A 26 0000			    MOV    AH,DS:0	;AN000; bring s
				ample data back...
Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             Page     1-7


 00EA  88 2E 0000			    MOV    DS:0,CH	;AN000; repair 
				damage to buffer
 00EE  1F				    POP    DS		;AN000;
 00EF  C3				    RET 		;AN000;
 00F0				CHECK_BUFF  ENDP		;AN000;
				;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 00F0				SERVICE     ENDS		;AN000;
					    END 		;AN000;

Microsoft (R) Macro Assembler Version 5.10                  5/17/24 09:44:29
                                                             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

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

SYSTEM_ID  . . . . . . . . . . .  	0003	0002
  MODEL_BYTE . . . . . . . . . .  	0002

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DATA . . . . . . . . . . . . . .  	0002	BYTE	PUBLIC	'DATA'
SERVICE  . . . . . . . . . . . .  	00F0	PARA	PUBLIC	'SERVICE'

Symbols:            

                N a m e         	Type	 Value	 Attr

ACTIVE . . . . . . . . . . . . .  	L BYTE	0000	DATA	Global
ALTERNATE  . . . . . . . . . . .  	L BYTE	0001	DATA	Global
ALT_SELECT . . . . . . . . . . .  	NUMBER	0012	

BASE_COLOR . . . . . . . . . . .  	NUMBER	B800	
BASE_MONO  . . . . . . . . . . .  	NUMBER	B000	

CGA  . . . . . . . . . . . . . .  	NUMBER	0002		Global
CHECK_BUFF . . . . . . . . . . .  	N PROC	00D8	SERVICE	Length = 0018

EGA  . . . . . . . . . . . . . .  	NUMBER	0003		Global
EGA_INFO . . . . . . . . . . . .  	NUMBER	0010	

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


GET_STATUS . . . . . . . . . . .  	NUMBER	0043	
GET_SYS_ID . . . . . . . . . . .  	NUMBER	00C0	

IN_CURNOR  . . . . . . . . . . .  	V WORD	0000		External

LCD  . . . . . . . . . . . . . .  	NUMBER	0004		Global
LCD_MODEL  . . . . . . . . . . .  	NUMBER	00F9	

MONO . . . . . . . . . . . . . .  	NUMBER	0001		Global
MONOCHROME . . . . . . . . . . .  	NUMBER	0001	

ON . . . . . . . . . . . . . . .  	NUMBER	0001	

READ_DISPLAY . . . . . . . . . .  	NUMBER	001A	

VIDEO_CHECK  . . . . . . . . . .  	F PROC	0000	SERVICE	Global	Length = 00D8

$L1  . . . . . . . . . . . . . .  	L NEAR	00D0	SERVICE
$L12 . . . . . . . . . . . . . .  	L NEAR	0042	SERVICE
$L14 . . . . . . . . . . . . . .  	L NEAR	004F	SERVICE
$L2  . . . . . . . . . . . . . .  	L NEAR	005B	SERVICE
$L20 . . . . . . . . . . . . . .  	L NEAR	0092	SERVICE
$L23 . . . . . . . . . . . . . .  	L NEAR	0081	SERVICE
$L34 . . . . . . . . . . . . . .  	L NEAR	00AC	SERVICE
$L37 . . . . . . . . . . . . . .  	L NEAR	00C1	SERVICE
$L4  . . . . . . . . . . . . . .  	L NEAR	0035	SERVICE
$L5  . . . . . . . . . . . . . .  	L NEAR	001E	SERVICE
$L7  . . . . . . . . . . . . . .  	L NEAR	002B	SERVICE
$LL1 . . . . . . . . . . . . . .  	NUMBER	0001	
$LL37  . . . . . . . . . . . . .  	NUMBER	0025	
@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  ckdisp		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    853 Source  Lines
   6599 Total   Lines
    198 Symbols

  47170 + 179250 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
