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

106 lines
1.3 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-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-05 22:59:32 +02:00
mov ax1, -9223372036854775807
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
2019-06-06 14:57:34 +02:00
mov rsi, 0x10
mov rdi, 8
2019-06-12 15:58:57 +02:00
lea rbi, b[rdi + rsi * 2 + 1]
2019-06-06 14:57:34 +02:00
2019-06-05 22:11:45 +02:00
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-06 22:07:34 +02:00
strtest:
2019-06-05 19:31:48 +02:00
enter
2019-05-30 12:39:24 +02:00
mov ax0, .msg
call print
2019-05-30 18:31:50 +02:00
mov ax0, .buf
mov ax1, .msg
2019-05-30 21:46:00 +02:00
mov ax2, 5
call strnzcpy
2019-05-30 18:31:50 +02:00
2019-05-30 19:07:04 +02:00
prn 10
2019-05-30 18:31:50 +02:00
mov ax0, .buf
2019-05-30 21:46:00 +02:00
mov ax1, 10
call print_n
2019-05-30 12:39:24 +02:00
2019-05-31 21:25:56 +02:00
mov ax0, .buf
mov ax1, .msg
call strcmp
2019-05-30 12:39:24 +02:00
leave
ret
2019-05-30 21:46:00 +02:00
.msg = "HelloWorld :)"
2019-06-05 19:31:48 +02:00
.buf = [32]
2019-05-30 12:39:24 +02:00
;
; Exit function
;
exit:
enter
mov ax0, .msg
2019-05-30 12:27:13 +02:00
call print
leave
ret
2019-05-30 12:39:24 +02:00
.msg = "Goodbye World :(\n"