Dark Bit Factory & Gravity

PROGRAMMING => Other languages => ASM => Topic started by: Phoenix on June 21, 2006

Title: Problems with FASM
Post by: Phoenix on June 21, 2006
Hi!

I'm learning ASM and I'm using FASM to code, but in all the tutorials I find they use MASM or TASM. And when I try to run the code from the tutorials FASM complains about things like DOSSEG and .code, I think this is because the syntax of the assemblers differ. I haven't found any ASM tutorials that uses FASM, and since I don't know how to convert from (X)ASM->FASM I guess I have to use another assembler. What should I do about this?
Title: Re: Problems with FASM
Post by: benny! on June 21, 2006
If you want to stick to fasm - have a look at the following link. It supplies
a very basic introductional tutorial in assembly using fasm.

http://decard.net/article.php
Title: Re: Problems with FASM
Post by: xteraco on June 21, 2006
i definately reccomend sticking with fasm....   but i gotta say, fasm and masm and tasm and goasm code arent all exactly the same, so, its definately best to find fasm only tutorials
Title: Re: Problems with FASM
Post by: Phoenix on June 21, 2006
Rbraz posted a link in another thread of an ASM tutorial which was great, but unfourtunately it wasn't FASM :'( But thanks for the link Benny! I'm reading it right now...
Title: Re: Problems with FASM
Post by: Phoenix on June 21, 2006
Hmm... The console window only flashes, is there any interrupt that waits for user input?
Title: Re: Problems with FASM
Post by: benny! on June 21, 2006
Hmm... The console window only flashes, is there any interrupt that waits for user input?

You can do a KEYBOARD_INPUT as follows :

Code: [Select]
mov ah,01
int 21h

01 stands for KEYBOARD_INPUT. Alternatively you could use 08 for
NO_ECHO_INPUT.

Here is a small working example for FASM

Code: [Select]
org 256
mov ah,9
mov dx,text_to_display
int 21h
mov ah,01
int 21h
int 20h
label text_to_display
db 'Hello World$'   

In addition, here is a link to an overview of interrupt-subfunctions :

http://www.csn.ul.ie/~darkstar/assembler/intlist.html
Title: Re: Problems with FASM
Post by: Phoenix on June 21, 2006
Nice :) Consider yourself applauded.
Title: Re: Problems with FASM
Post by: benny! on June 21, 2006
Nice :) Consider yourself applauded.
;) I am glad that I can help you ...
Title: Re: Problems with FASM
Post by: Phoenix on June 22, 2006
I managed to write a screen filler, which magically fills the screen with a solid color! :o

Code: [Select]
org 256

mov ax, 13h
int 10h

mov ah,0ch
mov dx,-1
mov cx,0
mov al,50

fill:
inc dx
cmp dx,200
ja swap
cmp cx, 320
int 10h
jne fill

mov ah, 01
int 21h
int 20h

swap:
inc cx
mov dx, 0
int 10h
jmp fill

I'm proud of myself since I only started two days ago, I'll attempt something harder now...
Title: Re: Problems with FASM
Post by: Phoenix on June 22, 2006
I'm having a little problem now, FASM complains about the following:
Code: [Select]
cmp 250*dx, count

...

label count word
dw 0
I get the error on the first line, but I can't fix the problem.
Title: Re: Problems with FASM
Post by: relsoft on June 22, 2006
try this:
Code: [Select]
mov ax, 320
imul ax, dx
cmp ax, count

Immediates and memory is incompatible.

Either of this should work:
 
reg, mem
mem, immed
reg, immed