more align examples

This commit is contained in:
Igor M 2024-03-17 14:05:00 +02:00
parent f8ea125d0f
commit 7b098ff98c
2 changed files with 6 additions and 3 deletions

View file

@ -18,7 +18,9 @@ hello_string:
hello_string_end: hello_string_end:
.db 42, "hi", 43 .db 42, "hi", 43
; TODO .db 'H', 'e', 'l', 'l', 'o', '\0' ; TODO .db 'H', 'e', 'l', 'l', 'o', '\0'
.align 2
.dw 0x4546
.align 4 .align 4
.dw 42 .dd 0x4748494a
.dd 42 .align 8
.dq 42 .dq 0x5051525354555657

View file

@ -132,6 +132,7 @@ AsmError assemble_directive(char *input, size_t len, ByteVec *out, Token *tok) {
if (ensure_push(out, 1, aligned - out->len) != 0) { if (ensure_push(out, 1, aligned - out->len) != 0) {
return ErrOutOfMemory; return ErrOutOfMemory;
} }
// TODO: zero-fill?
out->len = aligned; out->len = aligned;
} }
return ErrOk; return ErrOk;