About Computer
Share |

Our Web Directory launched! | EngineerPedia

Register FAQ Calendar Search Today's Posts Mark Forums Read
Go Back   About Computer > Engineering > EXTC Engineers > Micro Systems > MicroProcessor(μP)

MicroProcessor(μP) Also called CPU and is referred as μp

Reply
 
Thread Tools Display Modes
  #1  
Old 07-20-2010, 12:36 AM
GB's Avatar
GB GB is offline
ENGINEER
 
Join Date: May 2009
Location: New Jersey
Posts: 382
Thanks: 3
Thanked 6 Times in 6 Posts
Rep Power: 10
GB is on a distinguished road
Send a message via MSN to GB Send a message via Yahoo to GB
Default [ASM]Add two 8 bit numbers

The following program adds the two 8 bit numbers,code has been compiled using turbo assembler.


Code:
.model small         
.data                                                    
a db 09H
b db 02H
.code
    mov     ax, @data    ; Initialize data section
    mov     ds, ax
    mov     al, a        ; Load number1 in al
    mov     bl, b        ; Load number2 in bl
    add     al, bl        ; add numbers and result in al
    mov     ch, 02h    ; Count of digits to be displayed
    mov     cl, 04h    ; Count to roll by 4 bits
    mov     bh, al        ; Result in reg bh
l2: rol       bh, cl        ; roll bl so that msb comes to lsb 
    mov     dl, bh        ; load dl with data to be displayed
    and     dl, 0fH    ; get only lsb
    cmp     dl, 09        ; check if digit is 0-9 or letter A-F
    jbe     l4
    add     dl, 07        ; if letter add 37H else only add 30H
l4:    add     dl, 30H
    mov     ah, 02; Function 2 under INT 21H (Display character)
    int     21H
    dec     ch        ; Decrement Count
    jnz     l2
    mov     ah, 4CH    ; Terminate Program
    int     21H
    end
Reply With Quote
  #2  
Old 08-19-2010, 03:31 PM
GB's Avatar
GB GB is offline
ENGINEER
 
Join Date: May 2009
Location: New Jersey
Posts: 382
Thanks: 3
Thanked 6 Times in 6 Posts
Rep Power: 10
GB is on a distinguished road
Send a message via MSN to GB Send a message via Yahoo to GB
Default

One can also compile it using Yasm.

Yasm can be downloaded here - http://www.tortall.net/projects/yasm/
Reply With Quote
  #3  
Old 08-26-2010, 02:32 PM
Gaurav Gaurav is offline
COM ENGINEER
 
Join Date: Jul 2010
Location: MUMBAI
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Gaurav is on a distinguished road
Default

This program successfully compiled on turbo assembler...
great!
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



All times are GMT +6.5. The time now is 06:33 PM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

AboutComputer.Org is technical community targeted only for the Engineering students and students who want to seek admission in engineering.Engineering students and professionals share and important place in the world they master the Innovation & Creativity.This forum is free and new registrants are moderated and checked before being approved,users registered through AboutComputer.org volunteer enjoy all benefits than normal registered user.If you want us to come in your college please mail us at support@aboutcomputer.org,We do not claim the ownership of the content.In regard the Engineering Jobs we do not act as recruiters but you can try your luck here ;)
Our Sponsors