EASy68K
http://www.easy68k.com/EASy68Kforum/

Move a single bit
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1479
Page 1 of 1

Author:  blupig [ Fri Mar 06, 2015 7:44 am ]
Post subject:  Move a single bit

Hey folks,

I'm looking to transfer a single bit from an address register's content to a data register.

Code:
move.b  (a1), d3


...Moves 2 bits. I'm reading from a file and for some reason there are extra bits after the first number that I'm trying to grab.
The file contents are 1234
d3 contains 31 when the above code is executed for the first time, and shifting the address makes d3 equal to 20

I'd like for d3 to contain 1, 2, 3, and 4 respectively.

Thanks for any help

Author:  profkelly [ Fri Mar 06, 2015 9:15 am ]
Post subject:  Re: Move a single bit

31 is the ASCII code for '1'
20 is the ASCII code for Space

Author:  blupig [ Fri Mar 06, 2015 9:32 pm ]
Post subject:  Re: Move a single bit

profkelly wrote:
31 is the ASCII code for '1'
20 is the ASCII code for Space


That makes sense. Is there any way to grab the actual numbers from the file?
I.e. pulling the "1" from the text file and storing it in a data register eventually.

Thanks very much for your time. Love the simulator!

Author:  profkelly [ Fri Mar 06, 2015 11:43 pm ]
Post subject:  Re: Move a single bit

ASCII number may be converted to binary by subtracting $30.

$31 - $30 = 1

The binary result may be calculated in a data register. If D1 contains the ASCII code then
SUB.B #$30,D1 will result in D1 containing binary 1.

Author:  blupig [ Mon Mar 09, 2015 7:17 pm ]
Post subject:  Re: Move a single bit

profkelly wrote:
ASCII number may be converted to binary by subtracting $30.

$31 - $30 = 1

The binary result may be calculated in a data register. If D1 contains the ASCII code then
SUB.B #$30,D1 will result in D1 containing binary 1.


I ended up doing exactly that! Thanks so much for your help.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/