From c7bcd23ce7ee9223fa44291cb9c684b1c2cbbab2 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Fri, 12 Jul 2024 23:32:09 -0400 Subject: [PATCH] Hello, world --- .gitignore | 3 +++ listing1-4.asm | 12 ++++++++++++ listing1-5.asm | 22 ++++++++++++++++++++++ listing1-6.cpp | 12 ++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 listing1-4.asm create mode 100644 listing1-5.asm create mode 100644 listing1-6.cpp 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"); +}