•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 422,542 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,650 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 3746 | Replies: 0
![]() |
•
•
Join Date: Mar 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
I have 2 programs im stuck with at the moment.
In the first one im supposed to use the shrd instruction to shift a variable & get a specific number.
and in the second im supposed to take a decimal number and convert it to individual ascii characters. I've used it with a hexadecimal number because that's all i've got working so far , but I need to do it with a decimal number and that's where im stuck.
thanks for any help
In the first one im supposed to use the shrd instruction to shift a variable & get a specific number.
title 'exercise 13'
.model small
.stack 100h
.386
.data
byte1 db 3Bh ;after 03h
byte2 db 46h ;after B4h
byte3 db 0FFh ;after 6Fh
value db ?
.code
main proc
mov ax,@data
mov ds,ax
mov bx,0Bh
mov dl,byte2
movzx ax,dl
shrd ax,bx,4 ; ah:1011 0000 al: 0000 0100 (B004h)
mov bx,ax
shld ax,bx,4
and ax,0000000011111111b ;ah:0000 0000 al: 0100 1011 ; 4Bh (should be B4h)
mov dx,06h
mov bl,byte3
movzx ax,bl
shrd ax,dx,4 ;(600Fh)
mov cx,4
L1:
shr byte1,1 ; 03h
loop L1
mov ax,4C00h
int 21h
main endp
end main
and in the second im supposed to take a decimal number and convert it to individual ascii characters. I've used it with a hexadecimal number because that's all i've got working so far , but I need to do it with a decimal number and that's where im stuck.
.model small ; works but only with hexadecimal
.stack 100h
.data
packedval dw 3425h
.code
main proc
mov ax,@data
mov ds,ax
mov si,0
mov cx,2
next:
mov al,byte ptr packedval[si]
and al,00001111b
or al,30h
mov ah,6
mov dl,al
int 21h
mov al,byte ptr packedval[si]
and al,11110000b
shr al,1
shr al,1
shr al,1
shr al,1
or al,30h
mov ah, 6
mov dl,al
int 21h
inc si
loop next
mov ax,4C00h
int 21h
main endp
end mainthanks for any help
![]() |
•
•
•
•
•
•
•
•
DaniWeb Assembly Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Conversion (VB.NET)
- send raw data via serial (Python)
- 500 ways to print [1..10]! (Software Developers' Lounge)
- undefined reference to 'main' (C++)
- How to work with digits when they are characters in a string (C)
- converting integers to string in java (Java)
Other Threads in the Assembly Forum
- Previous Thread: Assembly newbie question
- Next Thread: Extreme beginner


Linear Mode