assembly

Documentation about inline gas

Hi When reading the linux 0.01 kernel I pass throw some inline gas which is hard for me to decode: __asm__("movl $0x3ff000,%%eax\n\t" "movl %%eax,%%db0\n\t" "movl $0x000d0303,%%eax\n\t" "movl %%eax,%%db7" :::"ax") or __asm__("push %%fs;mov %%ax,%%fs;movl %%fs:%2,%%eax;pop %%fs" \ ...

Disassembly question

Hi all, I had just a look at a very simple SPARC assembly output that I got from this C programm: int addition_func(int a, int b) { return(a+b); } void main() { int a = 20; int b = 19; int res; res = addition_func(a, b); } Disassembly of section .text: 00000000 <addition_func>: 0: 81 c3 e0 08 retl 4: 90 02 00 09 ...

Intel IAPX88 Processor, Trap ISR

I am posting the following piece of code, the basic aim of this code is, when i set the trap flag to 1 then after that i am printing a character z on the screen, now as trap flag is set, the program should execute one instruction and trap, I have written a simple trap ISR in which i have an infinite loop, this infinite loop will be broke...

Displaying data using BIOS in C

Is there any way to print data using bios in c. I know in assembly you can use int 0x10, but is there any equivalent for C? ...

Disassemble the PDP-8 program.

This is a PDP-8 Program. Kindly can any one disassemble it. Binary representation Octal Representation 111000000001 7001 010000011100 2034 101000010001 5021 101000010000 5020 I want to know what the heck this code is doing. PS: This is not a homework. I just found this code in a video. Th...

How do i read single character input from keyboard using nasm (assembly) under ubuntu?

Hi, I'm using nasm under ubuntu. By the way i need to get single input character from user's keyboard (like when a program ask you for y/n ?) so as key pressed and without pressing enter i need to read the entered character. I googled it a lot but all what i found was somehow related to this line (int 21h) which result in "Segmentation F...

Algorithmic Issue in MIPS

I'm rewriting my answer(s) to Project Euler questions in MIPS assembly, and I can't get this one to output the correct answer. I've gone over the code for the past hour, and I can't figure out what's wrong with my approach (as I am getting 33165 when the answer is a cool 200,00+ higher than that), so I figure the problem must be my shaki...

How to access directly to VGA

Hi guys. As most of you know CPUs are not well designed to do floating point calculation in contrast to GPUs. I am wondering how to use GPU's power without any abstraction layer or driver. Can I program for a GPU using assembly, C, C++ language (I mean how?). Although assembly seems to help me access the gpu directly, C/C++ are likely t...

assembly language and optimization

How can programming in assembly help in achieving optimization ...

Representing numbers greater than 65535 in MIPS

It's me again! And I'm working on Project Euler again! Surprise, surprise. This time, my issue is that I am working in MIPS, and problem 2 requires numbers in excess of 65535, and i'm getting an out of range error. How can I work around that in this code? ## p2.asm ## ## Andrew Levenson, 2010 ## Problem 2 from Project Euler ## In MIPS A...

Subroutines in MIPS and other beginner silliness

I'm using Project Euler to learn MIPS, specifically using Problem 6 to learn how to use a subroutine. Unfortunately, I am doing something very wrong because my answer that I'm getting is far too large in magnitude. Is my problem here with how I am using the subroutine, or is it something else entirely? ## p6.asm ## ## Andrew Levenson, 2...

Delphi Assembly Function Returning a Long String

I am trying to learn inline assembly programming in Delphi, and to this end I have found this article highly helpful. Now I wish to write an assembly function returning a long string, specifically an AnsiString (for simplicity). I have written function myfunc: AnsiString; asm // eax = @result mov edx, 3 mov ecx, 1252 call Syste...

Is C inefficient compared to Assembly?

Possible Duplicate: When is assembler faster than C? Hello, This is purely a theory question, so, given an "infinite" time to make a trivial program, and an advanced knowledge of C and Assembly, is it really better to do something in Assembly? is "performance" lost when compiling C into Assembly (to machine code)? By perfor...

Compile/run assembler in linux?

I'm fairly new to linux(ubuntu 10.04) and a total novice to assembler. I was following some tutorials and I couldn't find anything specific to linux. So, my question is, what is a good package to compile/run assembler and what are the command line commands to compile/run for that package? ...

assembly on X86 machines, Windows vs Linux

Are they the same? Longer version : Say I wrote, in assembly, on a windows machine, a small app that all it does is add 1+1 and stores it in a register. THEN, I write the exact same code on a Linux machine. Would it work? Im thinking yes, because at the hardware level, its the same machine, so the 'language of the hardware' (forgive t...

What is the difference between '__asm' and '__asm__'?

I am learning inline assembly in C. As far as I can tell, the only difference between __asm { ... }; and __asm__("..."); is that the first uses mov eax, var and the second uses movl %0, %%eax with :"=r" (var) at the end. Also, there are a lot less websites about the first. What other differences are there? ...

Assembler: Relative Jump

Can someone explain in English what a relative jump is in assembler? ...

Building a COM object vtable in x86 assembly

I am building a COM object in x86 assembly using NASM. I understand COM quite well and I understand x86 assembly pretty well, but getting the two to mesh is getting me hung up... (by the way, if you're thinking of attempting to dissuade me from using x86 assembly, please refrain, I have very particular reasons why I'm building this in x8...

DebugBreak for iPad

Hello, I want to make DebugBreak for iPad and found that asm{trap} should work, but there is a problem: if I use asm{trap} I have error: asm blocks not enabled, use `-fasm-blocks'. If I enable -fasm-blocks I have another error: -fasm-blocks option not supported for ARM. Do you know another way to implement DebugBreak or to make asm co...

Instruction timing on ARM Cortex-m3 (Specifically LPC1343)

I'm looking to write some very timing sensitive code on an LPC1343 where I need to count exact clock cycles. There are two issues :- I've read that code executing from the internal flash memory isn't always able to run at the full 72Mhz and wait states might be introduced. But I can't find any "official" document about this. I saw one ...