assembly

Approximate timings for various operations on a "typical desktop PC" anno 2010

In the article "Teach Yourself Programming in Ten Years" Peter Norvig (Director of Research, Google) gives the following approximate timings for various operations on a typical 1GHz PC back in 2001: execute single instruction = 1 nanosec = (1/1,000,000,000) sec fetch word from L1 cache memory = 2 nanosec fetch word from main memory = 1...

ADC instruction in ASM 8086

When I use ADC for exmaple: AL = 01 and BL = 02, and CF = 1 when I make this: ADC AL,BL Will AL be 3 or 4? (with the CF addition or without?) ...

Printing a string and variable in MIPS

Here's the C representation of what I'm trying to do in MIPS assembly: printf ("x=%d\n", x); I know that I can do a syscall to easily print x= and I can also do a syscall to print the int x (which is stored in a register). However, that prints them like this (let's say x is 5): x= 5 How can I make them print on the same l...

Choosing the right and learning assembler for compiler-writing

I'm writing a compiler and I have gone through all the steps (tokenizing, parsing, syntax tree structures, etc.) that they show you in all the compiler books. (Please don't comment with the link to the "Resources for writing a compiler" question!). I have chosen to use NASM together with alink as my backend. Now my problem is: I just c...

iPad development in assembly

Instead of C/C++/Objective-C, is it possible to write parts of an ipad application in raw assembly? ...

Assembly LC3: How to read input without "input a character" being printed to the display?

I'm writing an assembly language program using lc3 and when I run trap x23 (IN) the message "input a character" comes up. I want it to come up saying Please enter an integer between 1 and 15: but it ends up like this: Please enter an integer between 1 and 15: input a character: Help please ...

Modify EXE to stop launching firefox

I'm using a wireless modem program from my ISP. This program automatically disconnect when it detects the line is idle. It does so in 2-5 minutes of idle time. Whenever I reconnect, It will automatically fire up my default browser to the ISP portal. I DID NOT pay them to shove their web portal in my face 50 times a day. The ISP provides...

SAL and SAR by 0 errors

I have discovered a bug in some assembly code I have been working with but can't figure how to fix it. When shifting left by 0 the result ends up being 0 instead of jut the number. The same applies when shifting to the right. Any and all help is much appreciated. function sal(n,k:integer):integer; begin asm cld mov cx, k @1: ...

Assembly language 8086

I v porblem in assembly 8086, I can't use 2D array when I m using like this mov ar[cx][dx] then arising error and when I want to us SI and DI both in arrary then also find error. I need answer quickly thanks for your help ...

ASM programming, how to use loop?

Hello. Im first time here.I am a college student. I've created a simple program by using assembly language. And im wondering if i can use loop method to run it almost samething as what it does below the program i posted. and im also eager to find someome who i can talk through MSN messanger so i can ask you questions right away.(if possi...

What's the point of LEA EAX, [EAX]?

LEA EAX, [EAX] I encountered this instruction in a binary compiled with the Microsoft C compiler. It clearly can't change the value of EAX. Then why is it there at all? ...

assembly: data segment when called from c or created as an independet programm

im confused about this i dont think that there should be any difference in both cases , the programm ends up as exe file please help if you think a differ.... ok let me clear my question . is there is a differece in the data segment defenition or handeling between when i create an assembly program 'stand alone' and when i call...

x86 Assembly: Before Making a System Call on Linux Should You Save All Registers?

I have the below code that opens up a file, reads it into a buffer and then closes the file. The close file system call requires that the file descriptor number be in the ebx register. The ebx register gets the file descriptor number before the read system call is made. My question is should I save the ebx register on the stack or somew...

tasm not run predefined data in variable

I am assigning some value in a variable ar db 107,106,105,104,103,102,101,100,99,98 and also not run string msg db "this is not printed by tasm ","$" but this is run on emu8086 emulator The actual code The Bubble Sort data segment ar db 107,106,105,104,103,102,101,100,99,98 ends code segment start: assume cs:code,ds:data mov ...

For Loops in MIPS assembly

I'm having problems getting my processor to simulate correctly and I think I've narrowed it down to the program I'm giving it. 1. li $R1, 0 2. li $R2, 0x100 3. li $R6, 1 4. li $R8, 0 5. li $R9, 20 6. lw $R3, 0($R1) 7. lw $R4, 4($R1) 8. add $R5, $R3, $R4 9. srlv $R5, $R5, $R6 10. sw $R5, 0($R2) 11. ad...

Pentium Assembly Code Question

Hi I am new to Pentium assembly programming. Could you check if I am doing the translation of C to assembly correctly? Condition: 32-bit addresses, 32 bit integers and 16 bit characters. char[5] vowels="aeiou"; Translate: vowels db "aeoiu" ; or should it be "vowels dw "aeoiu" ? How to access vowels[p]? Is it byte[vowels+p*2]? (s...

How to determine the port numbers for peripheral devices?

I know that peripheral devices such as a hard driver, a floppy driver, etc are controlled by reading/writing certain control registers on their device controllers. I am wondering about the following questions: Is it true that when these peripheral devices are plugged onto the computer, the addresses(port numbers) of their control reg...

Problem with increment in inline ARM assembly

Hi , i have the following bit of inline ARM assembly, it works in a debug build but crashes in a release build of iphone sdk 3.1. The problem is the add instructions where i am incrementing the address of the C variables output and x by 4 bytes, this is supposed to increment by the size of a float. I think when i increment at some such s...

Simple way to print value of a register in x86 assembly.

I need to write a program in 8086 Assembly that receives data from the user, does some mathematical calculations and prints the answer on the screen, I have written all parts of the program and all work fine but I don't know how to print the number to the screen. At the end of all my calculation the answer is AX and it is treated as an ...

Easy way to convert c code to assembly?

Is there an easy way (like a free program) that can covert c/c++ code to x86 assembly? I know that any c compiler does something very similar and that I can just compile the c code and then disassemble the complied executable, but that's kind of an overkill, all I want is to convert a few lines of code. Does anyone know of some program...