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

Fast-wipe Hires

93 views
Skip to first unread message

BLuRry

unread,
Aug 30, 2012, 10:21:56 PM8/30/12
to
Here's something I wrote to see how fast I could fill the hires screen with the same number. I wrote this in a "race-the-gun" style so that you could in theory run this without ever getting a vertical retrace artifact or vertical blinds. Store the pattern you want in $06 before calling it.

I wrote this for ACME assembler. Because I unrolled the loop to store 8 bytes before a conditional branch it is incredibly speedy.

There is a reason for this routine, but it's actually because I want something that can reverse the whole screen. The way I see it is you can't make a killer 3d demo on this platform. But holy cow can you get creative with persistence of vision. Because this platform can fire off 60 fps, stroboscopic effects are much more effective.

-B


; @com.wudsn.ide.asm.hardware=APPLE2
!cpu 65c02
*=$6000

GRAPHICS = $c050
FULLSCREEN = $c052
PAGE1 = $c054
HIRES = $c057

bit HIRES
bit PAGE1
bit FULLSCREEN
bit GRAPHICS

LDY #47
CLC
clearloop
LDA lookup,y
STA rewrite1+2
ADC #$04
STA rewrite2+2
ADC #$04
STA rewrite3+2
ADC #$04
STA rewrite4+2
ADC #$04
STA rewrite5+2
ADC #$04
STA rewrite6+2
ADC #$04
STA rewrite7+2
ADC #$04
STA rewrite8+2
LDX #40
DEY
LDA lookup,y
STA rewrite1+1
STA rewrite2+1
STA rewrite3+1
STA rewrite4+1
STA rewrite5+1
STA rewrite6+1
STA rewrite7+1
STA rewrite8+1
LDA $06
rewrite1 STA $2000, X
rewrite2 STA $2000, X
rewrite3 STA $2000, X
rewrite4 STA $2000, X
rewrite5 STA $2000, X
rewrite6 STA $2000, X
rewrite7 STA $2000, X
rewrite8 STA $2000, X
DEX
BPL rewrite1
DEY
BPL clearloop
RTS

lookup !wo $23D0,$2350,$22D0,$2250,$21D0,$2150
!wo $20D0,$2050,$23A8,$2328,$22A8,$2228
!wo $21A8,$2128,$20A8,$2028,$2380,$2300
!wo $2280,$2200,$2180,$2100,$2080,$2000

Antoine Vignau

unread,
Aug 31, 2012, 3:10:06 PM8/31/12
to
Even faster ;-)
- divide your lookup table into two tables: one for low @ and one for high @

lookupl hex D050D050D050 ...
lookuph hex 232322222121 ...

LDY #24-1
CLC
clearloop
LDA lookuph,y
...

LDX #40-1 (and not 40)
LDA lookupl,y
...

You'll save one DEY per loop and even more with #40-1 instead of #40 :-)

antoine

BLuRry

unread,
Aug 31, 2012, 6:55:34 PM8/31/12
to
That's good feedback! Thanks Antoine! I expanded this out to EOR page 1 and page 2 and flip on the VBL. This proof of concept has shown me that the resolution of the display does not seem so low when you're flipping pages rapidly to produce optical illusions.

I've been able to reproduce these two:

http://www.moillusions.com/2007/01/flying-through-city-stereogram.html
http://www.grand-illusions.com/opticalillusions/chris_walken/

And I also have a take on this one which makes it look like it's continually expanding:

http://www.moillusions.com/wp-content/uploads/img142.imageshack.us/img142/4364/bulge023qx.gif

All in all, the speed of the routine is key to reversing the screen quickly.

More to follow...

-B

BLuRry

unread,
Aug 31, 2012, 8:49:46 PM8/31/12
to
With feedback from Antoine, here's a variation which inverses both hires screens and switches between them on the vertical retrace. The speed of this is sufficient to achieve the optical illusion of movement. I'm not sure if I could pull this off for DHGR because it would essentially be twice as slow.


; @com.wudsn.ide.asm.hardware=APPLE2
!cpu 65c02
*=$6000

KEYBOARD = $c000
STROBE = $c010
GRAPHICS = $c050
TEXT = $c051
FULLSCREEN = $c052
MIXED = $c053
PAGE1 = $c054
PAGE2 = $c055
LORES = $c056
HIRES = $c057

bit HIRES
bit FULLSCREEN
bit GRAPHICS
beginning
JSR waitForRetrace
LDA pageOffset+1
BEQ showPage2
showPage1
BIT PAGE2
LDA #$00
BEQ startLoop
showPage2
BIT PAGE1
LDA #$20
startLoop
STA pageOffset+1
LDY #23
CLC
clearloop1
LDA lookupHi,y
pageOffset ADC #$20
STA xor1a+2
STA xor1b+2
ADC #$04
STA xor2a+2
STA xor2b+2
ADC #$04
STA xor3a+2
STA xor3b+2
ADC #$04
STA xor4a+2
STA xor4b+2
ADC #$04
STA xor5a+2
STA xor5b+2
ADC #$04
STA xor6a+2
STA xor6b+2
ADC #$04
STA xor7a+2
STA xor7b+2
ADC #$04
STA xor8a+2
STA xor8b+2
LDA lookupLo,y
STA xor1a+1
STA xor2a+1
STA xor3a+1
STA xor4a+1
STA xor5a+1
STA xor6a+1
STA xor7a+1
STA xor8a+1
STA xor1b+1
STA xor2b+1
STA xor3b+1
STA xor4b+1
STA xor5b+1
STA xor6b+1
STA xor7b+1
STA xor8b+1
LDX #39
xor1a LDA $2000, X
EOR #$7f
xor1b STA $2000, X
xor2a LDA $2000, X
EOR #$7f
xor2b STA $2000, X
xor3a LDA $2000, X
EOR #$7f
xor3b STA $2000, X
xor4a LDA $2000, X
EOR #$7f
xor4b STA $2000, X
xor5a LDA $2000, X
EOR #$7f
xor5b STA $2000, X
xor6a LDA $2000, X
EOR #$7f
xor6b STA $2000, X
xor7a LDA $2000, X
EOR #$7f
xor7b STA $2000, X
xor8a LDA $2000, X
EOR #$7f
xor8b STA $2000, X
DEX
BPL xor1a
DEY
BMI finishedLoop
JMP clearloop1
;----------------------------------------------------------
finishedLoop
LDA STROBE
BMI gameOver
JMP beginning
waitForRetrace
LDA $c019
BMI waitForRetrace
RTS
gameOver
BIT PAGE1
BIT TEXT
RTS
lookupLo !by $d0, $50, $d0, $50
!by $d0, $50, $d0, $50
!by $a8, $28, $a8, $28
!by $a8, $28, $a8, $28
!by $00, $80, $00, $80
!by $00, $80, $00, $80
lookupHi !by $23, $23, $22, $22
!by $21, $21, $20, $20
!by $23, $23, $22, $22
!by $21, $21, $20, $20
!by $23, $23, $22, $22
!by $21, $21, $20, $20

Antoine Vignau

unread,
Sep 1, 2012, 1:25:24 AM9/1/12
to
Great change! Will you prepare a disk image of the illusions?
av

BLuRry

unread,
Sep 1, 2012, 6:55:14 PM9/1/12
to
M e g a d e m o
0 new messages