English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 01 February 2020, 03:01   #1
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
double Copper trick question..

I was testing that Interlaced code from Earok:
https://github.com/earok/BlitzBasicDemos

Is it possible to blit something into? I tried to blit a shape but its streched.
Lets say that I would like to use this hires laced display to show tittle screen but also make a menu options..

I was also thinking about using Screen 0,27 but its said that it only supports 4 bitplanes in hires mode, I would like to use 8.

Code:
WBStartup
DEFTYPE .w

;The interlaced bitmap
BitMap 0,640,512,8

;The original bitmap
BitMap 1,640,512,8
LoadBitMap 1,"image.iff",0

;Convert the original bitmap to interlaced
Use BitMap 0
for i = 0 to 255
	BlockScroll 0,i*2,640,1,0,i,1 
	BlockScroll 0,1+i*2,640,1,0,i+256,1 
next

;Configure two copper lists
for i = 0 to 1

	InitCopList i,44,DispHeight,$10000 + $1000 + $100 + $8,8,256,0
	DisplayBitMap i,0,0,i*256
	DisplayPalette i,0
		
next
	
BLITZ

;Repeatedly recreate the display and toggle the LOF bit
SetInt 5

	VP = Peek.w($DFF004)

	X=1-X
	if X=0
		CreateDisplay 0
		VP = VP BITSET 15				
	else
		CreateDisplay 1
		VP = VP BITCLR 15						
	endif
	
	Poke.w $DFF02A,VP

	
End SetInt

While Joyb(0)+Joyb(1) = 0
Wend

End
mateusz_s is offline  
Old 04 February 2020, 03:50   #2
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
OK, I found that code that works well with blitting objects, I think it is also more simply.. the result image was almost the same:
- both solution shifts image outside the screen - the firts more to right the second more to left
- and also both images were not sharp

I load reference image in filemaster and picviewer and the image was very sharp and centered.. but for now I only tested on winUAE, or

The original code is for 8 colors, I tried to change values to 256 and 8 bit depth but for now something is wrong it displays just garbage

code source: http://eab.abime.net/showthread.php?t=65184


; Setup the screen for a hires laced display. This is used for the credits screens

#BPLCON0=$100 ; Bitplane control register
#BPLMOD1=$108 ; Bitplane modulo
#BPLMOD2=$10A ; Bitplane modulo

#bitmapsize=768
#Modulo=(((#bitmapsize-320)/8)-2)*2

BitMap 0,320,256,5 ; Game screen. Lowres 32 colour
BitMap 1,320,256,5 ; Intro screens
BitMap 2,640,256,4 ; Title Screen
BitMap 3,#bitmapsize,512,3 ; Custom copper controlled hires-laced display for credits

; Lets build our own copperlist

