assembly

Reading 5-digit decimal number in x86 assembly

Hello all; I am writing a number converter between the (b h d) numbering systems , the program accepts 16 bits binary number , or 4 digits hex. or 5 decimal. the reading procedure i wrote seems to have a problem when the decimal value is above 65535 (FFFFh) since im dealing with 16 bit registers and it cant contain larger values i wou...

explanation of assembly code

Can anybody explain me this piece of assembly code? LINEAR_DATA_SEL equ $-gdt dw 0FFFFh dw 0 db 0 db 92h ; present, ring 0, data, expand-up, writable db 0CFh ; page-granular (4 gig limit), 32-bit db 0 Here I have already googled about the command equ, dw and db but I can't understand what this code act...

What is my compiler doing? (optimizing memcpy)

I'm compiling a bit of code using the following settings in VC++2010: /O2 /Ob2 /Oi /Ot However I'm having some trouble understanding some parts of the assembly generated, I have put some questions in the code as comments. Also, what prefetching distance is generally recommended on modern cpus? I can ofc test on my own cpu, but I was h...

How to put a C function in some address range.

I am developing a USB based bootloader for HCS08 family of micro-controllers. I have the bootloader code in assembly(which works fine for serial communication). I am calling a C functions for USB communication (Terminal<>Micro controller) from this assembly code. However, it seems that these C functions are not getting located in protec...

Assembly Segmented Model 32bit Memory Limit

If a 32bit Operating System operated with a segmented memory model would their still be a 4GB limit? I was reading the Intel Pentium Processor Family Developer's Manual and it states that with a Segmented memory model that it is possible map up to 64TB of memory. "In a segmented model of memory organization, the logical address ...

x86 MUL Instruction from VS 2008/2010

Will modern (2008/2010) incantations of Visual Studio or Visual C++ Express produce x86 MUL instructions (unsigned multiply) in the compiled code? I cannot seem to find or contrive an example where they appear in compiled code, even when using unsigned types. If VS does not compile using MUL, is there a rationale why? ...

How to turn off MIPS-GCC automatic instruction reordering?

Following this question: http://stackoverflow.com/questions/3807480/weird-mips-assembler-behavior-with-jump-and-link-instruction I have a working GNU assembly toolchain for my single cycle MIPS project (no branch delay slot!). I would really prefer to write in C though. The code itself generated from the compiler does run, but I have to ...

Beating a greedy algo

For class we have a grid and a bunch of squares on the grid that we need to detect and travel to. We start at (0,0). We scan tiny regions of the grid at a time (for reasons regarding our data structure it's mandatory), and when we detect squares that we need to travel, and then we travel. There are 32 locations on the grid, but we only n...

SIMD optimization puzzle

I Want to optimize the following function using SIMD (SSE2 & such): int64_t fun(int64_t N, int size, int* p) { int64_t sum = 0; for(int i=1; i<size; i++) sum += (N/i)*p[i]; return sum; } This seems like an eminently vectorizable task, except that the needed instructions just aren't there ... We can assume that N i...

how multicore processors boot ?

talking in very low level, how the cores are initialized ? ...

Assembly Language Arrays

This is a pretty simple question.. lets say I have the following. wordArray WORD 810Dh, 0C064h, 93ABh Now, if I do this... MOVZX EAX, wordArray Thats going to move the first value of the array onto EAX.. so EAX would look something like this.. 0000810D. My question is, how can I move ALL of the array onto EAX.. so EAX would look ...

Simple MIPS question, about load byte

I have the following question here .data a: .asciiz "2021" x: .byte 7,2,12 .text main: addi $t2, $0, 1 lb $t3, a($t2) Can someone explain to me, HOW the value of $t3 is 48? thanks EDIT this is an another question which is similiar, and is confusing. .data a: .word 12,-5,4,0 x: .byte 5 .text main: addi $t1, $0, 8 lw $t2, a($0) lw $t3...

Mips question, about load word

I have the following question .data a: .word 12,-5,4,0 x: .byte 5 .text main: addi $t1, $0, 8 lw $t2, a($0) lw $t3, a($t1) Can someone, what the value of $t3 will be?, How can you access, the 8th element when the array has a length of 4? ...

A simple MIPS, question

I have a question, which is kind of confusing Write the MIPS instruction whose machine language encoding is: 0000 0011 0001 1001 0100 0000 0010 1010 Your answer must use register names (like $t0) not numbers; and must specify any immediate as a signed integer in decimal. The answer, in the back has something to do with slt. Can someon...

How to check the EIP value with assembly language?

Hi, I want to get the current value of the EIP register with assembly language. Is that possible? Thanks. ...

Where can one find detailed information about stack operation in x86 processors

I am interested in the layout of an executable and dynamic memory allocation using stack and how the processor and kernel together manage the stack region, like during function calls and other scenarios of using stack based memory allocation. Also how stack overflow and other hazards associated with this model occur, are their other desi...

suggest a 8086 project

It's required from me to suggest an assembly project (not too simple and not too complex) tol be written for Intel 8086 microprocessor. One of the suggested projects was a calculator doing normal operations. Can anyone suggest another project? Simple clarification: that the idea of this project shall be implemented on the pc not usin...

[MASM] Long code length bug?

Hello everybody I'm currently working on a rather big assembly program it's a chatter bot. It spans currently well over 700 lines of code. In my program I've two labels, my program uses these labels to keep track of certain data that gets moved around in a random manner. Let me explain to you what happend: The job the program has to do...

X86 inline assembly, writing into C array

Assembly info: Using Visual Studio 2010 to write inline assembly embedded into C Hello, I am trying to write into an array of chars in C and trying to mimic the action of this C code: resNum[posNum3] = currNum3 + '0'; currently this is what i have: mov ebx, posNum3; mov resNum[ebx], edx; //edx is currNum3 add resNum[ebx], 48; // a...

Assign delays for 1ms or 2ms in C ?

Hello there, Im using a code to configure a simple robot. Im using a WinAVR and the code used there is similar to C, but without stdio.h libraries and such, so codes for simple stuff should be entered manually ( e.g. converting dec to hex is a multiple-step procedure involving ascii character manipulation ) Example of code used is ( ju...