masm

What can cause MASM to display "junk"?

I have some code which is supposed to display a short message. Here's the pertinent code: DATA SEGMENT 'DATA' MSG DB 0AH, 0DH, 'Hello, Adam', '$' CHAR DB 00H DATA ENDS CODE SEGMENT 'CODE' PRINT_MSG: MOV AH, 09H ;Command to print string of characters MOV DX, OFFSET MSG ;Mov address of message into DX INT 21H ;DOS ...

Using Visual Studio 2008 to Assemble, Link, Debug, and Execute MASM 6.11 Assembly Code

I would like to use Visual Studio 2008 to the greatest extent possible while effectively compiling/linking/building/etc code as if all these build processes were being done by the tools provided with MASM 6.11. The exact version of MASM does not matter, so long as it's within the 6.x range, as that is what my college is using to teach 16...

Why can't I change the value of a segment register? (MASM)

So I decided to teach myself assembly language. I know on a very basic level how this stuff works, but I have never programmed so close to the hardware and I thought that I should definitely know this stuff. I was playing around with different registers and general syntactical stuff and I have realized that my program will not compile ...

MASM under Linux?

I want to ask if there is any way to code in MASM under Linux. Even tough NASM is quite popular under Linux, it still differs for some instruction style on code. Currently I am using Ubuntu 8.10 (Intrepid Ibex). ...

zlib + masm

Can zlib be used with masm without all the c runtime libraries such as msvcrt.dll and many others? If so, can you tell me how? ...

Assembly Prototype instruction

I am writing an assignment in MASM32 Assembly and I almost completed it but I have 2 questions I can't seem to answer. First, when I compile I get the message: INVOKE requires prototype for procedure & invalid instruction operands the first is due to this piece of code: .data? Freq DWORD ? Time1 DWORD ? Time2 DWORD...

MASM32 loop

I'm trying to make a loop in masm32 running under Windows Vista, however I did it this way and even though it actually finishes the loop, it crashes and I see no obvious reason why...any ideas? .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include...

How do I convert a decimal number to REAL10 in MASM assembly?

Right now I convert the string containing the decimal number to an integer (ignoring the radix point for now), load it into ST(0), and divide by the correct power of ten to account for the radix point. This seems round about, and requires I have a look up table for some of the powers of 10. Is there a better way to do this? ...

Accessing Segment Registers MASM

Hello! I'm trying to query the value located in the Process Enviornment Block, pointed to by the FS segment register. Attempting to compile code with the fs:[0] segment included results in an error (error A2108: use of register assumed to ERROR). How do you query the segment registers?! Thanks ...

Assembly language tools and references

I used to do assembly language programming a while back, I was foolish enough to want to get back into it. Back in the day, I used to compile asm code with MASM.EXE command line, writing code with no validation in a basic text editor. What are the best tools in use today for writing in assembly? What are some good quick references on...

Converting problem: __asm__ __volatile__

I have been dealing with Nasm on a linux environment for some time and this function worked great... but now I am switching to a windows environment and I want to use Masm (with VS2008) I cant seem to get this to work... void outportb (unsigned short _port, unsigned short _data) { __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), ...

Inline Assembly Jump Error

Why does this fail, once Masm reaches jmp? struct gdt_entry { unsigned short limit_low; unsigned short base_low; unsigned char base_middle; unsigned char access; unsigned char granularity; unsigned char base_high; }; struct gdt_ptr { unsigned short limit; unsigned int base; }; struct gdt_entry gdt[3]; s...

DOS Interrupt in masm x86 assembly crashing

I've just begun learning some x86 assembly on win32, and I've used masm with visual studio 2008 using the custom build rule that comes with the ide for .asm files. I've been trying to use the DOS interrupt to print to the console, but instead I receive the message: "Unhandled exception at 0x00401004 in ASMTest.exe: 0xC0000005: Access vio...

XORing at the address stored in EAX

How can you XOR the value stored in EAX? The problem is at this line: xor eax, key EAX contains the address of the value i want to XOR. How can I accomplish this? I though it would be something along the lines of: xor [eax], key but that doesn't work (syntax error) decrypt proc startAddress:DWORD , sizeOfSegment:DWORD , key:DWOR...

[ASM] JMP to absolute address (op codes)

I'm trying to code a exe packer/protector as a way of learning more about assembler, c++, and how PE files work. I've currently got it working so the section containing the EP is XORed with a key and a new section is created that contains my decryption code. Everything works out great except when I try and JMP to the original EP after de...

Progress Bar Of URLDownloadToFile

Hello, I'm using MASM to build a download program, but the thing is that i don't know how to use a progress bar to show the progress of the download, i'm using URLDownloadToFile like this: invoke URLDownloadToFile, NULL, chr$("http://masm32.masmcode.com/masm32/m32v10r.zip"), chr$("D:\test.zip"), 0, 0 Best Regards. ...

how to setup irq with masm

How can I setup IRQ using C++ and Masm, most of the search results refer me to Nasm, I am trying to create a bootloader of my own, I get it to boot from cd (iso) then I want to add menu options but cant seem to setup IRQ An example that uses nasm can be found at Bran's Kernel Development looking something like global irq0 ; 32: IRQ0 i...

ml64 - warning A6004: procedure argument or local not referenced

I have a function written for th e x64 microsft macro assembler in visual studio 2005. The function recieves 3 arguments: theFunction PROC firstP:QWORD, secondP:QWORD, thirdP:QWORD the x64 calling convention state the the first 4 arguments will reside in registers rcx, rdx, r8 & r9. When I'm using the arguments in the function, I'm re...

Inline io wait using MASM

How to convert this to use VC++ and MASM static __inline__ void io_wait(void) { asm volatile("jmp 1f;1:jmp 1f;1:"); } I know asm changes to __asm and we remove the volatile but whats next? I am trying to create the function to place in the code below #define PIC1 0x20 #define PIC2 0xA0 #define PIC1_COMMAND PIC1 #define PIC1_DATA...

Compiling assembly for X86/X64 for use with C#

I would like to add cpuid functionality to my C# app. I found this interesting blog post online. I will probably need MASM to compile this but: How should I start? I suspect that I will have to compile a dll for both X86 and X64 but again I don't have a clue about how to go about such a thing (and I am a bit pressed for time). So any...