Sunteți pe pagina 1din 22

S se defineasc la ce este utilizat codul de mai jos,

i s fie descris fiecare funcie din exemplu.

Varianta 1 DOS
mov al,'.'
int 29h
mov ah,86h
xor cx,cx
mov dx,50000
int 15h
mov ah,1

int 16h
jz Repeat
xor ah,ah
int 16h
cmp ax,011Bh
jne Repeat

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 2 DOS
START: AH = 3Ch
X =
DS:DX =
END:
CF = 0 CF = 1 -

, AX =
, AX =

A file must be created before it can be used. To create a new file, or to rewrite an
existing file, the user provides a filename and an attribute. DOS returns a file handle.
INT 21h, Function 3Ch
DOS function:
Open a new file/rewrite a file
Input:
AH = 3Ch
DS:DX = address of filename (an ASCIIZ string ending with a zero byte)
CL = attribute
Output:
If successful, AX = file handle
Error: if CF = 1, AX = error code (3, 4, or 5)

http://fleder44.net/312/notes/16Files/Index.html

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 3
START: AH = 3Dh
AL =
(0
DS:DX =
END:
CF = 0
CF = 1 -

DOS
, 1 -

, 2 -

, AX =
, AX =

, :

AH
3dH
AL
(0 = , 1 = , 2 = , ..)
DS:DX
ASCII

AX
CF CY
,

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 4 DOS
START:
END:

AH
BX
CF
CF

= 3Eh
=
= 0
= 1 -

, AX =

(06h

, . 3dh AX.
.

AH
BX

AX

3eH

CF CY

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 5 DOS
START: AH = 3Fh
BX =
CX =
DS:DX =
END:
CF = 0
CF = 1 -

, AX =
, AX =

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 6 DOS
START: AH = 40h
BX =
CX =
DS:DX =
END:
CF = 0
CF = 1 -

, AX =
, AX =

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 7 DOS
START:

AH = 42h
AL = 0
1
2
BX =
CX:DX =
END: CF = 0
DX:AX =
CF = 1 , AX =

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 8 DOS
START:
END:

AX
BX
CF
AL
AL
CF

=
=
=
=
=
=

4406h
0 0
0FFh
1 -

, AX =

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 9
pushf
push bp
mov bp,sp
push ax
mov ax,[bp+8]
mov [bp+2],ax
pop ax bp
pusha
; flags
; cf
pushf
pop
ax
xor
ax,01h
push
ax
popf

http://www.kolasc.net.ru/cdo/programmes/assembler/pushf.html
http://www.kolasc.net.ru/cdo/programmes/assembler/pusha.html

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 10
Func1

Func1

in
push
in
or
out
pop
out

proc
push
in
and
out
pop
ret
endp

near
ax
al,61h
al,not 3
61h,al
ax

al,60h ; -
ax
;
al,61h ; 61h
al,80h ; 61h 1
61h,al ; -
ax
61h,al ; 61h

;
; : X=
http://forum.codenet.ru/q44474?nowrap=1&s=#
http://www.kolasc.net.ru/cdo/programmes/assembler/in.html
http://www.kolasc.net.ru/cdo/programmes/assembler/not.html

https://courses.engr.illinois.edu/ece390/books/labmanual/iodevices-speaker.html

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 11
begin:

message
text

begin:

mov

mov
mov
mov
mov
int
mov
mov
int
db
ends
end

DOS
AX,text
DS,AX
AH,09h
DX,offset message
21h
AH,4Ch
AL,00h
21h
'Assembler4Ever$'
begin

AX,text

; (3)

mov

DS,AX

; (4) AX, DS

mov

AH,09h

; (5) DOS 09h

mov

DX,offset message ; (6)

int

21h

; (7) DOS

mov

AH,4Ch

; (8) 4Ch

mov

AL,00h

; (9) 0

int

21h

; (10) DOS

message

db

text

ends

end

begin

' $' ; (11)


; (12)
; (13)

http://netlib.narod.ru/library/book0027/ch01_00.htm

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 12
jmp bx
mov
mov
mov
mov
mov
mov
mov
mov
int

bp,7c03h + len1
ah,13h
al,01h
bh,0h
bl,01h
cx,len2
dh,02h
dl,12h
10h

mov ah,00h
int 16h

http://devel.archefire.org/mirrors/my.execpc.com/~geezer/osd/cons/bios13.asm
; write string
mov ah,13h
mov al,1 ; write mode (advance cursor, ASCII string)
mov bh,0 ; video page
mov bl,02 ; attribute (green on black)
mov cx,5 ; string length
mov dh,2 ; starting row
mov dl,2 ; starting col
push cs
pop es
mov bp,string1
int 10h
http://www.programmersforum.ru/showthread.php?t=125335
00h , .
, , . - ASCII- .
:
: AH = 00h
: AL = ASCII- 0, AH
ASCII- ;
AH = - ASCII-
, AL=0;

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 13
mov cx, 100+weight
mov dx, 20
mov al, 15
u1: mov ah, 0ch
mov al,03h
mov bh,0
int 10h
dec cx
cmp cx, 100
jae u1
; draw upper line:

mov cx, 100+w ; column


mov dx, 20

; row

mov al, 15

; white

u1: mov ah, 0ch

; put pixel

int 10h
dec cx
cmp cx, 100
jae u1

https://github.com/AhmadAbdelNaser/emu8086/blob/master/examples/
0_sample_vga_graphics.asm

Varianta 14

mov
ax,
mov
ds,
mov
ah,
mov
al,
mov
bh,
mov
ch,
mov
cl,
mov
di,
mov
dh,
mov
di,
mov
dl, [di]
dec
dl
int
10h
CLEAR_SCREEN PROC NEAR

40h
ax
06h
0
01011111b
1
30
84h
[di]
4ah

; clear the screen by scrolling entire screen window,


; and set cursor position on top.
; default attribute is set to white on blue.
clear_screen proc near
push
ax
; store registers...
push
ds
;
push
bx
;
push
cx
;
push
di
;
mov
mov
mov
mov
mov
mov
mov
mov
mov
mov
mov
dec
int

ax,
ds,
ah,
al,
bh,
ch,
cl,
di,
dh,
di,
dl,
dl
10h

40h
ax ; for getting screen parameters.
06h ; scroll up function id.
0
; scroll all lines!
1001_1111b ; attribute for new lines.
0
; upper row.
0
; upper col.
84h ; rows on screen -1,
[di] ; lower row (byte).
4ah ; columns on screen,
[di]
; lower col.

; set cursor position to top


; of the screen:
mov
bh, 0
; current page.
mov
dl, 0
; col.
mov
dh, 0
; row.
mov
ah, 02
int
10h
pop
pop
pop
pop
pop

di
cx
bx
ds
ax

; re-store registers...
;
;
;
;

ret
clear_screen endp

http://read.pudn.com/downloads166/sourcecode/os/759925/microos_kernel.asm__.htm

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 15
push cx
mov bp,0c01bh
mov ah,13h
mov al,01h
mov cx,mes1_len
mov bh,05h
mov bl,02h
mov dh,06h
mov dl,0
int 10h
pop cx
jmp endLine

Write string (EGA+, meaning PC

ATminimum)

AH=13h

AL = Write mode, BH = Page Number, BL = Color, CX = String length, DH = Row, DL =


Column, ES:BP = Offset of string

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 16
mov ah,02h
mov al,1
mov ch,0
mov cl,2
mov dh,0
mov dl,0
mov bx,7f00h
int 13h
mov ah,00h

DISK - READ SECTOR(S) INTO MEMORY


AH = 02h
AL = number of sectors to read (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer

Return:
CF set on error
if AH = 11h (corrected ECC error), AL = burst length
CF clear if successful
AH = status (see #00234)
AL = number of sectors transferred (only valid if CF set for some
BIOSes)

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 17
push
mov
cld
mov
mov
mov
mov
mov
repne
dec
dec
mov
pop
ret

bp
bp,sp
ax,ds
es,ax
di,es
al,0
cx,0ffffh
scasb
di
di
ax,dx
bp

registru al este egal cu null. Scasb verifica byte cu byte caracterele incarcate in di, si le
compara cu valoarea din registru al. Conform ascii 0 = null , deci aici se face o iteratie cu repne
pentru a gasi sfirsitul stringului, si rezultatul pastrat in dx se introduce in ax.

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 18
mov
int
mov
cmp
je
inc
cmp
jb

DOS

ah,1
21h
[StarageBuffer+di],al
al,END_OF_DATA
DataAckquired
di
di,STORAGE_BUFFER_SIZE
StorageLoop

6 http://do.znate.ru/docs/index-14186.html?page=8
6.1 EQU

EQU. :
mov ah,1
int 21h ;
mov [StarageBuffer+di],al ;
cmp al,end_of_data ; " "?
je DataAckquired ; ,
inc di ;
cmp di,storage_buffer_size ; ?
jb StorageLoop ; ,
; ...

S se defineasc la ce este utilizat codul de mai jos,


i s fie descris fiecare funcie din exemplu.

Varianta 19
Temp
I
J
K
;
_Add

_Add

EQU
EQU
EQU
EQU

[bp-2]
[bp+4]
[bp+6]
[bp+8]

PROC
push
mov
sub
mov
add
mov
mov
mov
pop

bp
bp,sp
sp,2
ax,I
ax,J
ax,K
Temp,ax
sp,bp
bp

ret
ENDP

push bp ; save old value of bp


mov bp, sp ; make bp our reference point
sub sp, 2 ; creates a local variable,it can be accessed by [bp-2]

http://books.google.ru/books?id=WLgCBAAAQBAJ&pg=PA650&lpg=PA650&dq=push+bp++++++++++++++++++++++++mov++bp,sp+++++++++++++++++++++sub++sp,2++++++++++++++++++++++mov++ax,I+
+++++++++++++++++++++add++ax,J&source=bl&ots=dz5UImNI58&sig=L2moTB75y-qr-ywZ0b0WUCMxBC8&hl=ru&sa=X&ei=zNhPVLewIoOhyAPO34FY&ved=0CCUQ6AEwAQ#v=onepage&q=push%20bp
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mov%20%20bp%2Csp%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20sub%20%20sp
%2C2%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mov%20%20ax%2CI%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20add%20%20ax
%2CJ&f=false

Varianta 40
KeyLoop:
mov
ah,1
int
21h
mov
[bx],al
inc
bx
cmp
al,0dh
loopne KeyLoop
http://www.codenet.ru/progr/asm/tasm/39.php
, ,
, ENTER
128 .
( LOOPNE):

KeyLoop:
mov

ah,1

int

21h

mov
inc

[bx],al
bx

cmp
al,0dh
loopne KeyLoop

;
;
;
;
;
;
;
;
;
;
;
;

DOS




ENTER?
,
,

S-ar putea să vă placă și