Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 100h
- Welcome:
- mov ah, 09h
- mov dx, strWelcome
- int 21h
- call NewLine
- movzx eax, [number]
- call OPNum
- mov ah, 09h
- test [number], 0001h
- jz @Even
- mov dx, strOdd
- int 21h
- jmp EchoWait
- @Even:
- mov dx, strEven
- int 21h
- EchoWait:
- mov ax, 0c08h ;like "readln;" in delphi
- int 21h
- test al,al
- jnz Skip
- mov ah, 08h
- int 21h
- Skip:
- ret
- ;================================================
- strWelcome db "Hello!$"
- strNewLine db $0a, $0d, "$"
- strEven db " is even$"
- strOdd db " is odd$"
- number db 201
- NewLine:
- mov ah, 09h
- mov dx, strNewLine
- int 21h
- ret
- OPNum:
- push si
- push bx
- push cx
- cmp eax,0
- jns .noneg
- push dx
- push ax
- mov ah, 02h
- mov dl, '-'
- int 21h
- pop ax
- pop dx
- neg eax
- .noneg:
- mov si, 0
- mov ebx, 10
- .Diving:
- xor edx, edx
- div ebx
- push dx
- inc si
- cmp eax, 0
- jnz .Diving
- mov ah, 02h
- mov cx, si
- .OPa:
- pop dx
- add dl, 30h
- int 21h
- loop .OPa
- pop cx
- pop bx
- pop si
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement