Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RAINBOW: a "floating bus" example

109 views
Skip to first unread message

mmphosis

unread,
Dec 24, 2011, 1:54:56 AM12/24/11
to
10 A = 9200
20 B = 13136 + 32
30 C = 100
40 TEXT : HOME
50
DATA173,87,192,173,83,192,173,84,192,173,80,192,208,251,173,86,192,160,22,136,208,253,234,173,87,192,76,9,3
60 FOR I = 768 TO 796
70 READ N: POKE I,N
80 NEXT
100 HGR : POKE - 16302,0
110 HCOLOR= 4
120 HPLOT 0,0: CALL 62454
130 HCOLOR= 2
140 HPLOT 0,63 TO 279,63
150 HPLOT 0,62 TO 279,62
160 HCOLOR= 6
170 HPLOT 0,61 TO 279,61
180 HPLOT 0,60 TO 279,60
190 HCOLOR= 1
200 HPLOT 0,59 TO 279,59
210 HPLOT 0,58 TO 279,58
220 HCOLOR= 5
230 HPLOT 0,55 TO 279,55
240 HPLOT 0,54 TO 279,54
250 HCOLOR= 0
260 HPLOT 0,123 TO C,123
261 HPLOT 0,122 TO C,122
262 HPLOT 0,119 TO C,119
263 HPLOT 0,118 TO C,118
270 COLOR= 0
280 FOR I = 0 TO 39
290 VLIN 0,39 AT I
300 NEXT
310 COLOR= 13
320 HLIN 0,39 AT 14
330 FOR I = 0 TO 7
340 POKE A + I,0
345 POKE B + I,0
350 NEXT
360 COLOR= 1
370 HLIN 0,39 AT 13
380 VTAB 21
390 PRINT TAB( 16)"RAINBOW"
400 PRINT : PRINT "MIXED GRAPHICS (HI-RES/COLOR)"
500 CALL 768

magnusfalkirk

unread,
Dec 24, 2011, 3:07:54 AM12/24/11
to
I tried running this in Virtual II on my MacBook Air and got an error
"OUT OF DATA ERROR IN 70". I copied it from your post and pasted it
into Virtual II, so I know I couldn't have typed anything wrong. Any
ideas?

Dean

BluPhoenyx

unread,
Dec 24, 2011, 10:51:59 AM12/24/11
to
On 12/24/2011 02:07 AM, magnusfalkirk wrote:
>
> I tried running this in Virtual II on my MacBook Air and got an error
> "OUT OF DATA ERROR IN 70". I copied it from your post and pasted it
> into Virtual II, so I know I couldn't have typed anything wrong. Any
> ideas?

When I copied/(shift inserted) the text into Applewin the line 50 didn't
paste properly so the program had no DATA to work with.

Cheers,
Mike T

Charlie

unread,
Dec 24, 2011, 11:50:34 AM12/24/11
to
Before copying the text you need to move the DATA line so that it is
following the number 50 then it copies correctly into Applewin.

In Applewin I see horizontal stripes of the normal hires colors and they
occasionally blink.

Charlie

mmphosis

unread,
Dec 24, 2011, 12:17:27 PM12/24/11
to
> Before copying the text you need to move the DATA line so that it is
> following the number 50 then it copies correctly into Applewin.

Yes, the line number 50 and the DATA need to all be on the same line.
Unfortunately, Google groups wants to word wrap code.

50DATA173,87,192,173,83,192,173,84,192,173,80,192,208,251,173,86,192,160,22,136,208,253,234,173,87,192,76,9,3

> In Applewin I see horizontal stripes of the normal hires colors and they
> occasionally blink.

Yes, this is the behavior in AppleWin.

On a real Apple II+, a rainbow is displayed.

magnusfalkirk

unread,
Dec 24, 2011, 11:48:43 PM12/24/11
to
After fixing line 50 I get the same thing in Virtual II that you got
in AppleWin. I guess I'll need to try it in a real II to see what it
really looks like.

Dean

Bill Garber

unread,
Dec 25, 2011, 12:15:43 AM12/25/11
to

"magnusfalkirk" <dean....@gmail.com> wrote in message news:8f432809-c6f1-4ea7...@f15g2000yqo.googlegroups.com...
The correct syntax is: 50 DATA 173,87,...,76,9,3

I don't have Virtual II, or is that the online emulator?

It works in AppleWIN.

Bill


magnusfalkirk

unread,
Dec 26, 2011, 1:40:18 AM12/26/11
to
On Dec 24, 11:15 pm, "Bill Garber" <willy4...@comcast.net> wrote:
> "magnusfalkirk" <dean.pha...@gmail.com> wrote in messagenews:8f432809-c6f1-4ea7...@f15g2000yqo.googlegroups.com...
Virtual II is an excellent Apple II emulator for the Macintosh, the
only thing it doesn't emulate is the GS. For that I use Sweet 16. The
web site you're thinking of is Virtual Apple 2.

BLuRry

unread,
Dec 28, 2011, 12:10:39 AM12/28/11
to
On Dec 24, 11:15 pm, "Bill Garber" <willy4...@comcast.net> wrote:
> "magnusfalkirk" <dean.pha...@gmail.com> wrote in messagenews:8f432809-c6f1-4ea7...@f15g2000yqo.googlegroups.com...
It looks mostly OK in my locally compiled version of kegs (xkegs) --
though I might have mistyped a couple of lines, I see a few black
stripes. But the effect isn't lost at all. Neat!

-Brendan

D Finnigan

unread,
Dec 28, 2011, 2:56:53 PM12/28/11
to
I typed it in this morning. I found it interesting that when the Reset key
is held down, two of the color bars disappear. Presumably this is because it
causes the machine code program to stop.

I also disassembled the machine code to take a look at how it works. It
looks like it is waiting on a memory address to change ($C050, IIRC) before
taking further action.

--
]DF$
Mac GUI Vault - A source for retro Apple II and
Macintosh computing.
http://macgui.com/vault/

Michael J. Mahon

unread,
Dec 28, 2011, 5:45:00 PM12/28/11
to
D Finnigan <dog...@macgui.com> wrote:
> I typed it in this morning. I found it interesting that when the Reset key
> is held down, two of the color bars disappear. Presumably this is because it
> causes the machine code program to stop.
>
> I also disassembled the machine code to take a look at how it works. It
> looks like it is waiting on a memory address to change ($C050, IIRC) before
> taking further action.

That reads the "floating bus" value--the byte last read by the video
refresh controlled by the video scanner.

Prior to the introduction of the VBL signal, this was the only way for the
processor to sense the state of the video scanner, and therefore to
synchronize with it.

-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

mmphosis

unread,
Dec 28, 2011, 7:20:41 PM12/28/11
to
You got it!

Are you actually running it on "real" hardware?

I am pretty sure that anyone running this on an emulator, won't see
the same thing as on a real Apple II plus. Although, I believe that
OpenEmulator is very close to making this work.

0300- AD 57 C0 LDA $C057
0303- AD 53 C0 LDA $C053
0306- AD 54 C0 LDA $C054
0309- AD 50 C0 LDA $C050 ; 4 cycles -- reads the "floating bus"
value--the byte last read by the video refresh controlled by the video
scanner.
030C- D0 FB BNE $0309 ; 3 cycles if not $00, keep reading
the "floating bus" -- zeroes are strategically placed within the hi-
res screen
030E- AD 56 C0 LDA $C056 ; 4 cycles -- switch to lo-res
0311- A0 16 LDY #$16 ; 2 cycles -- Y = 22
0313- 88 DEY ; 2 cycles times 22 = 44 cycles
0314- D0 FD BNE $0313 ; 3 cycles times 22 + 2 cycles = 68
cycles
0316- EA NOP ; 2 cycles -- 4 + 2 + 44 + 68 + 2 = 120
cycles, long enough to display horizontal lines of lo-res two pixels
high
0317- AD 57 C0 LDA $C057 ; switch to hi-res
031A- 4C 09 03 JMP $0309 ; do it all over again

forgive me for the word wrap messing with the code

D Finnigan

unread,
Dec 29, 2011, 3:47:26 PM12/29/11
to
mmphosis wrote:
> On Dec 28, 11:56�am, dog_...@macgui.com (D Finnigan) wrote:
>> I typed it in this morning. I found it interesting that when the Reset
>> key
>> is held down, two of the color bars disappear. Presumably this is because
>> it
>> causes the machine code program to stop.
>>
>> I also disassembled the machine code to take a look at how it works. It
>> looks like it is waiting on a memory address to change ($C050, IIRC)
>> before
>> taking further action.
>>
>> --
>> ]DF$
>> Mac GUI Vault - A source for retro Apple II and
>> Macintosh computing.http://macgui.com/vault/
>
> You got it!
>
> Are you actually running it on "real" hardware?
>

Let me answer with a picture:

http://macgui.com/gallery/showphoto.php?pic_id=1519

> I am pretty sure that anyone running this on an emulator, won't see
> the same thing as on a real Apple II plus. Although, I believe that
> OpenEmulator is very close to making this work.
>

Antoine Vignau

unread,
Dec 31, 2011, 4:06:35 AM12/31/11
to
Just right now, DF$:
"Bandwidth Limit Exceeded

The server is temporarily unable to service your request due to the
site owner reaching his/her bandwidth limit. Please try again later."

BLuRry

unread,
Jan 19, 2012, 12:37:35 PM1/19/12
to

D Finnigan

unread,
Jan 19, 2012, 3:50:00 PM1/19/12
to
BLuRry wrote:
> Is it supposed to look like this? (sorry for the horrible-looking URL)
>

Nay.

The machine code adds 2 extra bars in that middle black space.

If one holds the reset key (or Control-Reset, if you've got your switch that
way), the machine code halts, and the two bars disappear from the screen.

BLuRry

unread,
Jan 19, 2012, 6:18:21 PM1/19/12
to
Hmmmm.... If I adjust my timing up or down it no longer holds still
and flickers a lot. I know that my floating bus code is doing
*something* otherwise I wouldn't see it at all. :-D Anyway, looks
like what I implemented is similar to what KEGS does.

D Finnigan

unread,
Jan 20, 2012, 2:09:18 PM1/20/12
to
BLuRry wrote:
> On Jan 19, 2:50 pm, dog_...@macgui.com (D Finnigan) wrote:
>> BLuRry wrote:
>> > Is it supposed to look like this? (sorry for the horrible-looking URL)
>>
>> Nay.
>>
>> The machine code adds 2 extra bars in that middle black space.
>>
>> If one holds the reset key (or Control-Reset, if you've got your switch
>> that
>> way), the machine code halts, and the two bars disappear from the screen.
>>
>
> Hmmmm.... If I adjust my timing up or down it no longer holds still
> and flickers a lot. I know that my floating bus code is doing
> *something* otherwise I wouldn't see it at all. :-D Anyway, looks
> like what I implemented is similar to what KEGS does.
>

KEGS? Even a real IIgs doesn't do the same thing as a real II Plus.

I saved the RAINBOW program on a 5.25" disk so I wouldn't have to type it
again. I loaded it on the IIgs. The results were... we shall say...
interesting.

On Fast speed (that's 2.8 MHz for me) there was quite a bit of screen
flickering. On normal speed, the flickering was less so, and was isolated
the right side of the screen.

Michael J. Mahon

unread,
Jan 20, 2012, 2:53:15 PM1/20/12
to
Of course, being a cycle-counting program, it would have to run at
1MHz.

But does this mean that the vus structure of the IIgs does not allow
"bus sniffing" and "vapor lock" at all?

-michael

NadaNet 3.1 for Apple II parallel computing!
Home page: http://home.comcast.net/~mjmahon/

"The wastebasket is our most important design
tool--and it's seriously underused."

EricN

unread,
Jan 22, 2012, 12:50:16 PM1/22/12
to
This is what I see with the Virtual ][ emulator:
http://i.imgur.com/L7iXj.jpg

The red and yellow lines of the rainbow were flickering off and on in
Virtual ][. The screenshot captured the rainbow when the red and
yellow lines were black.

Eric

D Finnigan

unread,
Jan 22, 2012, 1:17:43 PM1/22/12
to
EricN wrote:
>
> The red and yellow lines of the rainbow were flickering off and on in
> Virtual ][. The screenshot captured the rainbow when the red and
> yellow lines were black.
>

Close, but no cigar. Every line of the rainbow should be solid with no
flicker.

datawiz

unread,
Jan 23, 2012, 3:20:49 PM1/23/12
to
I finally broke down and ran this on my IIe, and all I can say is:

ROY G. BIV !!!

Well, actually, more like ROY G. BI or maybe ROY G. BV, but it was
cool to see in HGR mode!

Marc S. Ressl

unread,
Feb 5, 2012, 12:57:21 PM2/5/12
to
So,

I've refactorized the timing component in OpenEmulator, and thinks
seem to be much nicer now :-).

http://openemulator.googlecode.com/files/rainbow.png

There is still a problem with two bars that flicker at the beginning
(I posted the worst case)... does that happen on an Apple II as well?

With the best wishes,

Marc.-

D Finnigan

unread,
Feb 7, 2012, 12:11:09 PM2/7/12
to
Marc S. Ressl wrote:
>
> http://openemulator.googlecode.com/files/rainbow.png
>
> There is still a problem with two bars that flicker at the beginning
> (I posted the worst case)... does that happen on an Apple II as well?
>

That is almost correct, but not quite.

Every bar of the rainbow should be of uniform length. There should not be
any flickering at all.

Marc S. Ressl

unread,
Feb 7, 2012, 8:36:19 PM2/7/12
to
Hello D Finnigan:

thanks a lot for your help! By "uniform length", do you mean that the
LORES lines do not have the same length as the HIRES lines, or
something else? Would it be a lot of trouble to post a picture of the
output on a real Apple II?

I emphasize this, because I feel this is an excellent test of the
timing emulation. It not only tests horizontal but also vertical
timing.

I must also confess that I still have to go into the code further to
fully understand what is going on :-).

D Finnigan

unread,
Feb 8, 2012, 10:48:15 AM2/8/12
to
Marc S. Ressl wrote:
> On 7 feb, 14:11, dog_...@macgui.com (D Finnigan) wrote:
>> Marc S. Ressl wrote:
>>
>> >http://openemulator.googlecode.com/files/rainbow.png
>>
>> > There is still a problem with two bars that flicker at the beginning
>> > (I posted the worst case)... does that happen on an Apple II as well?
>>
>> That is almost correct, but not quite.
>>
>> Every bar of the rainbow should be of uniform length. There should not be
>> any flickering at all.
>>
>> --
>> ]DF$
>> Mac GUI Vault - A source for retro Apple II and
>> Macintosh computing.http://macgui.com/vault/
>
> Hello D Finnigan:
>
> thanks a lot for your help! By "uniform length", do you mean that the
> LORES lines do not have the same length as the HIRES lines, or
> something else?

In the screenshot that you posted, not all of the lines of the rainbow were
the same length.

On a real Apple II Plus, all lines should be the same length.

> Would it be a lot of trouble to post a picture of the
> output on a real Apple II?
>

I will take a picture and have it online tomorrow.

rich12345

