Adds strcat()
This commit is contained in:
@@ -8,6 +8,7 @@ extern puts
|
||||
; string.asm
|
||||
extern strlen
|
||||
extern strcpy
|
||||
extern strcat
|
||||
; convert.asm
|
||||
|
||||
section .rodata
|
||||
@@ -15,6 +16,7 @@ section .rodata
|
||||
TEST_puts equ 1
|
||||
TEST_strlen equ 1
|
||||
TEST_strcpy equ 1
|
||||
TEST_strcat equ 1
|
||||
|
||||
str1 db "Hello, world!",EOS
|
||||
str2 db "Hello, World!",EOS
|
||||
@@ -39,11 +41,16 @@ section .rodata
|
||||
strcpy3 db TAB,"strcpy(strBuff1, str1, 32): ",NL,TAB,TAB,EOS
|
||||
strcpy4 db TAB,"strcpy(strBuff1, str5, 32): ",NL,TAB,TAB,EOS
|
||||
|
||||
; strcat()
|
||||
msgStrcat db "TEST strcat()",NL,EOS
|
||||
strcat1 db TAB,"strcat(strBuff2, str1, 32): ",NL,TAB,TAB,EOS
|
||||
strcat2 db TAB,"strcat(strBuff2, str5, 32): ",NL,TAB,TAB,EOS
|
||||
|
||||
section .data
|
||||
|
||||
section .bss
|
||||
strBuff1 resb 32
|
||||
strBuff2 resb 4
|
||||
strBuff2 resb 32
|
||||
|
||||
section .text
|
||||
global _start
|
||||
@@ -125,6 +132,34 @@ _start:
|
||||
call puts
|
||||
%endif
|
||||
|
||||
;---
|
||||
;--- strcat
|
||||
;---
|
||||
%if TEST_strcat
|
||||
lea rdi, [rel msgStrcat]
|
||||
call print
|
||||
|
||||
; TEST 1
|
||||
lea rdi, [rel strcat1]
|
||||
call print
|
||||
lea rdi, [rel strBuff2]
|
||||
lea rsi, [rel str1]
|
||||
mov rcx, 32
|
||||
call strcat
|
||||
mov rdi, rax
|
||||
call puts
|
||||
|
||||
; TEST 3
|
||||
lea rdi, [rel strcat2]
|
||||
call print
|
||||
lea rdi, [rel strBuff2]
|
||||
lea rsi, [rel str5]
|
||||
mov rcx, 32
|
||||
call strcat
|
||||
mov rdi, rax
|
||||
call puts
|
||||
%endif
|
||||
|
||||
;---
|
||||
;--- exit()
|
||||
;---
|
||||
|
Reference in New Issue
Block a user