Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #2015 > unrolled thread
| Started by | D Finnigan <dog_cow@macgui.com> |
|---|---|
| First post | 2015-12-21 19:45 +0000 |
| Last post | 2016-01-04 19:02 +0000 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.sys.apple2.programmer
ProDOS and the random seed RNDL D Finnigan <dog_cow@macgui.com> - 2015-12-21 19:45 +0000
Re: ProDOS and the random seed RNDL awanderin <awanderin@gmail.com> - 2015-12-22 23:38 -0700
Re: ProDOS and the random seed RNDL D Finnigan <dog_cow@macgui.com> - 2015-12-23 19:39 +0000
Re: ProDOS and the random seed RNDL gids.rs@sasktel.net - 2015-12-23 09:23 -0800
Re: ProDOS and the random seed RNDL D Finnigan <dog_cow@macgui.com> - 2015-12-23 19:51 +0000
Re: ProDOS and the random seed RNDL gids.rs@sasktel.net - 2015-12-23 17:25 -0800
Re: ProDOS and the random seed RNDL D Finnigan <dog_cow@macgui.com> - 2016-01-04 19:02 +0000
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-12-21 19:45 +0000 |
| Subject | ProDOS and the random seed RNDL |
| Message-ID | <dog_cow-1450727254@macgui.com> |
Since converting the Marina IP source from DOS 3.3 to ProDOS, I've noticed that link-local addresses, which were previously randomly generated, were no longer random. I took the time to track down this issue yesterday. I'm using ProDOS 8 v1.9 on an enhanced (platinum) Apple IIe but I believe all versions of ProDOS have this problem. I had been using RNDL and RNDH ($4E and $4F) as my random seed. I put together this program to test what was happening: A5 4E 20 DA FD A5 4F 20 DA FD 4C D0 03 ]BRUN RND 0D80 *8000G 958E When I saved it as RND and did BRUN from the Applesoft prompt, I always got 0D80. But when I ran the program using the Monitor G command, I got changing results, which is what I expected. It looked like ProDOS was setting RNDL and RNDH to some constant value. Neither the white ProDOS Technical Reference Manual nor Gary B. Little's Apple ProDOS book mentioned this behavior. Nor could I find any mention of it from searching these newsgroups. Poking around in the LC RAM area for ProDOS I found this code at $E189: LDY #1 LDA ($40),y STA $4E INY LDA ($40),Y STA $4F I went back to the ProDOS 8 source in MliSrc.aii and found that it's a part of the get_prefix routine: getprefx clc ; calculate how big a buffer is needed to ldy #c_path ; get index to users pathname buffer lda (par),y sta usrbuf iny lda (par),y sta usrbuf+1 So it is seen that RNDL and RNDH are being used as part of a buffer for ProDOS. My work-around was to insert a call to GETLN ($FD6A) at the beginning of Marina in order to reseed the random number. Hum-ho. -- ]DF$ The Marina IP stack for Apple II-- http://marina.a2hq.com/
[toc] | [next] | [standalone]
| From | awanderin <awanderin@gmail.com> |
|---|---|
| Date | 2015-12-22 23:38 -0700 |
| Message-ID | <m31tad8yam.fsf@gmail.com> |
| In reply to | #2015 |
D Finnigan <dog_cow@macgui.com> writes: > Since converting the Marina IP source from DOS 3.3 to ProDOS, I've noticed > that link-local addresses, which were previously randomly generated, were no > longer random. I took the time to track down this issue yesterday. > > I'm using ProDOS 8 v1.9 on an enhanced (platinum) Apple IIe but I believe > all versions of ProDOS have this problem. > > I had been using RNDL and RNDH ($4E and $4F) as my random seed. I put > together this program to test what was happening: > > A5 4E > 20 DA FD > A5 4F > 20 DA FD > 4C D0 03 > > ]BRUN RND > 0D80 > > *8000G > 958E > > When I saved it as RND and did BRUN from the Applesoft prompt, I always got > 0D80. But when I ran the program using the Monitor G command, I got changing > results, which is what I expected. It looked like ProDOS was setting RNDL > and RNDH to some constant value. Neither the white ProDOS Technical > Reference Manual nor Gary B. Little's Apple ProDOS book mentioned this > behavior. Nor could I find any mention of it from searching these > newsgroups. > > Poking around in the LC RAM area for ProDOS I found this code at $E189: > LDY #1 > LDA ($40),y > STA $4E > INY > LDA ($40),Y > STA $4F > > I went back to the ProDOS 8 source in MliSrc.aii and found that it's a part > of the get_prefix routine: > > getprefx clc ; calculate how big a buffer is needed to > ldy #c_path ; get index to users pathname buffer > lda (par),y > sta usrbuf > iny > lda (par),y > sta usrbuf+1 > > So it is seen that RNDL and RNDH are being used as part of a buffer for > ProDOS. > > My work-around was to insert a call to GETLN ($FD6A) at the beginning of > Marina in order to reseed the random number. > > Hum-ho. Nice detective work! I don't know the internals of Marina, but if you have control of when ProDOS is called, perhaps Get_Prefix in particular, you could just save RNDL/H on the stack before issuing the MLI call. Having to call an interactive routine seems an ugly workaround unless you actually want some user input. -- Jerry awanderin at gmail dot com
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-12-23 19:39 +0000 |
| Message-ID | <dog_cow-1450899736@macgui.com> |
| In reply to | #2016 |
awanderin wrote: > D Finnigan <dog_cow@macgui.com> writes: > >> Since converting the Marina IP source from DOS 3.3 to ProDOS, I've >> noticed >> that link-local addresses, which were previously randomly generated, were >> no >> longer random. I took the time to track down this issue yesterday. >> >> I'm using ProDOS 8 v1.9 on an enhanced (platinum) Apple IIe but I believe >> all versions of ProDOS have this problem. >> >> I had been using RNDL and RNDH ($4E and $4F) as my random seed. I put >> together this program to test what was happening: >> >> A5 4E >> 20 DA FD >> A5 4F >> 20 DA FD >> 4C D0 03 >> >> ]BRUN RND >> 0D80 >> >> *8000G >> 958E > > > I don't know the internals of Marina, but if you have control of when > ProDOS is called, perhaps Get_Prefix in particular, you could just save > RNDL/H on the stack before issuing the MLI call. Having to call an > interactive routine seems an ugly workaround unless you actually want > some user input. The little test program I made shows that ProDOS sets RNDL and RNDH before control passes to my program. I agree, I don't like the work-around. But many applications that use Marina will probably involve keyboard input at some point. -- ]DF$ The Marina IP stack for Apple II-- http://marina.a2hq.com/
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-12-23 09:23 -0800 |
| Message-ID | <2297cc94-d8cc-4313-aff1-866df28a164e@googlegroups.com> |
| In reply to | #2015 |
On Monday, December 21, 2015 at 1:47:36 PM UTC-6, D Finnigan wrote: > Since converting the Marina IP source from DOS 3.3 to ProDOS, I've noticed > that link-local addresses, which were previously randomly generated, were no > longer random. I took the time to track down this issue yesterday. > > I'm using ProDOS 8 v1.9 on an enhanced (platinum) Apple IIe but I believe > all versions of ProDOS have this problem. > > I had been using RNDL and RNDH ($4E and $4F) as my random seed. I put > together this program to test what was happening: > > A5 4E > 20 DA FD > A5 4F > 20 DA FD > 4C D0 03 > > ]BRUN RND > 0D80 > > *8000G > 958E > > When I saved it as RND and did BRUN from the Applesoft prompt, I always got > 0D80. But when I ran the program using the Monitor G command, I got changing > results, which is what I expected. It looked like ProDOS was setting RNDL > and RNDH to some constant value. Neither the white ProDOS Technical > Reference Manual nor Gary B. Little's Apple ProDOS book mentioned this > behavior. Nor could I find any mention of it from searching these > newsgroups. > > Poking around in the LC RAM area for ProDOS I found this code at $E189: > LDY #1 > LDA ($40),y > STA $4E > INY > LDA ($40),Y > STA $4F > > I went back to the ProDOS 8 source in MliSrc.aii and found that it's a part > of the get_prefix routine: > > getprefx clc ; calculate how big a buffer is needed to > ldy #c_path ; get index to users pathname buffer > lda (par),y > sta usrbuf > iny > lda (par),y > sta usrbuf+1 > > So it is seen that RNDL and RNDH are being used as part of a buffer for > ProDOS. > > My work-around was to insert a call to GETLN ($FD6A) at the beginning of > Marina in order to reseed the random number. > > Hum-ho. > > -- > ]DF$ > The Marina IP stack for Apple II-- > http://marina.a2hq.com/ To get away from the key press, one could use a pseudo-random routine. One way is to have a list of link-local addresses in non-sequential or manually generated random order but selected sequentially. I am curious as to what routines are at each of link-local addresses that one could possibly want to be so random after loading or running a new file each time?
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-12-23 19:51 +0000 |
| Message-ID | <dog_cow-1450900424@macgui.com> |
| In reply to | #2017 |
gids.rs wrote: > > I am curious as to what routines are at each of link-local addresses that > one could possibly want to be so random after loading or running a new > file > each time? > I don't understand your question, but here is a link to the RFC, 3927: http://tools.ietf.org/html/rfc3927 -- ]DF$ The Marina IP stack for Apple II-- http://marina.a2hq.com/
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-12-23 17:25 -0800 |
| Message-ID | <bcfded12-c1ef-4713-8acf-87d2d93f5652@googlegroups.com> |
| In reply to | #2019 |
On Wednesday, December 23, 2015 at 1:53:47 PM UTC-6, D Finnigan wrote: > gids.rs wrote: > > > > I am curious as to what routines are at each of link-local addresses that > > one could possibly want to be so random after loading or running a new > > file > > each time? > > > > I don't understand your question, but here is a link to the RFC, 3927: > http://tools.ietf.org/html/rfc3927 > > > -- > ]DF$ > The Marina IP stack for Apple II-- > http://marina.a2hq.com/ Since the $4E.4F were being reset each time access was being made to the MLI and only calls that use a buffer (OPEN, READ, WRITE, BLKREAD, BLKWRITE), I ascertained (ok ASSUMED) you were intentionally loading files that required a random number for some reason. But all is clear now for the random usage.
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2016-01-04 19:02 +0000 |
| Message-ID | <dog_cow-1451934300@macgui.com> |
| In reply to | #2020 |
gids.rs wrote: > > Since the $4E.4F were being reset each time access was being made to the > MLI and only calls that use a buffer (OPEN, READ, WRITE, BLKREAD, > BLKWRITE), I ascertained (ok ASSUMED) you were intentionally loading files > that required a random number for some reason. Marina at present has no MLI calls. The RNDL and RNDH locations were being reset before *even one single instruction* of my program had executed. And thinking more, it is probably BASIC.SYSTEM that makes the MLI call before passing control to my program. -- ]DF$ The Marina IP stack for Apple II-- http://marina.a2hq.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web