i have done option 1 and have attempted option 2 but am stuck on it as well as 3 and 4
the tasks are below and i have attached the program file
>
>


Produce a menu such as the one below,
>
>
>ASSIGNMENT MENU
>
>
>1 Menu Option One
>
>
>2 Menu Option Two
>
>
>3 Menu Option Three
>
>
>4 Menu Option Four
>
>
>5 Menu Option Five
>
>
>6 Menu Option Six
>
>
>9 Quit
>
>
>Please Choose an Option:
>
>
>
>
>
>The first item on your assignment menu will be to allow the user to
>enter a
>
>
>string. So change 1 Menu Option One to 1 Enter a new string in your
>
>
>assignment program. The maximum length of the string will be 25
>characters.
>
>
>The second item on your assignment menu is to print out the string
>the
>
>
>user entered. So change 2 Menu Option Two to 2 Print out the string
>
>
>in your assignment menu.
>
>
>
>
>
>Option 3 on the menu should print out the string entered by the user
>in
>
>
>reverse. For example, ?Hello World? is printed out as ?dlroW olleH?.
>
>
>Assignment Task Four
>
>
>Option 4 on the menu requires you to print out the string the user
>entered
>
>
>excluding spaces and excluding the vowels (a , e , i , o and u ).
>For example,
>
>
>the word "hello" would be printed as "hll". "andrew williams" would
>
>
>2
>
>
>be printed as "ndrwwllms". You may assume that the string contains
>
>
>only letters and spaces.
>
>
>
>
>

>
>
>
>may god bless you and watch over you for any help you give
Posted on 2003-03-10 07:35:15 by evilz35
Again, we won't do your homework. If you tell us what you've tried or what you don't understand maybe we can help you, but this post is nearly the same as your previous one.

Thomas
Posted on 2003-03-10 07:44:56 by Thomas
evilz35 take a deep breath

now go look up an ASCII table.

understand that a string is a buffer that ends with 0
your questions involve almost nothing more than looping and maybe create a secondary stringbuffer.

if it's in DOS look up the interrupt tables so you can find out which one you need to print stuff. (I assure you it's not hard)
in windows there are a variety of functions you can use.


don't forget a ASCIIZ string is just
just move data from and to the location(s) and compare them to what you wish or don't wish.

If you get stuck, visualize it. Draw a couple of boxes that represent the data in memory, draw the string in there and go through the steps on paper to see what you'd need to do to get the desired end result.

e.g.

from
2[0]

[H,e,l,l,o, ,W,o,r,l,d,0]
is "a, e, o, u, i"?
no, copy to second buffer
2

e,l,l,o, ,W,o,r,l,d,0]
is "a, e, o, u, i"?
yes, do nothing on second buffer
2

to
2

don't forget: breathe out, it relaxes. :)
Posted on 2003-03-10 07:55:52 by Hiroshimator
thanks mate, can n e 1 give me some tips with option 3
Posted on 2003-03-10 12:57:25 by evilz35
Scan the input buffer backwards, copying one charachter at a time to a second buffer in normal order. At the end of the string, the second buffer contains the string in reverse order.

Btw do you have any experience in other program languages? If yes, try to write the programs in that language first to get the algorihm right and translate it to asm then. If not, then asm might not be the best language to start with :)

Thomas
Posted on 2003-03-10 13:19:24 by Thomas
i am cery god at java programming and think that i could easily create this program in java, but how would i translate it to asm?
Posted on 2003-03-10 15:37:02 by evilz35
You'll have to translate it yourself but it often helps to see it in another language. For example, option 3: Imagine you have a character array in java (don't use String as that's too high level, think low level):



char[] inputBuffer;
char[] outputBuffer;


InputBuffer contains the characters you've read in, now how do you get the string in reverse in outputBuffer? Write it out in java first:


int lenInput; // length of input, assume this var is set
int j = 0;
for (int i=(lenInput-1);i>=0;i--)
{
outputBuffer[j] = inputBuffer[i];
j++;
}

Now think about converting this to asm, in little steps. Use registers as variables, the char arrays can be represented as pointers to the buffers (also in a register, preferably bx, si or di on a 8086), think about how to implement the for loop, using conditional jumps and a counter register.

Btw how did you read the string in? Could you post your code for option 1?

Thomas

edit: P.S. The solution to option 2 is already given, look at the code that prints the options, just change it to print the buffer you read the string in. The string then has to be $-terminated though, I don't know in what format you've read your string in (0-terminated, not terminated at all?), that's why I asked for your code.
Posted on 2003-03-10 15:48:29 by Thomas
thanks 4 that. the code is attached to the first message iwrote at the top of this page. it's a bit messy but see what you think. do you program much in 8086?
Posted on 2003-03-10 16:27:57 by evilz35
thanks 4 that. the code is attached to the first message iwrote at the top of this page. it's a bit messy but see what you think.

But that doesn't include the code for option1, does it? You said you finished that one already. If you could post your code for reading in user input I can see what the format of the buffer is so I can help you further.

do you program much in 8086?

No, almost never. I had to program it for a study course though but that was quite easy with 3 years of win32asm experience. It's annoying when you're used to 32-bit registers and the full pentium instructions set to program in the restricted instruction set of the 8086 (have to use bx/si/di as base register, no shl reg, 4 etc.)
Posted on 2003-03-10 17:20:32 by Thomas
Some hints:
Accessing an element in a byte array
bx = pointer to start of array

di = 0-based index in array:
mov al, [bx][di] ; al = array[di]


Alternatively, you could have a direct pointer to an element, like a C style char *. For example, you can initialize the pointer to the base of an array:


.data?
array db 25 dup (?)
.code
mov bx, array ; bx points to array now


And then access the elements:


mov al, [bx][0] ; al = first byte in array (index 0)
mov al, [bx][1] ; al = second byte in array (index 1)
mov al, [bx][5] ; al = sixth byte in array (index 5)


Or move the pointer to the next element:


mov bx, array ; bx points to first element in array
inc bx ; bx++, bx points to second element in array
add bx, 5 ; bx+=5, bx points to element with index 6 (array[1+5])


Format of a basic for-loop "for (X;Y;Z)"
_start_for:

; do [b]X[/b]
_for_loop:
; check for condition [b]Y[/b]
; if false, jump to _end_for. if true, do nothing and fall through

do stuff inside for loop

; do [b]Z[/b]
jmp _for_loop
_end_for:
Posted on 2003-03-10 17:30:41 by Thomas
Afternoon, evilz35.

I was mucking about with Vortexs' Fasm example on using the Masm32.lib file and decided to see if I could implement something similar to what you're doing.

Attached are the files (BAT, ASM, EXE, include) for "Scrontsofts Next-Big-Software-Thingy(tm)".

I doubt that it would help you very much in coding something similar in 8086 code, however it may give you a few ideas.

Cheers,
Scronty
Posted on 2003-03-11 03:58:01 by Scronty
here is the file for the work i have actually produced, the first one i posted was a old one
mainmenu:
mov ah, 0
mov al, 7
int 16
mov ah, 9
lea DX, menu
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu1
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu2
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu3
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu4
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu5
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, menu6
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, quit
int 33
mov ah, 9
lea DX, crlf
int 33
mov ah, 9
lea DX, message
int 33
jmp keywait


keywait:
mov ah,7
cmp al,'1'
je option1
cmp al,'2'
je option2

jmp keywait
int 33

option1:

mov ah, 0
mov al, 7
int 16
mov ah, 9
lea DX, opt1
int 33
mov AH, 63
mov CX, 20
lea DX, text
mov BX, 0
int 33
sub AX, 2
mov lenght, AX
jmp mainmenu

option2:

mov ah, 0
mov al, 7
int 16
mov AH, 9
lea DX, text
int 33



hlt
menu db 'assignment-menu$'
menu1 db '1.enter a string$'
menu2 db '2.print out the string$'
menu3 db '3.print out string in reverse$'
menu4 db '4.menu optin four$'
menu5 db '5.menu optin five$'
menu6 db '6.menu optin six$'
quit db '7.quit$'
message db 'select an option$'
text DB '1234567890123456789012345'
crlf db 13, 10, 36
lenght DW '0'
choice DW '1234567890123456789012345'
opt1 DB 'Enter a string $'
Posted on 2003-03-11 04:14:00 by evilz35
Your code didn't work on my PC, here's a shorter and working versin of what you already had:
    mov ah, 0

mov al, 7
int 10h
mainmenu:
mov ah, 9
mov dx, menu
int 21h

keywait:
mov ah, 0
int 16h

cmp al, '1'
je option1
cmp al, '2'
je option2
cmp al, '7'
je option7
jmp keywait

option1:
mov ah, 9
mov dx, opt1
int 21h
mov ah, 0Ah
mov dx, textBuffer
int 21h
mov ah, 9
mov dx, crlf
int 21h
jmp mainmenu

option2:
xor ch, ch
mov cl, [readBytes]
test cl, cl
jz endPrint
mov si, textData
mov ah, 6
printLoop:
mov dl, [si]
inc si
int 21h
loop printLoop
endPrint:
mov ah, 9
mov dx, crlf
int 21h
jmp mainmenu


option7:
ret

menu db 'assignment-menu', 0Dh,0Ah
db '1.enter a string', 0Dh,0Ah
db '2.print out the string', 0Dh,0Ah
db '3.print out string in reverse', 0Dh,0Ah
db '4.menu optin four', 0Dh,0Ah
db '5.menu optin five', 0Dh,0Ah
db '6.menu optin six', 0Dh,0Ah
db '7.quit', 0Dh,0Ah
db 'select an option', 0Dh,0Ah, '$'
crlf db 0Dh,0Ah,'$'
opt1 db 'Enter a string: $'


textBuffer:
maxLen: db 25 ; number of bytes in buffer (equals textBuffer[0])
readBytes: db 0 ; number of bytes read (uninitialized) (equals textBuffer[1])
textData: db 25 dup(?) ; the buffer itself (equals textBuffer[2]+)



Tip: have a look here: http://www.geocities.com/codeteacher/x86asm/asml1008.html.

Thomas
Posted on 2003-03-11 04:45:13 by Thomas
the program i use to do all this kind of work in is sims 8086 and the corrected program you have given me does not work in there. i have sent u the program try it for yourself. why does it not work?
Posted on 2003-03-11 07:31:27 by evilz35