Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Your own mileage may vary.


devel / comp.sys.apple2.programmer / Re: Merlin32 and Negative DS Pseudo Op

SubjectAuthor
* Merlin32 and Negative DS Pseudo OpHugh Hood
`* Re: Merlin32 and Negative DS Pseudo OpAntoine Vignau
 `* Re: Merlin32 and Negative DS Pseudo Opfadden
  +* Re: Merlin32 and Negative DS Pseudo OpKent Dickey
  |`- Re: Merlin32 and Negative DS Pseudo Opfadden
  `* Re: Merlin32 and Negative DS Pseudo OpHugh Hood
   `- Re: Merlin32 and Negative DS Pseudo OpOliver Schmidt

1
Merlin32 and Negative DS Pseudo Op

<naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!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: Sun, 10 Oct 2021 13:50:41 -0500
Date: Sun, 10 Oct 2021 13:50:41 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
Newsgroups: comp.sys.apple2.programmer
Content-Language: en-US
From: hughh...@earthlink.net (Hugh Hood)
Subject: Merlin32 and Negative DS Pseudo Op
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
Lines: 45
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 208.189.118.138
X-Trace: sv3-jRY1xpz1tjfAm7endXXIYmBc7suDvjQQQhT0IC6IgiD6iBBM3ZPyqV6x1ddKU5lFOlTCdxKZrhCWV3r!SBxuz4ttz25ge/BKl4YZ8QdkAkxnOWdUcgf7wQjyYmDDNEfmKTV0Ad74EJCl4xBk38Tov69/cLaF!VaEhu5O2oMMvw2Rir7EA3ecc7hoEZPFZox42
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: 2638
 by: Hugh Hood - Sun, 10 Oct 2021 18:50 UTC

I'm doing some continually updated patches to an existing binary file
(ProDOS - 8 bit) where I use the Merlin32 'PUTBIN' pseudo op to place
the existing binary at the current object pointer, add my new code to
the end, and then assemble the source to generate the patched binary.
Simple enough.

For example:

Start
PUTBIN FILETOPATCH ; existing binary file

NewCode
LDA {etc} ; all the new and patching code

CodeEnd
SAV PATCHEDFILE ;

I've been manually editing the first three (3) bytes of the existing
binary so that its first instruction is to JMP to NewCode. That's not
very difficult nor time consuming, but I'd like to make it all more
automatic, if possible.

Ideally, I would use a Pseudo Op at the end of the source code to move
back the object pointer to the very beginning and overwrite the first
three (3) bytes of the PUTBIN'ed file with the necessary JMP to NewCode.

The Merlin 16 manual mentions using the 'DS' pseudo op with a negative
number (e.g. DS-1) to "back up the object and address pointers".
Frankly, I'm not sure if even that would accomplish what I'd like, but I
do know that in Merlin32 1.0 using 'DS-1' just generates an 'UNKNOWN' error.

Can anyone set me on the straight path to some method that would work?

I'll even gladly accept 'no, that can't be done' so that I won't spend
any more time on it, and just keep manually patching those first three
(3) bytes.

Thanks.

Hugh Hood

Re: Merlin32 and Negative DS Pseudo Op

<2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ad4:574c:: with SMTP id q12mr1700958qvx.47.1634927861027;
Fri, 22 Oct 2021 11:37:41 -0700 (PDT)
X-Received: by 2002:a9d:a37:: with SMTP id 52mr1160136otg.377.1634927860106;
Fri, 22 Oct 2021 11:37:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.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: Fri, 22 Oct 2021 11:37:39 -0700 (PDT)
In-Reply-To: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.124.207.129; posting-account=c4quJwoAAABUj_DOmUN3HIuXxN1tF7gT
NNTP-Posting-Host: 82.124.207.129
References: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com>
Subject: Re: Merlin32 and Negative DS Pseudo Op
From: ntn.vig...@gmail.com (Antoine Vignau)
Injection-Date: Fri, 22 Oct 2021 18:37:41 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: Antoine Vignau - Fri, 22 Oct 2021 18:37 UTC

Hi Hugh,
I do not understand what you want to achieve with the negative DS.
On Merlin 16 and 32, DS -1 will reserve $65535 bytes of memory.
On Merlin 16 and 32, DS *-1 will reserve current_address - 1 bytes of memory.

What am I missing here? If you want to link to an address in the putbin, you can do the following:

myCode putbin toto.bin
myLabel = *

patchAbove
lda #$BD
sta myLabel-3

Cheers,
Antoine

Re: Merlin32 and Negative DS Pseudo Op

<e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:7d14:: with SMTP id g20mr6767917qtb.185.1635001425981;
Sat, 23 Oct 2021 08:03:45 -0700 (PDT)
X-Received: by 2002:a9d:ed0:: with SMTP id 74mr5101749otj.173.1635001425630;
Sat, 23 Oct 2021 08:03:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.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, 23 Oct 2021 08:03:45 -0700 (PDT)
In-Reply-To: <2dd21bcd-ccc3-4872-8757-ce12f2e12237n@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: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com> <2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
Subject: Re: Merlin32 and Negative DS Pseudo Op
From: fad...@fadden.com (fadden)
Injection-Date: Sat, 23 Oct 2021 15:03:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fadden - Sat, 23 Oct 2021 15:03 UTC

I believe what he's trying to do is patch the binary included with PUTBIN with the assembler itself.

With an assembler written by C64 people you can do this, because they have separate notions of "physical" and "logical" program counters within the assembler. For example, in 64tass if you do this:

* = $1000
lda $1234

* = $1001
.word $4567
rts

The output is:

00000000: ad67 4560 .gE`

Merlin32 only has a "logical" PC, so it assembles the same code to:

00000000: ad34 1267 4560 .4.gE`

The C64 assemblers place everything into a 64KB bank. If the output is discontiguous, you'll get empty gaps in the output file. It will even wrap around at the end of the bank, so the stuff you output at the end of the source file ends up at the start of the binary. (https://sourceforge.net/p/tass64/bugs/59/)

Once I understood this, certain aspects of 64tass and ACME made a lot more sense. I'm not aware of an Apple II assembler that had the notion of separate PCs, though the old "OBJ" directive could have been used this way.

Re: Merlin32 and Negative DS Pseudo Op

<ntadnRcqNLICqOn8nZ2dnUU7-XfNnZ2d@giganews.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 23 Oct 2021 11:17:35 -0500
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Merlin32 and Negative DS Pseudo Op
References: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com> <2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com> <e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
Organization: provalid.com
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
From: keg...@provalid.com (Kent Dickey)
Originator: kegs@provalid.com (Kent Dickey)
Message-ID: <ntadnRcqNLICqOn8nZ2dnUU7-XfNnZ2d@giganews.com>
Date: Sat, 23 Oct 2021 11:17:35 -0500
Lines: 41
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-PIFafOJlLOURMEmw7RTlmFXk4NaueLgMXF2Ld9zUeK6fhRNrw7kwf6XUND4WOLDLvz0sS5ODl2nSkGS!gnUDXaZE2qf+1JSpfkx22TCgfkp4Ryvr2DYlHMU7KZG2mccjCNSB8W11itrFaGb5DwxKE+EvwIlj
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: 2723
X-Received-Bytes: 2933
 by: Kent Dickey - Sat, 23 Oct 2021 16:17 UTC

In article <e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>,
fadden <fadden@fadden.com> wrote:
>I believe what he's trying to do is patch the binary included with
>PUTBIN with the assembler itself.
>
>With an assembler written by C64 people you can do this, because they
>have separate notions of "physical" and "logical" program counters
>within the assembler. For example, in 64tass if you do this:
>
>* = $1000
> lda $1234
>
>* = $1001
> .word $4567
> rts
>
>The output is:
>
>00000000: ad67 4560 .gE`
>
>Merlin32 only has a "logical" PC, so it assembles the same code to:
>
>00000000: ad34 1267 4560 .4.gE`
>
>The C64 assemblers place everything into a 64KB bank. If the output is
>discontiguous, you'll get empty gaps in the output file. It will even
>wrap around at the end of the bank, so the stuff you output at the end
>of the source file ends up at the start of the binary.
>(https://sourceforge.net/p/tass64/bugs/59/)
>
>Once I understood this, certain aspects of 64tass and ACME made a lot
>more sense. I'm not aware of an Apple II assembler that had the notion
>of separate PCs, though the old "OBJ" directive could have been used
>this way.

EDASM worked differently and I think you could rewrite earlier
instructions by storing instructions directly in memory at the OBJ
addresses. EDASM was really slow and hard to use, so it wasn't popular
(at least the DOS 3.3 version was slow).

Kent

Re: Merlin32 and Negative DS Pseudo Op

<2f5ad2e5-b041-4a67-8b20-3f18f4bca801n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:a37:aa4c:: with SMTP id t73mr5739268qke.354.1635009455911;
Sat, 23 Oct 2021 10:17:35 -0700 (PDT)
X-Received: by 2002:a4a:6852:: with SMTP id a18mr5188533oof.92.1635009455661;
Sat, 23 Oct 2021 10:17:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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, 23 Oct 2021 10:17:35 -0700 (PDT)
In-Reply-To: <ntadnRcqNLICqOn8nZ2dnUU7-XfNnZ2d@giganews.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: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
<2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com> <e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
<ntadnRcqNLICqOn8nZ2dnUU7-XfNnZ2d@giganews.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f5ad2e5-b041-4a67-8b20-3f18f4bca801n@googlegroups.com>
Subject: Re: Merlin32 and Negative DS Pseudo Op
From: fad...@fadden.com (fadden)
Injection-Date: Sat, 23 Oct 2021 17:17:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 16
 by: fadden - Sat, 23 Oct 2021 17:17 UTC

On Saturday, October 23, 2021 at 9:17:41 AM UTC-7, Kent Dickey wrote:
> EDASM worked differently and I think you could rewrite earlier
> instructions by storing instructions directly in memory at the OBJ
> addresses. EDASM was really slow and hard to use, so it wasn't popular
> (at least the DOS 3.3 version was slow).

From the "Apple 6502 Assembler/Editor" manual (the scan of which doesn't seem to include a page with a copyright date on it):

"The OBJ directive has been included for compatibility with a previous version of this Assembler, in which it was used to specify the memory address of the output object file, which now can only be written on the output diskette. This directive is reserved for possible future enhancement of the Assembler/Editor system."

So I think the DOS Toolkit version of EDASM didn't really support it either..

Re: Merlin32 and Negative DS Pseudo Op

<75ednWXb7d50yun8nZ2dnUU7-cPNnZ2d@earthlink.com>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!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, 23 Oct 2021 13:43:53 -0500
Date: Sat, 23 Oct 2021 13:43:46 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
Subject: Re: Merlin32 and Negative DS Pseudo Op
Content-Language: en-US
Newsgroups: comp.sys.apple2.programmer
References: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
<2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com>
<e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
From: hughh...@earthlink.net (Hugh Hood)
In-Reply-To: <e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <75ednWXb7d50yun8nZ2dnUU7-cPNnZ2d@earthlink.com>
Lines: 22
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 208.189.118.233
X-Trace: sv3-whZ2s8UJ31/uPwMeD1ztTvSBr1Hcxkz6NND0RQTgW1EMuSnjYvA6Rl+ZpLlPJe2HAtPhFq7JLxUHrqp!73n6LAPH0pVifdnahxexhrwjZR7vZ0wrfAgMMfkD5dXUuLlp/N2huoX5KoROeFt7yqhUsS/USSxM!zYD3wVb6/SEGEfZYDVKUyjiQyV43MDZIHS1+
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: 1965
 by: Hugh Hood - Sat, 23 Oct 2021 18:43 UTC

On 10/23/2021 10:03 AM, fadden wrote:

>
> I believe what he's trying to do is patch the binary included with
> PUTBIN with the assembler itself.
>

Exactly! Thanks for boiling that down to one succinct sentence for me.

Thanks, fellas, for chiming in with the information and your thoughts
about this. I don't mind patching the object code after the assembler
generates it, but I didn't want to overlook an easier way to do it all
from within the assembler.

I've seen many clever techniques using assembler math and '*' operations
here and thought I'd give it a shot. Thanks.

Hugh Hood

Re: Merlin32 and Negative DS Pseudo Op

<sl356d$6a3$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol....@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Merlin32 and Negative DS Pseudo Op
Date: Sun, 24 Oct 2021 08:23:41 -0000 (UTC)
Message-ID: <sl356d$6a3$1@solani.org>
References: <naCdnfXJrIycq_78nZ2dnUU7-LnNnZ2d@earthlink.com>
<2dd21bcd-ccc3-4872-8757-ce12f2e12237n@googlegroups.com>
<e4fe03ff-6504-4557-8408-c7275de5e1a4n@googlegroups.com>
<75ednWXb7d50yun8nZ2dnUU7-cPNnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Oct 2021 08:23:41 -0000 (UTC)
Injection-Info: solani.org;
logging-data="6467"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:Gi9riOaImjSdAjWImDInlfZrzNE= sha1:U4jxYTFMBpzKt6Faq2UxOfJ+B18=
X-User-ID: eJwNxcEBwCAIA8CVQEjQcUBk/xHa+xyMyhtO0DGYzlUq6Sds3bIsBHGe0Ljv/IW8yd5N04D3BxgTEM0=
 by: Oliver Schmidt - Sun, 24 Oct 2021 08:23 UTC

Hi Hugh,

>> I believe what he's trying to do is patch the binary included with
>> PUTBIN with the assembler itself.

> Exactly! Thanks for boiling that down to one succinct sentence for me.

The ld65 linker supports 'overwrite' segments for that very purpose.
https://cc65.github.io/doc/ld65.html#ss5.4 says:

Perhaps you are modifying an OS ROM that has its public subroutines at
fixed, well-known addresses, and you want to prevent them from shifting to
other locations in memory if your changed code takes less space. Or you are
updating a block of code available in binary-only form with fixes that are
scattered in various places. Generally, whenever you want to minimize
disturbance to an existing code brought on by your updates, OVERWRITE
segments are worth considering.

Regards,
Oliver

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor