Welcome, Guest. Please login or register.

Author Topic: Pattern screen  (Read 4507 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Joloo

Re: Pattern screen
« on: October 24, 2011, 07:05:35 PM »
Well, your example works here, okay it is NTSC thus graphical glitches appear.
 
Seems that Thomas is right, your assembler doesn't recognize the "CODE_C, DATA_C" attributes, which means that the code or data sections weren't forced to CHIP-RAM.

Either you take an other assembler or an old tool that modifies the hunks of an executable file to be forced to CHIP-RAM or you use the tools Thomas suggested.

Please note that your source code is really old and thus won't do anything on an AGA machine unless you remember and restore the display correctly.
Your example was adopted for this reason and also the PAL norm was used instead of NTSC.

Code: [Select]

       OUTPUT RAM:test

       include hardware/custom.i
       include graphics/gfxbase.i
       include exec/exec_lib.i
       include graphics/graphics_lib.i

       SECTION Text,CODE
main:
        move.l  #scr,D0                 ;Load address of our screen in d0
        move.w  D0,pl1l                 ;Load low scr addr in Copper list
        swap    D0                      ;Swap address in d0
        move.w  D0,pl1h                 ;Load high scr addr in Copper list

        move.l  4.w,A6                  ;ExecBase
        moveq   #33,D0
        lea     GfxName(pc),A1
        jsr     _LVOOpenLibrary(A6)     ;Open GFX library
        lea     _GfxBase(pc),A0
        move.l  D0,(A0)
        beq.b   out

* Remember current view
        movea.l D0,A6
        lea     _OldCop(pc),A0
        move.l  gb_LOFlist(A6),(A0)     ; Current copper list being used
        lea     _OldView(pc),A0
        move.l  gb_ActiView(A6),(A0)    ; Current view being viewed

* Reset the view
        suba.l  A1,A1                   ; NULL
        jsr     _LVOLoadView(A6)        ; Reset whole display!
        jsr     _LVOWaitTOF(A6)         ; Wait until system has done
        jsr     _LVOWaitTOF(A6)         ; all changes

        move.l  #CopperList,$DFF080     ;Load Copper list in Copper

Loop:   btst    #6,$BFE001              ;Test left mouse button
        bne.b   Loop                    ;If not pressed keep in loop

endit:
* Reset to remembered state the view (bring back Intuition)
        movea.l _GfxBase(pc),A6
        lea     $DFF000,A5

        move.l  gb_copinit(A6),cop1lc(A5)
        move.w  #0,copjmp1(A5)
        move.w  #$83E0,dmacon(A5)

        movea.l _OldView(pc),A1
        move.l  _OldCop(pc),gb_LOFlist(A6)
        jsr     _LVOLoadView(A6)

        movea.l  A6,A1
        movea.l  4.w,A6
        jsr      _LVOCloseLibrary(A6)

out:
        rts

_GfxBase:
        ds.l    1
_OldCop:
        ds.l    1
_OldView:
        ds.l    1

GfxName:
        dc.b    "graphics.library",0


        SECTION Screen,DATA_C
* Settings for an overscan PAL display; screen: 416x345 pixels
CopperList:
        dc.w    diwstrt,$2981   ;Top left corner of the scr
        dc.w    diwstop,$29C1   ;Bottom right corner scr
        dc.w    ddfstrt,$20     ;Data fetch start
        dc.w    ddfstop,$D8     ;Data fetch stop
        dc.w    bplcon0,$1000   ;Set 1 bitplane lo-res scr
        dc.w    bplcon1,$0      ;No horizontal offset
        dc.w    color+0,$0      ;Black background color
        dc.w    color+2,$FFF    ;White foreground color
        dc.w    bplpt+0         ;Bitplane low high word
pl1h:
        dc.w    0
        dc.w    bplpt+2         ;Bitplane low word
pl1l:
        dc.w    0
        dc.w    $FFFF,$FFFE     ;End of copper list

scr:
        dcb.b   17940,$55       ; Block of n bytes filled with a pattern


        END
 

Offline Joloo

Re: Pattern screen
« Reply #1 on: October 30, 2011, 03:58:17 PM »
Sorry for replying that late.

I never created a NTSC display thus I did guess that your chosen values were correctly. Unfortunately, it turned out the weren't.
Please read the chapter for Playfields (hardware reference manual) again, then you know that an ordinary display window of size 320x200 (NTSC) or 320x256 (PAL) starts at 129;41. It ends for a NTSC display window (screen) at 449;241 (129+320;41+200) or for PAL at 449;297 (129+320;41+256).
If you choose overscan dimensions instead the starting point is 100;26 (DIWSTRT) and you cannot go lower this value due to the interrupts.
Next, any other value depends on DIWSTRT and DIWSTOP, hence DDFSTRT and DDFSTOP were also incorrect in your example and thus I believe that this caused the graphical corruptions, not the assembler, since Devpac supports sections which will be put to CHIP-RAM, as you know.
I modified your example to use default NTSC values.
Hope you don't see any more those graphical corruptions.

Regards

Code: [Select]

       OUTPUT RAM:test

       include hardware/custom.i
       include graphics/gfxbase.i
       include exec/exec_lib.i
       include graphics/graphics_lib.i

       SECTION Text,CODE
main:
        move.l  #scr,D0                 ;Load address of our screen in d0
        move.w  D0,pl1l                 ;Load low scr addr in Copper list
        swap    D0                      ;Swap address in d0
        move.w  D0,pl1h                 ;Load high scr addr in Copper list

        move.l  4.w,A6                  ;ExecBase
        moveq   #33,D0
        lea     GfxName(pc),A1
        jsr     _LVOOpenLibrary(A6)     ;Open GFX library
        lea     _GfxBase(pc),A0
        move.l  D0,(A0)
        beq.b   out

* Remember current view
        movea.l D0,A6
        lea     _OldCop(pc),A0
        move.l  gb_LOFlist(A6),(A0)     ; Current copper list being used
        lea     _OldView(pc),A0
        move.l  gb_ActiView(A6),(A0)    ; Current view being viewed

* Reset the view
        suba.l  A1,A1                   ; NULL
        jsr     _LVOLoadView(A6)        ; Reset whole display!
        jsr     _LVOWaitTOF(A6)         ; Wait until system has done
        jsr     _LVOWaitTOF(A6)         ; all changes

        move.l  #CopperList,$DFF080     ;Load Copper list in Copper

Loop:   btst    #6,$BFE001              ;Test left mouse button
        bne.b   Loop                    ;If not pressed keep in loop

endit:
* Reset to remembered state the view (bring back Intuition)
        movea.l _GfxBase(pc),A6
        lea     $DFF000,A5

        move.l  gb_copinit(A6),cop1lc(A5)
        move.w  #0,copjmp1(A5)
        move.w  #$83E0,dmacon(A5)

        movea.l _OldView(pc),A1
        move.l  _OldCop(pc),gb_LOFlist(A6)
        jsr     _LVOLoadView(A6)

        movea.l  A6,A1
        movea.l  4.w,A6
        jsr      _LVOCloseLibrary(A6)

out:
        rts

_GfxBase:
        ds.l    1
_OldCop:
        ds.l    1
_OldView:
        ds.l    1

GfxName:
        dc.b    "graphics.library",0


        SECTION Screen,DATA_C
* Settings for a plain NTSC display; screen: 320x200 pixels
CopperList:
        dc.w    diwstrt,$2981   ;Top left corner of the scr (129;41 NTSC *or* PAL!)
        dc.w    diwstop,$F1C1   ;Bottom right corner scr (449;241 NTSC - for PAL use:
*                                449,297)
        dc.w    ddfstrt,$38     ;Data fetch start ($2981 & $FF / 2 - 8.5)
        dc.w    ddfstop,$D0     ;Data fetch stop ($38 + (320 / 2 - 8)
        dc.w    bplcon0,$1000   ;Set 1 bitplane lo-res scr
        dc.w    bplcon1,$0      ;No horizontal offset
        dc.w    color+0,$0      ;Black background color
        dc.w    color+2,$FFF    ;White foreground color
        dc.w    bplpt+0         ;Bitplane low high word
pl1h:
        dc.w    0
        dc.w    bplpt+2         ;Bitplane low word
pl1l:
        dc.w    0
        dc.w    $FFFF,$FFFE     ;End of copper list

scr:
        dcb.b   320/8*200,$55   ; Block of n bytes filled with a pattern

        END