1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-07-05 14:06:14 +02:00
parent a42786831f
commit c216d0fbbb
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
7 changed files with 24 additions and 22 deletions

View File

@ -197,7 +197,7 @@ doprnt:
call nx3 call nx3
; did putc fail? ; did putc fail?
cmp rax, 0 test rax, rax
xor.nz nx0, nx0 ; yes, so artificially set n=0 xor.nz nx0, nx0 ; yes, so artificially set n=0
ret ret

View File

@ -12,7 +12,7 @@ itoa:
; void utoa(char *buf, int num, int base) ; void utoa(char *buf, int num, int base)
; ;
utoa: utoa:
sub ax3, ax3 xor ax3, ax3
jmp ltostr jmp ltostr
; ;
@ -44,8 +44,7 @@ ltostr:
.conv: .conv:
b.e ax1, 0, .fini b.e ax1, 0, .fini
mov r10, ax1 rem r10, ax1, ax2 ; ax1 % base
rem r10, ax2 ; ax1 % base
b.a r10, 9, .nondec ; r10 > 9 ? b.a r10, 9, .nondec ; r10 > 9 ?

View File

@ -18,7 +18,7 @@ strtol:
; rdx = pointer to first invalid byte ; rdx = pointer to first invalid byte
; ;
strtoul: strtoul:
sub ax2, ax2 xor ax2, ax2
jmp strtoq jmp strtoq
; ;
@ -48,7 +48,7 @@ strtoq:
; signed? ; signed?
test ax2, ax2 test ax2, ax2
sub.z r10, r10 xor.z r10, r10
jmp.z .unsigned jmp.z .unsigned
; parse '-' ; parse '-'

View File

@ -7,9 +7,8 @@
strnlen: strnlen:
mov rcx, ax1 mov rcx, ax1
scasb.rep.nz ax0, 0 scasb.rep.nz ax0, 0
mov rax, ax1 sub rax, ax1, rcx
sub rax, rcx
ret ret
; ;

View File

@ -79,8 +79,7 @@ CMD.builtins.dir:
prn ' ' prn ' '
prn ' ' prn ' '
mov rax, rdx shr rax, rdx, 10
shr rax, 10
and rdx, 1023 and rdx, 1023
mov ax0, .bytesstr mov ax0, .bytesstr

View File

@ -29,8 +29,7 @@ not r r
# #
# $dest = $src1 OR $src2 # $dest = $src1 OR $src2
# #
# Clears OF and CF # Preserves all flags
# Sets ZF and SF according to the result
# #
or r ri or r ri
or r r ri or r r ri
@ -50,8 +49,7 @@ nor r r ri
# #
# $dest = $src1 AND $src2 # $dest = $src1 AND $src2
# #
# Clears OF and CF # Preserves all flags
# Sets ZF and SF according to the result
# #
and r rim and r rim
and r r rim and r r rim
@ -71,8 +69,7 @@ nand r r ri
# #
# $dest = $src1 XOR $src2 # $dest = $src1 XOR $src2
# #
# Clears OF and CF # Preserves all flags
# Sets ZF and SF according to the result
# #
xor r rim xor r rim
xor r r rim xor r r rim
@ -89,15 +86,23 @@ xnor r r ri
# To document # To document
shl r rim shl r ri
shl r r ri
shl m ri shl m ri
shl m r ri
shr r rim shr r ri
shr r r ri
shr m ri shr m ri
shr m r ri
sal r rim sal r ri
sal r r ri
sal m ri sal m ri
sal m r ri
sar r rim sar r ri
sar r r ri
sar m ri sar m ri
sar m r ri

View File

@ -88,7 +88,7 @@ rotl rm r r
# Throws: # Throws:
# #ILL if $2 ≥ 16 # #ILL if $2 ≥ 16
# #
ldarg r ri ldarg r r
# #
# Get code/data offset (GCO/GCD) # Get code/data offset (GCO/GCD)