Re: Error: suffix or operands invalid for `int'



chiky wrote:
Hey guys,

I was writing a small assembly code in GAS syntax (actually learning
from Linus' first kernel). It is giving me errors like these:

project@BUZZ-SuSE:~/kernel/linux/boot/chiky> as -o b.o b.s
b.s: Assembler messages:
b.s:27: Error: suffix or operands invalid for `int'
b.s:33: Error: suffix or operands invalid for `int'

Here is the program:

.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text

BOOTSEG = 0x07c0
INITSEG = 0x9000
SYSSEG = 0x1000
ENDSEG = SYSSEG + SYSSIZE


start:

mov 0x03, %ah /*read cursor pos*/
xor %bh,%bh
int 0x10

mov $24, %cx
mov 0x0007, %bx # page 0, attribute 7 (normal)
mov msg1, %bp
mov 0x1301, %ax # write string, move cursor
int 0x10

msg1:
.byte 13,10
.ascii "Hello!"
.byte 13,10,13,10

.text
endtext:
.data
enddata:
.bss
endbss:


I tried the '$' suffix in front of the interrupt '0x10', it assembled
but ran with a segmentation fault.

Thanks
Chirag


If you're attempting to run it under Linux kernel,
the segfault is OK - you're not allowed to access
the BIOS from user mode. Actually, there's nothing
useful on the int 0x10 vector to handle the call.

DOS examples must be run on a plain computer without
any real operating system (or in a simulator).

Besides, even on a plain computer, your code will
run off the end after the second int 0x10.

--

Tauno Voipio
tauno voipio (at) iki fi
.



Relevant Pages

  • Re: win32 or native NT windows API
    ... Windows uses int or sysenter. ... Code which is executed in user mode can ... If you want to learn how to write assembler code, ... reinvent the wheel on each piece of code it executes. ...
    (alt.lang.asm)
  • Re: Are byte types a smart choice?
    ... Iturns it into byte code and interperates it on the fly. ... The CLR specification defines the size of an int to ... > assembler programmer code better. ... equivalent of the old #defines and the int full of flags. ...
    (microsoft.public.dotnet.csharp.general)
  • Re: Passing parameters to assembler program
    ... call some Assembler Code that does some computation. ... int main ... You might wish to study the assembler your compiler generates for: ... For GCC compilers, you will want these: ...
    (alt.lang.asm)
  • Re: Could someone help with this function
    ... mov bl, ... INT calls are different than DOS and are never used directly. ... IA32 assembly and you'll need to know how assembler interfaces with ...
    (borland.public.delphi.language.basm)
  • Re: Static Libraries and Assembly Language
    ... The "static libraries" is one of methods to fabricate that. ... syntax, you can choose to translate it to syntax of your assembler, ... Usage of a DLL is good thing as long as this DLL is common and is used widely. ... The point was about utilizing of assembly code among different assembly ...
    (alt.lang.asm)

Loading