Moving and consolidating repos

This commit is contained in:
klein panic
2025-04-14 17:05:27 -04:00
parent 0529e3c972
commit 3a7f7e1e13
36 changed files with 799 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,39 @@
sction .data
prompt db 'Please enter your name: ', 0 ; Null-terminated prompt message
promptLen equ $ - prompt ; Length of the prompt message
buffer db 128 dup(0) ; Buffer for the input
bufferLen equ 128 ; Maximum buffer length
section .bss
name resb 128 ; Reserve buffer for name
section .text
global _start
_start:
; Print prompt
mov eax, 4 ; sys_write syscall
mov ebx, 1 ; File descriptor 1 - stdout
mov ecx, prompt ; Pointer to the message to print
mov edx, promptLen ; Message length
int 0x80 ; Call the kernel
; Read input
mov eax, 3 ; sys_read syscall
mov ebx, 0 ; File descriptor 0 - stdin
mov ecx, buffer ; Pointer to the input buffer
mov edx, bufferLen ; Maximum number of bytes to read
int 0x80 ; Call the kernel
; Print greeting
mov eax, 4 ; sys_write syscall
mov ebx, 1 ; File descriptor 1 - stdout
mov ecx, buffer ; Pointer to the buffer to print
; Use the number of bytes read as the length to write
int 0x80 ; Call the kernel
; Exit program
mov eax, 1 ; sys_exit syscall
xor ebx, ebx ; Exit code 0
int 0x80 ; Call the kernel

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,61 @@
section .data
numberone db 'Enter fst number: ', 0 ; Null terminated string
numbertwo db 'Enter snd number: ', 0 ; Null terminated string
numonelen equ $ - numberone ; length of prompt 1
numtwolen equ $ - numbertwo ; length of prompt 2
section .bss
numone resb 128 ; reserve for number 1 input
numtwo resb 128 ; reserve for number 2 input
result resb 128 ; reserve for result of addition
section .text
global _start
_start:
; Number 1 prompt
mov eax, 4 ; sys_write syscall in 32 bit registry eax
mov ebx, 1 ; Stdout syscall in 32 bit registry ebx
mov ecx, numberone ; move null terminated string to 32 bit registry ecx
mov edx, numtwolen ; length of null terminated (value) moved to 32 bit registry edx
int 0x80 ; Interrupt kernel, reset
; Number 1 Read
mov eax, 3 ; Sys_read sysclal in 32 bit registry
mov ebx, 0 ; stdin file descriptor in 32 bit regstry
mov ecx, numone ; pointer for input
mov edx, 128 ; maxomim number of bytes to Read
int 0x80 ; Interrupt kernel, reset
; Number 2 prompt
mov eax, 4
mov ebx, 1
mov ecx, numbertwo
mov edx, numtwolen
int 0x80
; Number 2 Read
mov eax, 3
mov ebx, 0
mov ecx, numtwo
mov edx, 128
int 0x80
; Print result
mov eax, 4 ; Sys_write syscall for 32 bit register eax
mov ebx, 1 ; Stdout
mov ecx, numone
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, numtwo
int 0x80
; exit
mov eax, 1 ; sys_exit
xor ebx, ebx ; exit with code 0
int 0x80

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,49 @@
section .data
prompt db "What is your name? ", 10
output1 db "Hello, "
section .bss
input resb 34
section .text
global _start
_start:
call _getInput
call _printOutput1
call _printInput
mov rax, 60
mov rdi, 0
syscall
_getInput:
mov rax, 0
mov rdi, 0
mov rsi, input
mov rdx, 34 ; related to resb
syscall
ret
_printPrompt:
mov rax, 1
mov rdi, 1
mov rsi, prompt
mov rdx, 20 ; change for size of bytes reserved
syscall
ret
_printOutput1:
mov rax, 1
mov rdi, 1
mov rsi, output1
mov rdx, 7 ; change for size of db
syscall
ret
_printInput:
mov rax, 1
mov rdi, 1
mov rsi, input
mov rdx, 34 ; change for resb
syscall
ret

Binary file not shown.