x86

What segment is used by default in x86 indirect addressing?

I'm a little confused as to exactly what segment is used when you have x86 assembly like the below (Intel syntax): mov ax, [di] I'm pretty certain it wouldn't be the code segment, I'm thinking either the data segment or the stack? (Or is the stack part of the data segment?) ...

Assembly Character Comparison Problem

Hi all, We are trying to implement levensteing distance algorithm in assembly and calling the assembly function from C code. But we have some char comparison problem and could not solve the problem. Function takes two char* parameters. In the first two lines i mov the these addressess to ecx and edx. iminusOne and jminusOne are indexe...

problem with asm code, computing the factorial.

Given a number, this program computes the factorial, but it no long works with number bigger than 9 .section .data .section .text .globl _start _start: pushl $10 movl %eax, %ebx call func addl $4, %esp movl %eax, %ebx movl $1, %eax int $0x80 .type func,@function func: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax ...

Question regarding assembly language.

I am reading the book The Art of Assembly Language. I came across this paragraph. To determine a particular instruction’s opcode, you need only select the appropriate bits for the iii, rr, and mmm fields. For example, to encode the mov ax, bx instruction you would select iii=110 (mov reg, reg), rr=00 (ax), and mmm=001 (bx). This pr...

Question regarding assembly language.

I am reading the book The Art of Assembly Language. I came across these two lines. the three byte encoding for mov ax, [1000] would be 0C6h, 00h, 10h and the three byte encoding for mov ax, [2000] would be 0C6h, 00h, 20h. Can anybody show me how mov ax, [1000] converted to oc6h, ooh, 10h and mov ax, [2000] converted to 0C6h, 00h, 2...

Alt + F7 keyboard shortcut does not work on a netbook.

I am running Android 2.2 on a netbook (Android x86). The keyboard shortcut, Alt + F7 doesn't lead me back to graphics screen ( GUI) from the console. Does anyone know any alternative to this shortcut ? ...

x86 Assembly: How do Disassemblers know how to break up instructions?

How does a x86 disassembler know where to break up the instructions? I am looking at the 8088 instruction set. For example the move instruction has 7 variations that range from 2 to 4 bytes. The instructions themselves seem to follow no particular order. Another reason for Why is x86 ugly?. For example: 7654321...

array of Integers in embedded x86 assembly

I am trying to acces values from an array of integers and have been trying for hours with no luck. Here is my code so far: All I am trying to do is acces the values in the array "arr", i have seen how to do it with characters but not with integers. int binarySearch (int* arr, int arrSize, int key, int* count) { int result=-1; ...

Task management on x86

Can someone please point out some books or online resources which explain in detail and at an advanced level the task management features of x86? I'm specifically interested in understanding the relationship between x86 hardware and the OS (POSIX style) when an interrupt or context switch occurs. Intel manuals are very confusing and I ca...

x86 intel opcode assembly

Is there a way to write a program using pure x86 intel opcodes instead of the assembly mnemonics and instructions and then compile it with ML and LINK. For example if I try and write a 55 instead of push ebp ML thinks it is an integer. Does it require a special compiler or how would you write an opcode program and compile it. ...

LEAL Assembler instruction

I have the following instruction and I'd like to know what the function is of the 0x10 in regards to this LEAL instruction? Is it a multiply or addition or is something else? leal 0x10(%ebx), %eax Can someone please clarify? This is x86 assembler on a Linux box. ...

how do you make an x86 assembly program in linux that converts files to uppercase?

I found a pdf file called: ProgrammingGroundUp-1-0-booksize.pdf, and one of the projects is to make an assembly program that takes in files and converts them to uppercase, ` .section .data #######CONSTANTS######## #system call numbers .equ SYS_OPEN, 5 .equ SYS_WRITE, 4 .equ SYS_READ, 3 .equ SYS_CLOSE, 6 .equ SYS_EXIT, 1 #options for ope...

Switch Case Assembly Language

I am looking at the assembly language code of a switch statement. I understand how the code works and what the cases are. My question is how do I decide on the case names? Below is the assembly language code, which will be followed with my interpretation of it. I basically just need to use the jump table and fill in the case names. ...

Do Core i3/5/7 CPUs provide a mechanism to measure IPC?

All the Intel CPUs in the last decade (at least) include a set of performance monitors that count a variety of events. Do the latest Intel CPUs, Core i3, i5 and i7 (aka Nehalem) provide a mechanism to count Instructions Per Clock (IPC)? If so, how are they used? If this is possible, I'll probably be writing the code for this in Asse...

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...

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? ...

Loading an Assembly fails because of incorrect format

Hi, I develop on a pretty big windows forms .net (C#) application with several assemblys. Originally each assembly was build for the Target Platfom "Any CPU". Due to a problem with Crystal Reports on x64 machines we had to build the whole project for x86 target platform. I startet rebuilding some of our Projects for x86 and it worked j...

Get char at index location in char array Assembly X86 embedded

Hello, I am having a lot of trouble accessing a value in an array of chars at a specific location. I am using inline-assembly in C++ and using visual studio (if that is of any help). Here is my code: char* addTwoStringNumbers(char *num1) { // here is what I have tried so far: movzx eax, num1[3]; mov al, [eax] } When I debu...

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 ...

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. ...