English Amiga Board


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

 
 
Thread Tools
Old 14 February 2018, 15:37   #21
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,081
More than 30 years of Amiga coding and you still learn something new!

Really, I didn't know that LoadView(NULL) doesn't work for Kickstart 1.x. I used it in all my games. Probably I never noticed the bug, because I immediately take over the system after LoadView() and set up my own copper list.
phx is offline  
AdSense AdSense  
Old 14 February 2018, 19:44   #22
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 47
Posts: 762
A clean, simple and effective solution can be:
Code:
_LVOForbid      equ     -132
_LVOWaitTOF     equ     -270
_LVOLoadView    equ     -222

  SECTION  mycode,code
  movea.l  $4.w,a6          ;execBase
  jsr      _LVOForbid(a6)   ;WaitTOF() break Disable() so..
                            ; anyway if you have a graphic card you need this
  movea.l  156(a6),a6       ;dirty gfxBase, until now works in every kickstarts
                            ; but you are free to OpenLibrary(gfx) ;)
  move.l   #first_copper,$dff080
                            ;logically depends on your config to use
                            ; a pc relative copper list or custom reg. displacement
                            ; no one touch COP1LC so first_copper is first executed
                            ; on next frame; do not strobe COPJMP1!

  jsr      _LVOWaitTOF(a6)  ;meanwhile old frame is computed and normally displayed
  jsr      _LVOWaitTOF(a6)  ;wait the eventually interlaced odd lines
  suba.l   a1,a1
  jsr      _LVOLoadView(a6) ;LoadView(NULL), system tamper custom regs 
                            ; and make glitch but you're already protected:
                            ; first_copper closed the view (sprites comprised)

  ;TAKE OVER SYSTEM (or not..)

  SECTION  mychip,data_c
first_copper:
  dc.l     $00960100   ;BPLEN=0, first absolute execution in frame
;  dc.l     $01800000   ;setup init values or custom consts
;  dc.l    $01fc0000
  dc.l     $fffffffe   ;cend
Not a single glitch, not a single "strange" behavior

[EDIT: this is only a snippet, I've not put all the parts concerning the rescue of OldView, OldCopper(s), etc,
but they must logically be here, you know how to do it ]
[EDIT2: other things that I take for granted but maybe they are not..
In this situation LoadView() CPU write much registers for "basic" view but proper ECS/AGA set/reset is your responsibility!
And the call can not be avoided, it's here to switch from eventual graphic card to native mode]

Last edited by ross; 14 February 2018 at 22:16. Reason: []
ross is offline  
Old 14 February 2018, 22:34   #23
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 637
Thanks a lot for snippet. It pushes me to think (at least!). Why we can't strobe COPJMP1? Because there is a possibility that blitter working ? Perhaps in this case blitter must be on our side and problem will gone. I mean about WaitBlit() and OwnBlitter() before LoadView(0). But I'm not sure If LoadView didn't use blitter for something.
Asman is offline  
Old 14 February 2018, 22:54   #24
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 47
Posts: 762
Quote:
Originally Posted by Asman View Post
Thanks a lot for snippet. It pushes me to think (at least!). Why we can't strobe COPJMP1? Because there is a possibility that blitter working ? Perhaps in this case blitter must be on our side and problem will gone. I mean about WaitBlit() and OwnBlitter() before LoadView(0). But I'm not sure If LoadView didn't use blitter for something.
This is a reason, copper strobe/blitter bug is nasty, I've fixed some demo that in some condition invoke it
(i usually takeover the system and leave the blitter complete his job with my own BlitterWait).
Second reason is aesthetic: old copper list continue to the end of frame, so no "cut" of image in the middle.
[I do not think LoadView uses the blitter]
ross is offline  
Old 21 March 2018, 10:44   #25
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,837
Quote:
Originally Posted by dissident View Post
Loadview() with a NULL argument isn't supported on the old KS-versions and may lead to a guru.
I just read this and couldn't believe it and so I have checked the code (1.3 only for now) and 1.3 DOES support LoadView(0)! There is a bug which will cause a read from $0 and, depending on what $0.w contains, a skipped raster beam wait but that's it. LoadView(0) definitely does not cause a guru!

Here are the interesting lines of code:

Code:
    move.l    a1,gb_ActiView(a3)
    beq.b    .emptyview
    ; here the view is set
    .....
    bra.b    .exit

; LoadView(0): create default view
.emptyview

    ....
Quote:
Originally Posted by phx
Really, I didn't know that LoadView(NULL) doesn't work for Kickstart 1.x.
That's because it's not true.

Last edited by StingRay; 21 March 2018 at 11:05. Reason: typo
StingRay is offline  
Old 21 March 2018, 11:41   #26
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,081
Phew!
Thanks for having a look!
phx is offline  
Old 21 March 2018, 11:55   #27
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 47
Posts: 762
Yes, StingRay totally right.

Like i've dissected:
http://eab.abime.net/showpost.php?p=...6&postcount=10
http://eab.abime.net/showpost.php?p=...6&postcount=18
guru was not directly related to LoadView but some other KS1.2 oddity.

EDIT: LoadView(0) bug on KS1.3 can be 'skipped' with my snippet:
http://eab.abime.net/showpost.php?p=...7&postcount=22

ross is offline  
Old 21 March 2018, 12:22   #28
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,837
For reference, here's the Kick 1.3 "Set Default View" routine (which is called if LoadView(0) is used) so it's easy to see the CUSTOM registers which are changed.

Code:
SetDefaultView
	move.l	4(sp),a0	; a0: GfxBase
	moveq	#0,d1
	move.l	#$DFF000,a1
	move.w	gb_system_bplcon0(a0),d0
	ext.l	d0
	or.l	#$1200,d0
	move.w	d0,$100(a1)
	move.w	d1,$102(a1)
	move.w	#$24,$104(a1)
	move.w	d1,$10A(a1)
	move.w	d1,$108(a1)
	move.w	#$2C81,$8E(a1)
	move.w	#$F4C1,$90(a1)
	move.w	#$38,$92(a1)
	move.w	#$D0,$94(a1)

.wait	moveq	#0,d0
	move.w	6(a1),d0
	and.l	#$FF00,d0
	cmp.l	#$FF00,d0
	beq.b	.wait
	moveq	#0,d0
	move.w	4(a1),d0
	or.l	#$8000,d0	; set LOF bit
	move.w	d0,$2A(a1)
	rts
StingRay is offline  
Old 21 March 2018, 14:46   #29
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,068
One problem with calling LoadView(NULL) to switch from RTG to native video is that on ECS and AGA you can never be sure if you will get PAL or NTSC.

1.2 and 1.3 will typically be an OCS machine and you can look at the chipset revision to know what LoadView(NULL) will give you, but on 2.0 and later a better solution is to open a minimal screen and specify exactly what video standard you want.
Leffmann is offline  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copper ASM LeCaravage Coders. Asm / Hardware 5 30 January 2018 12:35
Using the Copper guy lateur Coders. C/C++ 22 26 July 2017 19:29
Best way to mix blitting with copper and copper effects roondar Coders. Asm / Hardware 3 12 September 2016 13:12
copper ? turrican3 Coders. Asm / Hardware 10 27 January 2016 09:10
Combining copper scrolling with copper background phx Coders. Asm / Hardware 14 16 June 2013 07: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 20:35.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.15197 seconds with 15 queries