ZIP indir
0
main
1 dal
git@carbon4code.com:ahmet/dr-quine.git
Ahmet Kerem Sezgin Make filelar tamam
11 commit
dr-quine ASM Colleen.s
Colleen.s 1.6 KB
;Global commentoo

global _start

section .text

_start:
    ; scope commentoo
    mov rbx, template

.next_byte:
    mov al, [rbx]
    cmp al, 0
    je .exit
    cmp al, 0x40
    je .emit_newline
    cmp al, 0x25
    je .emit_data_line
    mov rsi, rbx
    mov rdx, 1
    call print
    jmp .advance

.emit_newline:
    mov rsi, newline
    mov rdx, 1
    call print
    jmp .advance

.emit_data_line:
    mov rsi, quote
    mov rdx, 1
    call print
    mov rsi, template
    mov rdx, template_len
    call print
    mov rsi, quote
    mov rdx, 1
    call print

.advance:
    inc rbx
    jmp .next_byte

.exit:
    mov rax, 60
    xor rdi, rdi
    syscall

print:
    mov rax, 1
    mov rdi, 1
    syscall
    ret

section .data

template: db ";Global commentoo@@global _start@@section .text@@_start:@    ; scope commentoo@    mov rbx, template@@.next_byte:@    mov al, [rbx]@    cmp al, 0@    je .exit@    cmp al, 0x40@    je .emit_newline@    cmp al, 0x25@    je .emit_data_line@    mov rsi, rbx@    mov rdx, 1@    call print@    jmp .advance@@.emit_newline:@    mov rsi, newline@    mov rdx, 1@    call print@    jmp .advance@@.emit_data_line:@    mov rsi, quote@    mov rdx, 1@    call print@    mov rsi, template@    mov rdx, template_len@    call print@    mov rsi, quote@    mov rdx, 1@    call print@@.advance:@    inc rbx@    jmp .next_byte@@.exit:@    mov rax, 60@    xor rdi, rdi@    syscall@@print:@    mov rax, 1@    mov rdi, 1@    syscall@    ret@@section .data@@template: db %, 0@template_len equ $ - template - 1@newline: db 10@quote: db 0x22@", 0
template_len equ $ - template - 1
newline: db 10
quote: db 0x22