English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 17 April 2018, 20:54   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
Setting up maximum-size playfield

My hardware-banging skills are a bit rusty (not that they were ever much good, and I'm lazy).

I'm writing a tiny program which is going to set a maximum-size overscanned display. No bitplane DMA needed, I just plan to write a different value to BPL1DAT each frame, rotating the value by 1 bit each time for a smooth-scroll effect. [Hopefully that will be useful for testing the new lagless vsync mode in WinUAE.]

At the moment I'm just writing values to color00, color01 and bplcon0 (for 1 bitplane) and bpl1dat. But nothing is displayed since I did LoadView(0) beforehand. Do I just need to write appropriate values to DIWSTRT & DIWSTOP? Can I ignore DDFSTRT/DDFSTOP because I'm not using bitplane DMA?
mark_k is offline  
Old 17 April 2018, 21:46   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
DIWSTRT/DIWSTOP needs to be set. DDFSTRT/STOP can be ignored.

Note that I am not sure if no-bitplane-dma and writing to BPL1DAT is emulated properly...

Another option is to enable DMA normally and set "7-plane" mode (OCS/ECS only) and use BPL5DAT or 6 for pattern data.
Toni Wilen is offline  
Old 17 April 2018, 22:32   #3
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Too many unknowns, I think. Post your code and we'll be able to tell why you don't get pixels! (For Lores using DMA, this is max.)

Not writing DDFxxx will just leave them at their last values before starting your screen. For pumping out words to BPL1DAT, in theory starting a normal screen but setting 0 bitplanes should get you going. But this is for a sizetro?

Last edited by Photon; 17 April 2018 at 22:38.
Photon is offline  
Old 17 April 2018, 22:33   #4
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
I've uploaded my current source to
Code:
http://www.media!fire.com/file/llz2hsekxu6y4h2/ScrollTest.tar.gz
Maybe there's something simple I overlooked? Not tested on real hardware.
mark_k is offline  
Old 17 April 2018, 22:40   #5
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Well, um... just the relevant bits in a Code Tag is fine I think
Photon is offline  
Old 17 April 2018, 23:07   #6
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
OK...
Code:
BaseVal	EQU	%0000011100011001

Start	movea.l	(4).W,A6
	lea	(GfxName,PC),A1
	jsr	(_LVOOldOpenLibrary,A6)
	tst.l	D0
	beq.b	Error
	move.l	D0,A5

	exg	A5,A6
	jsr	(_LVOOwnBlitter,A6)
	jsr	(_LVOWaitBlit,A6)
	suba.l	A1,A1
	jsr	(_LVOLoadView,A6)
	jsr	(_LVOWaitTOF,A6)
	jsr	(_LVOWaitTOF,A6)

	exg	A5,A6
	jsr	(_LVODisable,A6)

; Main stuff here

	lea	(_custom).L,A1

	move.l	#$0001FF00,D7		; Mask for checking vposr/vhposr

.Wait	move.l	(vposr,A1),D0		; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait

; Disable sprite, blitter, copper and bitplane DMA
	move.w	#DMAF_SPRITE|DMAF_BLITTER|DMAF_COPPER|DMAF_RASTER,(dmacon,A1)

	move.w	#$1200,(bplcon0,A1)	; 1 bitplane, COLOR
	move.l	#$0FFF0000,(color00,A1)	; color00 white, color01 black

	move.w	#$2C81,(diwstrt,A1)	; Use default NTSC non-overscan values for now
	move.w	#$F4C1,(diwstop,A1)	;

	move.w	#BaseVal,D6

Loop	move.w	D6,(bpl1dat,A1)

.WaitNotLine0				; Wait until *not* on scanline 0
	move.l	(vposr,A1),D0
	and.l	D7,D0
	beq.b	.WaitNotLine0

.Wait2	move.l	(vposr,A1),D0		; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait2

	rol.w	#1,D6
	bra.b	Loop
mark_k is offline  
Old 18 April 2018, 00:30   #7
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
You must also set bit 15 (SET/CLR) on the DMACON line. Otherwise the bitmask you specify will be cleared, not set. (This works the same for many *CON and *ENA registers.)

If this is done and still nothing - hm, how do you exit the loop...? As in, can you determine that it reaches the line where you poke BPL1DAT.
Photon is offline  
Old 18 April 2018, 12:50   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
DMACON write is correct, it is supposed to clear the bits

But code can't work, single write/frame to BPL1DAT won't do what you wanted.

BPL1DAT needs to be written at the beginning of each scanline (but not too beginning) because BPL1DAT write is the trigger that starts Denise's output shifters and it gets disabled automatically at the start of next scanline (when hpos=0 = Agnus strobe signal)

"7-plane" mode and BPLDAT5/6 write would work as you expected, as long as bitplane DMA is active (=Agnus does required BPL1DAT writes).
Toni Wilen is offline  
Old 18 April 2018, 14:41   #9
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
I inserted move.w D6,(bpl1dat,A1) at the .Wait2 label in the code above.

That was obviously not the right thing to do. So I'm probably writing bpl1dat at the wrong time?

The effect should be vertical stripes which are moving horizontally. Some notes on different configs:
- With ECS, JIT, fastest possible CPU (not cycle-exact) the stripes are there but there are regular breaks in the lines (rows of white pixels).
- Same config but enabled cycle-exact (full): Stripes are all OK, except there is a consistent "glitch line" about 4/5 the way down the Amiga display. The part below that is offset two pixels to the left of the bars above.
- OCS, cycle-exact, 68000 CPU: Bars appear very broken, more white than black.

I'll upload that executable to The Zone in case anyone's curious. Next, I'll try waiting for a certain horizontal line position before writing bpl1dat.
mark_k is offline  
Old 18 April 2018, 15:51   #10
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Toni Wilen View Post
BPL1DAT needs to be written at the beginning of each scanline (but not too beginning) because BPL1DAT write is the trigger that starts Denise's output shifters and it gets disabled automatically at the start of next scanline (when hpos=0 = Agnus strobe signal)
Hi Toni, what do you mean by "not too beginning? hpos>=2 suffice?
ross is offline  
Old 18 April 2018, 15:59   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by ross View Post
Hi Toni, what do you mean by "not too beginning? hpos>=2 suffice?
OCS Denise needs large hpos (somewhere near decimal 40, if written too early: nothing happens), ECS Denise appears to not have any "limits".

Quote:
Originally Posted by mark_k View Post
I inserted move.w D6,(bpl1dat,A1) at the .Wait2 label in the code above.

That was obviously not the right thing to do. So I'm probably writing bpl1dat at the wrong time?

The effect should be vertical stripes which are moving horizontally. Some notes on different configs:
- With ECS, JIT, fastest possible CPU (not cycle-exact) the stripes are there but there are regular breaks in the lines (rows of white pixels).
- Same config but enabled cycle-exact (full): Stripes are all OK, except there is a consistent "glitch line" about 4/5 the way down the Amiga display. The part below that is offset two pixels to the left of the bars above.
- OCS, cycle-exact, 68000 CPU: Bars appear very broken, more white than black.

I'll upload that executable to The Zone in case anyone's curious. Next, I'll try waiting for a certain horizontal line position before writing bpl1dat.
IMHO better use copper (simply copper loop that writes to blt1dat once per scanline) Copper will also make it compatible with all models and CPUs without timing issues.
Toni Wilen is offline  
Old 18 April 2018, 16:04   #12
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Toni Wilen View Post
OCS Denise needs large hpos (somewhere near decimal 40, if written too early: nothing happens), ECS Denise appears to not have any "limits".
Thanks, good to know.
ross is offline  
Old 19 April 2018, 17:16   #13
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
It is probably easier to use sprites in non-DMA mode if there is no need to completely fill the screen horizontally.
Toni Wilen is offline  
Old 19 April 2018, 18:57   #14
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
I might end up using bitplane DMA after all. Create bitmap of 16 lines, each one pixel shifted from the one before. Set modulo to -(line length), then at the start of each frame write bitplane pointer to point to the next line.

I tried a simple copperlist without success, probably because WAIT matches any position after the initial one. I had something like
WAIT for hpos $20 (ignoring v. line number)
MOVE value to bpl1dat
MOVE 0 to copjmp1 to jump back to start of list

Last edited by mark_k; 19 April 2018 at 19:05.
mark_k is offline  
Old 19 April 2018, 19:57   #15
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by mark_k View Post
I might end up using bitplane DMA after all. Create bitmap of 16 lines, each one pixel shifted from the one before. Set modulo to -(line length), then at the start of each frame write bitplane pointer to point to the next line.

I tried a simple copperlist without success, probably because WAIT matches any position after the initial one. I had something like
WAIT for hpos $20 (ignoring v. line number)
MOVE value to bpl1dat
MOVE 0 to copjmp1 to jump back to start of list
Add another WAIT after MOVE that waits for last horizontal position
Toni Wilen is offline  
Old 19 April 2018, 22:35   #16
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
Still no luck with the copperlist method, but using bitplane DMA I did manage to get something working!

High-res almost-full-overscan display. I might have used illegal values for DIWSTRT/STOP but at least WinUAE shows it correctly.

Source & executables for bitplane and (not working) copperlist version:
Code:
http://www.media!fire.com/file/i7687wkl7guxdit/ScrollTest_2018-04-19.tar.gz
And most of the source for the bitplane version (please let me know about any mistakes):
Code:
bmwidth	EQU	736		; In (high res) pixels

; 736 = $2E0 pixels = $2E words.
; DDFSTRT = DDFSTOP - (4 * ($2E - 2)) = DDFSTOP - $B0
; Normal high-res DDFSTOP is $D4.
; Try DDFSTOP = $D8, DDFSTRT = $28

BaseVal	EQU	%00000011111000011110000111001101

Start	movea.l	(4).W,A6
	lea	(GfxName,PC),A1
	jsr	(_LVOOldOpenLibrary,A6)
	tst.l	D0
	beq	Error
	move.l	D0,A5

	exg	A5,A6
	jsr	(_LVOOwnBlitter,A6)
	jsr	(_LVOWaitBlit,A6)
	suba.l	A1,A1
	jsr	(_LVOLoadView,A6)
	jsr	(_LVOWaitTOF,A6)
	jsr	(_LVOWaitTOF,A6)

	exg	A5,A6
	jsr	(_LVODisable,A6)

; Main stuff here

	lea	(_custom).L,A1

	move.l	#$0001FF00,D7		; Mask for checking vposr/vhposr

.Wait	move.l	(vposr,A1),D0		; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait

;; Disable sprite, blitter, copper and bitplane DMA
;;	move.w	#DMAF_SPRITE|DMAF_BLITTER|DMAF_COPPER|DMAF_RASTER,(dmacon,A1)
; Disable all DMA
	move.w	#$7FFF,(dmacon,A1)

; Initialise bitmap
	lea	(Bitmap).L,A0
	move.l	A0,(bpl1pt,A1)
	move.l	A0,A2			; Point to first line of bitmap
	move.l	#BaseVal,D0

	moveq	#32-1,D1		; 32 lines, -1 for DBF

.Outer	moveq	#(bmwidth/32)-1,D2	; Number of longwords per line, -1 for DBF

.Inner	move.l	D0,(A0)+
	dbf	D2,.Inner

	rol.l	#1,D0
	dbf	D1,.Outer

	move.w	#-(bmwidth/8),(bpl1mod,A1)
	move.w	#$9200,(bplcon0,A1)	; 1 bitplane, high res, COLOR
	move.l	#$0FFF0000,(color00,A1)	; color00 white, color01 black
	move.w	#0,(bplcon1,A1)
	move.w	#$0028,(ddfstrt,A1)
	move.w	#$00D8,(ddfstop,A1)
;	move.w	#$2C81,(diwstrt,A1)	; Use NTSC non-overscan defaults for now
;	move.w	#$F4C1,(diwstop,A1)
	move.w	#$1A69,(diwstrt,A1)
	move.w	#$7FD9,(diwstop,A1)

	move.w	#DMAF_SETCLR|DMAF_MASTER|DMAF_RASTER,(dmacon,A1)	; Enable bitplane DMA
	moveq	#0,D1

	lea	(vposr,A1),A3

Loop	move.l	A2,(bpl1pt,A1)

.WaitNotLine0				; Wait until *not* on scanline 0
	move.l	(A3),D0			; vposr/vhposr
	and.l	D7,D0
	beq.b	.WaitNotLine0

.Wait2	move.l	(A3),D0			; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait2

	lea	(bmwidth/8,A2),A2	; Change bitplane 1 pointer to point to the next line
	addq.b	#1,D1			; Increment "line counter"
	cmpi.b	#32,D1
	bne.b	Loop

	moveq	#0,D1			; Reset "line counter"
	lea	(-32*(bmwidth/8),A2),A2 ; and bitplane address
	bra.b	Loop

; Currently don't bother checking for exit etc, just loop forever above.

Error
	moveq	#20,D0
	rts

GfxName		dc.b	"graphics.library",0

	SECTION	bitmap,BSS_C

Bitmap	ds.w	32*bmwidth/16
mark_k is offline  
Old 20 April 2018, 08:32   #17
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Toni let's see if I've understood.
A video line write to BPL1DAT is a strobe for Denise barrel-shift start.
Besides is a buffer for the 1st bitplane data and normally DMA replenish this buffer.
This is the reason why you suggest to use sprites in a manual way, you do not need to mess up to trigger BPL1DAT every line at the right time.
Copper can move data to custom every 8 low-res pixels so you eventually even generate two-plane manually writing to BPLxDAT.
But what happen if you bang BPL1DAT manually and continuously?
Assuming low resolution usage, the barrel-shifted data to video is retriggered every 8 pixel (against the normal 16)?
ross is offline  
Old 20 April 2018, 09:09   #18
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by ross View Post
Toni let's see if I've understood.
A video line write to BPL1DAT is a strobe for Denise barrel-shift start.
Besides is a buffer for the 1st bitplane data and normally DMA replenish this buffer.
Yes

Quote:
This is the reason why you suggest to use sprites in a manual way, you do not need to mess up to trigger BPL1DAT every line at the right time.
Yes. Same sprite data keeps repeating automatically. (This is how I made ACA500/ACA500plus menu star field, they are non-DMA sprites which allows all sprites in full overscan. Fully automatic, only need to update each SPRxPOS once per scanline)

Quote:
Copper can move data to custom every 8 low-res pixels so you eventually even generate two-plane manually writing to BPLxDAT.
But what happen if you bang BPL1DAT manually and continuously?
Assuming low resolution usage, the barrel-shifted data to video is retriggered every 8 pixel (against the normal 16)?
Nothing interesting happens.

BPLxDAT is not directly connected to shifter. Shifter is only loaded from xDAT when BPLCON1 shift value matches.

http://eab.abime.net/showthread.php?t=71437
Toni Wilen is offline  
Old 20 April 2018, 09:26   #19
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Toni Wilen View Post
BPLxDAT is not directly connected to shifter. Shifter is only loaded from xDAT when BPLCON1 shift value matches.

http://eab.abime.net/showthread.php?t=71437
As usual, valuable information

Thanks!
ross is offline  
Old 20 April 2018, 22:42   #20
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,335
I've been bashing away some more at this. Archive with source and executable:
Code:
http://www.media!fire.com/file/qn1p8rnmr1c39k2/ScrollTest2018-04-20.tar.gz
Executable is also in The Zone (VariableSpeedLowRes).

Low-res display, scrolling bars fill the entire screen. (There are no colour-0-only borders at all, except the last scanline on non-DIP Agnus. I didn't think that was possible.) Click left mouse to increase scroll speed or right to decrease & reverse direction. Not tested on real hardware yet.

Hopefully this could be a good test for WinUAE's vsync feature since tear lines anywhere in the display will be obvious.

TO DO: Exit program on pressing both mouse buttons. After restoring DMACON and enabling interrupts, do I just need to LoadView() the old gb_ActiView? Is RemakeDisplay() needed too?

Here's most of the source:
Code:
bmwidth	EQU	400		; In (low res) pixels

InitScrollSpeed	EQU	1	; Initial number of pixels to scroll each frame

; This defines the stripe pattern. 0 bits are white, 1s are black.
BaseVal	EQU	%0001110001100101

Start	movea.l	(4).W,A6
	lea	(GfxName,PC),A1
	jsr	(_LVOOldOpenLibrary,A6)
	tst.l	D0
	beq	Error
	move.l	D0,A5

	exg	A5,A6
	jsr	(_LVOOwnBlitter,A6)
	jsr	(_LVOWaitBlit,A6)
	suba.l	A1,A1
	jsr	(_LVOLoadView,A6)
	jsr	(_LVOWaitTOF,A6)
	jsr	(_LVOWaitTOF,A6)

	exg	A5,A6
	jsr	(_LVODisable,A6)

; Main stuff here
	lea	(_custom).L,A1
	move.l	#$0001FF00,D7		; Mask for checking vposr/vhposr

.Wait	move.l	(vposr,A1),D0		; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait

	move.w	#$7FFF,(dmacon,A1)	; Disable all DMA

; Initialise bitmap
	lea	(Bitmap).L,A0
	move.l	A0,(bpl1pt,A1)
	move.l	A0,A2			; Point to first line of bitmap
	move.l	A0,A3
	move.l	#BaseVal,D0

	moveq	#32-1,D1		; 32 lines, -1 for DBF
.Outer	moveq	#(bmwidth/16)-1,D2	; Number of longwords per line, -1 for DBF
.Inner	move.w	D0,(A0)+
	dbf	D2,.Inner
	rol.w	#1,D0
	dbf	D1,.Outer

	move.w	#-(bmwidth/8),(bpl1mod,A1)
	move.w	#$1200,(bplcon0,A1)	; 1 bitplane, low res, COLOR
	move.l	#$0FFF0000,(color00,A1)	; color00 white, color01 black
	move.w	#4,(bplcon1,A1)
	move.w	#$0018,(ddfstrt,A1)
	move.w	#$00D8,(ddfstop,A1)
	move.w	#$1A69,(diwstrt,A1)
	move.w	#$7FFF,(diwstop,A1)
	move.w	#DMAF_SETCLR|DMAF_MASTER|DMAF_RASTER,(dmacon,A1)	; Enable bitplane DMA
	moveq	#0,D1			; Initial line number
	moveq	#InitScrollSpeed,D3	; "Scroll speed" in D3
	moveq	#-1,D4			; Initial "last buttons" state
	lea	(ciaapra).L,A4

Loop	move.l	A3,(bpl1pt,A1)

.WaitNotLine0				; Wait until *not* on scanline 0
	move.l	(vposr,A1),D0		; vposr/vhposr
	and.l	D7,D0
	beq.b	.WaitNotLine0

.Wait2	move.l	(vposr,A1),D0		; Wait until scanline 0
	and.l	D7,D0
	bne.b	.Wait2

; Read state of mouse buttons into D5
	move.w	(potgor,A1),D5		; Right button state is in bit 10
	move.b	(A4),D5			; Left button state is in bit 6 of ciaapra

	btst	#10,D5			; Is right button currently pressed?
	bne.b	.NoRButton

	btst	#10,D4			; Was it pressed before?
	beq.b	.NoRButton		; If so, don't register another press

	subq.w	#1,D3			; Decrease scroll speed (scroll to right if -ve)

.NoRButton
	btst	#6,D5			; Is left button currently pressed?
	bne.b	.NoLButton

	btst	#6,D4			; Was it pressed before?
	beq.b	.NoLButton		; If so, don't register another press

	addq.w	#1,D3			; Increase scroll speed

.NoLButton
	move.w	D5,D4			; Remember this frame's buttons for next time

	add.w	D3,D1			; Update "line counter"
	andi.w	#$001F,D1		; Limit to 31 (and e.g. -1 --> 31)

	; Set bitplane address to the new line
	move.l	D1,D2			; New line number
	mulu.w	#bmwidth/8,D2		; Offset of new line
	movea.l	A2,A3			; First line in bitmap
	adda.w	D2,A3			; Point to the new line
	bra.b	Loop

Error
	moveq	#20,D0
	rts

GfxName		dc.b	"graphics.library",0

	SECTION	bitmap,BSS_C

Bitmap	ds.w	32*bmwidth/16
mark_k is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum Size Disk and Partition AMIGASYSTEM support.WinUAE 3 09 November 2017 21:04
Hard Maximum File Size AMIGASYSTEM support.WinUAE 6 13 August 2016 15:41
Maximum Hard Drive Size Limit On A Cyberstorm MK3 CU_AMiGA support.Hardware 9 29 November 2010 10:07
Whats the MAXIMUM card size to be used with PCMCIA ? Kakaboy support.Hardware 13 11 May 2010 00:03
Maximum partition size for a 1.3 setup coze support.Hardware 2 23 August 2006 17:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:29.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09637 seconds with 13 queries