.


:




:

































 

 

 

 


1.

 

:

 

-11

..

 

..

 

 

, 2011

1

 

: , .

 

: 9 .

: .

 

, ASCII 1 0.

 


:

masm

model small

.data

max db 10

len db 0

str1 db 10 dup (' ')

eos1 db 10, 13, '$'

.stack

db 256 dup ('?')

.code

main proc

mov ax,@data

mov ds,ax

mov es, ax

mov ah, 0ah

mov dx, offset max

int 21h

mov cx, 9

m2:

mov bx, offset str1

add bx, cx

 

mov al, [bx]

cmp al,10

je m1

cmp al,13

je m1

and al,11011111b

mov [bx], al

dec cx

cmp cx, 0

jns m2

mov ah,09h

mov dx,offset str1

int 21h

mov ax,4c00h

int 21h

m1: dec cx

mov [bx],20h

jmp m2

 

main endp

end main


 

:

1.

 

2. , .

2

 

: , .

 

: 9 .

: .

 

, , . BIOS 02h int 21h.

 


:

masm

model small

.data

max db 10

len db 0

str1 db 12 dup (' ')

str2 db 12 dup (' ')

eos1 db 10, 13, '$'

.stack

db 256 dup ('?')

.code

main proc

mov ax,@data

mov ds,ax

mov es, ax

mov ah, 0ah

mov dx, offset max

int 21h

 

mov cx, 9

m1:

mov bx, offset str1

add bx,cx

mov al, [bx]

 

mov dl,al

mov ah,02h

int 21h

dec cx

cmp cx, 0

jns m1

 

mov ax,4c00h

int 21h

 

main endp

end main


 

:

1.

2. , .

 

 


3

 

: , cpunt

 

: .

 

int 11h 14-15 , .

 


:

masm

model small

.data

s1 db 'port cpunt is:$'

s2 db '0'

s3 db '1'

s4 db '2'

s5 db '3'

eos db 10, 13, '$'

.stack

db 256 dup ('?')

.code

main proc

mov ax,@data

mov ds,ax

mov es, ax

int 11h

and ax,0c000h

mov bx,offset s2

cmp ax,00000h

je m1

 

inc bx

cmp ax,04000h

je m1

inc bx

cmp ax,08000h

je m1

inc bx

cmp ax,0c000h

je m1

m1:

mov ah,09h

mov dx,offset s1

int 21h

mov ah,02h

mov dl,[bx]

int 21h

mov ax,04c00h

int 21h

 

main endp

end main


 

:

1.

 

4

 

: , RS-232

 

: .

 

int 11h 9-11 , .

 


:


masm

model small

.data

s1 db 'port COM (RS-232) is:$'

s2 db '0'

s3 db '1'

s4 db '2'

s5 db '3'

s6 db '4'

s7 db '5'

s8 db '6'

s9 db '7'

eos db 10, 13, '$'

.stack

db 256 dup ('?')

.code

main proc

mov ax,@data

mov ds,ax

mov es, ax

int 11h

and ax,0e00h

mov bx,offset s2

cmp ax,0000h

je m1

inc bx

cmp ax,0200h

je m1

inc bx

cmp ax,0400h

je m1

inc bx

cmp ax,0600h

je m1

inc bx

cmp ax,0800h

je m1

inc bx

cmp ax,0a00h

je m1

inc bx

cmp ax,0c00h

je m1

inc bx

cmp ax,0e00h

je m1

m1:

mov ah,09h

mov dx,offset s1

int 21h

mov ah,02h

mov dl,[bx]

int 21h

mov ax,04c00h

int 21h

 

main endp

end main


:

1.

 

5

 

: , Shift-

 

: 9 .

: .

 

Shift-, BIOS 02h int 16h.

 


:


 

masm

model small

.data

 

rCtrl db 'Control pressed$'

lShift db 'Left Shift pressed$'

rShift db 'Right Shift pressed$'

lAlt db 'Left Alt pressed$'

rAlt db 'Right Alt pressed$'

 

eos db 10,13,'$'

 

c1 db 0

kf dw 0

 

.stack

db 256 dup ('?')

 

.code

main proc

mov ax,@data

mov ds,ax

mov es,ax

 

m1:

xor ax,ax

mov ah,02h

int 16h

 

cmp c1,al

 

je m1

 

mov c1,al

 

mov kf,ax

 

call getEXIT

 

mov ax, kf

call GetLShift

 

mov ax, kf

call GetRShift

 

mov ax, kf

call getCTRL

 

mov ax, kf

call GetLAlt

 

mov ax, kf

call GetRALT

 

jmp m1

 

exit:

mov ax,4c00h

int 21h

main endp

 

getLShift proc

and al,02h

cmp al,0

je m2

mov dx,offset lshift

mov ah,09h

int 21h

mov dx,offset eos

int 21h

m2:

ret

getLshift endp

 

 

getRShift proc

 

and al,01h

cmp al,0

je m3

mov dx,offset rshift

mov ah,09h

int 21h

mov dx,offset eos

int 21h

m3:

ret

 

getRshift endp

 

getCTRL proc

and al,04h

cmp al,0

je m5

mov dx,offset rCTRL

mov ah,09h

int 21h

mov dx,offset eos

int 21h

m5:

ret

getCTRL endp

 

 

getLALT proc

and ah,02h

cmp ah,0

je m6

mov dx,offset lalt

mov ah,09h

int 21h

mov dx,offset eos

int 21h

m6:

ret

getLALT endp

 

 

getRALT proc

and al,08h

cmp al,0

je m7

and ah,02h

jne m7

mov dx,offset rALT

mov ah,09h

int 21h

mov dx,offset eos

int 21h

m7:

ret

getRALT endp

 

getEXIT proc

and al,02h

cmp al,0

je m8

mov al,c1

and al,04h

cmp al,0

je m8

mov al,c1

and al,08h

cmp al,0

je m8

jmp exit

m8:

ret

getEXIT endp

 

end main


:

1.

2. LeftShift, Control, LeftAlt.

3. RightShift, Control, RightAlt.

4. LeftShift+Control+LeftAlt.

 

6

 

: , -.

 

: .

: .

 

BIOS int 10h.

 


:

 


masm

model small

.data

tr db 0

c1 db 0

k1 dw 160

k2 dw 100

eos db 10,13,'$'

.stack

db 256 dup ('?')

.code

main proc

mov ax,@data

mov ds,ax

mov es,ax

 

mov ah,0fh

int 10h

 

mov tr,al

 

mov ah,00h

mov al,4

int 10h

 

mov ah,0ch

mov bh,0

mov dx,100

mov cx,160

mov al,1

int 10h

 

m1:

xor ax,ax

mov ah,00h

int 16h

mov c1,al

cmp al,27

je m2

 

call getRight

 

call getLeft

 

call getDown

 

call getUp

 

mov ah,0ch

mov bh,0

mov dx,k2

mov cx,k1

mov al,1

int 10h

 

jmp m1

 

m2:

mov ah,00h

mov al,tr

int 10h

mov ax,4c00h

int 21h

 

main endp

 

getRight proc

 

cmp ah,77

jne m3

 

mov ah,0ch

mov bh,0

mov dx,k2

mov cx,k1

mov al,4

int 10h

 

inc k1

 

m3:

ret

 

getRight endp

 

getLeft proc

 

cmp ah,75

jne m4

 

mov ah,0ch

mov bh,0

mov dx,k2

mov cx,k1

mov al,4

int 10h

 

dec k1

m4:

ret

 

getLeft endp

 

getDown proc

 

cmp ah,80

jne m5

 

mov ah,0ch

mov bh,0

mov dx,k2

mov cx,k1

mov al,4

int 10h

 

inc k2

m5:

ret

 

getDown endp

 

getUp proc

 

cmp ah,72

jne m6

 

mov ah,0ch

mov bh,0

mov dx,k2

mov cx,k1

mov al,4

int 10h

 

dec k2

m6:

ret

 

getUp endp

 

end main


 

 



<== | ==>
| - ,
:


: 2015-10-01; !; : 387 |


:

:

, - , ; , - .
==> ...

1432 - | 1453 -


© 2015-2024 lektsii.org - -

: 0.071 .