English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm making a program with debug so i can invert the order of the bits in a given byte, the problem is when i ask the user to input the byte, the byte is seen by the program as an ascii caracter not as an hexa number (a=61 in ascii), i manage to work with the basic numbers (0-9) by just using "and al,0f", but i don't know how to work with the highers numbers (a to f). Theres another question. When you use the assembler how do you safe a value in a specific memory place. for example:
.
.
mov [0200h],al
.
.

when the enssambling moment comes it shows an error. how do i fix this??

2006-08-16 10:37:58 · 4 answers · asked by csrpolo 1 in Computers & Internet Programming & Design

1. Using debug and assembler is a requirement

2006-08-16 12:02:34 · update #1

2. The program that i wrote looks like this:

mov ah,1
int 21
and al,0f
mov bl,al
mov al,10
mul bl
mov [200],al
mov ah,1
int 21
and al,0f
add [200],al
int 20

*this in debug runs good, but if i assemble it in this way, the assembler shows error

2006-08-16 12:10:39 · update #2

4 answers

since capital letters start at 0x41, and small letters start at 0x61, and numbers start at 0x30, you first need to figure out WHAT it is, and if its a valid input.

What I would do is, first determine if its a number, capital letter or small letter by checking if the input is > 0x60 (small letter), else if not, is it > 0x40 (cap letter), else if not, > 0x2f (number).

Then check if it is valid. For small letters check if it is > 0x60 and < 0x67, caps > 0x40 and < 0x47, numbers > 0x2f and < 0x3a.

Next convert to binary by subtracting the small letters with 0x57, caps subtract 0x37, and numbers with 0x30 (or as you did, and with 0x0f)

As for saving to a specific memory place goes, I dont know what assembly you are using, but in intel 8 bit assembly there is an instruction called MOVX that is used.

2006-08-17 02:39:13 · answer #1 · answered by justme 7 · 0 0

You are using bear-skin and knives to do something that real tools are available to do. I recommend that you look for a free version of a modern language like C or C++. You will be able to some awesome stuff. You will even have fun using debug to run these programs, so you can see how they work.

2006-08-16 17:43:43 · answer #2 · answered by Anonymous · 0 0

the reason why are you getting an error is may be due to the following reasons
1) the way u are using the stack
2) may be some unreliable values in the al (Reg.)
3) memory range out of order
4) something wrong in the programming logic
please provide more information about the error and i can help u

2006-08-16 17:45:35 · answer #3 · answered by akshay 2 · 0 0

u can search in google.

2006-08-16 17:40:47 · answer #4 · answered by siva1013 3 · 0 0

fedest.com, questions and answers