Continued to lesson 28

This commit is contained in:
Lauri Koskenniemi 2025-06-24 10:54:16 +03:00
parent 1c0fcde351
commit 5a0c4a49c7
30 changed files with 282 additions and 0 deletions

BIN
lesson19/l19 Executable file

Binary file not shown.

24
lesson19/l19.asm Normal file
View File

@ -0,0 +1,24 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
command db '/bin/echo', 0h
arg1 db 'Hello World!', 0h
arguments dd command
dd arg1
dd 0h
environment dd 0h
SECTION .text
global _start
_start:
mov edx, environment
mov ecx, arguments
mov ebx, command
mov eax, 11
int 80h
call quit

BIN
lesson19/l19.o Normal file

Binary file not shown.

BIN
lesson20/l20 Executable file

Binary file not shown.

28
lesson20/l20.asm Normal file
View File

@ -0,0 +1,28 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
childMsg db 'Child process', 0h
parentMsg db 'Parent process', 0h
SECTION .text
global _start
_start:
mov eax, 2
int 80h
cmp eax, 0
jz child
parent:
mov eax, parentMsg
call sprintLF
call quit
child:
mov eax, childMsg
call sprintLF
call quit

BIN
lesson20/l20.o Normal file

Binary file not shown.

BIN
lesson21/l21 Executable file

Binary file not shown.

20
lesson21/l21.asm Normal file
View File

@ -0,0 +1,20 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
msg db 'Seconds since Jan 01 1970: ', 0h
SECTION .text
global _start
_start:
mov eax, msg
call sprint
mov eax, 13
int 80h
call iprintLF
call quit

BIN
lesson21/l21.o Normal file

Binary file not shown.

BIN
lesson22/l22 Executable file

Binary file not shown.

18
lesson22/l22.asm Normal file
View File

@ -0,0 +1,18 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'README.md', 0h
SECTION .text
global _start
_start:
mov ecx, 0777o
mov ebx, filename
mov eax, 8
int 80h
call quit

BIN
lesson22/l22.o Normal file

Binary file not shown.

BIN
lesson23/l23 Executable file

Binary file not shown.

25
lesson23/l23.asm Normal file
View File

@ -0,0 +1,25 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'README.md', 0h
contents db 'Hello world!', 0h
SECTION .text
global _start
_start:
mov ecx, 0777o
mov ebx, filename
mov eax, 8
int 80h
mov edx, 12
mov ecx, contents
mov ebx, eax
mov eax, 4
int 80h
call quit

BIN
lesson23/l23.o Normal file

Binary file not shown.

BIN
lesson24/l24 Executable file

Binary file not shown.

31
lesson24/l24.asm Normal file
View File

@ -0,0 +1,31 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'test.txt', 0h
contents db 'Hello world!', 0h
SECTION .text
global _start
_start:
mov ecx, 0777o
mov ebx, filename
mov eax, 8
int 80h
mov edx, 12
mov ecx, contents
mov ebx, eax
mov eax, 4
int 80h
mov ecx, 0
mov ebx, filename
mov eax, 5
int 80h
call iprintLF
call quit

BIN
lesson24/l24.o Normal file

Binary file not shown.

BIN
lesson25/l25 Executable file

Binary file not shown.

42
lesson25/l25.asm Normal file
View File

@ -0,0 +1,42 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'test.txt', 0h
contents db 'Hello world!', 0h
SECTION .bss
fileContents resb 255,
SECTION .text
global _start
_start:
mov ecx, 0777o
mov ebx, filename
mov eax, 8
int 80h
mov edx, 12
mov ecx, contents
mov ebx, eax
mov eax, 4
int 80h
mov ecx, 0
mov ebx, filename
mov eax, 5
int 80h
mov edx, 12
mov ecx, fileContents
mov ebx, eax
mov eax, 3
int 80h
mov eax, fileContents
call sprintLF
call quit

BIN
lesson25/l25.o Normal file

Binary file not shown.

BIN
lesson26/l26 Executable file

Binary file not shown.

46
lesson26/l26.asm Normal file
View File

@ -0,0 +1,46 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'test.txt', 0h
contents db 'Hello world!', 0h
SECTION .bss
fileContents resb 255,
SECTION .text
global _start
_start:
mov ecx, 0777o
mov ebx, filename
mov eax, 8
int 80h
mov edx, 12
mov ecx, contents
mov ebx, eax
mov eax, 4
int 80h
mov ecx, 0
mov ebx, filename
mov eax, 5
int 80h
mov edx, 12
mov ecx, fileContents
mov ebx, eax
mov eax, 3
int 80h
mov eax, fileContents
call sprintLF
mov ebx, ebx ; not needed: takes fd from ebx
mov eax, 6
int 80h
call quit

BIN
lesson26/l26.o Normal file

Binary file not shown.

BIN
lesson27/l27 Executable file

Binary file not shown.

31
lesson27/l27.asm Normal file
View File

@ -0,0 +1,31 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'test.txt', 0h
contents db '-updated-', 0h
SECTION .text
global _start
_start:
mov ecx, 1
mov ebx, filename
mov eax, 5
int 80h
mov edx, 2
mov ecx, 0
mov ebx, eax
mov eax, 19
int 80h
mov edx, 9
mov ecx, contents
mov ebx, ebx
mov eax, 4
int 80h
call quit

BIN
lesson27/l27.o Normal file

Binary file not shown.

BIN
lesson28/l28 Executable file

Binary file not shown.

17
lesson28/l28.asm Normal file
View File

@ -0,0 +1,17 @@
; %include '../lib/fl.asm' ; local
%include 'lib/fl.asm' ; build.sh
SECTION .data
filename db 'test.txt', 0h
SECTION .text
global _start
_start:
mov ebx, filename
mov eax, 10
int 80h
call quit

BIN
lesson28/l28.o Normal file

Binary file not shown.