bilsch01
2019-12-16 05:24:42 UTC
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.
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.