From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Tue, 08 Feb 2011 14:43:22 +0100 Organization: Ada @ Home Message-ID: References: NNTP-Posting-Host: 1X492nphQfDh1OTnmp4oXg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.01 (Win32) X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:17962 Date: 2011-02-08T14:43:22+01:00 List-Id: Le Thu, 03 Feb 2011 09:08:50 +0100, mockturtle a= = =C3=A9crit: >> Below is an >> example of code I would like to be able to implement. >> >> ... >> unsigned int print(char *message, unsigned int line) >> { >> char *vidmem =3D (char *) 0xb8000; >> unsigned int i=3D 0; >> > > I do not have any experience about this part of Ada, but maybe I can = > give you a "pointer" to some bootstrapping information. Maybe you cou= ld = > want to use an attribute representation clause for Vidmem'Address (se= e = > Section 13.3 of the RM) . With some improvisation, I would write = > something like > > type Vidmem_Array is array (natural range <>) of Character; > Vidmem : Vidmem_Array (0 .. Max_Size); > > for Vidmem'Address use 16#000B_8000#; There may be a real issue here. This was segment register =3D B800 and = offset register =3D 0000, for the base address. Ada does not make any = distinction about segment and offset. There should be something stated i= n = the compiler's documentation, to know how it maps linear address to = segment:offset address. Otherwise, I feel the result is unpredictable = because ambiguous: the compiler may have at least two options. The first= = one would be to work with a fixed segment as the base address for each = memory pool and then the address attribute would match the offset only = (Pascal compilers was working this way inside of units). The second one = = would be to use the standard convention at that time, to have offset ran= ge = in 0..15 and the remaining of the address held by the segment=E2=80=A6 t= he was the = Borland C++ way when using the so called Huge Memory model. These two = interpretation ends into different things. In short, there is no way to = = believe =E2=80=9Cfor Vidmem'Address use 16#000B_8000#=E2=80=9D can be OK= without further = investigations. -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens. =E2=80=9CI am fluent in ASCII=E2=80=9D [Warren 2010]