Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

MAC user's dynamic debugging list evaluator? Never heard of that.


devel / comp.sys.apple2.programmer / Re: I/O Buffer on Page Boundary

SubjectAuthor
* I/O Buffer on Page BoundaryBill Chatfield
+- Re: I/O Buffer on Page Boundaryfadden
+* Re: I/O Buffer on Page Boundaryqkumba
|`* Re: I/O Buffer on Page BoundaryHugh Hood
| `- Re: I/O Buffer on Page Boundaryqkumba
`* Re: I/O Buffer on Page BoundaryMichael J. Mahon
 `- Re: I/O Buffer on Page BoundaryBill Chatfield

1
I/O Buffer on Page Boundary

<3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=112&group=comp.sys.apple2.programmer#112

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:a37:f519:: with SMTP id l25mr5670869qkk.269.1628920029179;
Fri, 13 Aug 2021 22:47:09 -0700 (PDT)
X-Received: by 2002:a05:6830:1511:: with SMTP id k17mr4628340otp.19.1628920028872;
Fri, 13 Aug 2021 22:47:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Fri, 13 Aug 2021 22:47:08 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=65.60.154.173; posting-account=5B6FzAkAAAC8G3BRlbc_dHzwxqbWctPI
NNTP-Posting-Host: 65.60.154.173
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
Subject: I/O Buffer on Page Boundary
From: billchat...@gmail.com (Bill Chatfield)
Injection-Date: Sat, 14 Aug 2021 05:47:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Bill Chatfield - Sat, 14 Aug 2021 05:47 UTC

ProDOS requires a file I/O buffer to start on a page boundary. Merlin has syntax for filling to the next page boundary to make this easy. But, what if my assembler did not support "fill to next page boundary"? Is there a technique that can be used with a more basic assembler to position a variable on a page boundary?

Re: I/O Buffer on Page Boundary

<4c7fc9a1-7334-4a20-a035-126f6469c214n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=113&group=comp.sys.apple2.programmer#113

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:5744:: with SMTP id 4mr6519476qtx.326.1628952075927;
Sat, 14 Aug 2021 07:41:15 -0700 (PDT)
X-Received: by 2002:a9d:266a:: with SMTP id a97mr4988509otb.114.1628952075617;
Sat, 14 Aug 2021 07:41:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Sat, 14 Aug 2021 07:41:15 -0700 (PDT)
In-Reply-To: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP
NNTP-Posting-Host: 24.130.68.111
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4c7fc9a1-7334-4a20-a035-126f6469c214n@googlegroups.com>
Subject: Re: I/O Buffer on Page Boundary
From: fad...@fadden.com (fadden)
Injection-Date: Sat, 14 Aug 2021 14:41:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fadden - Sat, 14 Aug 2021 14:41 UTC

On Friday, August 13, 2021 at 10:47:09 PM UTC-7, billcha...@gmail.com wrote:
> ProDOS requires a file I/O buffer to start on a page boundary. Merlin has syntax for filling to the next page boundary to make this easy. But, what if my assembler did not support "fill to next page boundary"? Is there a technique that can be used with a more basic assembler to position a variable on a page boundary?

The alignment directives are useful for stuff defined inside your program, because some instructions cost an extra cycle when they cross page boundaries. You can allocate the buffer outside the program's binary (in C terms, use malloc() instead of a static buffer). This is probably a better idea anyway since buffers declared inside the program take up space on disk.

If you really want to make it part of the code, a general approach is to over-allocate the buffer by 255 bytes, and then pass a pointer to a location inside the buffer instead of the start. If it starts at an unaligned address (say $1234), you'd inc the high byte and zero the low byte, to get $1300.. This wastes up to 255 bytes of space in the binary... but so does an alignment directive. You're just aligning at run-time instead of assembly time.

Re: I/O Buffer on Page Boundary

<d5088dd5-a8cd-485b-a78b-beb2202ab61cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=114&group=comp.sys.apple2.programmer#114

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:a05:620a:88c:: with SMTP id b12mr9123316qka.483.1628982519248;
Sat, 14 Aug 2021 16:08:39 -0700 (PDT)
X-Received: by 2002:a05:6808:1807:: with SMTP id bh7mr6749420oib.52.1628982518856;
Sat, 14 Aug 2021 16:08:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Sat, 14 Aug 2021 16:08:38 -0700 (PDT)
In-Reply-To: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:7300:56d5:cf6:8f9c:53bc:d6f3;
posting-account=bGpciwoAAACg2KT8pQMph7tnt3o_9vtu
NNTP-Posting-Host: 2603:8001:7300:56d5:cf6:8f9c:53bc:d6f3
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d5088dd5-a8cd-485b-a78b-beb2202ab61cn@googlegroups.com>
Subject: Re: I/O Buffer on Page Boundary
From: peter.fe...@gmail.com (qkumba)
Injection-Date: Sat, 14 Aug 2021 23:08:39 +0000
Content-Type: text/plain; charset="UTF-8"
 by: qkumba - Sat, 14 Aug 2021 23:08 UTC

