English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Asm / Hardware (https://eab.abime.net/forumdisplay.php?f=112)
-   -   Array putting garbage in register (https://eab.abime.net/showthread.php?t=91043)

Locash 02 March 2018 00:02

Array putting garbage in register
 
Good evening all,

Sorry this is probably really simple but its been bugging me all day. I'm trying to populate an array with some colour values then point A2 at them. I'm not getting any compiler (AsmTwo) errors but looking at the value of A2 it just shows the value CCC.

e.g.

lea colour,a2

colour: dc.w $100,$200,$300,$400,$500 etc

Any thoughts or pointers? har har

Galahad/FLT 02 March 2018 00:08

Whats the entirety of your list of colours? Is one of them $ccc?

Locash 02 March 2018 00:09

1 Attachment(s)
Its just a straight run of $100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00,$e00,$f00 to get a red fade. I have attached the whole code, following Protons guide but im trying to wander a bit.

Galahad/FLT 02 March 2018 00:41

That code you just listed works fine, show me the code that doesn't.

StingRay 02 March 2018 00:46

I can't see that you access any values in your color table at all. Hint: what would a move.w (a2)+,d0 do?

Locash 02 March 2018 00:50

Sorry both i'm a bit shamefaced here, I just did a moveq #11,d2 and I see the correct value. It appears I'm not understanding how the output of AsmTwo displays data it seems. What was confusing me was when i exited the programe, AsmTwo was displaying CCC for the value of A2, I was expecting it to show $100 as the value for A2 as i had not advanced it. (sorry if im getting the terminology wrong)

Stingray, I think it moves the contents of A2 to D0 then increments A2 by two?

Sorry another edit. Ok i get it now, CCC is the memory address that A2 is pointing to, not the first value of the array like I expected. If i look in the debugger I see all the values I stored starting at CCC through to CDB!. Assume this is because its an address register and not a data register..

Locash 04 March 2018 12:05

Morning all, sorry another question.

In the attached code in the copper block, where i set the line to white with dc.w $180,$fff. If i change it to a move.w #$fff,$dff180 the rest of the copper executes successfully (top and bottom colour change borders are there but the white line isn't drawn. The HRM says copper accepts moves, waits and skips so i'm unsure why the line is not there. Any thoughts as to why the move isn't working? Thanks

phx 04 March 2018 12:52

???
The copper does not understand 68000 code.

When the HRM says it understands Move instructions, then it is refering to the Copper Move instruction, which is an even register in the first word and the value in the second word.

Locash 04 March 2018 13:03

Ahh ok, I understand now. Thanks PHX, I think i need to play some more with the basics first :)


All times are GMT +2. The time now is 11:51.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04046 seconds with 11 queries