assembler: emu8086
os: ms-dos shell in windows 7 32bit
توجه کنید که برنامه ای که نوشتم فقط با همین اسمبلر 8086 کامپایل میشه و در پوسته داس ویندوز 32 بیتی اجرا میشه!
; multi-segment executable file template.
data segment
; add your data here!
cr equ 0dh
lf equ 0ah
pmsg db " input is correct!!...$"
pl db cr , lf
pkey db "press any key to exit of program...$"
cbyte1 db 0x72 ; r
cbyte2 db 0x65 ; e
cbyte3 db 0x7a ; z
cbyte4 db 0x61 ; a
nl equ 00h
msgx db 32h dup (nl)
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax, @data ; set segment registers:
mov ds, ax
mov ax, offset msgx
call Getstr
Getstr:
push ax
push bx
push cx
push dx
mov bx, ax
call Section0
ret
Getchr:
push bx
push cx
push dx
mov ah, 01h
int 21h
pop dx
pop cx
pop bx
ret
Section0:
call Getchr
mov byte ptr [bx], al
mov al,cbyte1
cmp byte ptr [bx], al
je Section1
ret
Section1:
call Getchr
mov byte ptr [bx], al
mov al,cbyte2
cmp byte ptr [bx], al
je Section2
ret
Section2:
call Getchr
mov byte ptr [bx], al
mov al,cbyte3
cmp byte ptr [bx], al
je Section3
ret
Section3:
call Getchr
mov byte ptr [bx], al
mov al,cbyte4
cmp byte ptr [bx], al
je Getstrfree
inc bx
jmp Section0
ret
Getstrfree:
lea dx, pmsg
mov ah, 9
int 21h ; output string at ds:dx
lea dx, pl
mov ah, 9
int 21h ; output string at ds:dx
mov byte ptr [bx], nl
pop dx
pop cx
pop bx
pop ax
call Exit
ret
Exit:
mov ah, 1 ; wait for any key....
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
خروجی باینری را هم تست کردمضمیمه 149650