Assembler







. ,

.
,
, - 100 .
,
,
.
 
,
. IBM PC
.
, ,
,

. . 10.4 ,
. ,
-
. ASCII
(27 ASCII).
,
. . 10.4,
,
.
 

---------------------------------------------------------
ESC + "3" + n
n/216
Esc + "K" +n1+n2+v1...vk v1...vk
(k = n1 + 256*n2) 480
---------------------------------------------------------
.10.4
. 10.5

320*200 . .
,
. ,
.
,
.
.
-.
 
PRINT_SCREEN FAR.
FAR,
. ESC
+ "3" + 24 ,
.
, 1/72 .
8/72 ( 24/216
), .

.
.
.
 

( )
320 . NEXT_ROW
ESC + "K" + 64 + 1 .
, 320 (64 + 1*256)
.
"K"
480 .
 

BIOS .
: "1" ,
.
NEXT_COLUMN - , 320 (
320 ) .

" " " " (13 10 ASCII),
. 25
200 .
FAR.
 

PRINT.
BIOS.
- .
,
AH DX
PRINT.
A
Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:06:57
. 10.5 Page 1-1
 
PAGE ,132
TITLE . 10.5
 
= 001B ESC EQU 27 ; Escape
0000 CODE SEGMENT
ASSUME CS:CODE
0000 PRINT_SCREEN PROC FAR
0000 B0 1B MOV AL, ESC ; 1/8
0002 E8 0060 R CALL PRINT
0005 B0 33 MOV AL, '3'
0007 E8 0060 R CALL PRINT
000A B0 18 MOV AL, 24 ; 1/8 = 24/216
000C E8 0060 R CALL PRINT
000F BA 0000 MOV DX, 0 ;
0012 NEXT_ROW:
0012 B0 1B MOV AL, ESC
0014 E8 0060 R CALL PRINT
0017 B0 4B MOV AL, 'K'
0019 E8 0060 R CALL PRINT
001C B0 40 MOV AL, 320-256
001E E8 0060 R CALL PRINT
0021 B0 01 MOV AL, 1
0023 E8 0060 R CALL PRINT
0026 B9 0000 MOV CX, 0 ;
0029 NEXT_COLUMN:
0029 52 PUSH DX ;
002A BB 0008 MOV BX, 8 ;
002D NEXT_DOT:
002D D0 E7 SHL BH, 1 ;
002F B4 0D MOV AH, 13 ;
0031 CD 10 INT 10h
0033 0A C0 OR AL, AL
0035 74 03 JZ BACKGROUND ;
0037 80 CF 01 OR BH, 1 ; ,
003A BACKGROUND:
003A 42 INC DX ;
003B FE CB DEC BL ;
003D 75 EE JNZ NEXT_DOT
003F 8A C7 MOV AL, BH ; 8-
0041 E8 0060 R CALL PRINT ;
0044 5A POP DX ;
0045 41 INC CX ;
0046 81 F9 0140 CMP CX, 320 ; ?
004A 75 DD JNZ NEXT_COLUMN
004C B0 0D MOV AL, 13 ;
004E E8 0060 R CALL PRINT
0051 B0 0A MOV AL, 10
0053 E8 0060 R CALL PRINT
0056 83 C2 08 ADD DX, 8 ; 8
0059 81 FA 00C8 CMP DX, 200 ; ?
005D 72 B3 JB NEXT_ROW
005F CB RET ; BASIC
 
. 10.5 ()
0060 PRINT_SCREEN ENDP
 
0060 PRINT PROC NEAR
0060 52 PUSH DX
0061 B4 00 MOV AH, 0 ; , AL
0063 BA 0000 MOV DX, 0
0066 CD 17 INT 17h
0068 5A POP DX
0069 C3 RET
006A PRINT ENDP
006A CODE ENDS
ENDA

 
. 10.5 ()
 
,
?
.
( 64 ) .
96 ,
.
. ,

.

. ,
.
 
. 10.6
.
C
. ( . 10.6)
96 .
. /H.
.EXE ,
,
.
 
,
, DEBUG.
DEBUG
, .
128 .
CS, 1FF9H, ,
70H . ,
6AH ,

, .
, -
. , ,
0
.
.
A
 
B>A:MASM FIG10-5,,,;
The IBM Persona Computer MACRO Assembler
Version 1.00 (C)Copyright IBM Corp 1981
 
Warning Severe
Errors Errors
0 0
 
B>A:LINK FIG10-5,,,/H;
 
IBM Personal Computer Linker
Version 1.10 (C)Copyright IBM Corp 1982
 
Warning: No STACK segment
 
There was 1 error detected
 
B>A:DEBUG A:BASIC.COM
-R
 
AX=0000 BX=0000 CX=2B80 DX=0000 SP=FFF0 BP=0000 SI=0000 DI=0000
DS=04B5 ES=04B5 SS=04B5 CS=04B5 IP=0100 NV UP DI PL NZ NA PO NC
04B5:0100 E91329 JMP 2A16
-NFIG10-5.EXE
-L
-R
 
AX=0000 BX=0000 CX=006A DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=04B5 ES=04B5 SS=1FF9 CS=1FF9 IP=0000 NV UP DI PL NZ NA PO NC
1FF9:0000 B01B MOV AL,1B
 
-RSS
SS 1FF9
:4B5
 
-RCS
CS 1FF9
:4B5
 
-RIP
IP 0000
:100
 
-G
 
----
 
DEF SEG = &H1FF9
BSAVE "FIG10-5",0,&H70
 
. 10.6 ()
B>A:MASM FIG10-5,,,;
The IBM Persona Computer MACRO Assembler
Version 1.00 (C)Copyright IBM Corp 1981
 
Warning Severe
Errors Errors
0 0
 
B>A:LINK FIG10-5,,,/H;
 
IBM Personal Computer Linker
Version 1.10 (C)Copyright IBM Corp 1982
 
Warning: No STACK segment
 
There was 1 error detected
 
B>A:DEBUG A:BASIC.COM /M:&H8000
-R
 
AX=0000 BX=0000 CX=2B80 DX=0000 SP=FFF0 BP=0000 SI=0000 DI=0000
DS=04B5 ES=04B5 SS=04B5 CS=04B5 IP=0100 NV UP DI PL NZ NA PO NC
04B5:0100 E91329 JMP 2A16
-NFIG10-5.EXE
-L
-R
AX=0000 BX=0000 CX=006A DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=04B5 ES=04B5 SS=0FF9 CS=0FF9 IP=0000 NV UP DI PL NZ NA PO NC
0FF9:0000 B01B MOV AL,1B
 
-RSS
SS 0FF9
:4B5
 
-RCS
CS 1FF9
:4B5
 
-RIP
IP 0000
:100
 
-G
 
---- ;
 
DEF SEG = &H0FF9
BSAVE "FIG10-5",0,&H70
(b)
A
. 10.6 () ; (b)
64K
 
.
,
. , ,
DEF SEG.
BSAVE ,
BLOAD.
(b) . 10.6, (),
64 . ,

. /M
.
.
 
DEBUG
.
G
.
,
DEBUG .
 

. ,
128 ,
:
 
"BASIC" DOS;
"SCREEN1" .
 
 
 
. 10.7
 

320*200 . . 10.7.
. BLOAD
, .
BLOAD ,
. LINE
.
DEF SEG,
CS . IP
. CALL
. . 10.7
,
.
 
64 ,
.
BASIC/M:&H8000,
, DEF SEG
, (b) . 10.6.