Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .386
- .model large
- .DATA
- message db 'AX: $'
- code segment
- assume cs:code, ds:code, es:code, ss:code
- org 100h
- start:
- ;??????? ?? ??????
- jmp beg ;??????????? ???????
- print_symbol:
- ;??????????? ??????
- push ax
- push dx
- mov ah, 02h ;????? ?? ???????
- mov dl, dh ;dl - ?????? ?????????
- cmp dl, 0 ;c????????? ? ?????
- je t2 ;???????? ???????, ???? ZF=1; ??????? ???? ???? ??? ?????
- int 21h
- t2:
- pop dx
- int 21h
- pop ax
- ret ; ?????? ????????? ?????? ?? ?????, ????? ??????? ????
- print_number:
- ;??????????? ?????, base = 10
- push ax
- push bx
- push cx
- push dx
- mov ax, dx
- mov bx, 10
- mov cx, 0
- getdigits:
- mov dx, 0
- div bx
- inc cx
- add dx,
- push dx
- cmp ax, 0
- jnz getdigits
- mov ah, 02h
- printdigits:
- pop dx
- int 21h
- loop printdigits
- pop dx
- pop cx
- pop bx
- pop ax
- ret
- debug:
- ;????????? ????????, ????????? ??????????
- cli ;Clear Interrupt-Enable Flag IF
- push bp
- mov bp, sp
- push ax
- push bx
- push cx
- push dx
- push si
- ;????? ax
- mov ah,09h
- lea dx,message
- int 21h
- mov dx, [bp-2]
- call print_number
- mov dx, etr
- call print_symbol
- ;??????? ??????? ???????
- xor ax, ax
- int 16h
- ;???????? ??????
- mov ah, 02h
- mov dl, 07h ; ASCII ??? ??????? BELL
- int 21h ; ??????? ?????
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pop bp
- sti
- iret
- ;???????????? ?????????
- thread:
- mov ax, 1
- mov cx, 10
- t1:
- add ax, ax
- loop t1
- ret
- beg:
- ;????????? ?????? ??????????
- mov ax, 3501h ; 01h - ???? ? ??????????
- int 21h
- mov old, bx
- mov old+2, es
- ;?????????? ????? ??????????
- push cs ;??????? ????(???????? ??????) ??????????? ? ?????? ?????? ?????????
- pop ds
- mov dx, offset debug ;????? ????? ????? ??????
- mov ax, 2501h
- int 21h ;??????????? ?????????? DOS ????????? ?? ???????? ah
- ;????????? ???????? ??? ????????
- pushf
- push offset exit
- ;????????? TF ????, ?? ????????? ????????? ???????, ????? ????? ??????
- ; ?????????? ?????????? ?????????? ????????? ? ????? ???????????? ???????????
- pushf
- pop ax
- or ax, 0100h ;TF ???? ???????????????
- push ax
- push cs ;???????? ???????? ????
- push offset thread ;???????????? ????? ?? ??? ???????
- iret ;????????? ?? ????? ????? ???????? ip(thread) ????? cs ?????
- ;???? ??????????? ???????? ????????? ?????? ??????? ?? ? ax ????????
- exit:
- popf ; ??????????????? ???????? ???????? ??????
- ;?????????? ?????? ??????????
- lea dx, old
- mov ax, 2501h
- int 21h
- ;????? ????? ??????? ???????
- mov ax, 4c00h
- int 21h
- int 20h
- old dw 0h, 0h ;dw - 2 ????? ??? ??????????
- etr dw 0Ah, 0Dh ;???? ?????????? ? ??????? ??????????
- code ends
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement