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 / Restoring the system

 

Author Message
ZEROblue
Member
#1 - Posted: 4 Aug 2008 23:59
Reply Quote
I'm trying an alternative method for restoring the system after taking the hardware. Instead of peeking in graphics library to get the current view and copper list I am just leaving all of this up to the RemakeDisplay call.

The code below restores the system perfectly almost every time, and in fact I can also leave the restoration of DMACON out because I've seen that this is done via RemakeDisplay. However occasionally it happens that the view is not restored and I end up in AmigaOS with no changes whatsoever to the display related HW registers. Does anyone know why this happens?


dmacon  = $96
dmaconr = $2
intena  = $9a
intenar = $1c

OpenLibrary   = -552
CloseLibrary  = -414
LoadView      = -222
WaitTOF       = -270
RemakeDisplay = -384


    move.l   4.w, a6
    lea      graphicslib, a1
    moveq    #33, d0
    jsr      OpenLibrary(a6)
    move.l   d0, a6
    move.l   d0, -(sp)
    sub.l    a1, a1
    jsr      LoadView(a6)
    jsr      WaitTOF(a6)

    lea      $dff000, a6
    move.w   dmaconr(a6), d0
    move.w   intenar(a6), d1
    move.w   #$7ff, dmacon(a6)
    move.w   #$7fff, intena(a6)
    movem.w  d0-d1, -(sp)

    move.l   #copperlist, cop1lch(a6)
    move.w   d0, copjmp1(a6)
    move.w   #%1000001010000000, dmacon(a6)

wait
    btst     #6, $bfe001
    bne.s    wait

    move.w   #$7ff, dmacon(a6)
    move.w   #$7fff, intena(a6)
    movem.w  (sp)+, d0-d1
    or.w     #$8040, d0
    or.w     #$c000, d1
    move.w   d0, dmacon(a6)
    move.w   d1, intena(a6)

    move.l   4.w, a6
    lea      intuitionlib, a1
    moveq    #33, d0
    jsr      OpenLibrary(a6)
    move.l   d0, a6
    jsr      RemakeDisplay(a6)

    move.l   a6, a1
    move.l   4.w, a6
    jsr      CloseLibrary(a6)
    move.l   (sp)+, a1
    jsr      CloseLibrary(a6)

    moveq    #0, d0
    rts


intuitionlib
    dc.b     "intuition.library", 0

graphicslib
    dc.b     "graphics.library", 0


    section  dat, data_c

copperlist
    dc.l     $8001ff00, $01800800
    dc.l     $9001ff00, $01800080
    dc.l     $a001ff00, $01800008
    dc.l     $b001ff00, $01800000
    dc.l     -2
Cefa
Member
#2 - Posted: 14 Aug 2008 10:36 - Edited
Reply Quote
You could try posting in amiga.org some of them seems to know alot about the amiga OS. There is one guy there named Piru he is the author of the program blizkick. He seems to be know (based on his previous post in amiga.org) alot about the Amiga OS.
ZEROblue
Member
#3 - Posted: 15 Aug 2008 01:00
Reply Quote
Thanks, Cefa

For anyone's interest, I noticed some days ago that the code above fails when you hold the right mouse button down while calling RemakeDisplay. For some reason some of the display registers will then be set to that of an NTSC display, and some registers will remain untouched.
z5_
Member
#4 - Posted: 15 Aug 2008 21:47
Reply Quote
The coders are probably all on the beach right now, enjoying the summer.

Out of interest, ZEROblue, why are you trying a different method for restoring the system?
ZEROblue
Member
#5 - Posted: 16 Aug 2008 11:47 - Edited
Reply Quote
I've never actually had any problems with the "classic" method, but because I've never looked at RTG on the Amiga and the display related registers around $1C0 to $1E0, I have no idea how these work and how they might affect your display.

It seemed to me that peeking around in the Graphics Library base and basically just changing DMA and bitplane controls was not an intended method from the beginning, and that it could somehow fail on an RTG configuration.

I just reasoned that letting the AmigaOS take care of as much as possible was the safer bet of always getting a correct display output from the basic hardware and having the previous view restored correctly.

If anyone is well read up on how these things work and can still my curiosity, don't hesitate to enlighten me :)
Crumb
Member
#6 - Posted: 19 Aug 2008 12:05
Reply Quote
@ZEROblue

Take a look at Piru's init code:
URL

Perhaps you could simply open a public screen, perform a forbid() at the beginning and at the end perform a permit() and close the public screen.

 

  Please register a new account or log in to comment

  

  

  

 

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