Skip to content

Commit d5df6be

Browse files
authored
Update fire-gem-0002.asm to version 4.85
1 parent 5fa544e commit d5df6be

1 file changed

Lines changed: 53 additions & 44 deletions

File tree

fire-gem-0002.asm

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,97 @@
11
; /*******************************************************************************
22
; * TYPE: LAW | CLASS: PROCESSOR | NAME: fire-gem-0002.asm
3-
; * IDENTITY: VERSION 4.84 // PATH_ALIGNED // HAHA!
4-
; * ROLE: Devour Materialized CBORD Mirror & Execute Terminal Language.
3+
; * IDENTITY: VERSION 4.85 // AUTO-MATERIALIZE // HAHA!
4+
; * ROLE: Devour Vault. If Vault is empty, Materialize target placeholder.
55
; *******************************************************************************/
66

77
section .data
8-
; UPDATED PATH TO MATCH YOUR TARGET
98
cbord_dir db "fire-gem/artifacts/json/cbord/reg/", 0
9+
test_file db "fire-gem/artifacts/json/cbord/reg/materialized_001.exe", 0
1010
11-
ack_msg db "[ACK] GEM-0002: VAULT DETECTED. DEVOURING DROP...", 10
12-
ack_len equ 48
13-
err_msg db "[NACK] GEM-0002: VAULT NOT FOUND AT JSON/CBORD/REG/", 10
14-
err_len equ 52
11+
ack_msg db "[ACK] GEM-0002: VAULT ACTIVE. DEVOURING...", 10
12+
ack_len equ 45
13+
mat_msg db "[ACK] GEM-0002: VAULT EMPTY. MATERIALIZING 001...", 10
14+
mat_len equ 49
15+
elf_magic db 0x7f, 'E', 'L', 'F'
1516

1617
section .bss
1718
dir_buf resb 4096
18-
fd_in resq 1
19+
fd_out resq 1
1920

2021
section .text
2122
global _start
2223

2324
_start:
24-
; 1. OPEN CBORD VAULT
25-
mov rax, 2
25+
; 1. OPEN VAULT
26+
mov rax, 2 ; sys_open
2627
mov rdi, cbord_dir
27-
xor rsi, rsi
28+
xor rsi, rsi ; O_RDONLY
2829
syscall
29-
3030
test rax, rax
31-
js exit_error
32-
33-
mov r8, rax ; Save FD
31+
js exit_error
32+
mov r8, rax ; Vault FD
3433

35-
scan_cbord:
3634
; 2. CRAWL NAMESPACE
37-
mov rax, 217
35+
mov rax, 217 ; sys_getdents64
3836
mov rdi, r8
3937
mov rsi, dir_buf
4038
mov rdx, 4096
4139
syscall
42-
43-
cmp rax, 0
44-
jle close_exit
4540

46-
; --- FLUSH PROTOCOL (Ensures Log Visibility) ---
47-
mov rcx, 10 ; Reduced to 10 for cleaner logs now that it works
41+
; 3. CHECK IF EMPTY (nread <= 48 approx for . and ..)
42+
cmp rax, 48
43+
jle materialize_target
44+
45+
; --- DEVOUR LOOP ---
46+
mov rcx, 5
4847
.flush:
4948
push rcx
50-
push rax
51-
mov rax, 1
52-
mov rdi, 1
49+
mov rax, 1 ; sys_write
50+
mov rdi, 1
5351
mov rsi, ack_msg
5452
mov rdx, ack_len
5553
syscall
56-
pop rax
5754
pop rcx
58-
loop .flush
55+
loop .flush
56+
jmp close_exit
5957

60-
jmp scan_cbord
58+
materialize_target:
59+
; 4. DROP FILE INTO EMPTY VAULT
60+
mov rax, 2 ; sys_open
61+
mov rdi, test_file
62+
mov rsi, 65 ; O_CREAT | O_WRONLY
63+
mov rdx, 0755o ; Executable permissions
64+
syscall
65+
mov [fd_out], rax
6166

62-
close_exit:
63-
mov rax, 3
64-
mov rdi, r8
67+
; Seat ELF Handshake
68+
mov rax, 1
69+
mov rdi, [fd_out]
70+
mov rsi, elf_magic
71+
mov rdx, 4
6572
syscall
66-
jmp exit_success
6773

68-
exit_success:
69-
mov rax, 60
70-
xor rdi, rdi
74+
; Close Drop
75+
mov rax, 3
76+
mov rdi, [fd_out]
7177
syscall
7278

73-
exit_error:
74-
; 3. ERROR LOGGING
75-
mov rcx, 10
76-
.err_flush:
77-
push rcx
79+
; Log Materialization
7880
mov rax, 1
7981
mov rdi, 1
80-
mov rsi, err_msg
81-
mov rdx, err_len
82+
mov rsi, mat_msg
83+
mov rdx, mat_len
84+
syscall
85+
86+
close_exit:
87+
mov rax, 3 ; close vault
88+
mov rdi, r8
89+
syscall
90+
mov rax, 60 ; exit
91+
xor rdi, rdi
8292
syscall
83-
pop rcx
84-
loop .err_flush
8593

94+
exit_error:
8695
mov rax, 60
8796
mov rdi, 1
8897
syscall

0 commit comments

Comments
 (0)