26 June 2015, 11:52 | #1 |
Posts: n/a
|
Asm programmer's guide -> errors [SOLVED]
Hello!
I'm new on this forum, and let me first say that it looks excellent! I'm slowly getting back to asm coding and, using the Amiga System Programmer's Guide (1988), I tried to type in the Copperlist example found on p.93. [environment is asm-one on e-uae.] I get an error with the command ALIGN, placed before the copperlist. I switched it to EVEN, which seems ok. However, I also get a Relative Mode Error due to the line: moveq #CLsize,d0 I understand (or so I think!) that this is because CLsize is defined in another section of the program (near the end) CLsize = CLend - CLstart What I do not know is how to get around this. If anyone's interested, hints appreciated! Cheers. Tracker Last edited by Tracker; 27 June 2015 at 10:18. Reason: Problem solved! |
26 June 2015, 12:54 | #2 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
What is CLsize size ? Is bigger than 255 ? Anyway try move.l #CLsize,D0 instead moveq.
Last edited by obiwanken; 26 June 2015 at 13:04. |
26 June 2015, 13:02 | #3 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
CLsize is an equate, so the only reason it would give a relative mode error would be because CLend and CLstart are not in the same section.
If the value of CLsize is outside of the range -128 to 127 then, for moveq #CLsize, you would get an error saying "value out of 8-bit range" or similar. |
26 June 2015, 13:26 | #4 |
Posts: n/a
|
Thanks for the answers!
Well, CLsize should be small (not sure how to get its size quickly from the command h.l CLsize though). In any case, I tried the change moveq for move.l and, after doing so in a couple of places, it compiled fine. I agree it's weird the Relative error's gone away in this way... Anyway, not sure it's the end as the execution does nothing (while there should be some coloured lines on the screen and a wait for a left click...). Will try to look at it a bit later. Kind of weird that a listing in a book has such problems (probably it was written for another compiler, but still). Maybe it's my fault... |
26 June 2015, 14:14 | #5 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
To get size just type ? and equate in command line (after compiling).
In your case: ? clsize Even can be used as calculator ? 5*5 I think your program works well. It's a copper list tutorial. |
26 June 2015, 14:54 | #6 | |
Posts: n/a
|
Quote:
Thanks, I knew for the calculator, but not for the variables/labels. I'm taking note of everything, so I won't ask twice the same question and keep progressing So clsize is about $226472. As for the second point, I'm not sure: I think the prog should close the system, put on a black screen with 3 coloured lines and wait for a left click. It does nothing of this at present... |
|
26 June 2015, 15:04 | #7 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
CLsize is toooooooo big, no idea why. Try to post your program here.
|
26 June 2015, 16:33 | #8 | |
Posts: n/a
|
Quote:
## ;CustomChip-Register INTENA = $9A ; Interrupt-enable register DMACON = $96 ; DMA-control COLOR00 = $180 ; Color palette ;Copper Register COP1LC = $80 COP2LC = $84 COPJMP1 = $88 COPJMP2 = $8a ;CIA-A Port register A (left mouse button) CIAAPRA = $bfe001 ;Exec Library Offsets OpenLibrary = -30-522 Forbid = -30-102 Permit = -30-108 AllocMem = -30-168 FreeMem = -30-180 ;graphics base StartList = 38 ;other Labels Execbase = 4 Chip = 2 ;*** INIT *** ;Request memory for the CopperList Start: move.l Execbase,a6 move.l #Clsize,d0 moveq #chip,d1 jsr AllocMem(a6) move.l d0,CLadr beq.s Ende ;Copy the CopperList in CLadr lea CLstart,a0 move.l CLadr,a1 move.l #CLsize-1,d0 CLcopy: move.b (a0)+,(a1)+ dbf d0,CLcopy ;*** MAIN *** jsr forbid(a6) lea $dff000,a5 move.w #$03a0,dmacon(a5) move.l CLadr,cop1lc(a5) clr.w copjmp1(a5) ;Switching DMA move.w #$8280,dmacon(a5) ;Waiting for the left mouse button Wait: btst #6,ciaapra bne.s Wait ;End of the program move.l #GRname,a1 clr.l d0 jsr OpenLibrary(a6) move.l d0,a4 move.l StartList(a4),cop1lc(a5) clr.w copjmp1(a5) move.w #$83e0,dmacon(a5) jsr permit(a6) ;Freeing memory taken by Copperlist move.l CLadr,a1 move.l #CLsize,d0 jsr Freemem(a6) Ende: clr.l d0 btst #6,ciaapra bne.s Ende rts ;Variables CLadr: dc.l 0 ;Constants GRName: dc.b "graphics.library",0 even ;CopperList CLstart: dc.w color00,$0000 dc.w $640f,$fffe dc.w color00,$0f00 dc.w $be0f,$fffe dc.w color00,$0fb0 dc.w $ffff,$fffe CLend: CLsize = CLend - CLstart end |
|
26 June 2015, 17:49 | #9 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
Just tested your program and works well, German flag shown. Before you wrote that CLsize value is very big number, my value is $18. And this is your problem, you want alloc Chipmem which is not available and program ends. Check clsize=clend-clstart location. Must be $18.
Btw. I'm using Asm Pro. |
26 June 2015, 18:15 | #10 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
I suppose that your CLsize position is in left edge (column 0) and assembler takes it as label. And your big value is memory position not a copper size. Just press TAB key before you define equates.
|
26 June 2015, 19:49 | #11 |
Posts: n/a
|
Hum... So if right after compiling I do a
=s I get CLEND.........01.000000CC CLSTART......01.000000B4 CLSIZE........01.000000CC Isn't that weird that CLSIZE is not $CC-$B4=$18? |
26 June 2015, 20:35 | #12 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
CLsize Must be $18 and is calculated as CLend-CLstart. If CLend=CLsize then CLsize is Label for assembler. I think it must be assembler problem, try Asm Pro.
Try to trace your prog with AD directive and you will see what happen. Or change CLsize=CLend-CLstart to CLsize=$18 I'm curious |
26 June 2015, 21:06 | #13 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
26 June 2015, 21:13 | #14 |
Registered User
Join Date: Jan 2013
Location: Slovakia
Posts: 27
|
You right.
Asm One is accepting this mess. But Asm Pro generate "NO operand space alowed" error. |
26 June 2015, 21:13 | #15 |
Global Moderator
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
|
There are a lot of typos in the System Programmers Guide. Esp in the example code.
CLSize <> CLsize (If I remember this is one of the errors!) |
26 June 2015, 21:22 | #16 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
26 June 2015, 22:52 | #17 |
Posts: n/a
|
Right! If I hard set CLsize to $18 instead of CLend-CLstart, then I see the German flag. Had a look at the original version with the debugger, and it seems that CLsize get some non-sense value, for some reason...
|
26 June 2015, 23:00 | #18 |
Posts: n/a
|
Exactly! [Sorry, backreading messages, as the newest did not show up before my last answer to Obiwanken] Removing the spaces get things right. Bippym: in asm-one there's no difference between M and m (at least in my configuration). Many thanks to all! I'm sure I'll have many other questions, as I'm eager to learn... |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Guide: WinUAE PPC OS 4.0 Classic Install Guide (Beta 12+) | BinoX | support.WinUAE | 170 | 22 April 2021 11:37 |
Tool to convert asm to gnu asm (gas) | Asman | Coders. Asm / Hardware | 13 | 30 December 2020 11:57 |
asm code file errors and external file locations | Brick Nash | support.WinUAE | 0 | 06 April 2015 17:14 |
Help with programmer | majsta | support.Hardware | 1 | 20 January 2011 03:30 |
My first guide - Drakkhen leveling guide | Fragger | Nostalgia & memories | 2 | 08 April 2010 21:35 |
|
|