assembly

how to store assembly in memory

Hi, I have a question about how to store the assembly language in memory,when I compile the C-code in assembly, and run by "step", I can see the address of each instruction, but is there a way to change the start address of the code in the memory? Second question is, can I break the assembly code into two? That is, how to store the two ...

Help with GBA ARM assembly program

I tried to modify this ARM assembly program (see bottom of the page) to use subroutines. It should display a red screen on the GBA (and compiling the example program it actually does, so it's not a toolchain use problem), but, when I run it, the screen goes black instead. I'm using devkitARM 30 .arm .text .global main main: mov r0, ...

Change root package of Java JAR

I am writing a Java Agent which makes use of the Java ASM library for handling byte code. This is a common library and I want to be sure about the version of ASM which my code is using at runtime. What is the easiest and most automated way to take the ASM classes and process them into a private copy where all the classes have been reloc...

Write a maximum of two instructions to clear, set and complement some bits in the AL register

You are required to write a maximum of two instructions in assembly to do the following: Clear bits 0 and 7 of register AL, i.e. make them 0 Set bits 3 and 4 of register AL, i.e. make them 1. Complement bits 1 and 5 of register AL. Keep all other bits in the register AL as is without changing their values. ...

80x86 16-bit asm: lea cx, [cx*8+cx] causes error on NASM (compiling .com file)

Title says it all. The error NASM gives (dispite my working OS) is "invalid effective address". Now i've seen many examples of how to use LEA and i think i gots it right but yet my NASM dislikes it. I tried "lea cx, [cx+9]" and it worked; "lea cx, [bx+cx]" didn't. Now if i extended my registers to 32-bits (i.e. "lea ecx, [ecx*8+ecx]") ...

How to call DOS Interrupts within a C/C++ program using Inline Assembly ?

Hi, everyone ! I need to call some DOS interrupts (Services) from a C/C++ program, I tried the following inline asm code: (Read a character) int main() { asm( "movb $0x01, %ah;" "int $0x21" ); system("PAUSE"); } But it did not work ! I would like to know what have i done wrong here ! Also if there is another way to call dos interr...

Attempting to convert an if statement to assembly

What am I doing wrong? This is the assmebly I've written: char encode(char plain){ __asm{ mov al, plain ;check for y or z status cmp al, 'y' je YorZ cmp al, 'z' je YorZ cmp al, 'Y' je YorZ cmp al, 'Z' je YorZ ;check to make sure it is in the alphabet now mov cl, al sub cl, 'A' ...

What is a good 64-bit NASM assembly reference?

I have been able to find plenty of 16 and 32-bit NASM assembly references like here, but the only thing I could find on 64-bit NASM was what was in the small section of the NASM manual here. Are there any good sites or books that would have a better explanation of 64-bit assembly (Windows or Linux/Unix) with some good code examples? ...

how can I make a pure assembly project in visual studio?

How can I make a masm project in visual studio? I remember doing this in class a while back, but i've since forgotten, and google is only getting me inline assembly. Thanks. ...

How can I do Input/Output on a console with MASM?

I've googled and googled, and I've not found anything useful. How can I send output to the console, and accept user input from the console with assembly? I'm using MASM32 ...

MIPS assembly to determine whether hardware I/O interrupt has occurred?

In my MIPS32 exception handler, I want to determine whether the exception was caused by a I/O interrupt. The Cause register bits 2-6 inclusive has to be checked. What's the MIPS assembly code to determine this? ...

Optimizing comparison instruction count (PDP-11)

For PDP-11, how can I change the following snippet of assembly so that it's only two instructions, yet does the same work as these four? tst r0 blt label cmp r0, #75 bgt label ...

Printf in assembler doesn't print

Hi there, I have got a homework to hack program using buffer overflow ( with disassambling, program was written in C++, I haven't got the source code ). I have already managed it but I have a problem. I have to print some message on the screen, so I found out address of printf function, pushed address of "HACKED" and address of "%s" on t...

Getting the PC value in ARM assembly

I have a Windows Mobile 6 ARMV4I project where I would like to get the value of the program counter. The function is declared like this: extern "C" unsigned __int32 GetPC(); My assembly code looks like this: GetPC FUNCTION EXPORT GetPC ldr r0, [r15] ; load the PC value in to r0 mov pc, lr ; return the value of r0...

Stack / base pointers in assembly

I know this topic has been covered ad nauseam here, and other places on the internet - but hopefully the question is a simple one as I try to get my head around assembly... So if i understand correctly the ebp (base pointer) will point to the top of the stack, and the esp (stack pointer) will point to the bottom -- since the stack grow...

Intel IA-32 Assembly

I'm having a bit of difficulty converting the following java code into Intel IA-32 Assembly: class Person() { char name [8]; int age; void printName() {...} static void printAdults(Person [] list) { for(int k = 0; k < 100; k++){ if (list[k].age >= 18) { list[k].printName(); } } } } My ...

Why is my boot loader's stack segment at 0x3FF (end of Real Mode IVT)?

Title says it all. "address 0x500 is the last one used by the BIOS" is what Wikipedia - "00000000-000003FF Real Mode IVT (Interrupt Vector Table)" is what osdev.org's article over the BIOS memory map says. So can you tell me why NASM places my .com file's stack pointer to 0x3FF while my instruction pointer starts at 0x7C00? To me...

Could this code damage my processor?

A friend sent me that code and alleges that it could damage the processor. Is that true? void damage_processor() { while (true) { // Assembly code that sets the five control registers bits to ones which causes a bunch of exceptions in the system and then damages the processor Asm( "mov cr0, 0xffffffff \n\...

Intel Assembly Programming

class MyString{ char buf[100]; int len; boolean append(MyString str){ int k; if(this.len + str.len>100){ for(k=0; k<str.len; k++){ this.buf[this.len] = str.buf[k]; this.len ++; } return false; } return true; } } Does the above translate to: start: push ebp ; save calling ebp mov ebp, esp ; setup new ebp push esi ; ...

What is on the 68000 stack when classic MacOS enters a program?

I'm trying to understand an old classic Mac application's entry point. I've disassembled the first CODE resource (not CODE#0, which is the jump table). The code refers to some variables off the stack: a word at 0004(A7), an array of long words of starting at 000C(A7) whose length is the value at 0004(A7), and a final long word beyond tha...