Display hacks

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
User avatar
CaptainNemo
Posts: 27
Joined: Tue Apr 22, 2014 9:23 pm

Display hacks

Post by CaptainNemo »

Hi everyone,

I came across this interesting lecture about the Commodore 64 architecture. What caught my attention was a hack allowing to display graphics off screen (jump to 43:00).

Does the Dragon hardware allow this kind of magic?
Are there any cool display hacks you know of?
User avatar
jltursan
Posts: 15
Joined: Thu Jun 06, 2013 7:04 pm

Re: Display hacks

Post by jltursan »

Well, sort of. 6847 has no line interrupts like the VIC-II and has to emulate them by means of synchronous code and that means very limited CPU time or a lot of work scheduling tasks to the CPU while drawing at the same time, a nightmare. Maybe it features some trick to accomplish this; but I doesn't know any.

The best example of this technique is the game Dragonfire that uses raster palette changes (horizontal and vertical!) to show in the bridge level both 6847 palettes.
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Display hacks

Post by sixxie »

The only two "graphics off screen" hacks I know of are:

1. Border colour changes. Probably minimum of 32 pixels between switches though, not very useful. The PAL hack of Dragonfire uses this to bounce a larger-than-screen-width pair of lines up and down (amongst other fun mode switching).

2. 16 byte to 32 byte transitions mid-line gets the VDG to render into the right border. Screws with the timing a bit, and requires CPU to be dedicated to making the transitions.

Here's Simon Jonassen playing with the second effect under emulation: http://www.youtube.com/watch?v=YJIsaJfZIDw. I think on real hardware it's not so stable due to the timing, but he's managed it to an extent (though I don't see a video of it).

More usable, but less impressive: if you configure the SAM to "DMA" mode, some bytes are skipped each scanline, so you can render off-screen in that way. Mostly useful to avoid the need to clip in your draw routines, but you can just about wrangle an offset with frequent mode changes. SJ again: http://www.youtube.com/watch?v=Pp52G6b7oEw
Last edited by sixxie on Mon May 26, 2014 2:14 pm, edited 1 time in total.
User avatar
CaptainNemo
Posts: 27
Joined: Tue Apr 22, 2014 9:23 pm

Re: Display hacks

Post by CaptainNemo »

Thanks for sharing, this is very interesting. I guess the demoscene was always ahead of the herd...
Is there a source for reading more about these techniques?

Simon Jonassen's chessboard demos are brilliant!
simon
Posts: 163
Joined: Wed Nov 27, 2013 8:56 pm

Re: Display hacks

Post by simon »

@captain nemo....

chessboard is pretty good... (took alot of attempts)

the right hand sideborder is "piece of cake"... just requires very careful timing.... and don't go to far or the screen freaks out.....

the basic idea would be shift from a 16 to 32 byte mode on a per line basis to fool the vdg's counters.....

here you go nemo:

this is my code:

org $3f00



START lda #$ff Setup DP register
tfr a,dp
setdp $ff

orcc #$50 Disable interrupts

VSTART ldb $ff01 Disable hsync interrupt generation
andb #$fa
stb $ff01
tst $ff00

lda $ff03 Enable vsync interrupt generation
ora #$05
sta $ff03
tst $ff02

sync Wait for vsync interrupt

anda #$fa Disable vsync interrupt generation
sta $ff03
tst $ff02

orb #$05 Enable hsync interrupt generation
stb $ff01
tst $ff00

clr <$c1
clr <$c3
clr <$c5
clr <$c7


VSYNC ldb #$77 Count lines during vblank and vertical borders ($45)
HCOUNT tst $ff00
sync
decb
bne HCOUNT
ldx #192
lda #$80 Setup CSS options for raster effects
ldb #$f0

crap tst $ff00 Wait for next hsync interrupt
sync

sta $ff22
sta $ff22
sta $ff22
stb $ff22
stb $ff22
stb $ff22
stb $ff22
stb $ff22


leax -1,x
cmpx #$00
bne crap

clr $ff22
jmp VSYNC


end START



this would be with 42 byte dma code.... ($ffc1)

/Simon Jonassen :-)
simon
Posts: 163
Joined: Wed Nov 27, 2013 8:56 pm

Re: Display hacks

Post by simon »

btw....

let me know if you want the chessboard source......

/Simon :-)
Post Reply