🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5160

Re: Another delphi translation please!

#5160
From: Bruce Knowles
Date: Tue, 27 Sep 2005 12:26
85 lines
3127 bytes
Hmm,

I need to read what I have written before I click the send button :(

The line
 val =  (Romcode + i) & (1 << b % 8));

Should be
 val =  *(RomCode + i) & (1 << b % 8));

Sorry.

This was an interesting exercise, which is the reason I had a go at it.

Regards

Bruce

"Bruce Knowles" <knowle_b@mtn.co.za> wrote in message 
news:433937cc@newsgroups.borland.com...
> HI ScOe,
>
> I have mulled over your remark for a bit, and wonder about the following.
>
> I think the term RomCode[i] is in fact not generating the address as I 
> initially intended.
>
> In fact, the address could be in fact an offset relative to the start 
> address supplied in the calling mechanism.
>
> To be precise here, I think the address generated is original offset +  (i 
> * sizeof(TxROMCode)); The intention is to address the individual bytes of 
> the TxROMCode structure.
>
> As a result your solution of  *RomCode[i] is also probably not the correct 
> solution.
>
> Two ways to address this that occur to me are:
>
> val = ((char *)RomCode) [i] & (1 << (b %8));
>
> or
>
> val =  (Romcode + i) & (1 << b % 8));
>
> The other manipulation routines should also be amended in a similar 
> fashion.
>
> Maybe you should try this ??
>
> Regards
>
>
>
> Bruce
>
> "ScOe" <__cbinders@hotmail.com__> wrote in message 
> news:4338f3fe$1@newsgroups.borland.com...
>>> Andrue Cope's query of my posting triggered a recognition of an error 
>>> that
>> I
>>> had made in the code previously supplied. Herewith an updated version of
>>> that code that should now suffice.
>>>
>>> Thanks to Andrue Cope for his observation.
>>>
>>> Regards
>>>
>>> Bruce Knowles
>>
>> Ok, this seems to be correct accept few minor mistakes.
>>
>>>
>>>         // Get the Sernumbit
>>>         val = RomCode[i] & (1 << (b % 8));
>>>
>> i think this one should be *RomCode[i], because on call like you wrote i 
>> get
>> illegal use of pointer error.
>>
>> Thank you all for your help!
>>
>>
>
> 
Technical Details
Message-ID: <43393a2d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com> <4337fdd8@newsgroups.borland.com> <4338f3fe$1@newsgroups.borland.com> <433937cc@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6ea8b2c4d2578842
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bruce Knowles" <knowle_b@mtn.co.za>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43370a81@newsgroups.borland.com> <4337b0dd$1@newsgroups.borland.com> <4337e343@newsgroups.borland.com> <4337fdd8@newsgroups.borland.com> <4338f3fe$1@newsgroups.borland.com> <433937cc@newsgroups.borland.com>
Subject: Re: Another delphi translation please!
Date: Tue, 27 Sep 2005 14:26:43 +0200
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 196.11.239.43
Message-ID: <43393a2d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1127823917 196.11.239.43 (27 Sep 2005 05:25:17 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail