mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
132 lines
1.6 KiB
Plaintext
132 lines
1.6 KiB
Plaintext
; The OS/K Team licenses this file to you under the MIT license.
|
|
; See the LICENSE file in the project root for more information.
|
|
|
|
;
|
|
; Main function
|
|
;
|
|
main:
|
|
jmp ramdev_test
|
|
|
|
ramdev_test:
|
|
call DevGetMemOff
|
|
mov rdx, rax
|
|
|
|
call DevGetMemSize
|
|
ret
|
|
|
|
stosb_test:
|
|
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:
|
|
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
|
|
ret
|
|
|
|
itoa_test:
|
|
mov ax0, .buf
|
|
mov ax1, LONG_MIN
|
|
mov ax2, 10
|
|
call itoa
|
|
|
|
mov ax0, rax
|
|
call print
|
|
|
|
prn 10
|
|
mov ax0, .buf
|
|
mov ax1, 0xfff85ffffffffff4
|
|
mov ax2, 16
|
|
call itoa
|
|
|
|
mov ax0, rax
|
|
call print
|
|
|
|
ret
|
|
|
|
.buf = [32]
|
|
|
|
devtest:
|
|
mov ax0, .buf
|
|
devctl 0, 1
|
|
|
|
mov ax0, .buf
|
|
call print
|
|
|
|
iocall 0, 0
|
|
|
|
ret
|
|
|
|
.buf = [32]
|
|
|
|
str_test:
|
|
mov ax0, .msg
|
|
call print
|
|
|
|
mov ax0, .buf1
|
|
mov ax1, .msg
|
|
call strcpy
|
|
|
|
prn 10
|
|
mov ax0, .buf1
|
|
call print
|
|
|
|
mov ax0, .buf2
|
|
mov ax1, .msg
|
|
mov ax2, 8
|
|
call strnzcpy
|
|
|
|
prn 10
|
|
mov ax0, .buf2
|
|
mov ax1, 12
|
|
call print_n
|
|
|
|
mov ax0, .msg
|
|
mov ax1, .buf1
|
|
call strcmp
|
|
mov rbx, rax
|
|
|
|
mov ax0, .buf2
|
|
mov ax1, .msg
|
|
call strcmp
|
|
mov rsx, rax
|
|
|
|
mov ax0, .msg
|
|
call strlen
|
|
|
|
ret
|
|
|
|
.msg = "Hello World :)"
|
|
|
|
.buf1 = [32]
|
|
.buf2 = "!!!!!!!!!!!!!"
|
|
|