Hi, I need a help to find out solution to these problems

(1) Write a program that will ask the user to input a hexadecimal number and display the number of binary one’s within that number.

(2) Write a program that will ask the user to input his name. Then the
program will compare the inputted name with presorted (using DB) name. If the names are same, the program outputs a message “access granted” in the monitor screen.

(3) Write a program that will ask the user to input a “two digit decimal number” and then display the equivalent hexadecimal number.

(4) Write a program that will ask the user to inter his name in upper case letter and display the lower case letters.

(5) Write a program that will,
(a) Ask the used to enter a Secret Message, that consist of five letters.
(b) Store the entered data in a memory location VAR1.
(c) Encrypt the entered data & store them in a new memory location of VAR2
(as if after encryption they are transmitted over public internet/telephone line)
(d) read the restore the encrypted letters from VAR2 and save them in
another new memory location.

(6) Write a program that will display ‘+’ or ‘-‘ depending the signed decimal data, entered from keyboard, is negative or positive.

(7) Write a program that will display the parity status (PO or PE) of the entered Decimal digit.

2
Contributors
7
Replies
9
Views
9 Years
Discussion Span
Last Post by wildgoose

You need to post code.

As to binary

``````unsigned char b;

for ( b = 0x80; b; b>>= 1)
{
}``````

And of course this is an assembly language forum but where did you say that in your post?
What processor? (Though you hint at it with PO and PE).

Write your code or atleast one component, we'll review then you add more features.

A hint to task #1. There's an 80x86 instruction that will help make it easier!

You need to post code.

As to binary

``````unsigned char b;

for ( b = 0x80; b; b>>= 1)
{
}``````

And of course this is an assembly language forum but where did you say that in your post?
What processor? (Though you hint at it with PO and PE).

Write your code or atleast one component, we'll review then you add more features.

A hint to task #1. There's an 80x86 instruction that will help make it easier!

8088\8086

Specifically what processor. An old 16-bit 8088 or 8086 or something much newer?

And you need to post your first attempts of code! Without it, we can't help too much as per forum rules!

it is the one which is communally used , and I will post my attempt as soon as possible

The reason I asked about which processor is that new instructions were added to later processors. Also you haven't specified 16-bit DOS or 32-bit console app or otherwise!

I am just beginer in this language, I am just studying 8088\8086 course during summer.I don't kow how to answer your questions but if I understand what you are saying,we just use simple instroction

mov
xchg
lea
sub
mul
div
rotat instruction
logic instruction
string instruction
.....

Summer is almost over. Take one of your previous programs, strip it down to just the parts you need and then add on new code.

Here's a start

``````mov     ebx,0a5h    ; 10100101

mov	eax,0
bsf	eax,ebx      ; Bit scan``````

eax will return a 0 as the first bit found with a 1 bit is 0
then eax will return 6 Bit 6 contains the first 1 bit!
Then clear the bit easiest method is a Logical Shift Right by that many bits + 1
Then check again!

OR

``````mov al,0
mov cl,32
Loop:
lsr ebx,1            Shift MSB into carry
adc al,0              al = al + 0 + carry
dec cl
jne Loop
; al  count of 1 bits``````
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.