Assembler






SEGMENT.

, .
 

SEGMENT.
, . ,
,
ASSUME
.
8088 ,
.
64 ,
.
 
,
SEGMENT.
.5 , DOS.
STACK. , ,
, , SEGMENT,
STACK, .EXE
.
STACK, DOS
, .
.
 
SEGMENT -
. , DOS
, .
, DOS .

.
AT SEGMENT.
 
AT, .
BIOS, -
.
,
, .
,
. IBM PC
- ,
ROM BIOS. -
-,
. -
-
. ,
-
. ROM
BIOS.
BIOS.
,
BIOS.
, ROM BIOS.
ROM BIOS ( A
IBM PC), , DATA
40H 400H.
. 6.12
BIOS c . DATA
KB_FLAG,
. ,
IBM, , ,
(CAPS LOCK) . .
6.12 , CAPS LOCK,
.
, ,
,
.
DATA . 6.12 ,
, -
. DATA SEGMENT AT ,
40H.

Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:03:25
. 6.12 Page 1-1
 
PAGE ,132
TITLE . 6.12
 
0000 DATA SEGMENT AT 40H
0017 ORG 17H
0017 ?? KB_FLAG DB ?
= 0040 CAPS_STATE EQU 40H
0018 DATA ENDS
 
0000 VIDEO SEGMENT AT 0B800H
009E ORG 158
009E ?? INDICATOR DB ?
009F VIDEO ENDS
 
0000 CODE SEGMENT
ASSUME CS:CODE
 
0000 CAPS PROC FAR
0000 1E START: PUSH DS ;
0001 B8 0000 MOV AX,0
0004 50 PUSH AX
0005 B8 ---- R MOV AX,DATA ; DATA
0008 8E D8 MOV DS,AX
ASSUME DS:DATA
000A B8 ---- R MOV AX,VIDEO ; VIDEO
000D 8E C0 MOV ES,AX
 
. 6.12 ()
ASSUME ES:VIDEO
000F DISPLAY_CAPS:
000F B0 18 MOV AL,18H ; " " 18H
0011 F6 06 0017 R 40 TEST KB_FLAG,CAPS_STATE ; CAPS
0016 75 02 JNZ CAPS_LOCK
0018 B0 19 MOV AL,19H ; " " 19H
001A CAPS_LOCK:
001A 26: A2 009E R MOV INDICATOR,AL ;
001E B4 06 MOV AH,6 ;
;
0020 B2 FF MOV DL,0FFH ; -
0022 CD 21 INT 21H
0024 3C 00 CMP AL,0 ;
0026 74 E7 JZ DISPLAY_CAPS ;
0028 3C 25 CMP AL,'%' ;
002A 74 08 JE RETURN
002C B4 02 MOV AH,2 ;
002E 8A D0 MOV DL,AL ;
0030 CD 21 INT 21H
0032 EB DB JMP DISPLAY_CAPS ;
0034 RETURN:
0034 CB RET ;
0035 CAPS ENDP
0035 CODE ENDS
END START
 
. 6.12 ()
 
ROM BIOS, KB_FLAG
17H DATA. ORG 17H
.
, EQU, CAPS_STATE
BIOS .
CAPS LOCK.
 
. 6.12
SEGMENT. VIDEO 0B800H.
-
.
.
, , 80 ,
158
.
.8, .
 

. DS DATA, ES -
VIDEO.
AT , "R",
. LINK, ,
.
 
KB_FLAG,
, 17H.

, CAPS LOCK.
DOS,
.
%.
,
.
 
,

. 40
,
- .
,
VIDEO 0B000H,
.
 

80
, "".
-
. -
40 .
, ,
IBM PC.
 
SEGMENT
.
64 , .
,
.
(
) .
 
, DOS
. DOS
DOS.

. ,
DOS INT 27H,
, .
DOS
PSP , .
SEGMENT.
 
. 6.13 ,
.
DOS,
. ,
.EXE,
PSP. . 5.6
DOS,
.COM.
PSP PSP.
, DOS ,
PSP.
.EXE- PSP ,
.
.EXE DOS DS ES PSP,
PSP .
. 6.13 CODE, ,
PSP.

Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:03:31
. 6.13 Page 1-1
 
 
PAGE ,132
TITLE . 6.13
0000 PROGRAM_SEGMENT_PREFIX SEGMENT
 
0000 0002[ INT_20 DB 2 DUP (?)
??
]
 
0002 ???? MEMORY_SIZE DW ?
0004 0005[ LONG_CALL DB 5 DUP (?)
??
]
 
0009 ???????? TERMINATE_ADDR DD ?
000D ???????? CTRL_BREAK DD ?
005C ORG 05CH
005C 0010[ FCB1 DB 16 DUP (?)
??
]
 
006C ORG 06CH
006C 0010[ FCB2 DB 16 DUP (?)
??
]
 
0080 ORG 080H
0080 0080[ DTA DB 128 DUP (?)
??
]
 
 
0100 PROGRAM_SEGMENT_PREFIX ENDS
 
0000 CODE SEGMENT
ASSUME CS:CODE,DS:PROGRAM_SEGMENT_PREFIX
 
0000 A1 0002 R MOV AX,MEMORY_SIZE
 
0003 CODE ENDS
END
 
. 6.13
, PSP . 6.13
. , ,
PSP INT 20H.
, 2
- .
,
,
- . ,
. SEGMENT
,
. ,
. . 6.13
DS.
 

,
8088. ,
, ,
,
.
. ,

( )
.
.
.
 
,
8088. IBM PC
8088 1
, 64 .

, .
 
64, :
. ,
, 64,
.
. ,
(
, ,
), 64 .
 
,
.
.
, ,
.
-
. ,
LDS
LES. ,
.
,
.
0 15,
16.
 

, , .
, 64 .
,
0FH.
0FFFFH,
64 - 15, 65521 .

.
( )
.
 

FCB.
DOS FCB
. -
. DOS

. FCB DOS
DS:DX.
 

.
, .
,
.
,
. , .
, ,
15 . ,
.
15 , 15
. ,
16 .
, .
 
,
DOS . DOS
. DOS
, ,
. ,
,
.
 
,
,
SEGMENT.
,
.
.