Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!atha!aunro!ukma!usenet.ins.cwru.edu!ysub!psuvm!cunyvm!g60lg From: G60LG@CUNYVM.BITNET (Anton Mitchell) Newsgroups: comp.sys.amiga.programmer Subject: Assembly Graphics Help Needed Message-ID: <91177.015130G60LG@CUNYVM.BITNET> Date: 26 Jun 91 05:51:30 GMT Organization: City University of New York/ University Computer Center Lines: 212 I have tried to get this assembly program to work for the longest. Any help would be great. What I dont understand is when assembled and executed the bitplanes are not cleared. When allocating the memory I set the Clear and Chip flags. But it is not cleared. The only way I have been able to clear the bitplanes is by using: lea PlaneAdr,a1 move.l PlaneSize*6,d1 Loop: move.w #0,(a1)+ dbra d1,Loop Also when executed several times the bars which usually present in a blue wind up with other colors etc. And after several executions it will not execute. Any help on what is wrong with the code would be great. I have just started programming Assembly and I am going crazy with this program. Thanks in Advance, Anton Mitchell ;CustomChip-Register INTENA EQU $9A DMACON EQU $96 COLOR00 EQU $180 VHPOSR EQU $6 ;COPPER REGISTER COP1LC EQU $80 COP2LC EQU $84 COPJMP1 EQU $88 COPJMP2 EQU $8A ;BITPLANE REGISTER BPLCON0 EQU $100 BPLCON1 EQU $102 BPLCON2 EQU $104 BPL1PTH EQU $0E0 BPL1PTL EQU $0E2 BPL1MOD EQU $108 BPL2MOD EQU $10A DIWSTRT EQU $08E DIWSTOP EQU $090 DDFSTRT EQU $092 DDFSTOP EQU $094 ;CIA-A PORT REGISTER A (MOUSE BUTTON) CIAAPRA EQU $BFE001 ;EXEC LIBRARY BASE OFFSETS OpenLibrary EQU -552 CloseLibrary EQU -414 Forbid EQU -132 Permit EQU -138 AllocMem EQU -198 FreeMem EQU -210 ;Grafix Base StartList EQU 38 ;Other Labels ExecBase EQU 4 PlaneSize EQU 40*200 CLsize EQU 13*4 Chip EQU $02 Clear EQU $10000+Chip ;****** Initialize Main Program ******** ;Request memory for bitplanes Start: move.l ExecBase,a6 move.w #PlaneSize*6,d0 move.w Clear,d1 jsr AllocMem(a6) move.l d0,Planeadr beq Exit move.l Planeadr,a1 move.l #PlaneSize,d1 LoopA: move.w #%11110000,(a1)+ dbra d1,LoopA ;Request Memory for copperlist moveq #CLsize,d0 moveq #Chip,d1 jsr AllocMem(a6) move.l d0,CLadr beq FreePlane ; Build CopperList moveq #5,d4 move.l d0,a0 move.l Planeadr,d1 move.w #BPL1PTH,d3 MakeCL: move.w d3,(a0)+ addq.w #2,d3 swap d1 move.w d1,(a0)+ move.w d3,(a0)+ addq.w #2,d3 swap d1 move.w d1,(a0)+ add.l #PlaneSize,d1 dbf d4,MakeCL move.l #$fffffffe,(a0) ;*******Main Program ********* ; DMA Task switching off jsr Forbid(a6) lea $dff000,a5 move.w #$03e0,DMACON(a5) ;Copper Initialization move.l CLadr,COP1LC(a5) clr.w COPJMP1(a5) ;Color Table with different color fills moveq #31,d0 lea COLOR00(a5),a1 moveq #1,d1 SetTab: move.w d1,(a1)+ mulu #3,d1 dbf d0,SetTab ;PlayField Initilization move.w #$2C81,DIWSTRT(a5) move.w #$F4C1,DIWSTOP(a5) move.w #$0038,DDFSTRT(a5) move.w #$00d0,DDFSTOP(a5) move.w #%0110001000000000,BPLCON0(a5) clr.w BPLCON1(a5) clr.w BPLCON2(a5) clr.w BPL1MOD(a5) clr.w BPL2MOD(a5) ;DMA on move.w #$8380,DMACON(a5) Wait: btst #6,CIAAPRA bne Wait ;****** END LOOP ****** ;Activate Old CopperList moveq #0,d0 move.l ExecBase,a6 lea GFXName,a1 jsr OpenLibrary(a6) move.l d0,GFXBase movea.l d0,a4 move.l StartList(a4),COP1LC(a5) clr.w COPJMP1(a5) move.w #$8060,DMACON(a5) jsr Permit(a6) ;Free Memory for Copper List move.l CLadr,a1 moveq #CLsize,d0 jsr FreeMem(a6) ;Free Memory for BitPlanes FreePlane: move.l Planeadr,a1 move.l #PlaneSize*6,d0 jsr FreeMem(a6) movea.l 4,a6 move.l GFXBase,a1 jsr CloseLibrary(a6) Exit: clr.l d0 rts ;Variables CLadr: dc.l 0 Planeadr dc.l 0 GFXBase dc.l 0 ;Constants GFXName dc.b "graphics.library",0 Program end end