A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / display without copperlist

 

Author Message
jar
Member
#1 - Posted: 9 Feb 2019 17:18
Reply Quote
hi,

i'm currently trying to do some a500 coding again and have some trouble getting a simple bitplane display setup to work. So far I successfully managed setup a vblank irq routine that just increments a tick counter and periodically changes the background color. This is working fine.

Now I am trying to display some bitplane data (1bpl iff picture converted to raw bpl data), but without using a copperlist - just setting DIWSTRT/STOP and friends plus BPL1PT etc. in my vblank routine.

But so far I was not able to display any pixel data. What am I doing wrong (code below)? Do I still need a dummy copperlist (just a WAIT e.g)?


start:
bsr getvbr
move.l d0,a0
move.l $6c(a0),oldvbi

bsr WaitRaster
move.w $dff01c,oldintena
move.w $dff002,olddma

bsr disable_dma_and_irqs

lea irq_level3(pc),a1
move.l a1,$6c(a0)

move.w #$c020,$dff09a ; c020 = SET|INTEN|VERTB
move.w #$8160,$dff096 ; DMACON=SET|BPLEN|BLTEN|SPREN

waitmouse:
btst #6,$bfe001
bne waitmouse

bsr WaitRaster
bsr disable_dma_and_irqs

move.l oldvbi(pc),$6c(a0)

; restore irq requests
move.w olddma(pc),d0
or.w #$8000,d0
move.w d0,$dff096

move.w oldintena(pc),d0
or.w #$c000,d0
move.w d0,$dff09a

rts

setscreen:
; Setup 320x256x1 screen

move.w #$2c81,$dff08e ; DIWSTRT
move.w #$2cc1,$dff090 ; DIWSTOP
move.w #$0038,$dff092 ; DDFSTRT
move.w #$00d0,$dff094 ; DDFSTOP
move.w #$1200,$dff100 ; BPLCON0 (1 planes)
move.w #0000,$dff102
move.w #0000,$dff108 ; BPL1MOD
move.w #0000,$dff10a ; BPL2MOD
rts

disable_dma_and_irqs:
lea $dff000,a6
move.w #$7fff,d2
;bsr WaitRaster
move.w d2,$9A(a6)
move.w d2,$96(a6)
move.w d2,$9C(a6)
move.w d2,$9C(a6) ; twice for A4k
rts

; VBR helper code
; ---------------

getvbr:
moveq #0,d0 ; on 68k default is 0

; Check for 68010+

move.l $4.w,a6
btst #0,296+1(a6)
beq.b is68k

; Switch to supervisor mode (movec is priviledged instruction)

lea svr_getvbr(pc),a5
jsr -30(a6) ; Supervisor() - returns vbr in d0
lea vbroffset(pc),a0
move.l d0,(a0) ; store vbr

is68k:
rts

svr_getvbr:
dc.l $4e7a0801 ; movec vbr,d0
rte

; Level3 interrupt handler
; ------------------------

irq_level3:
movem.l d0-a6,-(a7)
move.w $dff01e,d0 ; Check bits of INTREQR
btst #5,d0 ; VBLANK?
bne vertb
bra irq_level3_quit
vertb:
move.w #$0fff,$dff182
lea timer(pc),a0
addq.l #1,(a0)
bsr setscreen
move.l #pic,d1 ; bplsize=320/8*256=10240
;add.l timer,d1
move d1,$dff0e2 ; BPL1PTL
swap d1
move d1,$dff0e0 ; BPL1PTH
;move.w #$00f0,$dff180
move.w timer+2,$dff180
move.w #$4020,$dff09c
move.w #$4020,$dff09c
bra.w irq_level3_quit

irq_level3_quit:
movem.l (a7)+,d0-a6
nop
rte

; Vars
; ----

vbroffset:
dc.l 0
oldvbi: dc.l 0
oldintena: dc.l 0
olddma: dc.l 0
timer: dc.l 0

gfxlib: dc.b "graphics.library",0,0

WaitRaster:
move.l d0,-(a7)
loop:
move.l $dff004,d0
and.l #$1ff00,d0
cmp.l #303<<8,d0
bne.b loop
move.l (a7)+,d0
rts

SECTION ChipData,DATA_C
pic:
incbin "apic.bpl"

losso
Member
#2 - Posted: 19 Feb 2019 16:03
Reply Quote
Hi! I tested that, and I think you need to set DMAEN as well, so the move to DMACON needs to be:

	move.w #$8360,$dff096	; DMACON=SET|DMAEN|BPLEN|BLTEN|SPREN


