From: Frank K. <fbk...@zy...> - 2009-03-25 02:26:04
|
harlequin88 wrote: > I need help... ia have to do program on I8080 platform, but i have no > approach about it. Please if you help me i will be grateful. > > my problem is: > > Count up number of words, which count (addition) ASCII codes number (letter) > is bigger (greather) than 200. Write up result (achievement) in decimal > code. > > > an example: Old house is big. - word house has bigger count of ASCII code > than 200 so result will be 1. I've never done anything with 8080 - don't think Nasm will emit code for it - so we may not be able to help you much... The overall approach would be something like... get the address of your string into a register zero a register to use as an "ascii counter" zero a register to use as a "words over 200" counter top: get a character from the string into a register (8-bit) bump the string pointer register check if it's a zero (end of string) yes - is the "ascii counter" over 200? yes - bump the "words counter" either - go to exit no... check if it's a space (end of word) yes - is the "ascii counter" over 200? yes - bump the "words counter" zero the ascii counter goto top no... add this character value to the "ascii counter" goto top exit: ... however you do that on whatever OS your 8080 is running You may need an extra step in there to "print the result". I guess that's the "decimal code" you mention? You probably do that by dividing repeatedly by ten... the "remainders" are the digits you want to print - add '0' to each one to "convert" it from a digit to an ascii character. That's how you'd do it on 8086 - I assume 8080 has similar instructions(???). If you post what you've got so far, we *might* be able to help you debug it, even if it isn't x86/Nasm. "Code is code", I keep sayin'... Best, Frank |