diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a268cd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.exe +*.obj +*.lnk diff --git a/listing1-4.asm b/listing1-4.asm new file mode 100644 index 0000000..63a0c8d --- /dev/null +++ b/listing1-4.asm @@ -0,0 +1,12 @@ + .code +myProc proc + ret +myProc endp + +main PROC + + call myProc + + ret +main endp + end diff --git a/listing1-5.asm b/listing1-5.asm new file mode 100644 index 0000000..3a30d02 --- /dev/null +++ b/listing1-5.asm @@ -0,0 +1,22 @@ + option casemap:none + .data + +fmtStr byte "Hello, world!", 10, 0 + + .code + + externdef printf:proc + + public asmFunc +asmFunc proc + + sub rsp, 56 + + lea rcx, fmtStr + call printf + + add rsp, 56 + + ret +asmFunc endp + end diff --git a/listing1-6.cpp b/listing1-6.cpp new file mode 100644 index 0000000..08221fd --- /dev/null +++ b/listing1-6.cpp @@ -0,0 +1,12 @@ + +#include +extern "C" +{ + void asmFunc(void); +}; + +int main(void){ + printf("Calling asmFunc: \n"); + asmFunc(); + printf("Returned from asmFunc\n"); +}