Mail Archives: djgpp/1996/08/21/12:10:17
strider7 AT unm DOT edu wrote:
> .file "junk.s" # new logical file
> .data
> string:
> .ascii "hello there!\r\n$"
> .text
> .global _main
> _main:
> movl $string, %dx # move string into dx
^^^^
According to the DJGPP documentation, the assembler does not
automatically generate code dependant on what size register you use.
Although you used the %dx (16-bits) register, movl is trying to use a
32-bit offset. To correct this (I hope. I've only read the docs once),
use movw instead of movl.
> it works under win95, but doesnt under dos (with cwsdpmi v2), it prints out
> junk on the screen. am i doing this right, if im not, how come it works
> under win95?
It's probably due to some idiosyncratic difference between the two DPMI
hosts.
> another question, what does '.align' do and why do i need it?
..align probably aligns the code on a boundary:
.align 1 align code on a byte boundary
.align 2 align code on a word boundary
.align 4 align code on a dword boundary
.
.
.
--
I support the fight against "Look and Feel" patents.
- Raw text -