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-05-30 19:33:22 +02:00
parent 439aa159ea
commit 18747ae31a
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
5 changed files with 26 additions and 5 deletions

View File

@ -22,7 +22,7 @@ main:
ret
.msg = "Hello World :)"
.buf = "!!!!!!!!!!!!!!!!"
.buf = "!!!!!!!!!!!!!!!!!!!!!"
;
; Exit function

21
dos/str/strcpy.k Normal file
View File

@ -0,0 +1,21 @@
; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
;
; void strcpy(char *, const char *)
;
strcpy:
ret
;
; void strncpy(char *, const char *, int)
;
strncpy:
ret
;
; void strnzcpy(char *, const char *, int)
;
strnzcpy:
ret

View File

@ -3,4 +3,5 @@
include "str/strlen.k"
include "str/strrev.k"
include "str/strcpy.k"

View File

@ -10,8 +10,7 @@ strrev:
jz .4
; save str's location
; xxx why is dec'ing needed?
lea rdx, b[ax1 + -1]
mov rdx, ax1
; go to str's end, just before
; the null terminator
@ -23,7 +22,7 @@ strrev:
jmp .1
; copy, going backward though str
; and forward through buf
; and forward through buf
.2:
mov b[ax0], b[ax1]

View File

@ -31,7 +31,7 @@ void i_##name(ctx_t *ctx, acc_t *p1, acc_t *p2) \
assert(p1->type == A_REG || p1->mem); \
if (p1->mem) { \
ulong addr = p1->type == A_REG ? ctx->r[p1->val].val : p1->val; \
writemem(ctx, v1, addr, p1->mlen); \
writemem(ctx, v1, addr + p1->off, p1->mlen); \
} \
else ctx->r[p1->val].val = v1; \
} \