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
; did putc fail?
cmp rax, 0
test rax, rax
xor.nz nx0, nx0 ; yes, so artificially set n=0
ret

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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