adds example for calling external C func from masm

This commit is contained in:
Emanuel Rodriguez 2022-11-23 00:02:57 -08:00
parent 94878a596c
commit 6cccbf0a18
2 changed files with 24 additions and 1 deletions

View File

@ -10,4 +10,6 @@ main proc ; the main procedure
call asm_proc ; call our proc
ret
main endp
end
end

21
src/1_5.asm Normal file
View File

@ -0,0 +1,21 @@
option casemap:none
.data
fmt_str byte 'Hello World!', 10, 0 ; here 10 is the newline feed
.code
externdef printf:proc
public asm_func
asm_func proc
sub rsp, 56
lea rcx, fmt_str ; load the format string into the RCX register to be used by the printf
call printf
add rsp, 56
ret
asm_func endp
end