Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------Задание 1
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- type db "vvedite chislo (0-9): $"
- pkey db 10, 13, "press any key...$"
- endl db 10,13, "$"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- lea dx, type
- mov ah, 9
- int 21h
- mov ah, 1
- int 21h
- sub al, 2Fh
- mov cx, 0
- mov cl, al
- mov bx, 0
- lea dx, endl
- mov ah, 9
- int 21h
- loop_start:
- mov ax, bx
- OutInt proc ;output number 0 - 99
- aam
- add ax,3030h
- mov dl,ah
- mov dh,al
- mov ah,02
- cmp dl,48 ;is the number starts as 0
- je next
- int 21h
- next:
- mov dl,dh
- int 21h
- OutInt endp
- inc bx
- loop loop_start
- 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.
- //-----------------------------Задание 2
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- pkey db 10,13, "press any key...$"
- endl db 10,13, "$"
- count dw -1
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- loop_start:
- inc count
- mov ah, 1
- int 21h
- cmp al, 13
- jne loop_start
- lea dx, endl
- mov ah, 9
- int 21h
- mov ax, count
- OutInt proc ;output number 0 - 99
- aam
- add ax,3030h
- mov dl,ah
- mov dh,al
- mov ah,02
- cmp dl,48 ;is the number starts as 0
- je next
- int 21h
- next:
- mov dl,dh
- int 21h
- OutInt endp
- 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