It is currently Fri Jun 05, 2020 6:35 pm

 All times are UTC

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Move a single bitPosted: Fri Mar 06, 2015 7:44 am

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
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

Top

 Post subject: Re: Move a single bitPosted: Fri Mar 06, 2015 9:15 am

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
31 is the ASCII code for '1'
20 is the ASCII code for Space

_________________
Prof. Kelly

Top

 Post subject: Re: Move a single bitPosted: Fri Mar 06, 2015 9:32 pm

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
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!

Top

 Post subject: Re: Move a single bitPosted: Fri Mar 06, 2015 11:43 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
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.

_________________
Prof. Kelly

Top

 Post subject: Re: Move a single bitPosted: Mon Mar 09, 2015 7:17 pm

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
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.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC

Who is online

Users browsing this forum: Google [Bot] and 39 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects