Tau Empire Codex 2013 | Army Builder Program
Dark Angels Codex 2013
Chaos Daemons Codex 2013
Chaos Space Marines Codex 2012

Warhammer 40k Forum Tau Online

 

Warhammer 40K Forum

Assembly anyone?
Reply
Old 05 Apr 2009, 11:25   #1 (permalink)
Shas'Ui
 
Join Date: Jan 2008
Location: Ireland
Posts: 698
Default Assembly anyone?

Right I've written a bit of Assembly code, but I need a little help on it for my exam. Can anyone track the binary bits in the Accumulator,A, for this sequence.

SETB C
MOV A,7Ah ; 01111010
RLC A
RLC A

;Somehow, all this is supposed to end up as 11101010, but I can't get it.
__________________
Click on these little dudes to get a slightly bigger little dude!




http://www.travian.co.uk/?uc=uk1
RonanB1011 is offline   Reply With Quote
Old 05 Apr 2009, 12:04   #2 (permalink)
Shas'O
 
Join Date: Apr 2004
Location: Retired back into the depths of the Internets.
Posts: 6,440
Send a message via MSN to mace
Default Re: Assembly anyone?

Er. Depends on what assembly you're using, i.e. what chip you're programming for and what the instruction set is, as it will differ from device to device...
__________________
mace is offline   Reply With Quote
Old 05 Apr 2009, 12:32   #3 (permalink)
Shas'Ui
 
Join Date: Jan 2008
Location: Ireland
Posts: 698
Default Re: Assembly anyone?

A basic 8051 with ADC831 settings.

I can go in Monday actually to check it on the simulator, now that I think of it...
__________________
Click on these little dudes to get a slightly bigger little dude!




http://www.travian.co.uk/?uc=uk1
RonanB1011 is offline   Reply With Quote
Old 05 Apr 2009, 14:16   #4 (permalink)
Shas'La
 
Join Date: Aug 2008
Location: Illinois
Posts: 266
Default Re: Assembly anyone?

SETB C ; C <- 1
MOV A,7Ah ; A <- 01111010
RLC A ; A <- 11110101 ; C <- 0
RLC A ; A <- 11101010 ; C <- 1

SETB C sets the carry bit to 1
MOV A, 7Ah puts the value 01111010 into the accumulator
RLC A is the rotate left through carry function which rotates the operand left and sets the right side bit to the carry value. In this case SETB C set the carry to 1, so the accumulator rotates left and the right bit is set to 1. Since the left bit of A was originally 0, the RLC call will set C to 0.
RLC A rotates left again, and with the carry bit being 0, it will set the right bit to 0. Since the left most bit was originally 1, this call will also set the carry bit to 1.

Final registers:
A <- 11101010
C <- 1
Xanzar is offline   Reply With Quote
Old 05 Apr 2009, 15:16   #5 (permalink)
Shas'Ui
 
Join Date: Jan 2008
Location: Ireland
Posts: 698
Default Re: Assembly anyone?

John Locke
__________________
Click on these little dudes to get a slightly bigger little dude!




http://www.travian.co.uk/?uc=uk1
RonanB1011 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kharn Assembly WNxMeteora Forces of Chaos 6 29 Sep 2009 00:34
Assembly of SM Zachinator Space Marines 11 11 Apr 2008 17:29
hammerhead assembly ShadowMk3 Tau 13 21 Aug 2007 05:52
model assembly? krupintupple Hobby 3 17 Jun 2007 01:03
Skyray Assembly Firebird4Life Hobby 5 20 Feb 2007 02:16