mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
66 lines
701 B
NASM
66 lines
701 B
NASM
# Test assembly file
|
|
# Wololo!
|
|
|
|
hw = 'Hello World'
|
|
|
|
;
|
|
; Entry point
|
|
;
|
|
main:
|
|
; This comment is successfully ignored
|
|
mov rbp, 0x200000
|
|
mov rsp, rbp
|
|
|
|
mov ax0, hw
|
|
call print
|
|
|
|
mov ax0, hw
|
|
mov ax1, hw_len
|
|
call print_n
|
|
|
|
stop
|
|
|
|
;
|
|
; Max amount of characters that print() will print
|
|
;
|
|
v_print_max := 0xFF
|
|
|
|
;
|
|
; void print(char *)
|
|
;
|
|
; Print a string
|
|
;
|
|
print:
|
|
enter
|
|
mov rcx, v_print_max
|
|
|
|
.p1:
|
|
test b[ax0], b[ax0]
|
|
jz .p2
|
|
prn b[ax0]
|
|
inc ax0
|
|
loop .p1
|
|
|
|
.p2:
|
|
leave
|
|
ret
|
|
|
|
|
|
;
|
|
; void print_n(char *, int)
|
|
;
|
|
; Print exactly ax1 characters
|
|
;
|
|
print_n:
|
|
enter
|
|
mov rcx, ax1
|
|
|
|
.pn1:
|
|
prn b[ax0]
|
|
inc ax0
|
|
loop .pn1
|
|
|
|
leave
|
|
ret
|
|
|