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
+25
View File
@@ -0,0 +1,25 @@
bits 32 ; assembling for the 32 bits architecture
; declare the EntryPoint (a label defining the very first instruction of the program)
global start
; declare external functions needed by our program
extern exit ; tell nasm that exit exists even if we won't be defining it
import exit msvcrt.dll ; exit is a function that ends the calling process. It is defined in msvcrt.dll
; msvcrt.dll contains exit, printf and all the other important C-runtime specific functions
; our data is declared here (the variables needed by our program)
segment data use32 class=data
; ...
a db 255
b dd 100h
; our code starts here
segment code use32 class=code
start:
; exit(0)
push dword 0 ; push the parameter for exit onto the stack
call [exit] ; call exit to terminate the program
+23
View File
@@ -0,0 +1,23 @@
; The code below will calculate the result of some arithmetic operations in the EAX register, save the value of the registers, then display the result value and restore the value of the registers.
bits 32
global start
; declare extern functions
extern exit, printf
import exit msvcrt.dll
import printf msvcrt.dll ; tell assembler function is found in library msvcrt.dll
segment data use32 class=data
segment code use32 class=code
start:
; will calculate 20 + 123 + 7 in EAX
mov al, 250>>4
mov al,0ffffh>>4
mov al,0efffh>>12
mov al,-1>>4
mov al,-1>>12
push dword 0 ; we place on stack parameter for exit
call [exit] ; call exit to end the program