1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/ka/main.k

140 lines
1.7 KiB
Plaintext
Raw Normal View History

2019-05-30 12:44:56 +02:00
; The OS/K Team licenses this file to you under the MIT license.
2019-05-30 12:27:13 +02:00
; See the LICENSE file in the project root for more information.
;
; Main function
;
main:
2019-06-14 12:40:49 +02:00
mov rbx, 10
lea rax, b[rbx + -1]
2019-06-13 22:20:35 +02:00
ret
stosb_test:
2019-06-13 17:13:59 +02:00
cld
mov rcx, 11
mov rax, 33
mov rdi, .buf
mov rsi, .buf
rep stosb
mov rbx, rdi
sub rbx, rsi
mov ax0, .buf
mov ax1, 12
call print_n
ret
.str1 = "Hello World!\n"
.buf = [32]
movzx_test:
2019-06-13 15:00:48 +02:00
enter 1
mov q[rsp], 0xFABC1234CCCCDDDD
mov rax, b[rsp]
mov rbx, w[rsp]
mov rcx, l[rsp]
mov rdx, q[rsp]
movzx rsx, b[rsp]
movzx rbi, w[rsp]
movzx rdi, l[rsp]
movzx rsi, q[rsp]
leave
2019-06-12 18:43:24 +02:00
ret
2019-05-30 12:27:13 +02:00
2019-06-12 18:43:24 +02:00
itoa_test:
2019-06-05 22:11:45 +02:00
mov ax0, .buf
2019-06-13 22:20:35 +02:00
mov ax1, LONG_MIN
2019-06-05 22:11:45 +02:00
mov ax2, 10
call itoa
mov ax0, rax
call print
2019-06-05 22:59:32 +02:00
prn 10
2019-06-05 22:11:45 +02:00
mov ax0, .buf
2019-06-05 22:59:32 +02:00
mov ax1, 0xfff85ffffffffff4
2019-06-05 22:11:45 +02:00
mov ax2, 16
call itoa
mov ax0, rax
call print
ret
.buf = [32]
2019-06-06 22:07:34 +02:00
devtest:
2019-06-05 22:11:45 +02:00
enter
2019-06-05 19:31:48 +02:00
mov ax0, .buf
devctl 0, 1
2019-05-30 21:46:00 +02:00
mov ax0, .buf
call print
2019-06-05 19:48:56 +02:00
iocall 0, 0
2019-06-05 19:31:48 +02:00
leave
ret
.buf = [32]
2019-06-13 22:20:35 +02:00
str_test:
2019-05-30 12:39:24 +02:00
mov ax0, .msg
call print
2019-06-13 22:20:35 +02:00
mov ax0, .buf1
2019-05-30 18:31:50 +02:00
mov ax1, .msg
2019-06-13 22:20:35 +02:00
call strcpy
prn 10
mov ax0, .buf1
call print
mov ax0, .buf2
mov ax1, .msg
mov ax2, 8
2019-05-30 21:46:00 +02:00
call strnzcpy
2019-05-30 18:31:50 +02:00
2019-05-30 19:07:04 +02:00
prn 10
2019-06-13 22:20:35 +02:00
mov ax0, .buf2
mov ax1, 12
2019-05-30 21:46:00 +02:00
call print_n
2019-05-30 12:39:24 +02:00
2019-06-13 22:20:35 +02:00
mov ax0, .msg
mov ax1, .buf1
call strcmp
mov rbx, rax
mov ax0, .buf2
2019-05-31 21:25:56 +02:00
mov ax1, .msg
call strcmp
2019-06-13 22:20:35 +02:00
mov rsx, rax
mov ax0, .msg
call strlen
2019-05-31 21:25:56 +02:00
2019-05-30 12:39:24 +02:00
ret
2019-06-13 22:20:35 +02:00
.msg = "Hello World :)"
.buf1 = [32]
.buf2 = "!!!!!!!!!!!!!"
2019-05-30 12:39:24 +02:00
;
; Exit function
;
exit:
mov ax0, .msg
2019-05-30 12:27:13 +02:00
call print
ret
2019-05-30 12:39:24 +02:00
.msg = "Goodbye World :(\n"