Hello, world
This commit is contained in:
parent
4095bacdf6
commit
c7bcd23ce7
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*.exe
|
||||||
|
*.obj
|
||||||
|
*.lnk
|
12
listing1-4.asm
Normal file
12
listing1-4.asm
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
.code
|
||||||
|
myProc proc
|
||||||
|
ret
|
||||||
|
myProc endp
|
||||||
|
|
||||||
|
main PROC
|
||||||
|
|
||||||
|
call myProc
|
||||||
|
|
||||||
|
ret
|
||||||
|
main endp
|
||||||
|
end
|
22
listing1-5.asm
Normal file
22
listing1-5.asm
Normal file
|
@ -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
|
12
listing1-6.cpp
Normal file
12
listing1-6.cpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
void asmFunc(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
printf("Calling asmFunc: \n");
|
||||||
|
asmFunc();
|
||||||
|
printf("Returned from asmFunc\n");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user