G60LG@CUNYVM.BITNET (Anton Mitchell) (06/26/91)
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
endchrisg@cbmvax.commodore.com (Chris Green) (06/26/91)
In article <91177.015130G60LG@CUNYVM.BITNET> G60LG@CUNYVM.BITNET (Anton Mitchell) writes: > > 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 > > > move.w #PlaneSize*6,d0 This should be MOVE.L #PlaneSize*6,d0 > move.w Clear,d1 This should be MOVE.L #Clear,d1 Also, your replacement of the system copper list didn't look robust enough. That would explain your messed up colors. -- *-------------------------------------------*---------------------------* |Chris Green - Graphics Software Engineer - chrisg@commodore.COM f | Commodore-Amiga - uunet!cbmvax!chrisg n |My opinions are my own, and do not - killyouridolssonicdeath o |necessarily represent those of my employer.- itstheendoftheworld r *-------------------------------------------*---------------------------d
peterk@cbmger.UUCP (Peter Kittel GERMANY) (06/26/91)
In article <91177.015130G60LG@CUNYVM.BITNET> G60LG@CUNYVM.BITNET (Anton Mitchell) writes: > > 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. >Chip EQU $02 >Clear EQU $10000+Chip ^^^^^ This is a LONG value! A WORD would only be max. 4 hex digits, you have here 5. > move.w Clear,d1 ^ Make this a move.l -- Best regards, Dr. Peter Kittel // E-Mail to \\ Only my personal opinions... Commodore Frankfurt, Germany \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk
ins760z@monu4.cc.monash.edu.au (mr c.r. hames) (06/27/91)
In article <91177.015130G60LG@CUNYVM.BITNET> G60LG@CUNYVM.BITNET (Anton Mitchell) writes: > > 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 Besides the faults with your allocate mem putting words into d0 and d1 instead of longs which has been mentioned and the general nastiness of wacking in your own copperlist. REMEMBER that dbra does one more operation than what the counter started with. Many people forget this an overwrite memory not owned by them. So if you want to clear 100 words. move.l MemPtr,a0 moveq #100-1,d1 ; Note The -1 moveq #0,d0 ; lets not be too slow hey! Loop: move.w d0,(a0)+ dbra d1,Loop -- Chris Hames Person to blame for DirWork, VMK, FSDirs, etc And soon for PC-Task? ins760z@monu4.cc.monash.edu.au OR bytey@phoenix.pub.uu.oz.au OR 3:633/353 I speak for nobody not even myself.....
carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) (06/28/91)
In article <91177.015130G60LG@CUNYVM.BITNET> G60LG@CUNYVM.BITNET (Anton Mitchell) writes: > > 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 I don't know if anyone has pointed this out yet, but do you know that the decrement-and-branch instructions (like dbra) operate on just the low word of the data register ? ie. the maximum number of iterations a single dbra loop can get you is 65536. So you are probably only moving a portion of what you are trying to move... -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com Signed characters are xenophobic. ==========================================================================
mykes@amiga0.SF-Bay.ORG (Mike Schwartz) (06/28/91)
In article <1991Jun27.140403.15476@monu0.cc.monash.edu.au> ins760z@monu4.cc.monash.edu.au (mr c.r. hames) writes: >In article <91177.015130G60LG@CUNYVM.BITNET> G60LG@CUNYVM.BITNET (Anton Mitchell) writes: >> >> 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 > > Besides the faults with your allocate mem putting words into >d0 and d1 instead of longs which has been mentioned and the general >nastiness of wacking in your own copperlist. REMEMBER that dbra >does one more operation than what the counter started with. Many >people forget this an overwrite memory not owned by them. > As well, most assemblers will allow you to let the OS do your memory allocation for you. For example, instead of using AllocMem to allocate screen bitplanes, you could do the following: SECTION screen,BSS,CHIP myScreen ds.b (WIDTH/8)*HEIGHT*DEPTH And you can put your copper list right into CHIP ram, too: SECTION copper,DATA,CHIP myCopper dc.w ... ... -- **************************************************** * I want games that look like Shadow of the Beast * * but play like Leisure Suit Larry. * ****************************************************