hi, i want to learn assembly so i got a book and stared to read ;) but i got a problem with my first test programm i used the borland tasm32 and ilink32 when i tried to link my program i got the errormsg: Fatal: Unsupported 16-bit segment(s) in module asm1.ASM i lookd up in the help and find out that i have to specify the segment as 32bit when i did so i got the msg from tasm32: **Error** asm1.ASM(17) Offset or pointer is 32-bit (mov dx,offset Meldung) so i tried nasm and alink i could translate the code but the exe don't work,... (i tested Win98, Win98-MSDOS Mode, Win2000) so if anybody can help me,... here is the code of the little prog: ------------------------------------ DATEN SEGMENT Meldung db "Assembler ist gar nicht so schwer" db "$" DATEN ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATEN Anfang: mov ax,DATEN mov ds,ax mov dx,offset Meldung mov ax,9 int 21h mov ax,4Ch int 21h CODE ENDS END Anfang ---------------------------------- thx artur
Posted on 2001-05-28 13:23:00 by artur
I would use MASM to start learning.. you will find the best support for it here with future problems.. (get it at Hutch's Home page.. MASM32) To answer your question, yes, you had to indicate 32 bit mode and the error you got was completely valid! Its easy to over look this a new programmer, but when you are in 32 bit data segments all pointer information ( in this case your asking for the pointer (( memory address )) to 'Meldung'), and the cpu will return a 32 bit number indicating where in the Data segment Meldung resides. The rest of the command then proceeds to "try" and store it in a 16 bit container (dx). Obviously 16 bits != 32 bits!!. This is why you get your error, basicly trying to remind you that the number is 32 bits, not 16! To correct this, use "edx" which measn "extended"-"dx". In 32 bit operation, all registers have an extended mode. dx is still valid for 16 bit manipulations! But primarily all data will be based on 32 registers. To recap: In 32 bit mode, all these registers are valid:

BITS:
  32   16  8   8
  ---------------
  EAX, AX, AH, AL 
  EBX, BX, BH, BL
  ECX, CX, CH, CL
  EDX, DX, DH, DL
  EDI, DI
  ESI, SI
  EBP, BP
  ESP, SP

and segment offsets are ALWAYS 32 bits!
Also, It appears your aiming to learn 16 bit anyways, (the int commands etc.) This is good to know, and i would practice in it for a short while, but its good to know that In the windows' enviroment, most of what you learn is useless (int 21h etc). Dont get me wrong, i learned that stuff first, and think it was a great asset, but dont get all hung up over it if you plan to move onto bigger and better things. After stating that, to allow you to continue in 16 bit mode, you need to find a compile command line switch to comple in 16 bit mode with your 32 bit compiler (i dont know if there is one). If not you need to get a 16 bit version of the compiler (this may be hard). If you get his hacked out, your origional code should work ok... (with out the 32 bit segments set). BTW: There are some amazing tutorials for MASM32 and windows programming at Iczelion's Web Site, but Im not too sure your ready for all this yet.. If you think you are.. there it is. Hope that helps... NaN
Posted on 2001-05-28 16:27:00 by NaN
You're coding a 16bit example that use dos 21h interrupts. tasm and tlink (not tasm32 and tlink32) should work. angelo
Posted on 2001-05-28 16:51:00 by angelo
thank you for your answers i think ill try to start with 32bit asm,... (masm32)
Posted on 2001-05-29 11:51:00 by artur