School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
bits 32
global start
extern exit,function,printf
import exit msvcrt.dll
import printf msvcrt.dll
segment data use32 class=data
str1 db "hello ",0
str2 db "world",0
new_str resb 100
format db "%s",0
segment code use32 class=code
start:
push dword str1
push dword str2
push dword new_str
call function
add ESP,4*3
push dword new_str
push dword format
call [printf]
add ESP,4*2
push dword 0
call [exit]
@@ -0,0 +1,19 @@
bits 32
global function
segment code use32 class=code public
function:
mov esi, [esp+12]
mov edi, [esp+4]
loop1:
movsb
cmp [esi], byte 0
jne loop1
mov esi, [esp+8]
loop2:
movsb
cmp [esi], byte 0
jne loop2
mov [edi], byte 0
ret
+30
View File
@@ -0,0 +1,30 @@
bits 32
global start
extern sum,exit,printf,scanf
import exit msvcrt.dll
import printf msvcrt.dll
import scanf msvcrt.dll
segment data use32 class=data
format db "%u",0
n dd 0
result dd 0
segment code use32 class=code
start:
push dword n
push dword format
call [scanf]
add ESP,4*2
push dword result
push dword [n]
call sum
add ESP,4*2
push dword [result]
push dword format
call [printf]
add ESP,4*2
push dword 0
call [exit]
@@ -0,0 +1,20 @@
bits 32
global sum
segment code use32 class=code
sum:
mov EAX,[ESP+4]
mov EBX,0
mov ECX,10
loop1:
cmp eax,0
je end
mov EDX,0
div ECX
add EBX,EDX
jmp loop1
end:
mov EDX,[ESP+8]
mov [EDX],EBX
ret
+70
View File
@@ -0,0 +1,70 @@
bits 32
global start
extern exit, printf, scanf, fopen, fclose, fread
import exit msvcrt.dll
import printf msvcrt.dll
import scanf msvcrt.dll
import fopen msvcrt.dll
import fclose msvcrt.dll
import fread msvcrt.dll
segment data use32 class=data
format db "%X", 0
n dd 0
path db "textfile.txt", 0
mode db "r", 0
filehandle dd 0
s db 0
string resb 17
segment code use32 class=code
start:
push dword n
push dword format
call [scanf]
add esp, 4*2
push dword mode
push dword path
call [fopen]
add esp, 4*2
cmp eax, 0
jz end
mov [filehandle], eax
mov eax,0
mov ax, [n]
mov edi, string
loop_label:
push eax
push edi
push dword [filehandle]
push dword 1
push dword 1
push dword s
call [fread]
add esp, 4*3
cmp eax, 0
jz end
pop edi
pop eax
shr eax, 1
jnc loop_label
mov edx,[s]
mov [edi], edx
inc edi
jmp loop_label
end:
mov byte [edi], 0
push dword string
call [printf]
add esp, 4
push dword [filehandle]
call [fclose]
add esp, 4
push dword 0
call [exit]
@@ -0,0 +1 @@
0123456789abcdef