Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- str1 db "Vnesi n:$"
- first db 10 dup(?)
- last db 10 dup(?)
- str1 db "Nema greska$"
- str2 db "Greska$"
- pkey db "press any key...$"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- read proc
- lea si,first
- lea di,last
- prvpat:
- cmp cl,0
- je kraj
- mov ah,1h
- int 21h
- mov ah,0d
- mov si,ax
- jmp citaj
- citaj:
- mov ah,01h
- int 21h
- cmp al,'-'
- je poslednabukva
- mov [bx],al
- jmp citaj
- poslednabukva:
- mov di,[bx]
- dec cl
- jmp prvpat
- kraj:
- ret
- read endp
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- mov ah,9h
- lea dx,str1
- int 21h
- mov ah,01h
- int 21h
- mov cx,0d
- sub al,30h
- mov cl,al
- call read
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement