[net.micro.amiga] Console device question

shives@decwrl (04/26/86)

	I have been struggling with this problem and I hope that someone in net 
land can help. In the Rom Kernal Manual in the chapter on the Console Device 
there is a program called "cons.c".  I have verified that I have typed in the 
program correctly. So I am not sure what to do next.

	The symptoms seem to be that it skips commands. The first command is
ConWrite ("Hello World/r/n",14), but I do not get that line. I do get the line 
saying "testing BACKSPACE" but then the cursor does not move backwards. I get 
the next "testing" line but the cursor does not do it.  this continues for the  
calls o ConPutChar primarily. It sort of straightens out for the calls to 
ConPutStr (it displays the text and move the cursor correctly) except I never 
get a Carriage Return - Linefeed.

	I have tried every combiniation I can think of, and don't see that I am 
missing anything according to the documentation.  Has anyone else tried this 
program?  Could someone at Commodore check the documentation and see if there 
are any mistakes? 

			Thanks in advance for any and all help.

				Mark Shives
dec-rhea!dec-glory!shives
DECNET- GLORY::SHIVES

randy@cbmvax (04/29/86)

In article <2563@decwrl.DEC.COM> shives@glory.DEC (Mark Shives) writes:
>
>... In the Rom Kernal Manual in the chapter on the Console Device 
>there is a program called "cons.c".  I have verified that I have typed in
>the program correctly...
>
>	The symptoms seem to be that it skips commands... 
>
>				Mark Shives
>dec-rhea!dec-glory!shives
>DECNET- GLORY::SHIVES

Mark,

   I have typed and run the program without any problems. Therefore, I
can offer the following suggestions:

   First, which compiler are you using. My guesss is that it is the Manx
Aztec-C. Note that this compiler defaults an 'int' to 16-bits. The Amiga
libraries expect a 32-bit int., for example: the io_length field
of the device request block. The quick solution is to use the +L (??)
option that forces all ints to 32-bits. The suggested solution (refer
to the Aztec manual) is to cast/coerce the value being passed (to
ConWrite, amoung others) as long.

  If you are using the Lattice compiler, then there is a high probability 
that a typo exists. Did you copy the entire example from cons.c, or did
you make use of previous code fragments to build the working example?
I am grasping at straws here since I have no reason to think there
is anything wrong with the example, as I have said, I have a working
copy (and it is the same as the printed example).

   Let me know how you make out.

-- 
Randy Weiner -- Commodore Business Machines <<Amiga Technical Support>>
		uucp: {ihnp4|seismo|caip}!cbmvax!randy
		arpa: cbmvax!randy@seismo.css.GOV
		TEL:  215-431-9180

hr@uicsl.UUCP (05/08/86)

RE:
	"..In the Rom Kernal Manual in the chapter on the Console Device 
	there is a program called 'cons.c'...."

I have just spent the better part of a weekend struggling with the same
program. Different problems though. I believe I have it working now.

My question is: What are the legalities of mailing/posting programs
we type in from the Amiga manuals? The manuals are copyrighted, and
I have a note from Mr. Street saying that I am to treat all materials
as confidential. While keeping secret programs that are publicly
available, seems a bit strange, I don't want to mess up my chances
of receiving V1.2!

----

	harold ravlin		{ihnp4,pur-ee}!uiucdcs!uicsl!hr

randy@cbmvax.cbm.UUCP (Randy Weiner) (05/13/86)

In article <151400028@uicsl> hr@uicsl.UUCP writes:
>RE:
>	"..In the Rom Kernal Manual in the chapter on the Console Device 
>	there is a program called 'cons.c'...."
>...
>My question is: What are the legalities of mailing/posting programs
>we type in from the Amiga manuals? The manuals are copyrighted, and
>I have a note from Mr. Street saying that I am to treat all materials
>as confidential. While keeping secret programs that are publicly
>available, seems a bit strange, I don't want to mess up my chances
>of receiving V1.2!


   Example programs found in RKM are copyrighted, etc. At the
same time, they are considered to be in the public domain and
you may freely use these programs, or distribute them. If you
redistribute them, you should make sure that the header, attributing
these programs to Commodore, is not removed.

A quick note about cons.c, this program must be compiled under
version 3.03 of the compiler. It does not work under 3.02!!!

-- 
     + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
Randy Weiner -- Commodore Business Machines <<Amiga Technical Support>>
		uucp: {ihnp4|seismo|caip}!cbmvax!randy
		arpa: cbmvax!randy@seismo
		(or)  randy@cbmvax.UUCP@{seismo | harvard}
		TEL:  215-431-9180

hr@uicsl.UUCP (05/14/86)

RE:
	"...>there is a program called 'cons.c'..."

	"...I have typed and run the program without any problems..."

I had a lot of problems and I may have found a bug because of
them. I believe the goto labels 1-9 are off by a row. If an Openxxxx
call fails, the program jumps to the matching Closexxxx. Guess what
happens if CloseLibrary is passed a null pointer?

Are the first two OpenLibrary calls necessary?
----

	harold ravlin		{ihnp4,pur-ee}!uiucdcs!uicsl!hr

lbg@gitpyr.UUCP (Lee B Grey) (05/17/86)

In article <2563@decwrl>, shives@decwrl writes:
> 
> 	The symptoms seem to be that it skips commands. The first command is
> ConWrite ("Hello World/r/n",14), but I do not get that line. I do get the line 
I believe that all your problems would be solved if you were to change your
"/"s to "\"s.  All of those control-character codes (\n, \t, \b, \r, ...)
use the back-slash, not the regular slash.  I can hear you blushing. :-)

Lee

randy@cbmvax.cbm.UUCP (Randy Weiner) (05/19/86)

In article <151400032@uicsl> hr@uicsl.UUCP writes:
>
>	"...>there is a program called 'cons.c'..."
>
>	"...I have typed and run the program without any problems..."
>
>I had a lot of problems and I may have found a bug because of
>them. I believe the goto labels 1-9 are off by a row. If an Openxxxx
>call fails, the program jumps to the matching Closexxxx. Guess what
>happens if CloseLibrary is passed a null pointer?

   I have compiled and run the console example called "cons.c" that
is found in the 1.1 version of the Rom Kernal Manual. It works as
listed. But, you must make sure that you are running the correct
version(s).

   The compiler MUST be version 3.03 (v1.1) AND, you should be certain
that the library files, Amiga.lib and Lc.lib were copied from the 
V1.1 release disk. This example will not run under V1.0 (3.02)!

>
>Are the first two OpenLibrary calls necessary?
>----

   For the dos.library, no. This library is opened by the startup
code, either Lstartup.asm or Astartup.asm. You can check this
yourself by looking at these files. They may be found on
the distribution disk, sub-dir "examples".

  I don't see any reason for including diskfont.library, 
there are no calls to the font library. You should be able
to remove the reference.


In general, I never assume a library base pointer is non-null.
Instead, I close as shown:
	if (dosBase) CloseLibrary(dosBase)

etc. etc.


-- 
     + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
Randy Weiner -- Commodore Business Machines <<Amiga Technical Support>>
		uucp: {ihnp4|seismo|caip}!cbmvax!randy
		arpa: cbmvax!randy@seismo
		(or)  randy@cbmvax.UUCP@{seismo | harvard}
		TEL:  215-431-9180