For a retro computing project, I need to translate a body of 1970s era 8080 assembly language into x86 form. There was a time when a tool to do just that was a key part of Intel's marketing for introduction of the 80x86 family. But my googling skills don't seem up to the job of finding that original tool or something similar. Does anyone...
Here are two ways to set an individual bit in C on x86-64:
inline void SetBitC(long *array, int bit) {
//Pure C version
*array |= 1<<bit;
}
inline void SetBitASM(long *array, int bit) {
// Using inline x86 assembly
asm("bts %1,%0" : "+r" (*array) : "g" (bit));
}
Using GCC 4.3 with -O3 -march=core2 options, the C version t...
In a program I wrote, 20% of the time is being spent on finding out the minimum of 3 numbers in an inner loop, in this routine:
static inline unsigned int
min(unsigned int a, unsigned int b, unsigned int c)
{
unsigned int m = a;
if (m > b) m = b;
if (m > c) m = c;
return m;
}
Is there any way to speed this up? I am ok ...
I posted this Q to TI's 28xx DSP forum but haven't heard a response and figured maybe someone here might know.
I know how to write functions in assembly so that they are C-callable; if the C-callable name is foo() then the assembly function is named _foo().
What if I want to use C++ and optimize a class method in assembly? How do I d...
Is there a utility like CodeView that I can use to step through code assembled by NASM where I can see the current state of the registers/memory?
...
I'm just touching the surface of the x86 instruction set after a long period of high level programming. It's been about 20 years I had my first read on x86 assembly programming and from my googlings I get just lost with the myriad of instruction set references; from ones that mix new generations of processors (286, 386, 486...) to others...
I'm just cross posting the same question I did on virtualbox.org. http://forums.virtualbox.org/viewtopic.php?f=9&t=26702&p=119139#p119139
If not breaking any rule, I'd appreciate to kwon more about it since stackoverflow promisses to be more dynamic!
"Hi,
I did some search and could not find any tool to debug a guest system fro...
I have a simple bootloader, which initializes and prepares SDRAM. Then it loads an application from the Flash and starts it at some address in the RAM. After the application has finished its execution, the system does restart. There is no system stack.
Now, I would like this bootloader receives control back after an application finished...
I'm generating AT&T-syntax assembly files. I want to encode some data in the generated instruction stream. (I want to embed a register pointer mask that I can lookup using a fixed offset to the PC.)
I can simply use the .byte or .ascii directive and jmp over embedded data:
movq _label6@GOTPCREL(%rip), %rax
jmp _skip0
.ascii "garbage in...
I'm working on a thing where I want to have the output option to go to a video overlay. Some support rgb565, If so sweet, just copy the data across.
If not I have to copy data across with a conversion and it's a frame buffer at a time. I'm going to try a few things, but I thought this might be one of those things that optimisers w...
Hi stackoverflow
I've to do an interface (say, a wrapper) that allow a call from X86_64 assembly code using his calling convention to C function, with other calling convention. The best thing would be to be pretty "compiler independant" (juste modifying the wrapper), so i'm looking for something that puts registers/stack stuff on compi...
I dump my RAM (a piece of it - code segment only) in order to find where is which C function being placed. I have no map file and I don't know what boot/init routines exactly do.
I load my program into RAM, then if I dump the RAM, it is very hard to find exactly where is what function. I'd like to use different patterns build in the C ...
The assembly code generated by assembler, from a C-source code depends on the CPU architecture underlying it, eg x-86 .
Then does the assembler output of a simple C-source code (containing common function-calls of both windows and linux) differ between Operating Systems ?
...
I was told by c-faq that compiler do different things to deal with a[i] while a is an array or a pointer. Here's an example from c-faq:
char a[] = "hello";
char *p = "world";
Given the declarations above, when the compiler sees the expression a[3], it emits code to start at the location ``a'', move three past it, and fetch the ch...
I don't know much about assembly, but I am pretty sure that there are square root instructions on the x86? I am trying to get a square root function to work well in froth and the one that I have found gets bogged down somehow when I run it many times.
: sqrt-closer ( square guess -- square guess adjustment)
2dup / over - 2 /
;
: sqrt (...
Compiling this simple function with MSVC2008, in Debug mode:
int __cdecl sum(int a, int b)
{
return a + b;
}
I get the following disassembly listing:
int __cdecl sum(int a, int b)
{
004113B0 push ebp
004113B1 mov ebp,esp
004113B3 sub esp,0C0h
004113B9 push ebx
004113BA push esi
00...
I wish to learn more about the inner working of the computer, to enhance my knowledge about embedded system developement.
At work, I never get involved with the low-level details (such as, the GDT, the loader of the code from flash to RAM, etc) as all these are already written.
I'd rather not buy any other hardware currently.
Is there ...
What are the requirements of a PE file (PE/COFF)? What fields should be set, which value, at a bare minimum for enabling it to "run" on Windows (i.e. executing "ret" instruction and then close, without error).
The library I am building first is the linker: Now, the problem I have is the PE file (PE/COFF). I don't know what is "required"...
Background: I've been tasked with writing a data collection program for a Unitech HT630, which runs a proprietary DOS operating system that can run executables compiled for 16-bit MS DOS, albeit with some restrictions. I'm using the Digital Mars C/C++ compiler, which seems to be working very well.
For some things I can use standard C l...
I have been given the task to fix an Embedded Operating System which is written in C/C++. The Current thread scheduler being used is very similar to Round Robin Scheduling, except it lacks one very important feature, the ability to interrupt threads and then return executing thus creating a dependable "slice" of execution time.
My Qu...