Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Evolution is a million line computer program falling into place by accident.


programming / comp.lang.asm.x86 / Re: can't read memory at 0xb8000

SubjectAuthor
* can't read memory at 0xb8000bilsch01
+* Re: can't read memory at 0xb8000JJ
|`- Re: can't read memory at 0xb8000bilsch01
+- Re: can't read memory at 0xb8000R.Wieser
`* PROBLEM SOLVEDbilsch01
 `- Re: PROBLEM SOLVEDrick.c.hodgin

1
Subject: can't read memory at 0xb8000
From: bilsch01
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 16 Dec 2019 05:24 UTC
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: king...@nospicedham.comcast.net (bilsch01)
Newsgroups: comp.lang.asm.x86
Subject: can't read memory at 0xb8000
Date: Sun, 15 Dec 2019 21:24:42 -0800
Organization: A noiseless patient Spider
Lines: 36
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qt74es$bla$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="15387"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iJE4aqoUGZq1Xvn1f01zDpaAt1uQq7pg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.2.2
Cancel-Lock: sha1:rTBlg7dQDXmV2ghuuU0txc8555s=
View all headers
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.



Subject: Re: can't read memory at 0xb8000
From: JJ
Newsgroups: comp.lang.asm.x86
Organization: albasani.net
Date: Mon, 16 Dec 2019 06:27 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jj4pub...@nospicedham.vfemail.net (JJ)
Newsgroups: comp.lang.asm.x86
Subject: Re: can't read memory at 0xb8000
Date: Mon, 16 Dec 2019 13:27:51 +0700
Organization: albasani.net
Lines: 39
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <feq8oujemk13.8tz2dh6gd5c9$.dlg@40tude.net>
References: <qt74es$bla$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="30897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UE10QCn+ya+klBzBEvsW++uP4ZAV0LmY="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:5pSZ+5fx+CuOykPlQFbfMoTjPLM=
View all headers
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.



Subject: Re: can't read memory at 0xb8000
From: bilsch01
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 16 Dec 2019 07:45 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: king...@nospicedham.comcast.net (bilsch01)
Newsgroups: comp.lang.asm.x86
Subject: Re: can't read memory at 0xb8000
Date: Sun, 15 Dec 2019 23:45:58 -0800
Organization: A noiseless patient Spider
Lines: 10
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qt7cnn$h58$1@dont-email.me>
References: <qt74es$bla$1@dont-email.me>
<feq8oujemk13.8tz2dh6gd5c9$.dlg@40tude.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="19792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tyqKLvT+SJEPa3lFXFm53M9nymmaLHBg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.2.2
Cancel-Lock: sha1:l2HwTVtvOAEImwoHVPOVYtlRoNk=
View all headers
The program writes the directory listing to screen buffer using es=0xb800 then proceeds to set up the arrow keys and read the cluster number bytes it has written to screen memory - all using es=0xb800.

ds=0x1000
es=0xb800 is screen buffer
gs=0x1200 is buffer with root directory

Maybe the screen buffer is unavailable for reading? Is that possible?



Subject: Re: can't read memory at 0xb8000
From: R.Wieser
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Mon, 16 Dec 2019 09:17 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: addr...@nospicedham.not.available (R.Wieser)
Newsgroups: comp.lang.asm.x86
Subject: Re: can't read memory at 0xb8000
Date: Mon, 16 Dec 2019 10:17:03 +0100
Organization: Aioe.org NNTP Server
Lines: 24
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qt7i2r$1mm5$1@gioia.aioe.org>
References: <qt74es$bla$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="15448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Q25Z0yrOJXNx2BITogrXihbKdLImc1ac="
Cancel-Lock: sha1:8er9KVPIzQhzmrKg7yGVbASqh2s=
View all headers
bilsch01,

The problem is that anywhere I place the cursor, hitting the enter key
returns 0x081b regardless where the cursor is on the screen.

Suggestion: Check if your values are what you expect them to be.   And start
with *writing* something to the screen before you subtract 2 from DI.   It
will show you if your calculated position is where the cursor is.

If-and-when that doesn't quite work, display the contents of DX after the
"get cursor" call.   After that shows the expected values display the
contents of ES:DI. just before reading from screen-memory / subtracting 2
from DI

Remark: The code you posted works here.

Maybe the screen buffer is unavailable for reading? Is that possible?

Ofcourse.  But not likely (never heard of it).

Regards,
Rudy Wieser




Subject: PROBLEM SOLVED
From: bilsch01
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 16 Dec 2019 10:31 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: king...@nospicedham.comcast.net (bilsch01)
Newsgroups: comp.lang.asm.x86
Subject: PROBLEM SOLVED
Date: Mon, 16 Dec 2019 02:31:00 -0800
Organization: A noiseless patient Spider
Lines: 25
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qt7md5$4dh$1@dont-email.me>
References: <qt74es$bla$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="7195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9NBhAGwpoMoyPWniCl5uRtIF2fae+I9U="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.2.2
Cancel-Lock: sha1:1S5Ko5N7vLg054s7u2Pe/Ibdlpg=
View all headers
I don't use a debugger with these .bin files. I have a routine I jump to that reads a pushed word and prints 4 hex digits in the corner of the screen and then goes into infinite loop.  Crude but pretty useful. I have similar routines that use call and ret but this one is to be used with jmp. Well, what I had done was type

push ax
call vuhex

instead of

push ax
jmp vuhex

vuhex isn't made for call and  ret.

It's interesting that I made the mistake because I was using jmp vuhex
for checking the screen buffer coordinate in dx register and getting correct results. Then I tried reading screen memory with 'call' and wondered about reading screen memory.

Thanks everyone for your help. Sorry for the bother.

Bill S.



Subject: Re: PROBLEM SOLVED
From: rick.c.h...@nospicedham.gmail.com
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 16 Dec 2019 13:09 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@nospicedham.gmail.com
Newsgroups: comp.lang.asm.x86
Subject: Re: PROBLEM SOLVED
Date: Mon, 16 Dec 2019 05:09:41 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 21
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <42cb766f-e9be-4258-b730-42c77f34ce7e@googlegroups.com>
References: <qt74es$bla$1@dont-email.me> <qt7md5$4dh$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Mon, 16 Dec 2019 13:09:42 +0000
Injection-Info: reader02.eternal-september.org; posting-host="1dfff7c7ca62a78e9a59915f51ef5467";
logging-data="2742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zbNH+m5VTDNVBo6ZmA3uvN2gjw1Ywco4="
User-Agent: G2/1.0
Cancel-Lock: sha1:ARfVdd5KAByhp8OzEc20+6b5lGw=
View all headers
On Monday, December 16, 2019 at 5:39:33 AM UTC-5, bilsch01 wrote:
I don't use a debugger with these .bin files.

Use a debugger.  Microsoft's CodeView 3.x or 4.x can be found
online where Microsoft's C Compiler 6.x is, or MASM 6.x if you
are using DOS, Windows, or OS/2.  It will debug in raw assembly
mode for .BIN files.

You need a debugger to examine the contents of things to see
if what you think it is actually it what it is.  It will gain
you much productivity and resolve issues far more quickly in
pretty much every case.

If you use Microsoft's compilers, use /ZI to include symbolic
debugger information so you can actually step through your
source code rather than machine code.  It makes things so
much easier across-the-board.

--
Rick C. Hodgin



1
rocksolid light 0.7.2
clearneti2ptor