Enter multiple values and display them all at once
- From: "Chris" <spamtrap@xxxxxxxxxx>
- Date: 17 Oct 2006 13:13:32 -0700
I'm trying to input name, age and pay rate and then have them display
all at once. The problem is, only the pay rate is displaying and its
becoming quite frustrating. Here is my code, any ideas?
[code]
DOSSEG
..MODEL small
..STACK 100h
..DATA
NAMESTRUCT LABEL BYTE
AGESTRUCT LABEL BYTE
RATESTRUCT LABEL BYTE
MaxLen DB 20
ActLen DB ?
NameField DB 20 DUP('-')
DB '$'
RateField DB 6 DUP('-')
DB '$'
AgeField DB 3 DUP('-')
DB '$'
NamePrompt DB 'Enter name: ', '$'
AgePrompt DB 'Enter your age: ', '$'
RatePrompt DB 'Enter your hourly wage: ', '$'
..CODE
start:
mov ax,@DATA
mov ds,ax
mov cl,12d
call clrscr
getname:
;Get the name
mov dx,0000
call movecursor
call showname
call GetNameInput
mov bh,00h
mov bl,ActLen
call clrscr
;Get the age
mov dx,0000
call movecursor
call showage
call getAgeInput
mov bh,00h
mov bl,ActLen
call clrscr
;Get the rate
mov dx,0000
call movecursor
call showrate
call getRateInput
mov bh,00h
mov bl,ActLen
call clrscr
; If nothing is enter, then exit the program
cmp ActLen,00
jne displayname
jmp exit
displayname:
call centeranddisplay
call clearName
jmp getname
exit:
mov ax,4C00h
int 21h
showAge PROC near
lea dx,AgePrompt
mov ah,09h
int 21h
ret
showAge ENDP
showname PROC near
lea dx,NamePrompt
mov ah,09h
int 21h
ret
showname ENDP
showrate PROC near
lea dx,RatePrompt
mov ah,09h
int 21h
ret
showrate ENDP
getAgeInput PROC near
lea dx, AGESTRUCT
mov ah,0Ah
int 21h
ret
getAgeInput ENDP
getRateinput PROC near
lea dx, RATESTRUCT
mov ah,0Ah
int 21h
ret
getRateinput ENDP
GetNameInput PROC near
lea dx, NAMESTRUCT
mov ah,0Ah
int 21h
ret
GetNameInput ENDP
centeranddisplay PROC near
;Set Cursor Position
mov bh, 0d
mov ah, 02h
mov dh, 12d ; Sets the row
mov dl, 40d ; Sets the column
int 10h ; BIOS Video Interrupt
; Print name
mov ah, 09h
lea dx, NameField
int 21h
;Set Cursor Position
mov bh, 0d
mov ah, 02h
mov dh, 13d ; Sets the row
mov dl, 40d ; Sets the column
int 10h ; BIOS Video Interrupt
; Print age
mov ah, 09h
lea dx, AgeField
int 21h
;Set Cursor Position
mov bh, 0d
mov ah, 02h
mov dh, 14d ; Sets the row
mov dl, 40d ; Sets the column
int 10h ; BIOS Video Interrupt
; Print rate
mov ah, 09h
lea dx, RateField
int 21h
ret
centeranddisplay ENDP
clearName PROC near
mov cl,MaxLen
mov si,0000
clearloop:
mov NameField[si],20h
inc si
loop clearloop
ret
clearName ENDP
clrscr PROC near
mov cx,0000
mov dx,184Fh
mov bh,07
mov ax,0600h
int 10h
ret
clrscr ENDP
movecursor PROC near
mov ah,02h
mov bh,00
int 10h
ret
movecursor ENDP
END start
[/code]
.
- Follow-Ups:
- Re: Enter multiple values and display them all at once
- From: Frank Kotler
- Re: Enter multiple values and display them all at once
- Prev by Date: Re: GCC inline assembly
- Next by Date: Re: Sending/returning values to MFC/Microsoft functions
- Previous by thread: GCC inline assembly
- Next by thread: Re: Enter multiple values and display them all at once
- Index(es):
Relevant Pages
|