assembly

Making a simple assembly emulator

Dear All, I am working on project that is detecting unknown Viruses, so i am going to build my small emulator that emulates the assembly code of the executable so i can detect whether it is a virus or not by emulating it to virtual registers then observing what happens. so i need help in getting the code of every assembly instruction in...

PIC 16F684 Microcontroller Interupt Handling

I just finished up my Microprocessors class in college just a few weeks ago, there we programmed in assembly only. We learned a fair amount (IMHO) about interrupts. Here is my question: I am programming in C using the HiTech Compiler for the 16F684, in the datasheet section discussing the interrupts (PIC 16F684 Datasheet Section 12.4) ...

Basic C++ debugging question

Do I absolutely have to learn assembly language to be able to use the debugger optimally? I noticed that during debugging sessions, I see these cryptic codes and CPU registers... (eax... blah blah). I shall assume that that's assembly and I am supposed to somehow decipher the cause of the problem from it. Is there some shortcut to ...

ASM-optimizations lost after compilation?

Not that I'm in that situation currently, but I'm just interested in the answer... Assuming you have some code written in C/C++ and you want to manually optimize it by modifying it in ASM. What happens if you alter the code in C/C++ and recompile from source. Sure, the optimization on the just compiled file is lost. How do you avoid th...

Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed certain optimizations. I was trying to look at the assembly listing generated with g++ (g++ -c -g -O2 -Wa,-ahl=file.s file.c) to possibly see what is going on un...

Shutdown computer in MS-DOS using ACPI

I have MS-DOS 6.22 running on a Pentium based computer (motherboard supports ACPI), and would like to know if there was an assembly language routine I could use to shut down the computer, or is it a little harder than that (i.e. motherboard specific)? Basically, I want to create a small program to shut down the computer from the command...

Assembler Language Programming

I am trying to write a program that inputs a positive number less than 10 and outputs the sum of the first numbers. For example 5 would be 5+4+3+2+1. The commands are Stop, Load, Store, Add, Sum, Multiply, Divide, Input, Output, Branch, Branch if 0, and branch if not 0. Can anyone help me out here. I am kind of stuck. well what I have wr...

Xilinx Microblaze C and assembly

I have an application written in C for a Xilinx Microblaze core. However, the performance isn't quite what I want so I was considering rewriting some of the core functions in assembly. I'm having trouble figuring out how to get Xilinx Platform Studio to compile both into a single ELF file though. How can I do it? ...

What do the brackets mean in x86 asm?

Given the following code: L1 db "word", 0 mov al, [L1] mov eax, L1 What do the brackets ([L1]) represent? ...

Decode sys calls?

How do you find out what number each sys call is? Like on SP3 ZwCreateFile is ZwCreateFile: mov eax, 0x25 mov edx, 0x7ffe0300 call [edx] retn 0x2c How do you find out that ZwCreateFile is 0x25? ...

Size optimizations for Assembly

What other optimizations, like the one presented here http://stackoverflow.com/questions/147173/x86-assembly-testl-eax-against-eax can one apply in order to reduce code size? I am interested especially in one-line optimizations like using test eax, eax instead of cmp eax, 0. Thanks. ...

Taylor series implementation in assembly language using 68hc11

How to implement Taylor series to calculate sine value in assembly using 68hc11. As 68hc11 does not support floating point, display value will be in integer..(e.g. multiply by 100 to make integer value). ...

MASM/NASM Differences

What are the syntax differences between the NASM and MASM assemblers? ...

Word and Double Word integers in C

I am trying to implement a simple, moderately efficient bignum library in C. I would like to store digits using the full register size of the system it's compiled on (presumably 32 or 64-bit ints). My understanding is that I can accomplish this using intptr_t. Is this correct? Is there a more semantically appropriate type, i.e. something...

Assembly fast division by 2

Is there a faster way of dividing by 2, with sign, in assembly than the one in the example below? ... mov ecx, 2 idiv ecx push eax #push the result ... ...

Simple RPN Calculator in Assembly (mips32)

hi i'm zoe . i have a project in my university about RPN calculator in Assembly language but i dont really know much . can someone help me out with the code ? thanks !!! ...

Mergesort for easy68k

Hi everybody, has anybody done a merge sort in m68k? Thanks. John ...

Basic OS boot question

Hello! I have some kinda basic question to the boot process of a computer and the part where the bootloader calls the OS. So I know that the BIOS copies the first 512 bytes from a bootable drive into memory and executes the code - so that's the boot block. But how does that small assembler boot bootloader the commands from the OS? Do...

Read instructions being executed

As the title suggests, is there any way to read the machine code instructions as/after they have been executed? For example, if I had an arbitrary block of C code and I wanted to know what instructions were compiled and executed when that block was entered then would there be a way to do that? Thank you in advance for any pointers on the...

Smaller instruction than "add esp, 4"

Me again. I'm having a lot of "add esp, 4" in my program and I'm trying to reduce its size. Is there any smaller instruction that can replace "add esp, 4" ? ...