If your assembler can adjust the position using arithmetic, you can do the equivalent of "var=(*+255) & -256)", where '*' denotes the current location in memory.

Re: I/O Buffer on Page Boundary

<88ydnVBoJZlrDoX8nZ2dnUU7-RudnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=115&group=comp.sys.apple2.programmer#115

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 14 Aug 2021 23:11:34 -0500
Subject: Re: I/O Buffer on Page Boundary
Newsgroups: comp.sys.apple2.programmer
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
<d5088dd5-a8cd-485b-a78b-beb2202ab61cn@googlegroups.com>
From: hughh...@earthlink.net (Hugh Hood)
Date: Sat, 14 Aug 2021 23:11:34 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
MIME-Version: 1.0
In-Reply-To: <d5088dd5-a8cd-485b-a78b-beb2202ab61cn@googlegroups.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <88ydnVBoJZlrDoX8nZ2dnUU7-RudnZ2d@earthlink.com>
Lines: 13
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 208.189.119.214
X-Trace: sv3-L3tkFKBKaDi5saRF9oHz4m49L4JtqBZDriPrANtCt3ED1GDyl/Anl+7myTS7xHeS/Bd6tcie59glhZ0!HP37rfjU77aoj7NFl2G0ADJiTtWcAEq7H51GF8PxJUIZQun3J3kiERGA/qgwX7QRSC73fQWeJpvg!q0kP0zN82iare0qoppz53543xnacsK1oQCCB
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 1607
 by: Hugh Hood - Sun, 15 Aug 2021 04:11 UTC

On 8/14/2021 6:08 PM, qkumba wrote:
> If your assembler can adjust the position using arithmetic, you can
> do the equivalent of "var=(*+255) & -256)", where '*' denotes the
> current location in memory.
>

Very clever. I'm curious, does Merlin allow the AND of a negative number
like that?

Hugh Hood

Re: I/O Buffer on Page Boundary

<c5263b3b-11a0-4508-a716-5a68e5b6e4afn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=116&group=comp.sys.apple2.programmer#116

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:5744:: with SMTP id 4mr8587727qtx.326.1629002004784; Sat, 14 Aug 2021 21:33:24 -0700 (PDT)
X-Received: by 2002:a9d:266a:: with SMTP id a97mr6988902otb.114.1629002004424; Sat, 14 Aug 2021 21:33:24 -0700 (PDT)
Path: i2pn2.org!rocksolid2!news.neodome.net!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Sat, 14 Aug 2021 21:33:24 -0700 (PDT)
In-Reply-To: <88ydnVBoJZlrDoX8nZ2dnUU7-RudnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:7300:56d5:fcba:53a8:c35a:a4f4; posting-account=bGpciwoAAACg2KT8pQMph7tnt3o_9vtu
NNTP-Posting-Host: 2603:8001:7300:56d5:fcba:53a8:c35a:a4f4
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com> <d5088dd5-a8cd-485b-a78b-beb2202ab61cn@googlegroups.com> <88ydnVBoJZlrDoX8nZ2dnUU7-RudnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c5263b3b-11a0-4508-a716-5a68e5b6e4afn@googlegroups.com>
Subject: Re: I/O Buffer on Page Boundary
From: peter.fe...@gmail.com (qkumba)
Injection-Date: Sun, 15 Aug 2021 04:33:24 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 0
 by: qkumba - Sun, 15 Aug 2021 04:33 UTC

If not, then perhaps 0FF00h or 65280.

Re: I/O Buffer on Page Boundary