unread,
Feb 8, 2012, 10:59:11 AM2/8/12
to
rich12345.tripod.com/aiivideo/softalk.html also
check out rich12345.tripod.com/ for other information about apple ii
video timing related to cpu cycles

D Finnigan

unread,
Feb 9, 2012, 11:55:02 AM2/9/12
to
Marc S. Ressl wrote:
> Would it be a lot of trouble to post a picture of the
> output on a real Apple II?
>

Some 16-leggedy creatures congregated in my Apple II Plus, and this is what
they made:

http://macgui.com/gallery/showphoto.php?pic_id=1539
http://macgui.com/gallery/showphoto.php?pic_id=1540

EricN

unread,
Feb 11, 2012, 9:18:17 AM2/11/12
to
Virtual ][ v6.5 for OS X was just released and it supports this
floating bus test now-no more flickering of the red and yellow lines.

Eric

D Finnigan

unread,
Feb 12, 2012, 1:31:35 PM2/12/12
to
I also tried this program on a ROM 255 Apple IIc and an unenhanced Apple
IIe.

Results:

The screen from the Apple IIc matches that from the II Plus (save for the
color tint).

However!

The Apple IIe showed a funny little "glitch" right at the right end of the
blue bar. The blue bar appeared to be slightly longer than the other bars,
and just the right end of it appeared to be flickering very slightly.

michael....@gmail.com

unread,
Jan 2, 2015, 9:55:51 PM1/2/15
to
AppleWin 1.26 will display this correctly ...
http://imgur.com/iJZWfsD

I also cleaned up the code, and using it as a reference image for Bug #254.

10 A = 9200 :B = 13168:C=100:X=279
20 TEXT : HOME :GOTO 40
30 HPLOT 0,Y TO X,Y:RETURN
40 DATA 173,87,192,173,83,192,173,84,192,173,80,192
50 DATA 208,251,173,86,192,160,22,136,208,253,234,173,87,192,76,9,3
60 FOR I = 768 TO 796:READ N:POKE I,N:NEXT
70 HGR : POKE - 16302,0
80 HCOLOR= 4:HPLOT 0,0: CALL 62454
90 HCOLOR= 2:Y=63:GOSUB 30:Y=62:GOSUB 30
100 HCOLOR= 6:Y=61:GOSUB 30:Y=60:GOSUB 30
110 HCOLOR= 1:Y=59:GOSUB 30:Y=58:GOSUB 30
120 HCOLOR= 5:Y=55:GOSUB 30:Y=54:GOSUB 30
130 HCOLOR= 0:X=C
140 Y=123:GOSUB 30:Y=122:GOSUB 30
150 Y=119:GOSUB 30:Y=118:GOSUB 30
160 COLOR= 0:FOR I = 0 TO 39:VLIN 0,39 AT I:NEXT
170 COLOR= 13:HLIN 0,39 AT 14
180 FOR I = 0 TO 7:POKE A + I,0:POKE B + I,0:NEXT
190 COLOR= 1:HLIN 0,39 AT 13
200 VTAB 21:? TAB( 16)"RAINBOW"
210 ?:? "MIXED GRAPHICS (HI-RES/COLOR)"
220 CALL 768

wss...@gmail.com

unread,
Jan 3, 2015, 1:08:39 AM1/3/15
to
That's an interesting usage of "cleaned up".

michael....@gmail.com

unread,
Jan 7, 2015, 7:20:32 PM1/7/15
to
On Friday, January 2, 2015 10:08:39 PM UTC-8, wss...@gmail.com wrote:
> Am Freitag, 2. Januar 2015 21:55:51 UTC-5 schrieb michael....@gmail.com:
>
> That's an interesting usage of "cleaned up".

Well, I was too lazy to bust out ADTPro, so entering this manually on the //c forced me to "compact" it.

Yeah, your probably right, should of said "compressed/optimized for manual entry." :-)

0 new messages