nasm

linux kernel booting from my bootloader

hi , i wish to load linux using my own bootloader .. preliminary research and google told me that i ll have to use start_kerne() function .. i want to ask how can i call start_kernel() from assembly .. i have already formatted my usb into ext3 and pasted the compiled kernel there .. now how can i start the linux kernel ? any help is we...

Why does this 'hello world' x86 bootloader code written for NASM work without the [BITS 16] and [ORG 0x7C00] directives?

push word 0b800h pop es xor di, di mov [es:di], word 441h jmp $ times 510 - ($-$$) db 0 db 55h db 0AAh ...

NASM and a question about ADC - ASM 8086

Hello,I study assembly on High-school and I would like to try to make assembly programs at home. I downloaded NASM but I don't understand how to run the .s files with it - if you can write a simple way here to run it I'd glad :-) and in addition I have a question: when I use ADC for exmaple: AL = 01 and BL = 02, and CF = 1, when I make ...

Choosing the right and learning assembler for compiler-writing

I'm writing a compiler and I have gone through all the steps (tokenizing, parsing, syntax tree structures, etc.) that they show you in all the compiler books. (Please don't comment with the link to the "Resources for writing a compiler" question!). I have chosen to use NASM together with alink as my backend. Now my problem is: I just c...

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]") ...

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

Problem in linking an nasm code

I'm using a computer with an Intel Core 2 CPU and 2GB of RAM. The SO is Ubuntu 9.04. When I try to compile this code: ;programma per la simulazione di un terminale su PC, ottenuto utilizzando l'8250 ;in condizione di loopback , cioè Tx=Rx section .code64 section .data TXDATA EQU 03F8H ;TRASMETTITORE RXDATA EQU 03F8H ;RICEVITORE...

Problem with asm program (nasm)

org 0x100 SEGMENT .CODE mov ah,0x9 mov dx, Msg1 int 0x21 ;string input mov ah,0xA mov dx,buff int 0x21 mov ax,0 mov al,[buff+1]; length ;string UPPERCASE mov cl, al mov si, buff cld loop1: lodsb; cmp al, 'a' jnb upper loop loop1 ;output mov ah,0x9 mov dx, buff int 0...

Assembly Language Question: Counting upper case and lower case letter from a string

Write an Assembly Language program named “count letters” that counts the occurrences of all small and capital letters in given below string and then prints the result in the format (Caps, count:: Small, count). String is “bcAdBDeCEad” and it should print this result (Caps, 5:: Small, 6). The program should take address of the source stri...

Writing an OS kernel in assembly with NASM

I want to know what is the standard way for writing a -simple- kernel to be compiled on NASM? To get it clearer: I was able to define the code block with all the following ways: [segment code] [segment .code] segment code segment .code [section code] [section .code] section code section .code I need to know what is the standard way ...

Building a music player with assembly

Is it possible to build a music player in assembly (I'm thinking along the lines of NASM)? What are the obstacles one might face in the process of building one? ...

Learning Assembly, Issue With Code?

jmp start ;============================== ; Draws a horiz and vert line ;============================== startaddr dw 0a000h ;start of video memory colour db 1 ;============================== start: mov ah,00 mov al,19 int 10h ;switch to 320x200 mode ;============================= horiz: mov es, startaddr ;put s...

Am I Writing Assembly Or NASM?

I'm fed up with this. I've been trying to just get a grip on assembly for awhile, but I feel like I'm coding towards my compiler rather than a language. I've been using this tutorial, and so far it's giving me hell. I'm using NASM, which may be the problem, but I figured it was the most popular one. I'm simply trying to learn the most g...

link nasm program for mac os x

i have some problems with linking nasm program for macos: GLOBAL _start SEGMENT .text _start: mov ax, 5 mov bx, ax mov [a], ebx SEGMENT .data a DW 0 t2 DW 0 fry$ nasm -f elf test.asm fry$ ld -o test test.o -arch i386 ld: warning: in test.o, file was built for unsupported file format which is not the architecture being l...

What are the limitations of assembler? (NASM)

Is there a technical limitation of what kind of programs I can write with assembler (NASM)? For now I've only seem some program that do arithmetic operations, like adding two numbers. Is it possible to write complex assembler programs, that provide a GUI, access the file system, plays sounds et cetera? I know I wouldn't write such pr...

NASM: Count how many bits in a 32 Bit number are set to 1.

I have a 32 Bit number and want to count know how many bits are 1. I'm thinking of this pseudocode: mov eax, [number] while(eax != 0) { div eax, 2 if(edx == 1) { ecx++; } shr eax, 1 } Is there a more efficient way? I'm using NASM on a x86 processor. (I'm just beginning with assembler, so please do not tell me to use ...

[NASM] How do I print out the content of a register in Hex

Hi, I'm currently getting started with NASM and wanted to know, how to output the contents of a register with NASM in Hexadecimal. I can output the content of eax with section .bss reg_buf: resb 4 . . . print_register: mov [reg_buf], eax mov eax, SYS_WRITE mov ebx, SYS_OUT mov ecx, reg_buf mov edx, 4 int 80...

Call Another Source File

I'm building a program(in 16-Bits) using Assembly(nasm as the assembler), but as I love to have things organized in different source files. Let's think I have 2 sources, one called main.asm and another one called source2.asm, but I want to call the source1.asm content in the middle of main.asm. How could I do this? ...

Compiling Assembly code

Hello, I'm trying to compile an ASM program I wrote with NASM and the "ld" command from DJGPP. This is the code for the batch file I'm using to compiling it: @echo off set path=C:\NASM;%PATH% nasm -f aout -o start.o start.asm ld -T link.ld -o kernel.bin start.o But when I run the file I get: start.o: file not recognised: File format...

Putting Two ORGs Together

I'm building a boot loader that boots the content that is located at the 1000h part of the floppy. I was doing that using Fasm(because my friend only uses Fasm, and he was helping me with this), but I prefer to use Nasm, and now I'm having problems with the syntax, then I want to know how could I do this in Nasm: org 7C00h %include ...