English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 17 October 2008, 15:59   #1
cosmiq
Junior Member
cosmiq's Avatar
 
Join Date: Apr 2002
Location: Holland
Age: 37
Posts: 301
Stuck with copper example

Hello,

While reading data beckers 'amiga intern', I came across assembler code which, after typing it over, I'm not able to compile with devpac. When compiling the code below, it tells me that 'CLsize = CLend - CLstart' is not valid.. Is this a bug in my program, or is the sample code perhaps not compatible with my devpac version?

Code:
;Amiga Intern, Pagina 80. - Voorbeeld eenvoudige copperlist

INTENA = $9A
DMACON = $96
COLOR00 = $180

COP1LC = $80
COP2LC = $84
COPJMP1 = $88
COPJMP2 = $8A

CIAAPRA = $BFE001

OpenLibrary = -30-522
Forbid = -30-102
Permit = -30-108
AllocMem = -303-168
FreeMem = -30-180

StartLijst = 38
ExecBase = 4
Chip = 2

Start:
	MOVE.L ExecBase,a6
	MOVEQ #CLsize,d0
	MOVEQ #Chip,d1
	JSR AllocMem(a6)
	Move.l d0,CLadr
	BEQ.S Einde
	
	LEA CLstart,a0
	Move.l CLadr,a1
	Moveq #CLsize-1,d0
	CLcopy:
	Move.b (a0)+,(a1)+
	DBF d0,CLcopy
	
	JSR Forbid(a6)
	LEA $dff000,a5
	Move.w #$03a0,DMACON(a5)
	Move.l CLadr,COP1LC(a5)
	CLR.w COPJMP1(a5)
	
	Move.w $8280,DMACON(a5)
	
WAIT:	btst #6,CIAAPRA
	BNE.S WAIT
	
	Move.l #GRname,a1
	CLR.L d0
	JSR OpenLibrary(a6)
	Move.l d0,a4
	Move.l StartLijst(a4),COP1LC(a5)
	CLR.W COPJMP1(a5)
	Move.w #$83e0,DMACON(a5)
	JSR Permit(a6)
	
	Move.l CLadr,al
	Moveq #CLsize,d0
	JSR FreeMem(a6)
	Einde:
	Clr.l d0
	rts
	
	CLadr: dc.l 0
	GRname: dc.b "graphics.library",0
	even
	
	CLstart:
	dc.w COLOR00,$0000
	dc.w $780f,$fffe
	dc.w COLOR00,$0f00
	dc.w $d70f,$fffe
	dc.w COLOR00,$0fb0
	dc.w $ffff,$fffe

	CLend:
	CLsize = CLend - CLstart

	;End of program
cosmiq is offline  
Old 17 October 2008, 16:03   #2
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 38
Posts: 2,302
The labels with colons ( : ) need to be in the left-hand column or the assembler will think they are instructions.

Start: in your code is correct for example.
musashi5150 is offline  
Old 17 October 2008, 19:23   #3
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,372
Try removing the spaces, i.e.

CLsize = CLend-CLstart

might be Devpac doesn't accept spaces in the calculation. If that doesn't work, you can try
CLsize = *-CLstart

Hope that helps.

Edit: And read what Musashi wrote too, he has a very good point.
StingRay is offline  
Old 17 October 2008, 20:49   #4
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 43
Posts: 3,088
Here's the corrected the program, and I've tested it (AsmOne v1.49). It just contained some typos

Code:
;Amiga Intern, Pagina 80. - Voorbeeld eenvoudige copperlist

INTENA = $9A
DMACON = $96
COLOR00 = $180

COP1LC = $80
COP2LC = $84
COPJMP1 = $88
COPJMP2 = $8A

CIAAPRA = $BFE001

OpenLibrary = -30-522
Forbid = -30-102
Permit = -30-108
AllocMem = -30-168
FreeMem = -30-180

StartLijst = 38
ExecBase = 4
Chip = 2

Start:
	MOVE.L ExecBase,a6
	MOVEQ #CLsize,d0
	MOVEQ #Chip,d1
	JSR AllocMem(a6)
	Move.l d0,CLadr
	BEQ.S Einde
	
	LEA CLstart,a0
	Move.l CLadr,a1
	Moveq #CLsize-1,d0
CLcopy:
	Move.b (a0)+,(a1)+
	DBF d0,CLcopy
	
	JSR Forbid(a6)
	LEA $dff000,a5
	Move.w #$03a0,DMACON(a5)
	Move.l CLadr,COP1LC(a5)
	CLR.w COPJMP1(a5)

;You may want to change the added line back to what it was, but without it
;the code doesn't do what it's supposed to my system.
	
;	Move.w #$8280,DMACON(a5)
	Move.w #%1000001110000000,DMACON(a5)
	
WAIT:	btst #6,CIAAPRA
	BNE.S WAIT
	
	Move.l #GRname,a1
	CLR.L d0
	JSR OpenLibrary(a6)
	Move.l d0,a4
	Move.l StartLijst(a4),COP1LC(a5)
	CLR.W COPJMP1(a5)
	Move.w #$83e0,DMACON(a5)
	JSR Permit(a6)
	
	Move.l CLadr,a1
	Moveq #CLsize,d0
	JSR FreeMem(a6)
Einde:
	Clr.l d0
	rts
	
CLadr: dc.l 0
GRname: dc.b "graphics.library",0
	even
	
CLstart:
	dc.w COLOR00,$0000
	dc.w $780f,$fffe
	dc.w COLOR00,$0f00
	dc.w $d70f,$fffe
	dc.w COLOR00,$0fb0
	dc.w $ffff,$fffe

CLend:
CLsize	=CLend-CLstart

	;End of program
Thorham is offline  
Old 17 October 2008, 21:53   #5
cosmiq
Junior Member
cosmiq's Avatar
 
Join Date: Apr 2002
Location: Holland
Age: 37
Posts: 301
Simply fantastic! Thanks -
The code is running... now it's time to do some analyzing.
Great to have some expertise around here! Thumbs up!
cosmiq is offline  
Old 17 October 2008, 22:06   #6
cosmiq
Junior Member
cosmiq's Avatar
 
Join Date: Apr 2002
Location: Holland
Age: 37
Posts: 301
Oh and by the way.. now that I see the flag, let's change the colors a bit
Code:
CLstart:
	dc.w COLOR00,$0f00
	dc.w $780f,$fffe
	dc.w COLOR00,$0fff
	dc.w $d70f,$fffe
	dc.w COLOR00,$000f
	dc.w $ffff,$fffe
cosmiq is offline  
Old 17 October 2008, 22:29   #7
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 43
Posts: 3,088
Quote:
Originally Posted by cosmiq View Post
Oh and by the way.. now that I see the flag, let's change the colors a bit
Indeed. It's much better that way
Thorham is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copper timing yaqube Coders. General 61 08 April 2019 00:41
Combining copper scrolling with copper background phx Coders. Asm / Hardware 14 16 June 2013 07:26
Understanding the Copper BippyM Coders. Tutorials 38 04 September 2010 12:18
Best use of copper in a game donnie Retrogaming General Discussion 16 09 August 2010 21:34
Copper Bars Vortex Coders. Tutorials 51 26 June 2009 23:23

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06620 seconds with 13 queries