cop$=Mki$(#BPLMOD1)+Mki$(#Modulo)
cop$+Mki$(#BPLMOD2)+Mki$(#Modulo)
cop$+Mki$(#BPLCON0)+Mki$($b004) ; BPLCON0 : Bit number:
; 15 - Hires
; 14, $13, $12 bitplanes set (011 here for 3 bitplanes)
; 11 - Ham mode Off
; 10 - Dual playfield Off
; 09 - Composite colour mode off
; 08 - Genlock Audio Enable off
; 07 to bit 4 - Unused, set to 0
; 03 - Lightpen off
; 02 - Interlace ON
; 01 - External Synchronization Enable off
; 00 - Unused

; Buffer for animation

InitCopList 3,41,256,$513,8,8,-3 ; $11903 ; 8 colour hires laced display
DisplayUser 3,0,cop$ ; Set our copperlist
DisplayAdjust 3,768,-8,-8,-32,32 ; and adjust the display accordingly

CreateDisplay 3
Use BitMap 3
DisplayPalette 3,1

SetInt 5
If Peek($df004) <0
DisplayBitMap 3,3,3,0
Else
DisplayBitMap 3,3,3,1
EndIf
End SetInt


Blit 1,0,20
DisplayBitMap 3,3

End
mateusz_s is offline  
Old 04 February 2020, 22:38   #3
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
Shiny!
E-Penguin is offline  
Old 04 February 2020, 23:49   #4
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Ok, I found the solution.. everything is OK if I create executable and run it from the OS not from Blitz2, the image is sharp and also I managed to use HAM8 with over 16 000 colours: https://i.imgur.com/xBnc0eb.jpg


mateusz_s is offline  
Old 06 February 2020, 01:05   #5
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Ok, I managed to make my own alternative to Earoks code,
using only 1 bitmap and copper instruction for displaying every second line instead of BlockScroll.
And there is no problems with blitting objects:

WBStartup

#BPLCON0 = $100
#BPLMOD1 = $108
#BPLMOD2 = $10A

#BPLCON0_MASK = %1000000000010100 ; binary
#MODULO = 80 ; line modulo for hires laced 256

; init bitmap space
BitMap 0,640,512,8

; loading 640x512 x 256 colors image
LoadBitMap 0,"dh1:test-hires-256.iff",0

BLITZ

; configure two copper lists
; custom set to -3, because 3 instructions $100+$108+$10A

cop$ = Mki$(#BPLCON0) + Mki$(#BPLCON0_MASK)
cop$ + Mki$(#BPLMOD1) + Mki$(#MODULO)
cop$ + Mki$(#BPLMOD2) + Mki$(#MODULO)

; copper nr 0 for displaying only odd lines

InitCopList 0, 44, DispHeight, $10000 + $1000 + $100 + $8, 8, 256, -3
DisplayUser 0, 0, cop$
DisplayBitMap 0,0,0,0
DisplayPalette 0,0

; copper nr 1 for displaying only even lines

InitCopList 1, 44, DispHeight, $10000 + $1000 + $100 + $8, 8, 256, -3
DisplayUser 1, 0, cop$
DisplayBitMap 1,0,0,1
DisplayPalette 1,0

; using interupt 5 to display and toggle two copper lists

counter.w = 0

SetInt 5

counter = 1 - counter

If counter = 0
CreateDisplay 0
Else
CreateDisplay 1
EndIf

End SetInt

MouseWait

End


The one thing that need to be checked is the SetInt routine. In above case the image flickers like normal interlace but in WinUAE (I can't check right now on real Amiga),
But if we use Earoks routine the image is not shaking anymore but the code throws Overflow at the end of program:

SetInt 5
counter = 1 - counter
VP = Peek.w($DFF004)

If counter = 0
CreateDisplay 0
VP BitSet 15
Else
CreateDisplay 1
VP BitClr 15
EndIf

Poke.w $DFF02A, VP

End SetInt
mateusz_s is offline  
Old 06 February 2020, 20:46   #6
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Additional simple hires laced bitmap load as Screen:

Screen 0,0,0,640,512,8,-28668,"TEST",0,1
BitMap 0,640,512,8
LoadBitMap 0,"dh1:test-hires-256-info.iff",0
Use Palette 0
ShowBitMap 0
MouseWait
mateusz_s is offline  
Old 09 February 2020, 16:52   #7
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
Can you mix Screen with Display?
E-Penguin is offline  
Old 17 August 2021, 00:04   #8
Raislin77it
Zone Friend
 
Raislin77it's Avatar
 
Join Date: Jan 2005
Location: italy
Age: 46
Posts: 244
another problem with interlace and blitz, here the code


Code:
WBStartup

#BPLCON0 = $100
#BPLMOD1 = $108
#BPLMOD2 = $10A

#BPLCON0_MASK = %1010000000000100 ; binary
#MODULO = 80 ; line modulo for hires laced 256

; init bitmap space
BitMap 0,640,512,2
BitMap 1,640,512,2


InitPalette 0,32


; loading 640x512 x 4 colors image
LoadBitMap 0,"titlea.iff"
LoadBitMap 1,"titleb.iff"

LoadPalette 0,"palette.bsh"

BLITZ

; configure two copper lists
; custom set to -3, because 3 instructions $100+$108+$10A

cop$ = Mki$(#BPLCON0) + Mki$(#BPLCON0_MASK)
cop$ + Mki$(#BPLMOD1) + Mki$(#MODULO)
cop$ + Mki$(#BPLMOD2) + Mki$(#MODULO)

; copper nr 0 for displaying only odd lines

InitCopList 0, 44, DispHeight, $00000 + $0000 + $500 + $10 + $4, 8, 8, -3
DisplayUser 0, 0, cop$
DisplayBitMap 0,0,0,1,1,0,1
DisplayPalette 0,0

; copper nr 1 for displaying only even lines

InitCopList 1, 44, DispHeight, $00000 + $0000 + $500 + $10 + $4, 8, 8, -3
DisplayUser 1, 0, cop$
DisplayBitMap 1,0,0,0,1,0,0
DisplayPalette 1,0

; using interupt 5 to display and toggle two copper lists

counter.w = 0

SetInt 5
counter = 1 - counter
VP = Peek.w($DFF004)

If counter = 0
CreateDisplay 0
VP BitSet 15
Else
CreateDisplay 1
VP BitClr 15
EndIf

Poke.w $DFF02A, VP

End SetInt

Poke.w $DFF02A,$8000


MouseWait

  End
here the result
https://ibb.co/NVhJ8py


if i do not enable the smoothscroll on the initcoplist the figure is ok
https://ibb.co/F02xZgd



but i need scrolling the bitmap


i suspect there is something with the size of the bitmap and the modulo, but it seems ok to me. any idea ?


Raislin77it is offline  
Old 18 October 2021, 02:14   #9
TymoDEV
Registered User
 
TymoDEV's Avatar
 
Join Date: Feb 2021
Location: Katowice
Posts: 26
BlitzBasic 2 is very poor about it.
There is true conflict between smooth scrolling and interlace. It is even flagged in type parameter. I think new CopperList handling in new library for Blitz may help with it.
Some new commnds will be very equal:
ForceCopList ; system Cpperlist to BLITZ mode
MoveCopList ; eg #0,#1
DeleteCopList
There is really shit for now.
Interlace under AMIGA mode is OK. But without scrolling. BLITZ mode haven't INTERLACE instead this stupid bit for smooth scrolling -flag.
TymoDEV is offline  
Old 18 October 2021, 12:29   #10
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
To be fair, creating an interlaced display on Amiga hardware is kinda tricky and involved. It's not just setting a single flag the way smooth scrolling is. Under Amiga mode, the OS handles all the trickery needed to run an interlaced display (maintaining two copperlists, using interrupts to switch registers etc.). But the hardware doesn't do it automatically, so when you shut down the OS as you do in Blitz mode, you have to do the interlace handling yourself. Such displays will of course complicate smooth scrolling, since you're effectively dealing with two displays instead of one.
Daedalus is offline  
Old 18 October 2021, 19:23   #11
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,741
Quote:
Originally Posted by Daedalus View Post
Such displays will of course complicate smooth scrolling, since you're effectively dealing with two displays instead of one.
You have single display and two fields - you need to know which one is Top which one is Bottom and to use interlace correctly you need to remember that fields are draw sequentially (depends on video system NTSC or PAL there is something called field dominance or cadence - there can be two field dominance types: Top Field First aka TFF or Bottom Field First aka BFF).
If you follow correctly field flag (long/short) then it should be fine.
Of course single frame (display) has refresh rate half of fields so common 50/60 fps approach is wrong in interlace screen.
Also i recall that there is some issue in OS to deal properly with interlace (at least PCHG standard is affected by current HW/SW mix) so it may be difficult to get true interlace animation without directly dealing with HW.
pandy71 is offline  
Old 19 October 2021, 09:46   #12
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Quote:
Originally Posted by pandy71 View Post
You have single display and two fields
Indeed, but the terminology differs depending on context. If you're talking about an abstract video signal, you of course have a single display and two fields. If you're talking about the Blitz display library in relation to the Amiga hardware, you have two displays and no concept of fields at all.
Daedalus is offline  
Old 19 October 2021, 18:16   #13
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,741
Quote:
Originally Posted by Daedalus View Post
Indeed, but the terminology differs depending on context. If you're talking about an abstract video signal, you of course have a single display and two fields. If you're talking about the Blitz display library in relation to the Amiga hardware, you have two displays and no concept of fields at all.
Indeed terminology may differ but it is striking to me that recommended way to deal with interlace display (set unified frame buffer and use modulo to access fields) is not followed...
pandy71 is offline  
Old 19 October 2021, 21:43   #14
TymoDEV
Registered User
 
TymoDEV's Avatar
 
Join Date: Feb 2021
Location: Katowice
Posts: 26
Quote:
Originally Posted by Daedalus View Post
To be fair, creating an interlaced display on Amiga hardware is kinda tricky and involved. It's not just setting a single flag the way smooth scrolling is. Under Amiga mode, the OS handles all the trickery needed to run an interlaced display (maintaining two copperlists, using interrupts to switch registers etc.). But the hardware doesn't do it automatically, so when you shut down the OS as you do in Blitz mode, you have to do the interlace handling yourself. Such displays will of course complicate smooth scrolling, since you're effectively dealing with two displays instead of one.
Yes, I know it. Basic like 'BlitzBasic2' may to offer automatic handling for interlace mode. We do not have to worry about full pocedure, just one command may be equal for it, even without OS, under Blitz mode. It is easy to display bitmaps converted from .iff's files with IFFMaster or IFFConverter with interlace mode. Off course we need to use full procedure manual by ourself with the use of assembler, like ASMOne.
I just really hopped for full automatic with InitCopList cammand. It is very strange, why interlace is missing among 'types' field flags?
AMOS works very well with interlace mode, BLitzBasic2 too, but only with AMIGA mode.
Only new .libs package of commmands for CpperList handling is wright way for now. Unfortunally we must to write this by ourself.
3 another programmers (ASMOne) needed....<<<< You may to write for it.
1 manager
1 producer with MONEY.
TymoDEV is offline  
Old 21 October 2021, 13:33   #15
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,741
Quote:
Originally Posted by TymoDEV View Post
I just really hopped for full automatic with InitCopList cammand. It is very strange, why interlace is missing among 'types' field flags?
AMOS works very well with interlace mode, BLitzBasic2 too, but only with AMIGA mode.
Not sure but OS seem to be very limited on interlace too so AMOS may have some workarounds on this - not sure why Blitz exhibit some limitations but as it is open source perhaps this area could be improved - not sure how AmiBlitz is on this...
pandy71 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
noob copper question jotd Coders. Asm / Hardware 4 10 January 2020 15:37
Copper question leonard Coders. Asm / Hardware 7 17 September 2017 14:14
double copper colours turrican3 support.WinUAE 12 19 January 2016 11:20
Double buffer copper?? h0ffman Coders. General 8 19 July 2011 19:10
Copper speed question FrenchShark Coders. General 18 14 August 2009 21:14

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 15:29.

Top

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