17 October 2008, 15:59 | #1 |
Junior Member
Join Date: Apr 2002
Location: Holland
Age: 41
Posts: 314
|
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 |
17 October 2008, 16:03 | #2 |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 42
Posts: 2,351
|
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. |
17 October 2008, 19:23 | #3 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
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. |
17 October 2008, 20:49 | #4 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,799
|
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 |
17 October 2008, 21:53 | #5 |
Junior Member
Join Date: Apr 2002
Location: Holland
Age: 41
Posts: 314
|
Simply fantastic! Thanks -
The code is running... now it's time to do some analyzing. Great to have some expertise around here! Thumbs up! |
17 October 2008, 22:06 | #6 |
Junior Member
Join Date: Apr 2002
Location: Holland
Age: 41
Posts: 314
|
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 |
17 October 2008, 22:29 | #7 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,799
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combining copper scrolling with copper background | phx | Coders. Asm / Hardware | 16 | 13 February 2021 12:41 |
Copper timing | yaqube | Coders. General | 61 | 08 April 2019 00:41 |
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 |
|
|