Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2002 09:20:11 -0400 (EDT)
From:      John Mills <jmmills@telocity.com>
To:        Z Kuang <zhiwenkuang@hotmail.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: your mail
Message-ID:  <Pine.LNX.4.21.0205080908180.2883-100000@otter.mills-atl.com>
In-Reply-To: <F101NWep4CMxfqclwml000125ec@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 8 May 2002, Z Kuang wrote:

> The program now generates paper tape output. This format is based on the 
> well
> known 'Morse Code', which consists of 'dots' and 'dashes'. On paper tape, a
> 'dash' is represented by a hole in the bottom half of the paper, and a 'dot'
> by a hole in the top half. The program simulates the hole by printing the
> letter 'o'.

Morse code is strictly sequential ('dots' and 'dashes' do not overlap, 
and their order is significant), and also includes inter-character and
inter-element delays. I suggest a 'space' between characters.

> The Morse Codes for hex digits are as follows:
> 
> A  .-
> B  -...
> C  -.-.-
> D  -..
> E  .
> F  ..-.
> 0  -----
> 1  .----
> 2  ..---
> 3  ...--
> 4  ....-
> 5  .....
> 6  -....
> 7  --...
> 8  ---..
> 9  ----.

> The paper tape output for the number BAD would now be:
> 
> oooo  oo
> o    oo

I would thus have expected:
-
  ooo o   oo
 o     o o
-

I suggest you first write your program in 'C' (or some other mid-level
language if you don't know 'C'), then recode in assembly. I suggest this
because you will have to create a data structure which includes at least
two lines of characters, and your entire hex number into those lines, then
print out the first line, a 'newline', the second line, and another
'newline'.

Of course you can print the hex values to the screen in the order they are
typed.

I recommend 'C' because it is easy to write low-level logic and data
structures in 'C'.

Naturally this is not the most expert way to write a program, but you need
to 'divide and conquer' the parts of the assignment one at a time.

 - John Mills


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0205080908180.2883-100000>