English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 26 April 2021, 17:23   #1
DaveInFL
Registered User
 
Join Date: Apr 2021
Location: Florida
Posts: 48
Amiga Copper Example from ASPG

Hi All,

Very new to assembly language and I wanted to give it a try on the Amiga via FS-UAE. I did some stuff on the C64 emulator and that was pretty nice to get things working. I've followed some YouTube videos and got some copper demos to work and I have to say, impressive. So, I thought I would start going through the Amiga's System Programmers Guide. The first example for the copper doesn't seem to work when I try it. I am using FS-UAE in A4000 mode. I've gone through the code several times and it looks exactly as it is in the ASPG. It assembles just fine and when I run it there are no black, red and gold bars on the screen, the screen remains unchanged. When I click the left mouse button it exits, as it should. So, something wrong with the actual copper code?

Hoping that some kind person on here can help me understand why it isn't working. I'd be more than happy to provide additional information.

Code:
;*** Example for a simple Copperlist ***

;CustomChip-Register

INTENA  = $9A		;Interrupt-Enable-Register (write)
DMACON  = $96		;DMA-control register (write)
COLOR00 = $180		;Colour palette register 0

;Copper Register

COP1LC  = $80		;Address of 1. Copper List
COP2LC  = $84		;Address of 2. Copper List
COPJMP1 = $88		;Jump to Copper list 1
COPJMP2 = $8A		;Jump to Copper list 2

;CIA-A Port register A (Mouse key)

CIAAPRA = $BFE001

;Exec Library Base Offsets

OpenLibrary = -30-522	;LibName, Version/a1,d0
Forbid      = -30-102
Permit      = -30-108
AllocMem    = -30-168	;Byte Size, Requirements/d0,d1
FreeMem     = -30-180	;Memory Block, Byte Size/a1,d0

;graphics base

StartList = 38

;other labels

Execbase = 4
Chip = 2		;Request Chip-RAM

;*** Initialise Program ***

;Request memory for Copperlist

Start:
	move.l Execbase,a6
	moveq  #CLsize,d0	;Set Parameter for AllocMem
	moveq  #Chip,d1		;Ask for Chip-RAM
	jsr    AllocMem(a6)	;Request Memory
	move.l d0,CLadr		;Address of the RAM-area memory
	beq.s  Ende		;Error -> end

;copy Copplerlist to CLadr
	lea    CLstart,a0
	move.l CLadr,a1
	moveq  #CLsize-1,d0	;set loop value
CLcopy:
	move.b (a0)+,(a1)+	;copy Copperlist byte for byte
	dbf    d0,CLcopy

;*** Main program ***

	jsr    Forbid(a6)	;Task switching off
	lea    $dff000,a5	;Basic address of the register to a5
	move.w #$03a0,DMACON(a5);DMA offn
	move.l CLadr,COP1LC(a5) ;Address of the copperlist to COP1LC
	clr.w  COPJMP1(a5)	;Load copperlist in program counter

;Switch Copper DMA
	move.w #$8280,DMACON(a5)

;wait for left mouse press
Wait:
	btst   #6,CIAAPRA	;Bit test
	bne.s  Wait

;*** End Program ***

;Restore old Copper List
	move.l #GRname,a1	;Set parameter for OpenLibrary
	clr.l  d0
	jsr    OpenLibrary(a6)	;Graphics Library Open
	move.l d0,a4		;Address of GraphicsBase to a4
	move.l StartList(a4),COP1LC(a5) ;load address of startlist
	clr.w  COPJMP1(a5)	
	move.w #$83e0,DMACON(a5);all DMA on
	jsr    Permit(a6)

;Free memory of Copperlist
	move.l CLadr,a1
	moveq  #CLsize,d0
	jsr    FreeMem(a6)

Ende:
	clr.l  d0
	rts

;Variables

CLadr:	dc.l   0

;Constants

GRname:	dc.b "graphics.library",0
	EVEN

;Copperlist

CLstart:
	dc.w   COLOR00,$0000	;Background colour to black
	dc.w   $640f,$fffe	;On line 100 change to
	dc.w   COLOR00,$0f00	;red
	dc.w   $be0f,$fffe      ;On line 190 change to
	dc.w   COLOR00,$0fb0	;gold
	dc.w   $ffff,$fffe	;Impossible wait. End of Copperlist

CLend:

CLsize = CLend-CLstart

end
;End of program
DaveInFL is offline  
Old 26 April 2021, 17:53   #2
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,801
I just tested the source under WinUAE with AsmTwo and I can see the black, red and gold colors. (conf A3000/ECS)
kamelito is offline  
Old 26 April 2021, 17:58   #3
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
when I run it there are no black, red and gold bars on the screen, the screen remains unchanged.
Are you running the code from a native screen mode? If you are using an (emulated) graphics card and start the code from a non-native screen, you won't see anything as your code doesn't handle such screens at all.
StingRay is offline  
Old 26 April 2021, 18:19   #4
DaveInFL
Registered User
 
Join Date: Apr 2021
Location: Florida
Posts: 48
Quote:
Originally Posted by StingRay View Post
Are you running the code from a native screen mode? If you are using an (emulated) graphics card and start the code from a non-native screen, you won't see anything as your code doesn't handle such screens at all.
Thank you, that was it....much appreciated.
DaveInFL 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
Combining copper scrolling with copper background phx Coders. Asm / Hardware 16 13 February 2021 12:41
Best looking copper backgrounds on Amiga OCS Trachu Coders. General 7 28 March 2017 10:27
Best way to mix blitting with copper and copper effects roondar Coders. Asm / Hardware 3 12 September 2016 13:12
copper ? turrican3 Coders. Asm / Hardware 10 27 January 2016 09:10
Can anyone here hack a single load Amiga game to add a copper list please? ImmortalA1000 Amiga scene 10 19 January 2012 08:20

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 02:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09979 seconds with 15 queries