nasm

NASM Printing Out Time - Beginner Help

I'm just getting started with ASM (NASM), and need some help with the following snippet. I get no errors/warnings, it just doesn't output anything. What I was expecting was for it to get the time (13), then print that out (4), then exit (1). Also, does anyone know of some good (preferably NASM specific) ASM tutorials? section .bss ...

gas vs. nasm: which assembler produces the best code?

Both tools translate assembly instructions directly into machine code, but is it possible to determine which one produces the fastest and cleanest code? ...

Executing a flat binary file under Linux

Is there a way to execute a flat binary image in Linux, using a syntax something like: nasm -f bin -o foo.bin foo.asm runbinary foo.bin ...

Windows/DOS Assembly - Simple Math

Hi there... I'm currently learning Windows/DOS assembly. I'm just making a small program that adds two base 10 integers, and outputs the solution to standard output. Here is my current code: org 100h MOV al,5 ADD al,3 mov dx,al mov ah,9 int 21h ret I'm confused as to why when that is compiled, I get the error: error: invalid co...

Asm IDE recommendations

Hello I want to learn some assembly . I installed nasm on my x86 windows machine . But I need recommendation for some IDE that i will be able to compile with my installed nasm through it , and of course that it will color the syntax . (maybe even debugger ) . I saw that notepad++ can color syntax but it not really Enough. Thanks f...

Converting problem: __asm__ __volatile__

I have been dealing with Nasm on a linux environment for some time and this function worked great... but now I am switching to a windows environment and I want to use Masm (with VS2008) I cant seem to get this to work... void outportb (unsigned short _port, unsigned short _data) { __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), ...

Inline Assembly Jump Error

Why does this fail, once Masm reaches jmp? struct gdt_entry { unsigned short limit_low; unsigned short base_low; unsigned char base_middle; unsigned char access; unsigned char granularity; unsigned char base_high; }; struct gdt_ptr { unsigned short limit; unsigned int base; }; struct gdt_entry gdt[3]; s...

How can I access system time using NASM?

I am trying to seed my random number generator with current system time. How can I access the system time using NASM? (I am using linux) ...

How to write my own include files for NASM?

I'm currently teaching myself assembly language programming on AMD64 for Linux. I've just discovered the NASMX project with its include files. They certainly make things a lot easier, but I would eventually like to extend them and even to be able to write my own. I have lots of enthusiasm and patience to do this, just no knowledge, onl...

Loading kernel from assembly (NASM)

I've been stuck with this for weeks now and have no idea where I'm going wrong because NASM hasn't given me any errors. The code is pretty self explanatory because of the comments. this is the code that is loaded from the BIOS ;-------------------------------------------- ; 'boot.asm' ; loaded from BIOS [org 0x7C00] [bits 16] ;...

DOS assembly Simple math

I have a number stored in dl, and I need this to work for numbers up to three digits? Here is the working code for digits 0-9. WriteNumber: ;; print out number in dl push ax push dx add dl,"0" mov ah,02h ; printing one char int 21h pop dx pop ax ret For example, for two digits. I could take dl/10. And then print out the result and th...

x86 Assembly: What's the main prologue and epilogue?

Hello, I'm following this tutorial on x86 assembly. Every example so far uses what the author calls a "c-driver" program, compiled with the assembly module, for means of some "initialization". Something like: int main(void) { int ret = asm_main(); return ret; } And then the asm_main function is written normally, using a C calling...

Build application in Xcode and NASM support (my application will use NASM)

Hello, I want to create simple Cocoa application with Xcode. But i need to add NASM assembler functionality to my application (to compile assembler application). NASM is shipped with developers tools but not everyone have installed developer tools. Is it possible to ship NASM with my application bundle and how would I make such a projec...

NASM accessing sound card directly (No OS)

I'm attempting to write a very simple OS in ASM and C. (NASM assembler) I would like to access the sound card directly, with or without drivers. If I don't need drivers, how could I access and send a sample audio file to the sound card? (An example would be nice) If I do need drivers, is there anyway to interface them and call functions ...

What's the file format used by gcc in OSX?

I'm trying to learn assembly using NASM, the pcasm-book.pdf from Dr Paul Carter - http://www.drpaulcarter.com/pcasm/ - on my Mac OS X Snow Leopard. I'm trying to link the previous compiled C sample to asm samples: gcc first.o driver.c asm_io.o -o first But it's returning it: driver.c:3: warning: ‘cdecl’ attribute ignored ld: warning...

Help with Assembly. Segmentation fault when compiling samples on Mac OS X.

Hi, I'm trying to learn assembly using Dr Paul Carter's pcasm book: http://www.drpaulcarter.com/pcasm/ The author doesn't packaged Mac OS X samples, then I've started using from linux sources. Here is the first sample, that uses his library asm_io. I'm getting Segmentation Fault when running it. Why? What need to be changed to run in ...

GCC outputs error "undefined reference to `printf'" when using an NASM extern statement to access printf.

I am learning NASM and am tying to compile this code (which I found here). It assembles using this NASM command: nasm -f coff -l printf.lst printf1.asm to printf.o but this gcc linking command: gcc -o printf1 printf1.o fails with the error: printf1.o:printf1.asm:(.text+0x1a): undefined reference to `printf' collect2: ld returned...

A good NASM/FASM tutorial?

Does anyone know any good NASM or FASM tutorials? I am trying to learn assembler but I can't seem to find any good resources on it. ...

problem in understanding mul & imul instructions of Assembly language

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 ...

Mono ASM Generation

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? ...