<PvadncoOVfQ9K4X8nZ2dnUU7-SPNnZ2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=117&group=comp.sys.apple2.programmer#117

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 15 Aug 2021 01:39:28 -0500
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:O309nFECNS/s0WOhB/SdHgufosY=
Newsgroups: comp.sys.apple2.programmer
Subject: Re: I/O Buffer on Page Boundary
Content-Type: text/plain; charset=UTF-8
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
From: mjma...@aol.com (Michael J. Mahon)
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com>
Message-ID: <PvadncoOVfQ9K4X8nZ2dnUU7-SPNnZ2d@giganews.com>
Date: Sun, 15 Aug 2021 01:39:28 -0500
Lines: 55
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-Z0tQhIaetn8GjMtvpEOsQ7aS6T6UGxMxMnF46xFjLQDgIhZg/+NirMLtWr2sJorgdON+5Z6fVS5WK8E!evHZ44dnqJ61TfoWyl9QirCKde+pt3yvv/+BKyF88srw+AlqAUPQZqFvXu3xozQ5NNSXPWW2bysT
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3801
 by: Michael J. Mahon - Sun, 15 Aug 2021 06:39 UTC

Bill Chatfield <billchatfield1@gmail.com> wrote:
> ProDOS requires a file I/O buffer to start on a page boundary. Merlin has
> syntax for filling to the next page boundary to make this easy. But, what
> if my assembler did not support "fill to next page boundary"? Is there a
> technique that can be used with a more basic assembler to position a
> variable on a page boundary?

The problem can be solved pretty easily in any assembler that supports
integer arithmetic expressions.

First, it’s necessary to determine which page the location counter is
currently on, then add one to it and cause the location counter to advance
to the first byte of that page. In many assemblers this is as simple as
ORGing to the next page, but in some assemblers, including Merlin, ORG
doesn’t work that way (ORG just informs the assembler that the code that
follows will be executed at the ORG address, and then it continues to
assemble code and data “in-line” at the original address).

OK, so let’s compute the current page by dividing the value of the current
location counter (usually represented by “*”) by 256. Then add one to it
(to get the next page) and multiply by 256 to get the desired location.

A special case that needs handling is the case when the location counter is
*already* page aligned. To avoid wasting a page in that case, we need to
subtract one from the original value of the location counter before doing
the divide. So:

<new location counter> = ((* - 1)/256 + 1) * 256

As noted, in some assemblers, just ORG to the new location counter value.

In Merlin ORG won’t do what’s needed, but you can get the desired effect by
DSing a number of bytes equal to the new location counter value minus the
current location counter, like so:

ds *-1/256+1*256-*

It looks a little confusing, but since Merlin evaluates expressions from
left to right that does exactly what I described! (Note that the “*”
between the “1” and “256” means “multiply”, not “current location
counter”.)

Strictly speaking, this isn’t required in Merlin since it has a built-in
“page align” capability, but this technique can be used to align to *any*
boundary if you substitute the desired boundary value for 256.

I usually define a macro “align” to do this, where the macro parameter
takes the place of 256.

It has the advantage that it never wastes more space than is actually
required to align to the desired boundary, which is half the boundary value
on average, and therefore practically insignificant.

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com

Re: I/O Buffer on Page Boundary

<273ad3ef-e3ce-4871-946f-4c4aba4b0a71n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=119&group=comp.sys.apple2.programmer#119

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:a05:6214:c69:: with SMTP id t9mr894987qvj.28.1629162680068;
Mon, 16 Aug 2021 18:11:20 -0700 (PDT)
X-Received: by 2002:a05:6830:88:: with SMTP id a8mr667966oto.233.1629162679243;
Mon, 16 Aug 2021 18:11:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Mon, 16 Aug 2021 18:11:19 -0700 (PDT)
In-Reply-To: <PvadncoOVfQ9K4X8nZ2dnUU7-SPNnZ2d@giganews.com>
Injection-Info: google-groups.googlegroups.com; posting-host=65.60.154.173; posting-account=5B6FzAkAAAC8G3BRlbc_dHzwxqbWctPI
NNTP-Posting-Host: 65.60.154.173
References: <3597472c-de7a-486c-ae21-b6450a772935n@googlegroups.com> <PvadncoOVfQ9K4X8nZ2dnUU7-SPNnZ2d@giganews.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <273ad3ef-e3ce-4871-946f-4c4aba4b0a71n@googlegroups.com>
Subject: Re: I/O Buffer on Page Boundary
From: billchat...@gmail.com (Bill Chatfield)
Injection-Date: Tue, 17 Aug 2021 01:11:19 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Bill Chatfield - Tue, 17 Aug 2021 01:11 UTC

Great ideas. Thank you everyone. I wish I was smart enough to think of them myself. :-)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor