Classic Computer Magazine Archive ANTIC VOL. 6, NO. 11 / MARCH 1988

Type-In Software

Roman Numeral Translator

Losin' those MCMXXIV blues

By David Stone

ROMAN NUMERAL TRANSLATOR is a brief program that simplifies your life by converting mysterious MCMLXXIV into good old Arabic numerals 1974, etc. This BASIC program works on all 8-bit Atari computers with disk or cassette.

Erected MDCCCXCVII. Copyright MCMLXXIV. See Chapter XLIX. Aarrghh!

Yeah, now you know you got them Roman Numeral Blues! You look up a date or some other numeric information, and you find it coded in this antiquated format that's indecipherable to any self-respecting member of the computer age. Why couldn't they put those numbers into some easier form, such as reverse Polish hexadecimal bytes?

If you're like me, you don't appreciate being burdened with needless trivia just to determine that the building was erected in 1897, the book was published in 1974, or you should see Chapter 49. It's been a long time since I learned Roman numerals in school and I don't find it easy to remember information that I might actually need to use once every two or three years.

But now you have Roman Numeral Translator to take all those cryptic M's and X's and display their equivalent in good old standard Arabic 1,000's and 10's. Or, if you're strange enough to want to express your own numeric data in Roman numerals (Yechh!), my program will also convert from Arabic back to Roman.

ABOUT THE PROGRAM

Type in Listing 1, ROMAN.BAS, check it with TYPO II and SAVE a copy before you RUN it. At the prompt, simply type in either a Roman or an Arabic numeral, then press the [RETURN] key. Whichever type of number you entered, the value will now be displayed in both its Roman and Arabic forms.

To keep Roman Numeral Translator as short as possible, the program is designed to handle the kind of data that is normally encountered in the Roman numeral system. This means it is not equipped to convert exceptional mathematical cases such as negative numbers, non-integers, or the little-used feature of placing a bar over a Roman digit to multiply its value by 1,000.

Also, syntax-checking is beyond the scope of this small program, so if you enter a number that does not follow the legal structure of either the Roman or Arabic numbers, you'll probably get an inaccurate or meaningless result.

The Translator's main loop, lines 500-520, accepts input, calls the appropriate subroutine to do the conversion, and displays the result. The Roman-to-Arabic conversion takes place in the subroutine in lines 100-180, using the DATA line 600. (Line 600 contains both letters and numbers, so be sure to distinguish between the numeral 1 and the letter I.) Lines 200-290, plus the subroutine on line 50 and the DATA line 610, do the conversion from Arabic to Roman.

This is the first Antic appearance by David Stone, a freelance musician front St. Louis, Missouri. He has been enthusiastically programming his Atari 400 (now upgraded to 48K) since receiving it for Christmas in 1981.

Listing:ROMAN.BAS Download