flat assembler
Message board for the users of flat assembler.
  
|  Index
      > DOS > Starting devel for DOS with FASM (DPMI32) Goto page Previous 1, 2 | 
| Author | 
 | 
| DOS386 20 Dec 2006, 21:02 Quote: Possibly a good opportunity to use the new FD DebugX Found out without. BUT: Found out what is wrong, but NOT HOW to fix. File exists and empty: "ordinary" exception "E" File exists and >=1 bytes: exception "E" in Ring0 OK, let's test single byte writing without any INT: Failure !!! exception "E" Reading from this segment at least ?: Failure !!! exception "E" Seems that none of the INT's $31 returns flag(C) set ...  everything seems OK but is crappy: my new great segment is neither writable nor readable ... it is useless   Code: segment seg1 use32 mov ah,9 mov edx,t1 int 21h jmp short @f t1 db 'Hey ... not yet hello ... trying to allocate INT 31,501 !',0Dh,0Ah,24h @@: mov bx,40h ;BX is high mov cx,0 ;CX is low 4MB mov ax,0501h int 31h ;BX:CX = linear address of allocated memory block jnc @f ;OK mov ax,0900h mov edx,t2 int 21h jmp failure t2 db 'INT 31,501 ran in a failure !!!',0Dh,0Ah,24h @@: and EBX,$FFFF shl ebx,16 and ecx,$FFFF or ebx,ecx push ebx mov ax,$0900 mov edx,t3 int 21h jmp short @f t3 db 'INT 31,501 success !',0Dh,0Ah,24h @@: mov cx,1 xor ax,ax int 31h ; allocate descriptor for code mov si,ax xor ax,ax int 31h ; allocate descriptor for data mov di,ax mov dx,cs ; Find out where we are ... suspicious There is probably a bug in the segment creation ... could someone look at the code please ? _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug | |||
|  20 Dec 2006, 21:02 | 
 | 
| Japheth 21 Dec 2006, 09:15 > ... could someone look at the code please ?
 Code: pop ecx ;Our new linear address shl ecx,4 ; ?????????????????????? mov dx,cx shr ecx,16 mov ax,7 ; set descriptor base address int 31h | |||
|  21 Dec 2006, 09:15 | 
 | 
| vid 21 Dec 2006, 14:11 see description of int 31h/ax=7 | |||
|  21 Dec 2006, 14:11 | 
 | 
| DOS386 22 Dec 2006, 02:14 Quote: see description of int 31h/ax=7 The thing does not reveal too much: Code: 8.7 Set Segment Base Address This function changes the 32-bit linear base address of the specified selector. To Call AX = 0007h BX = Selector CX:DX = 32-bit linear base address for segment Returns If function was successful: Carry flag is clear. If function was not successful: Carry flag is set. Programmer's Notes o This function will fail if the selector specified in BX is invalid. o Your program should only modify descriptors that were allocated through the Allocate LDT Descriptors function. o The high 8 bits of the base address (contained in CH) will be ignored by 16-bit implementations of DPMI. This is true even when running on 80386 machines. Code: pop ecx ;Our new linear address shl ecx,4 ; ?????????????????????? mov dx,cx shr ecx,16 mov ax,7 ; set descriptor base address int 31h I did not like these calculations already before anyway, I just as suggested re-used the "2" code with the only marginal patch: new linear address instead the segment label. The problem is also that this INT$31/AX=7 call does NOT set the CARRY flag although it seems to fail. I really hope not to have found a bug in HDPMI   Code: mov bx,di int 31h ; set data descriptor access rights pop ecx ; Our new possibly buggy linear address mov edx,ecx shr ECX,16 mov ax,7 ; set descriptor base address CX:DX // CX high int 31h ; Here the bug is created, but flag(C)=0 Tried to fix ^^^ the bug, but no effect: still Exception "E"   Code: mov cx,1 xor ax,ax int 31h ; allocate descriptor for code mov si,ax xor ax,ax int 31h ; allocate descriptor for data mov di,ax mov dx,cs ; Find out where we are ... suspicious Other thing I do not like (but I could be wrong of course) is ^^^ the "cs" usage here. Is it correct ? Any additional ideas to fix the bug ? _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug | |||
|  22 Dec 2006, 02:14 | 
 | 
| Japheth 22 Dec 2006, 09:11 > The problem is also that this INT$31/AX=7 call does NOT set the
 > CARRY flag although it seems to fail. I already suggested to use FD DebugX. Without being able to use a debugger you will not have much fun in protected-mode. FD DebugX has a 'DL' command displaying the linear base of a selector, which instantly will show if int 31h, ax=0007 has failed or not. Your code still is small and simple enough for DebugX. btw, int 31h, ax=0007 will only fail if the selector in BX is "invalid", it accepts *any* linear address in CX:DX. | |||
|  22 Dec 2006, 09:11 | 
 | 
| DOS386 22 Dec 2006, 18:05 Quote: I already suggested to use FD DebugX. Without being able to use a debugger you will not have much fun in protected-mode. FD DebugX has a 'DL' command displaying the linear base of a selector OK, thanks for improving the FreeDOS DEBUG  , but I actually can't really use it since it lacks a docu. A list of improvements against MS-DOG DEBUG does not really explain how to use it. I probably will need a debugger one day, but one should NOT it to find such criminal and obvious bugs. Quote: 
 Code: pop ecx ;Our new linear address shl ecx,4 ; ?????????????????????? mov dx,cx shr ecx,16 mov ax,7 ; set descriptor base address int 31h I does no longer fail after I fixed this ^^^ bug. This code is for a real mode segment label (clarified in other thread in "Main") and obvioulsy can't work   Code: jmp @f t7 db 'New segment created !!!',0Dh,0Ah,24h ;==================================================== binname db "hello32.bin",0 @: mov edx, binname And here ^^^ we have the other criminal and obvious bug   Quote: 
 OK, there is no bug, it "accepts" *any* junk address, but creates an inaccessible segment   Well, I got my "Hello from my new 4 MB segment" now  , it seems to work, but I probably will discover some problems later ... please look in here in future also ... _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug | |||
|  22 Dec 2006, 18:05 | 
 | 
| Dex4u 24 Dec 2006, 06:05 Bugs do seem to follow you around NTOSKRNL_VXE, but your program must hold the record for the most bugs in a "hello world!" program   . You just do not have, the needed ART and remember the best debugger is in your head. | |||
|  24 Dec 2006, 06:05 | 
 | 
| Goto page  Previous  1, 2 < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.