assembly

CPU simulator with an assembler, linker with Simple assembly

Do somebody know some CPU simulator featuring simple assembly language with assembler, loader, linker for learning and testing purpose. That I could run on GNU systems. ...

A reference for AT&T syntax assembly floating point arithmetic

I've been trying for the past week to find a decent resource on floating point arithmetic for x86 assembly using AT&T syntax. Ideally, a list of the opcodes, what they do, and where the floats are stored. I am familiar with IEEE 754 representation. I am not familiar with the floating point stack, and any assembly referring to floating po...

array address when pushed to stack

hi, I wrote a simple c function: void function(){ int n; char s[6]; n = 1; s[0] = 2; s[5] = 3; } This disassembles to: pushl %ebp movl %esp, %ebp sub $40, %esp movl $1, -12(%esp) movb $2, -40(%esp) movb $3, -35($esp) leave ret I am trying to understand why the char[] is given the address that starts at -40. it...

Assembly tutorial

I am trying to learn assembly language. I tried few tutorials, videos and pdfs but unable to understand much. Since last three days , I am struggling on this. Can anybody please give me a link to good assembly tutorial or ebook? Thanks in advance. EDIT: I tried the vtc video tutorials on assembly first. After that I searched for assembl...

Query regarding binary numbers in assembly

I am reading the book art of assembly language. There I came across this paragraph. If the H.O. bit is zero, then the number is positive and is stored as a standard binary value. If the H.O. bit is one, then the number is negative and is stored in the two’s comple-ment form. To convert a positive number to its negative, two’s co...

Query regarding binary numbers

I am reading a book on assembly languages. I came across these sentences in that book. Consider the value “-64”. The eight bit two’s complement value for this number is 0C0h. The 16-bit equivalent of this number is 0FFC0h. I can't understand these two sentences. Can anybody show me how -64's eight bit 2's complement is 0c0h? And how ...

run an assembly code on ubuntu

The code i am trying to run is bellow. I use nasm util to convert it into object file. When i tried to execute it says "can not execute binary file". I run the command: nasm -f elf -o helloworld.o helloworld.asm segment .data msg db "Hello, world!",10 len equ $ - msg segment .text global _start _start: mov eax,4 mov ebx,...

How to call C++ functions in my assembly code

I need to call PrintResult from my assembly to display the result. I know I have to use extrn _PrintResult somewhere, and I should call the function using call _PrintResult but I'm not sure quite sure how to use it. any suggestions public _Square .386 .model flat .code _Square proc mov eax, [esp+4] imul eax ret _Square endp .....

How to turn off showing assembly codes when debug?

I accidentially turn on this mode and want to return to previous setting. How can I do this? ...

How's __RTC_CheckEsp implemented ?

__RTC_CheckEsp is a call that verifies the correctness of the esp, stack, register. It is called to ensure that the value of the esp was saved across a function call. Anyone knows how it's implemented? ...

Assembly language for 8086 resources

I'm looking for resources to learn programming in assembler for 8086 processor. Either books or online resource for total beginners in assembly. ...

Why doesn't the assembly seem consistent to me?

Dumped from visual studio: CheckPointer(pReceivePin,E_POINTER); 017D616D cmp dword ptr [ebp+0Ch],0 017D6171 jne CBasePin::Connect+4Dh (17D617Dh) 017D6173 mov eax,80004003h 017D6178 jmp CBasePin::Connect+1A7h (17D62D7h) But the actual definition is: #define CheckPointer(p,ret) {if((p)==NULL)...

How many stacks does a windows program use?

Are return address and data mixed/stored in the same stack, or in 2 different stacks, which is the case? ...

How are hex sequence translated to assembly without ambiguity?

8B EC 56 8B F4 68 00 70 40 00 FF 15 BC 82 40 A senquence like above can be segmented in various ways,each segment can be translated to corresponding assembly instruction, but each binary executable has its only DEFINITE assembly ,what's the mathematical principle that avoids ambiguity? UPDATE The answer with most votes doesn't act...

how to program high level concepts (i.e. Object class, and Generics) in C

Here lately I've been tinkering around with my own languages as well as reading various writings on the subject. Does anyone have any good advice on how, in C (or Assembler), do you program the concept of the Object Class and/or the concept of Generics into a language. (referring to the Java implementations of Object and Generics) For...

Converting Decimal to Binary and Printing in MIPS

Hello, I'm writing a simple snippet of code for an assignment and I need to convert a decimal number to binary, octal, and hexadecimal. I have it working, but I realized afterwards that because of the algorithm I'm using, I print the binary number backwards. The strategy I was using was to print one digit at a time. I'm still a beginn...

Has anyone gotten MASM Assembly Language working in Wine for Linux?

Apparently WIne doesn't support 16bit DOS apps. Anyone know how to Get MASM intel-style assembly working in wine? ...

Why does this code cause an access violation exception?

_memcpy_r SEGMENT memcpy_r PROC mov r10, rdi mov r11, rsi mov rdi, rcx mov rsi, rdx mov rcx, r8 shr rcx, 3 rep movsq mov rcx, r8 and rcx, 7 rep movsb mov rsi, r11 mov rdi, r10 ret memcpy_r ENDP _memcpy_r ENDS END I have the above code in a .asm file which I'm using in a Visual Studio 2010 project. It's set to compile us...

Array not crossing 256 byte boundary

Is it possible to create an array that doesn't cross 256 byte boundary? That is addresses of the individual array items only differ in the lower byte. This is weaker requirement than keeping the array aligned to 256 bytes. The only solution I could think of was aligning to next_power_of_two(sizeof(array)), but I'm not sure about the gaps...

Is there an escape character in MASM?

I know that strings surrounded by single quotes can contain double quotes and vice versa, but can a string contain both? For example, the string: How do you say, "Where's the bathroom?" in Spanish? ...