Jump to content
Sign in to follow this  
hang tuah

Assembly Code

Recommended Posts

Salam suma, sy nk mnta tlg. Actually sy msh bru dlm assembly language ni. Sy nk try to do assembly code to perform simple arithmetic. mslhnya sy x reti nk display kn

ans utk arithmetic tu. cuba korg tgk program nie, tp yg ni utk perform addition je:

.Model Small

.Stack 200h

.Data

message1 db 'enter number1 $'

int1 db 32,33 dup (0)

message2 db 10,13, 'enter number2 $'

int2 db 32,33 dup (0)

message3 db 10,13, 'plus become $'

ans db 32,33 dup (0)

.CODE

START:

mov ax,seg message1

mov ds,ax

mov dx,offset message1

mov ah,09h

int 21h

mov dx,offset int1

mov ah,0Ah

int 21h

mov ax,seg message2

mov ds,ax

mov dx,offset message2

mov ah,09h

int 21h

mov dx,offset int2

mov ah,0Ah

int 21h

mov al,int1

add al,int2

mov [ans],al

mov ah,09h

mov dx,offset message3

int 21h

mov byte ptr [bx+di], '$'

mov dx,di

mov ah,09h

int 21h

mov ax,4c00h

int 21h;

END START

bleh x sapa2 genius kt luar sna buat correction tuk program ni. bleh ekk..., pastu bgtau code utk display ans on th screen !

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...