home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,988 of 4,675   
   JJ to All   
   Re: can't read memory at 0xb8000   
   16 Dec 19 13:27:51   
   
   From: jj4public@nospicedham.vfemail.net   
      
   On Sun, 15 Dec 2019 21:24:42 -0800, bilsch01 wrote:   
   > I had an idea to write the file's starting cluster number a few spaces   
   > to the left of the file name when I write a directory listing to the   
   > screen using memory at 0xb8000. I used 00 for the background/foreground   
   > bytes for the bytes of the cluster number so they don't show up on the   
   > screen. When I change the bg/fg byte to 0x0f for the number 0x0003 it   
   > shows as a black space followed by a white heart - which is correct. The   
   > number 0x000d shows as a black space and a white musical note - which is   
   > correct as far as I know. I'm sure the correct bytes are where I intend.   
   >   
   > My idea is to position the cursor on a visible asterisk left of the file   
   > name and hit the enter key. The program reads the invisible cluster   
   > number written in the screen buffer 'to the left' of the asterisk. The   
   > problem is that anywhere I place the cursor, hitting the enter key   
   > returns 0x081b regardless where the cursor is on the screen. With the   
   > cursor on the visible asterisk to the right of the invisible cluster   
   > number bytes the following code executes:   
   >   
   > mov ah,03		;get cursor position   
   > int 0x10		;returns dh=row, dl=col   
   > mov al,dh   
   > mov bl,160   
   > mul bl			;ax=dh*160   
   > add dl,dl   
   > movzx dx,dl		;dx=dl*2   
   > add dx,ax		;screen buffer coord. of cursor   
   > mov di,dx   
   > sub di,2   
   > mov ah,byte[es:di]	;hi byte of cluster #   
   > sub di,2   
   > mov al,byte[es:di]	;lo byte of cluster #   
   >   
   > This code returns 0x081b in ax regardless of where the cursor is -   
   > anywhere on the screen. Apparently it's not possible to read the bytes   
   > from the screen buffer like this.  Does anyone know how to do this?   
   > TIA.   Bill S.   
      
   The way I see it, you forgot to set the ES register to the correct value.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca