View Single Post
Old 23 August 2018, 16:14   #12
borchen
Registered User
 
Join Date: Jan 2016
Location: NL
Posts: 32
I'm also having no success showing the picture in the example on the screen.


Here's the code I added:
Code:
    INCDIR "SOURCES:Scoopex/Frazetta/"

    SECTION ConvPCHGCF,Code
    JUMPPTR    Start

;        #-----+-----------------------------------------#
;        |Name:| PCHG converter source            |
;        +-----+-----------------------------------------+
;        |V1.00|    Just cleaned up from RC3 for ConvPCHG    |
;        +-----+-----------------------------------------+
;        |            © Photon/Scoopex        |
;        #-----------------------------------------------#

;Converter from ConvPCHG command to also do PCHG and CAMG hunks.

MaxLsize=$19000                ;max copper list size (test!)
maxpic    =$28020                ;352/8*536*6, real max is 384/8*576*6
copsiz    =20+128                ;nullcop with palette

;--- Macros
WAITRAS:MACRO
    move.l    #$1ff00,d2        ; mask
    lsl.l    #8,d0
    and.l    d2,d0
    lea    $04(a6),a0
.wr_l\@
    move.l    (a0),d1
    and.l    d2,d1
    cmp.l    d1,d0
    bne.s    .wr_l\@
    ENDM


Start: 
    movem.l    d1-a6,-(sp)        ; put registers on stack
OSoff:
    move.l    4.w,a6            ; a6 = execbase
    move.l    #Gfxname,a1        ; a1 = gfxname
    jsr    -408(a6)        ; open gfxlibrary
                    ; using oldopenlibrary()
    move.l    d0,a1            ; a1 = gfxlibrary
    move.l    38(a1),d6        ; d4 = copper state
    jsr    -414(a6)        ; close gfxlibrary using closelibrary()

    lea    $dff000,a6        ; a6 = custombase

    move.w    $1c(a6),d5        ; d5 = INTENAR state
    move.w    $02(a6),d4        ; d3 = DMACON  state

    movem.l    d4-d6,-(sp)        ; put registers on stack

    move.l    #302,d0            ; wait for rasterline 302
    WAITRAS                ; = EOFrame

    move.w    #$7fff,$9a(a6)        ; disable all INTENA bits = turn off OS
    move.w    #$7fff,$9c(a6)        ; disable all INTREQ bits
    move.w    #$7fff,$9c(a6)        ; twice because of amiga4000 hw bug!
    move.w    #$7fff,$96(a6)        ; disable all DMACON bits
    move.w    #$8380,$96(a6)        ; enable neccesary bits in DMACON

Example:
    lea    R(PC),a5        ;-R(A5) used to save some bytes for
                    ;nonexistant d16(PC) writes
    lea    Pic,a0            ;source ILBM data.
    bsr    ConvPCHG        ;fills Buff0 and copdst, see below.
    tst.l    d0
    beq.w    .dontshow

    *--- show Buff0 with copdst here! ---*

;--- generate screen setup in copperlist
    lea    copdst,a1        ; copperlist

    move.l    #$01fc0000,(a1)+    ; FMODE slow
    move.l    #$01000000,(a1)+    ; BPLCON0 disable
    move.l    #$008e2c81,(a1)+    ; DIWSTRT
    move.l    #$00902cc1,(a1)+    ; DIWSTOP PAL
    move.l    #$00920038,(a1)+    ; DDFSTRT
    move.l    #$009400d0,(a1)+    ; DDFSTOP
    move.l    #$01020000,(a1)+    ; BPLCON1
    move.l    #$01080000,(a1)+    ; BPL1MOD
    move.l    #$010a0000,(a1)+    ; BPL2MOD

    move.l    #$00e00000,(a1)+    ; BPL1PTH
    move.l    #$00e20000,(a1)+    ; BPL1PTL
    move.l    #$00e40000,(a1)+    
    move.l    #$00e60000,(a1)+    
    move.l    #$00e80000,(a1)+    
    move.l    #$00ea0000,(a1)+    
    move.l    #$00ec0000,(a1)+    
    move.l    #$00ee0000,(a1)+    
    move.l    #$00f00000,(a1)+    
    move.l    #$00f20000,(a1)+    
    move.l    #$00f40000,(a1)+    ; BPL6PTH
    move.l    #$00f60000,(a1)+    ; BPL6PTL

    move.l    #$01006200,(a1)+    ; BPLCON0 6 bitplanes

;--- set bitplane pointers in copperlist
    move.l    #Buff0,d0        ; source screenbuffer
    lea    copdst+(9*4),a1        ; destination in copperlist
    moveq    #6-1,d7            ; 6 bitplanes
.bpl_l
    move.w    d0,6(a1)        ; BPLxPTL
    swap    d0
    move.w    d0,2(a1)        ; BPLxPTH
    swap    d0
    add.w    #(320*256)/8,d0        ; next bitplane +10240B
    addq    #8,a1            ; next pointers copperlist
    dbf    d7,.bpl_l

    move.l    #copdst,$80(a6)        ; COP1LCH set and
    move.w    #0,$88(a6)        ; COPJMP1 activate

.lmb_l
    move.l    #302,d0            ; wait for rasterline 302
    WAITRAS                ; = EOFrame

    btst    #6,$bfe001        ; check left mousebutton
    bne.s    .lmb_l            ; not pressed -> check again

.dontshow:
;    rts

;----- restore states & end the program
OSon:
    movem.l    (sp)+,d4-d6        ; pop registers from stack

    move.w    #$7fff,$096(a6)        ; clear DMACON
    or.w    #$8200,d4        ; set bits of DMACON state (d3)
    move.w    d4,$096(a6)        ; restore original DMACON

    move.l    d6,$080(a6)        ; restore original copperlist

    or.w    #$c000,d5        ; set 2 highest bits of INTENAR state
    move.w    d5,$09a(a6)        ; restore INTENA state = turn on OS

    movem.l    (sp)+,d1-a6        ; pop registers from stack
    moveq    #0,d0            ; nice clean
    rts                ; exit

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

    EVEN

ConvPCHG:                ;a0=src ILBM data.
<the rest is unchanged>
borchen is offline  
 
Page generated in 0.05360 seconds with 11 queries