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-16 22:18:09 +02:00
|
|
|
call str_test
|
2019-06-16 20:27:24 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
showoff:
|
2019-06-16 19:42:10 +02:00
|
|
|
call bswap_test
|
|
|
|
call itoa_test
|
2019-06-16 19:55:59 +02:00
|
|
|
call str_test
|
2019-06-16 20:27:24 +02:00
|
|
|
call movzx_test
|
|
|
|
ret
|
2019-06-16 13:06:41 +02:00
|
|
|
|
|
|
|
bswap_test:
|
2019-06-16 13:28:21 +02:00
|
|
|
mov rdx, 0x1122334455667788
|
|
|
|
bswap rax, rdx
|
|
|
|
|
|
|
|
mov rdi, 0x1111222233334444
|
|
|
|
wswap rsx, rdi
|
|
|
|
|
|
|
|
mov ax3, 0x1111111122222222
|
|
|
|
dswap ax0, ax3
|
|
|
|
|
2019-06-16 12:17:31 +02:00
|
|
|
ret
|
2019-06-14 16:47:01 +02:00
|
|
|
|
|
|
|
ramdev_test:
|
2019-06-16 19:42:10 +02:00
|
|
|
call MEM.GetMemOff
|
2019-06-14 16:47:01 +02:00
|
|
|
mov rdx, rax
|
|
|
|
|
2019-06-16 19:42:10 +02:00
|
|
|
call MEM.GetMemSize
|
2019-06-13 22:20:35 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
stosb_test:
|
2019-06-13 17:13:59 +02:00
|
|
|
mov rcx, 11
|
|
|
|
mov rax, 33
|
|
|
|
mov rdi, .buf
|
|
|
|
mov rsi, .buf
|
2019-06-16 21:17:56 +02:00
|
|
|
stosb.rep
|
2019-06-13 17:13:59 +02:00
|
|
|
|
|
|
|
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 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
|
|
|
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
|
|
|
|