Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACCEPT] Tokun lab4 #163

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tokun/lab4/Tokun_GS_1303_report.docx
Binary file not shown.
Binary file added tokun/lab4/Tokun_GS_1303_report.pdf
Binary file not shown.
66 changes: 66 additions & 0 deletions tokun/lab4/lr4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include <iostream>
#include <stdio.h>
#include <clocale>

char instr[81];
char outstr[162];

int main()
{
setlocale(LC_ALL, "cp866");
fgets(instr, 81, stdin);
instr[strlen(instr) - 1] = '\0';
__asm {
push ds
pop es
mov esi, offset instr
mov edi, offset outstr
L :
lodsb; копирует один байт в al
; space (32)
cmp al, 32
jne skip1
stosb
jmp final

; 0 - 9 (48 - 57)
skip1:
cmp al, 48
jb final
cmp al, 57
ja skip2
stosb
jmp final

; A - п (128 - 175)
skip2:
cmp al, 128
jb final
cmp al, 175
ja skip3
stosb
jmp final

; р - ё(224 - 241)
skip3:
cmp al, 224
jb final
cmp al, 241
ja final
stosb
ja final

final:
mov ecx, '\0'
cmp ecx, [esi]
je LExit;
jmp L
LExit :
};

std::cout << outstr;
FILE* f;
fopen_s(&f, "out.txt", "w");
fwrite(outstr, sizeof(char), strlen(outstr), f);
return 0;
}