jar
Member
#3 - Posted: 20 Feb 2019 17:44
Reply Quote
Thanks for your reply! However, wouldn‘t setting of DMAEN also enable copper DMA (and audio etc), i.e. any previously set copperlist would be active again, interfering with my vblank display settings?
jar
Member
#4 - Posted: 20 Feb 2019 18:13
Reply Quote
.. hm or maybe I am just misinterpreting the DMACON docs here. It says „DMAEN: Enables all DMA below“ which I read as „activates all the DMA channels mentioned below“. It dawns on me now that it might mean „need to set DMAEN in addition ton some of the other flags below in order to activate them“.. hence why sometimes this flag is referred to DMAF_MASTER i guess
jar
Member
#5 - Posted: 21 Feb 2019 20:58
Reply Quote
well, just was a able to try it out - lo and behold it immediately worked :) just needed to set the DMAEN flag. Thanks a lot losso!
Blueberry
Member
#6 - Posted: 21 Feb 2019 21:47 - Edited
Reply Quote
You might be interested in my demo startup code. It handles all of the boilerplate startup code you have in your example, plus several other useful things, such as switching from other screenmodes and automatic exit on left mousebutton. It doesn't require you to have a copperlist, so you can still use it for copper-free displays.
rloaderror
Member
#7 - Posted: 22 Feb 2019 15:16
Reply Quote
is there a benefit to a copperless display? Save dma? No need to waste bytes on a coper list? Less typing?
jar
Member
#8 - Posted: 22 Feb 2019 17:47
Reply Quote
Main reason for me was to gain a proper understanding about how the amiga display hardware works from first principles. The minimum basics are DMA, bitplanes and hardware registers, copperlists can be considered a convenience on top :)

My background is from PC democoding, and I didn't wan't to go the "use some preexisting api/framework" road, because then I can just continue coding on PC :)

I grew up with amiga (little coding), but it seems it took me until now to fully grasp some hardware details :)
rloaderror
Member
#9 - Posted: 27 May 2019 14:49
Reply Quote
Are you Jar in Alien Prophets?

It is fascinating how it all hangs together. For me I’m still curious whether there is some hidden crazy screenmode that could be made. Several registers I never touched yet from the descriptions it seems they should allow controlling the display. Used by monitor drivers perhaps? Who knows
rloaderror
Member
#10 - Posted: 27 May 2019 14:58
Reply Quote
I’m thinking of all these.. what happens if writing these? Are they emulated in uae?

HTOTAL 1C0 W A( E ) Highest number count (VARBEAMEN=1)
HSSTOP 1C2 W A( E ) Horizontal line position for HSYNC stop
HBSTRT 1C4 W A( E ) Horizontal line position for HBLANK start
HBSTOP 1C6 W A( E ) Horizontal line position for HBLANK stop
VTOTAL 1C8 W A( E ) Highest numbered vertical line (VARBEAMEN=1)
VSSTOP 1CA W A( E ) Vertical line position for VSYNC stop
VBSTRT 1CC W A( E ) Vertical line for VBLANK start
VBSTOP 1CE W A( E ) Vertical line for VBLANK stop
BEAMCON0 1DC W A( E ) Beam counter control register (SHRES,PAL)
HSSTRT 1DE W A( E ) Horizontal sync start (VARHSY)
VSSTRT 1E0 W A( E ) Vertical sync start (VARVSY)
Blueberry
Member
#11 - Posted: 31 May 2019 23:35
Reply Quote
They do seem to be fully emulated by WinUAE. The various monitor drivers work fine, and the internal flag I had in one of my old demos (Peanut) to manually write these registers for DBLPAL also works.

One problem with using these in demos would be that the output then is no longer PAL, so whatever monitor or recording equipment is attached to the Amiga might not be able to display it.

I think they could be useful to get the superhires resolution distributed to more square-ish pixels than 1280x256. The safest bet in that case would probably be to output completely standard VGA, i.e. 640x480 60Hz noninterlaced. And ask the compo organizers first. :)
jar
Member
#12 - Posted: 5 Jun 2019 21:23
Reply Quote
“Are you Jar in Alien Prophets?“

:) no. My current handle is actually „spike“ of Science. I changed it a while ago, to avoid confusion. Didn‘t bother to change it here in ADA so far :) However, i used this handle in releases starting back in 1997. the earliest alien prophets release seems to be from july 1998. but well :)
rloaderror
Member
#13 - Posted: 19 Jun 2019 17:45
Reply Quote
@jar: I now thought you were the coder behind "copperstorm" which was released recently only to find out that was Origo. The reason I thought of Spike was because I think Origo and Spite(not spike)!! did a few demos together in the past. Now I see from Pouet you have made a few nice PC demos.

Allrighty then :) Looking forward to your Amiga works.

@blueberry: If superhires pixels can be distributed to more square pixels.. Does that mean that lowres resolutions like 256x256 could be distributed to full width on a pal screen by messing with these registers?
Blueberry
Member
#14 - Posted: 19 Jun 2019 20:29
Reply Quote
You could stretch it, but the resulting mode would not be PAL. Since the pixel frequency is fixed (7MHz for lowres, 14MHz for hires, 28MHz for superhires), you would end up with a very non-standard mode with 20kHz scanlines, which probably very few monitors would be able to display.

 

  Please register a new account or log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0