I'm learning 80386 from PC Assembly by paul caurter
mul source
If the operand is byte sized, it is multiplied by the byte in the AL
register and the result is stored in
the 16 bits of AX.
fine.
If the source is 16-bit, it is multiplied by the word in AX and the
32-bit result is stored in DX:AX.
Q1: Why ...
I want to try write a simple kernel in C# like cosmos, just for learning. Is it possible to generate x86 or x86-64 ASM from a Mono assembly? because mono --full-aot generates an executable...
After the generation of the ASM I need to compile it with NASM. Any ideas?
...
I would like to set the video mode in a ASM kernel I'm working on to a video mode 1920x1080 or higher (or at least higher than the usual limit in VESA). Is there anyway to do that, and if so, provide sample code?
I'm using NASM to code the kernel.
...
I want to use "_test_and_set lock" assembly language implementation with atomic swap assembly instruction in my C/C++ program.
class LockImpl
{
public:
static void lockResource(DWORD resourceLock )
{
__asm
{
InUseLoop: mov eax, 0;0=In Use
xchg eax, resourceLock
cmp ea...
My Code
const int howmany = 5046;
char buffer[howmany];
asm("lea buffer,%esi"); //Get the address of buffer
asm("mov howmany,%ebx"); //Set the loop number
asm("buf_loop:"); //Lable for beginning of loop
asm("movb (%esi),%al"); //Copy buffer[x] to al
asm("inc %e...
What would be the assembly code for 68HC11 to calculate value of sine using either Taylor series or a lookup table?
Display value will be only in integer. How would a lookup table work
in this case? How can it be implemented using Taylor series?
...
Hi,
I came across this inline asm. I am not sure how it should look without this syntax... Could someone show it to me?
__asm__ volatile ("lock\n\tincl %0"
:"=m"(llvm_cbe_tmp__29)
:"m"(*(llvm_cbe_tmp__29))"cc");
...
I attended interview for samsung. They asked lot of questions on memory layout of the program. I barely know anything about this.
I googled it "Memory layout of an executable program". "Memory layout of process".
I'm surprised to see that there isn't much info on these topics. Most of the results are forum queries. I just wonder why? ...
Are there any asm instructions that can speed up computation of min/max of vector of doubles/integers on Core i7 architecture?
Update:
I didn't expect such rich answers, thank you.
So I see that max/min is possible to do without branching.
I have sub-question:
Is there an efficient way to get the index of the biggest double in array?
...
Hello, I am looking for an extremely small way of turning a string like "123" into an integer like 123 and vice-versa.
I will be working in a freestanding environment. This is NOT a premature optimization. I am creating code that must fit in 512 bytes, so every byte does actually count. I will take both x86 assembly(16 bit) and C code t...
I have a function sincos_Q15_asm() in assembly, in file sincos_p5sh.asm with directives as follows:
.sect ".text"
.global _sincos_Q15_asm
.sym _sincos_Q15_asm,_sincos_Q15_asm, 36, 2, 0
.func 1
The function works fine when I test it by itself (assembly only), but when I try to link to it, I get a linker error:
undefined ...
I want to use the bts and bt x86 assembly instructions to speed up bit operations in my C++ code on the Mac. On Windows, the _bittestandset and _bittest intrinsics work well, and provide significant performance gains. On the Mac, the gcc compiler doesn't seem to support those, so I'm trying to do it directly in assembler instead.
Here's...
Hello,
I'm a novice programmer. I just wanted to see output at different phases compilation, assembling & linking. I don't know assembly language also.
I wrote a simple program
#include <stdio.h>
int humans = 9;
int main()
{
int lions = 2;
int cubs = populate(lions);
return 0;
}
int populate(int crappy...
I started learning Assembly language from the book: Introduction to 80x86 Assembly Language and Computer Architecture
This is from the Representing Data in a Computer
We have looked at two schemes to
represent numbers-
by using binary integers (often expressed in hex) or
by using ASCII codes.
However, these meth...
How do you translate these lines from Linux assembly to Intel assembly?
pushl cb_queue
pushl %eax
popl (%eax)
jg .FOR_end0
.FOR_end0:
sete (%esp)
pushl $.rte_isqrt
.rte_isqrt:
.string "isqrt returns no value"
...
Hi to all
I need to be able to write a program in assembly to read the first sector of a disk (The MBR) and write it to a floppy disk or at least show the data.
I understand that INT 13h and 25h do not work in the windows protected mode and i even tried my code in Dos but the dos system hangs when I run the program. This is the code:
...
I have been given an end of term project to write an assembly code to read the MBR and save it to floppy. I think I managed to read it with INT 13h in DOS in a virtualBox machine. The machine has only one hard disk with one partition with XP installed.
When I read the MBR and print it, it gives me a whole lot of junk and amongst the jun...
Hi,
Sometimes when there are errors output by gcc, one will break down the the process for each stage of preprocessing, compilation, assembly, linking by options like -E, -S and -c. Here is an example.
I just wonder what types of errors could happen at each of these four stages and if there is one error occuring at one of these stages ...
Hello,
I'm learning assembly language. I started with Paul A. Carter's PC Assembly Language which uses NASM (The Netwide Assembler). Then in the middle I switched and started reading Introduction to 80×86 Assembly Language and Computer Architecture which uses MASM.
In NASM I used to write, for initializing a byte
db 110101b
In MA...
Is it better for a compiler to compile code to assembly language, or output binary machine code directly?
Advantages of assembly language that I can think of off the top of my head: avoiding the need to learn the object file format, ease of debugging the backend.
Advantage of binary: faster compile speed. How significant is this? Assum...