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 :)

 

  Please register a new account or log in to comment

  

  

  

 

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