Assembler







. - ..,
. -
, .

, .
 

.
.
, .
. ,
, .
,
.
 

.
- 201H.
201H,
0. 1
.
, . . 8.18 -

. .
,
. ,
, . ,

.

Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:05:57
. 8.18 Page 1-1
 
PAGE ,132
TITLE . 8.18
 
= 0201 GAME_PORT EQU 201H
 
0000 STACK SEGMENT STACK
0000 0040[ DW 64 DUP (?)
????
]
0080 STACK ENDS
 
0000 CODE SEGMENT
ASSUME CS:CODE
0000 GAME_CONTROL PROC FAR
0000 1E PUSH DS ;
0001 2B C0 SUB AX, AX
0003 50 PUSH AX
0004 BA 0201 MOV DX, GAME_PORT
0007 B8 B000 MOV AX, 0B000H ;
000A 8E D8 MOV DS, AX
 
000C B5 21 MOV CH, 21H ; ,
000E B1 00 MOV CL, 0
0010 WRITE_LOOP:
0010 B4 01 MOV AH, 1 ; X
0012 E8 0042 R CALL POSITION
0015 8B D8 MOV BX, AX ; X
0017 D1 EB SHR BX, 1
0019 D1 EB SHR BX, 1 ; 4
 
. 8.18 ()
001B B4 02 MOV AH, 2 ; Y
001D E8 0042 R CALL POSITION
0020 D0 E8 SHR AL, 1
0022 D0 E8 SHR AL, 1
0024 D0 E8 SHR AL, 1
0026 D0 E8 SHR AL, 1 ; 16
0028 B4 A0 MOV AH, 160
002A F6 E4 MUL AH ;
002C 03 D8 ADD BX, AX
002E 88 2F MOV [BX], CH ;
0030 EC IN AL, DX
0031 24 10 AND AL, 10H
0033 3A C1 CMP AL, CL
0035 74 D9 JE WRITE_LOOP
0037 8A C8 MOV CL, AL
0039 80 F9 10 CMP CL, 10H
003C 75 D2 JNE WRITE_LOOP
003E FE C5 INC CH ;
0040 EB CE JMP WRITE_LOOP
 
0042 GAME_CONTROL ENDP
 
;----- AH
 
0042 POSITION PROC NEAR
0042 51 PUSH CX
0043 2B C9 SUB CX, CX ;
0045 EE OUT DX, AL ;
0046 POS_LOOP:
0046 EC IN AL, DX
0047 84 C4 TEST AL, AH
0049 E0 FB LOOPNE POS_LOOP ; 1 -
004B B8 0000 MOV AX, 0
004E 2B C1 SUB AX, CX ;
0050 59 POP CX ; 0-255
0051 C3 RET
0052 POSITION ENDP
0052 CODE ENDS
END
 
. 8.18 ()
 
. 8.18 X-Y,
,
.
,
201H.
,
.