![]() |
![]() |
#1 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
![]()
Hi!
I've been following this section with joy and for a few years ago I decided to re-boot my coding on Amiga. After some routines and effect made in assembler I found that the init-code that I was using was *erhm*, well, not that system friendly. I started to write a brand new init-code and so far so good. Since I have a Indivision AGA MK1 I use two different modes. NTSC for Workbench and PAL for games/demos. It might be a better way but since the Indivison only supports either PAL, NTSC or HighGFX I had to used one for each "mode". One part of the init-code should contain a routine that detects the original screen mode and saves it when a "Indivision" flag is defined in the top of the code. This was harder than I though. No matter what I do, I get PAL??! I made a quick routine where I test different to detect the screen and it looks like the code below. When it is executed D0 returns with the value $00320032 (50 50) and gd_DisplayFlags sets D1 to $00000014 (picture CRSnap007.png). Code:
; ******************************************* ; $VER: LibraryTest.s 0.1 (09.03.15) ; AUTHOR: Highpuff iKod.se ; ******************************************* incdir "include:old/" ;include "dos/dos_lib.i" include "exec/exec_lib.i" include "graphics/graphics_lib.i" ;include "dos/dosextens.i" include "exec/execbase.i" include "graphics/gfxbase.i" ; ********************************************* ; Main Code AREA ; ********************************************* Section MainCode,code MainCode: movem.l d0-a6,-(sp) move.l $4.w,a6 move.l a6,Execbase lea.l GfxName,a1 moveq #39,d0 jsr _LVOOpenLibrary(a6) beq .Error move.l d0,Gfxbase lea.l DosName,a1 moveq #39,d0 jsr _LVOOpenLibrary(a6) beq .Error move.l d0,Dosbase clr.l d0 clr.l d1 move.l Execbase,a6 move.b PowerSupplyFrequency(a6),d0 swap d0 move.b VBlankFrequency(a6),d0 move.l Gfxbase,a6 move.w gb_DisplayFlags(a6),d1 move.l Gfxbase,d0 beq .noGfxLib move.l d0,a1 jsr _LVOCloseLibrary(a6) .noGfxLib: move.l Dosbase,d0 beq .noDosLib move.l d0,a1 jsr _LVOCloseLibrary(a6) .noDosLib: .Error: movem.l (sp)+,d0-a6 rts ; ********************************************* ; Data AREA ; ********************************************* Section MainData,data MainData: dc.b "$VER: LibraryTest.s 0.1 (09.03.15)",0 GfxName: dc.b "graphics.library",0 DosName: dc.b "dos.library",0 cnop 0,4 Execbase: dc.l 0 Gfxbase: dc.l 0 Dosbase: dc.l 0 end
Pictures of the screen config: ![]() ![]() ![]() |
![]() |
![]() |
#2 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 44
|
If the purpose is just to restore the original screenmode when your demo exits, the "proper" way of doing it is like this:
- Save the gb_ActiView field in GraphicsBase. This points to the current View, as managed by graphics.library. - Call LoadView(0). This tells graphics.library to reset the view to default (PAL or NTSC, you can't rely on which). - move.w #$0020,$dff1dc to force display to PAL. - Call WaitTOF twice (makes sure any remaining odd/even field copperlists have completed). - Bang the hardware as you like - When done, call LoadView with the original (saved) view. This restores the original screenmode. This procedure works from any screenmode, including RTG modes. Getting all parts of the init code to fit together properly in the right order can be a bit tricky. Take a look at my init code, as discussed here: http://ada.untergrund.net/?p=boardthread&id=444 - it closes and restores the system robustly, sets op a vblank interrupt, and a few other useful things. Use it as is or just for inspiration. ![]() |
![]() |
![]() |
#3 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
@Blueberry:
So if I save the gb_Actiview + gb_copinit and do all the rest all by the book and later in my code bang hardware $dff1dc with #$0020 and force my view to PAL, will the system be restore the saved gb_Actiview or do I need to set $dff1dc to #$0000 as well? Or.. What the heck! I will try tonight ![]() Thanks so far ![]() |
![]() |
![]() |
#4 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
@Blueberry:
I tried it now and if I do as you told me, like the list below. - Save the gb_ActiView + gb_copinit fields in GraphicsBase. This points to the current View, as managed by graphics.library. - Call LoadView(0). This tells graphics.library to reset the view to default (PAL or NTSC, you can't rely on which). - move.w #$0020,$dff1dc to force display to PAL. - Call WaitTOF twice (makes sure any remaining odd/even field copperlists have completed). - Bang the hardware as you like - When done, call LoadView with the original (saved) view. This restores the original screenmode. If I then put #$20 in $dff1dc in my copperlist and then exit the system, it does not restore $dff1dc to $0. It seems like this register is not set either in gb_ActiView and gb_copinit. ![]() |
![]() |
![]() |
#5 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Call RemakeDisplay before putting gb_copinit back in (read gb_copinit AFTER RemakeDisplay). Settings related to the display generator, such as vertical and horizontal frequencies, are global for the entire screen and are kept out of the Copper program inside the View.
If you want to force PAL, then it might be a better idea to check if you're on ECS and Kickstart 2.0 or higher, and just call OpenScreen with PAL_MONITOR_ID and get a blank screen without title-bar, bitmap etc. before hitting the hardware. This way you can let the system deal with all the stuff related to the display generator, which is probably a safer bet. BTW, The display mode you get when calling LoadView(NULL) is the one you booted into, so if you f.ex. have a PAL machine and select NTSC via the early startup menu, and run 31kHz VGA in Workbench, then calling LoadView(NULL) will give you the NTSC. |
![]() |
![]() |
#6 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
I might have done something wrong now, but so far it did not work. This is the schema.
- Call _LVORemakeDisplay - Read&Store gb_copinit - yada yada - Call _LVORemakeDisplay - Read&Restore gb_copinit Still the same, I need to set $dff1dc to $0 else I do get a PAL-screen in Workbench. I will try some more tonight and during the weekend. Thanks so far! |
![]() |
![]() |
#7 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Try this:
Code:
LoadView(NULL) WaitTOF() WaitTOF() ... Restore interrupt and DMA settings RemakeDisplay() cop1lc = GfxBase->copinit |
![]() |
![]() |
#8 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
Tried it in asmOne with latest includes and older ones. I cannot say that it does not work, but it also hangs the system on exit.
It does go back to NTSC so now I need to see what it is that causes the hang. |
![]() |
![]() |
#9 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
|
did you forget a Permit() call before exit? or restore of intena?
|
![]() |
![]() |
#10 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
No, they are there and it is working with I remove the call to IntuitionBase/RemakeDisplay.
The exit does this: 1) Restore old DMA 2) Restore old INT 3) Restore old REQ 4) Exec/Permit 5) Intuition/RemakeDisplay 6) gb_inicop->$dff080 7) Kickstart CopJmp 8) Close IntuitionLib 9) Close GraphicsLib Since this is only because I use Indivision MK1 with two separate displaymodes between games/demos and Workbench I think I will stay with my manual routine. But it would be nice to have a routine that detects the screen mode that was before execution of the code and then be able to restore it. Else.. Cheap solution, buy a LCD that supports 15,6KHz Horizontal ( Thanks Hewitson for the reminder ![]() Last edited by highpuff; 15 March 2015 at 10:44. Reason: Small error in text |
![]() |
![]() |
#11 |
Registered User
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
|
|
![]() |
![]() |
#12 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
|
![]() |
![]() |
#13 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Does the small test program I posted above crash too? Could you post your code?
|
![]() |
![]() |
#14 | |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,351
|
Quote:
What you could do on exiting, is force the system to write to BEAMCON0 itself. If you load an NTSC View, then load a PAL View, then restore the original View, the system should write to BEAMCON0. |
|
![]() |
![]() |
#15 |
Registered User
Join Date: Jan 2014
Location: Göteborg
Posts: 43
|
@Leffman: (or should I call you Master from now?)
I tried the C-application that you shared in this thread and it worked in Workbench. It seems that I made a huge bo-bo. Above the pointer to the Intuition library I had a dc.w, that SHOULD have been a dc.l, meaning that the I pointer was overwritten in a early phase. My bad ![]() Thanks again! Last edited by highpuff; 18 March 2015 at 17:25. Reason: Spelling |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PAL vs. NTSC | jimmyd35 | project.TOSEC (amiga only) | 1 | 29 April 2013 03:23 |
NTSC A500 Pal/NTSC mod pics | kipper2k | Hardware pics | 2 | 29 March 2009 07:56 |
NTSC to PAL ...what's next? | NfernalNfluence | support.Hardware | 7 | 28 July 2007 12:19 |
Pal/ntsc | Marcuz | request.UAE Wishlist | 16 | 20 July 2007 10:07 |
Ntsc / Pal | killergorilla | project.SPS (was CAPS) | 3 | 09 July 2003 18:25 |
|
|