v3n0mn33dl3
Moldy Popcorn
public text 4 hire!
Posts: 33
|
Post by v3n0mn33dl3 on Dec 26, 2016 9:06:49 GMT -5
Hi all,
I was trying to do some ASM. Just to see how it works and learn some.
the questions I have are; How do I copy information to BEX? the value I get back is not what I expected, this is probably because in the ASM part it is a word and the BEX part is an integer. But what is the correct way?
I'm trying to copy the first 4 numbers of value 1 on over to value 2. So I'd expect value 3 to be 01233210....
Dim Value1 as Integer Dim Value2 as Integer Dim Value3 as Integer on vblank gosub main enable interrupt vblank end main: gosub pieceOFasm locate 0,0 print Value1 locate 2,0 print Value2 locate 4,0 print Value3
return pieceOFasm: asm addi.w #$01234567,d0 ; put 01234567 into d0 move.w d0,(__INTEGER_Value1) ; copy to BEX addi.w #$76543210,d1 ; put 76543210 into d1 move.w d1,(__INTEGER_Value2) ; copy to BEX move.w d0,d1 ; put d0 into d1 move.w d1,(__INTEGER_Value3) ; copy to BEX rts end asm
|
|
pico
PooP MonkeeH
Posts: 8
|
Post by pico on Dec 26, 2016 11:30:05 GMT -5
- A word is the exact same thing as a integer ~ your suspicion is incorrect.
- A word is only 16-bit, so the largest supported value is 65535 ~ your values are too big.
- A "#$" prefix indicates immediate hexadecimal data ~ not decimal.
- A addi operation adds a immediate value to the destination operand ~ not "put into".
- A word is a number, you can't just chop half of its notation off ~ unlike a string.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 26, 2016 12:06:00 GMT -5
Doing addi.w is adding that value to D0, so if D0 isn't 0, it'll be whatever value + the value you specified (1234567), so your second "addi.w" is actually D0+&h1234567+&h76543210, or D0+&h77777777. Dim value1 As Long, value2 As Long, value3 As Long Asm move.l #$01234567,(__LONG_value1) move.l #$76543210, (__LONG_value2) move.w (__LONG_value1),(__LONG_value2) End Asm Print Hex$(value1&) Print Hex$(value2&) Print value1& Print value2&
Here's a good set of tutorials by MarkyJester: mrjester.hapisan.com/04_MC68/
|
|
v3n0mn33dl3
Moldy Popcorn
public text 4 hire!
Posts: 33
|
Post by v3n0mn33dl3 on Dec 28, 2016 4:06:00 GMT -5
Thanks guys! This is really helpful! Bummer I have to work this week..... So MarkyJester website has to wait... loads to read
|
|