Created
March 21, 2023 15:11
-
-
Save amostyaev/a56988cb570b0984d8cd08a6670014b8 to your computer and use it in GitHub Desktop.
Семинар от 21 марта
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INCLUDE settings.inc | |
INCLUDE io2020.inc | |
.STACK 4096 | |
.DATA | |
FStr DB 'The program starts working.',0 | |
LStr DB 'The program has ended.',0 | |
X DQ 0 | |
S DB 0 | |
N DD ? | |
.CODE | |
start: OUTSTR offset FStr | |
NEWLINE | |
; 4.10 | |
; MOV EBX, 10 | |
; ININT EAX | |
; MOV EDX, 0 | |
; DIV EBX ; EAX := N div 10; EDX := n mod 10 | |
; OUTU EDX | |
; NEWLINE | |
; OUTU EAX | |
; NEWLINE | |
; 4.14 | |
; INCHAR AL | |
; SUB AL, 'A' - 'a' | |
; OUTCHAR AL | |
; NEWLINE | |
; 5.10 | |
; CMP dword ptr X+4, 0 | |
; JGE G | |
; MOV S, -1 | |
; JMP KON | |
; G: | |
; JE E | |
; MOV S, 1 | |
; JMP KON | |
; E: | |
; CMP dword ptr X, 0 | |
; JNE QQ | |
; MOV S, 0 | |
; JMP KON | |
; QQ: | |
; MOV S, 1 | |
; KON: | |
; MOV AL, S | |
; CBW | |
; CWDE | |
; OUTI EAX | |
; 5.24 | |
ININT N | |
MOV EBX, 0 | |
MOV ECX, N | |
L: | |
MOV EAX, N | |
MOV EDX, 0 | |
DIV ECX | |
CMP EDX, 0 | |
JNE Q | |
INC EBX | |
Q: | |
LOOP L | |
OUTU EBX | |
OUTSTR offset LStr | |
NEWLINE | |
EXIT | |
END start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment