8085 Assembly Program Help
I need help with an old 8085 Assembly Program - the purpose is to take a user input of a number between 0-255 (Does not check for user input error). It takes 8 inputs, and then displays the max, the min, and the average inputs.
I have the following code so far, but it's only capable of taking a number any amount of digits long, 8 times. It (I believe) finds the max, but won't display it. Any help would be greatly greatly appreciated.
BDOS equ 5
boot equ 0
keyin equ 1
keyout equ 2
sprint equ 9
cr equ 0Dh
lf equ 0Ah
mvi B,8 ;the B register holds the counter for how many inputs the user has left
lxi D,mess1 ;these three print the message at mess1, which is the program welcome message
lxi D,mess2 ;this piece prints the message at mess2 then jumps to getnum
start: lxi D,mess3 ;these three print the message at mess3, over and over
getnum: mvi c,keyin ;this piece gets user input, and reads a cr as the end of their input
jz mem ;if a cr is found, it jumps to mem
jnz getnum ;if no cr is found, it continues to take user input
mem: mov M,A ;the user input is moved into memory
inx H ;the buffer is increased by 1 for the next bit of user input to be stored into
dcr B ;the counter is decremented
jz pre ;if the counter is 0, then the program moves on to next loop
jnz start ;if the counter is not 0, the program takes more user input
pre: dcr h
next: mov A,E
hbig: mov A,H
print: lxi D,mess5
;these next lines, mess1-mess6, are messages seen by the user
mess1: db lf,cr,'Calculate averages, mins and maxes using this tool!',lf,cr,'$'
mess2: db lf,cr,'Type in a number between 0-255: $'
mess3: db lf,cr,'Type in another number between 0-255: $'
mess4: db lf,cr,'The average number was: $'
mess5: db lf,cr,'The highest number entered was: $'
mess6: db lf,cr,'The lowest number entered was: $'
buff: ds 40
sp0 equ $