我试图在winApi函数IsWindows10OrGreater中调用Masm32,但得到了错误LNK2001:未解析的外部符号_IsWindows10OrGreater@0。我还试图在visual .asm中调用此函数,但结果是相等的。为什么masm不认识这个函数?我试着用C代码调用这个函数,它可以工作。这是我的代码:
.686
.model flat, STDCALL
option casemap :none
include D:\masm32\include\windows.inc
include D:\masm32\macros\macros.asm
include D:\
我需要编写一个带有函数定义的汇编器模块,并将其与我在C++中的程序相链接,其中是在汇编中实现的函数的声明。我不知道如何编写C++文件和汇编模块来正确编译它们。
我已经写了一个C++文件
#include <iostream>
using namespace std;
void copy(unsigned int * source, unsigned int * dest, int n);
int main() {
unsigned int source[] = {1, 2, 3, 4};
unsigned int dest[4];
copy(source
我正在编写一个程序,它将使用MASM调用一些C++函数。我在一个单独的文件中定义了两个整数之和并显示输出。
目前,我无法让“main.cpp”运行asmMain()来调用'main.cpp‘中的函数。
code.asm
; ---------------------------------------
promptFirst PROTO C
promptSecond PROTO C
printInt PROTO C
.586
.model flat, stdcall
.stack 4096
; --------------------------------------
我刚开始组装。我在WIN XP SP3上使用了SP3。每当我试图组装代码时,我都会收到警告。
.model small
.stack 100h
.code
main proc
mov ah,1
int 21h
mov bl,al
mov ah,2
mov dl,bl
int 21h
mov ah,4ch
int 21h
main endp
end main
组装后的ASM文件
C:\masm32\coa.asm(14):警告A4023:使用/coff开关,开始地址所需的下划线:
驱动器C中的卷没有标签。
卷序列号为A 868-C4EC
..。
请告诉我该怎么做:(谢谢
我正试着运行这个由我的教授编写的代码。不幸的是,当我编译和运行代码时,结果是:
INCLUDE Irvine32.inc
.data
ARRAY_SIZE = 1000
FILL_VAL EQU 0FFh
hHeap HANDLE ? ;Handle to the process heap
pArray DWORD ? ;pointer to block of memory
newHeap DWORD ? ;handle to new h
以下是我在Youtube视频教程中获得的汇编程序的源代码:
.386
.model flat, stdcall
option casemap:none
include c:\masm32\include\windows.inc
include c:\masm32\include\masm32.inc
include c:\masm32\include\kernel32.inc
includelib c:\masm32\lib\masm32.lib
includelib c:\masm32\lib\kernel32.lib
.data
message1 db "Type your
我一直在想,在文件开始时使用所有这些include语句是否只是减慢了程序运行时的速度,因为它必须找到文件,打开它,初始化代码,然后运行它。我用了所有这些:
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
所以我一直在想,因为宏实际上是在调用代码函数来保存您自己编写的代码,我想使用实际的代码来
在访问特定位置的字符数组中的值时,我遇到了很多问题。我正在使用C++中的内联汇编和visual studio (如果这有任何帮助的话)。下面是我的代码:
char* addTwoStringNumbers(char *num1)
{
// here is what I have tried so far:
movzx eax, num1[3];
mov al, [eax]
}
当我调试时,我可以看到num13是我想要的值,但是我似乎不能使al或eax等于这个值,它似乎总是一些指针引用。我也玩过Byte PTR,但没有运气。
如何使用Visual Studio编译汇编代码?
我想用编译并运行一个汇编源文件。
我已经创建了一个Visual C++项目,并在文件code.asm中插入了一些汇编代码
.586 ;Target processor. Use instructions for Pentium class machines
.MODEL FLAT, C ;Use the flat memory model. Use C calling conventions
.STACK ;Define a stack segment of 1KB (Not requir
我正在使用masm32在windows7上编译和链接,它在下面的代码中工作得很好。然而,调用stdOut并不是简单地在我的命令提示符上打印任何东西。我做错了什么?
.386
.model flat, stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\masm32.inc