Continued to lesson 28

This commit is contained in:
2025-06-24 10:54:16 +03:00
parent 1c0fcde351
commit 5a0c4a49c7
30 changed files with 282 additions and 0 deletions
Executable
BIN
View File
Binary file not shown.
+24
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+28
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+20
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+18
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+25
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+31
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+42
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+46
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+31
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
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+17
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
View File
Binary file not shown.