flat assembler
Message board for the users of flat assembler.

Index > Main > is ds:dx disallowed in 16 bit?

Author
Thread Post new topic Reply to topic
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 19 Jun 2006, 15:45
the following code fragment doesnt compile:

Code:
use16
          cmp [ds:dx],byte 0
    


with error message:

error: reserved word used as symbol

whereas this one does compile:

Code:
use16  
         cmp [ds:bx], byte 0
    


also [ds:ax] and [ds:cx] dont compile Crying or Very sad

however [ds:di] and [ds:si] both do compile, Razz

does more recent 16 bit real x86 not recognise [ds:dx] , [ds:ax], [ds:cx]?
Post 19 Jun 2006, 15:45
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 19 Jun 2006, 16:20
Quote:

does more recent 16 bit real x86 not recognise [ds:dx] , [ds:ax], [ds:cx]?


Actually there is no addressing mode that supports [dx], [ax], [cx] even if you use use32 (but you can use [edx], [eax], [ecx]). Anyway it's a little strange the error that FASM reports, I think it should be "Invalid addressing mode" or something similar
Post 19 Jun 2006, 16:20
View user's profile Send private message Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 19 Jun 2006, 17:49
locodelassembly wrote:
Quote:

does more recent 16 bit real x86 not recognise [ds:dx] , [ds:ax], [ds:cx]?


Actually there is no addressing mode that supports [dx], [ax], [cx] even if you use use32 (but you can use [edx], [eax], [ecx]). Anyway it's a little strange the error that FASM reports, I think it should be "Invalid addressing mode" or something similar


you are right, I tried it just now and use16 accepts [ds:eax] and
[ds:ecx] and [ds:edx],

however as all my code runs beyond the first 64K of memory
16 bit real will freeze up if any of the upper 16 bits of eax, ecx, edx, ebx
are nonzero.

at the moment I often do things like:

Code:
    org 20000h
use16
    ....
    mov ebx,xyz
    call f

xyz    dd  0

f:
    mov [ds:bx],10
    ret
    


here mov [ds:ebx] will freeze up the machine
if ds is 0 and eg ebx==21234h

so instead I have ds==2000h and ebx would need to
be 1234h,

simply because it can only deal with 16 bit offsets even though
it is a long way from even 1MB,
Post 19 Jun 2006, 17:49
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Jun 2006, 08:38
yes, unless you enable flat-real mode, all offsets must be below 10000h. Search board for "flat real mode" and "unreal mode"
Post 20 Jun 2006, 08:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.