[comp.sys.amiga] Console Question

carroll@unirot.UUCP (03/12/87)

   I have a couple of questions for the net:

     A> How to I translate the raw keycodes being sent when I set my
       IDCMPs to include RAWKEY?

     B> In trying to use a console device directly, by setting up IOStdReqs
       for the window, and giving the pointer in the io_data in the OpenDevice
       call, when I actually use the device, the speed is unbelievably slow.
       The code Im testing it with is a simple loop that sends the IOReq
        async, ( SendIO() ), and then checks the IO until it completes, then
       does a DoIO to write the inputted char to the screen. The throughput
       ends up being much less than that from a 300 bps modem. Why is it so
       slow? What is the console device doing? When I use the IDCMPs with
       VanillaKey, the speed is about 800% higher! With the same basic loop!

     C> As long as Im posting, Ill try my old Serial problem AGAIN. How
       can I check the carrier( Pin 5 serial port) on a modem without 
       directly looking at the memory location associated with the port?

          Oh, Incidentally, the compiler is Lattice 3.10, WB 33.37, kickstart
     1.2, Im not sure what version number on the kick. Its release 1.2.. and
     I looked at the dissasembled source for B>.. no ridicoulous quantities of
     code, or crazy loops or anything.

        Thanks in Advance,
            <MC>

  Please Reply to:
     ...!rutgers!carroll@aim.rutgers.edu
       or
     ...!rutgers!unirot!carroll
       or, if you have ARPANET access:
     carroll@aim.rutgers.edu

================================================================================ <MC>= Mark C. Carroll, Rutgers University Student, Part Time Programmer for
 Computer Systems and Methods of Somerville, NJ : (201)725-1373
================================================================================

carolyn@cbmvax.UUCP (03/12/87)

In article <407@unirot.UUCP> carroll@unirot.UUCP (mark carroll) writes:

>     A> How to I translate the raw keycodes being sent when I set my
>       IDCMPs to include RAWKEY?

See the 1.2 Enhancer booklet Intuition section for an example using
RawKeyConvert().  Since you'll probably ask, I think you can send NULL
for the kmap argument if you want translation according to the current
keymap.

>     B> In trying to use a console device directly, by setting up IOStdReqs
>       for the window, and giving the pointer in the io_data in the OpenDevice
>       call, when I actually use the device, the speed is unbelievably slow.
>       The code Im testing it with is a simple loop that sends the IOReq
>        async, ( SendIO() ), and then checks the IO until it completes, then
>       does a DoIO to write the inputted char to the screen. The throughput
>       ends up being much less than that from a 300 bps modem. Why is it so
>       slow? What is the console device doing? When I use the IDCMPs with
>       VanillaKey, the speed is about 800% higher! With the same basic loop!

First of all, your busy wait (checkio checkio...) slows other tasks down
by unnecessarily wasting the processor's time.  I'm sure you're not
busy waiting for your IDCMP messages.  You're probably using Wait().
You should be Wait()ing on a combined mask of (1<<window->UserPort->mp_SigBit)
|(1<<yourConsolePort->mp_SigBit).  When you wake up from signals = Wait(...)
you should compare signals to each of your masks (the 1<< things) and
handle all messages at each port whose signal bit is set.

Second, console device output has a much higher overhead than things
like Text() alone.  The console device provides lots of terminal features
such as autowrap, autoscroll, cursor, insert, delete, bold, italic,
etc.  It also keeps its own copy (in the ConUnit structure) of the
of the color, font, attributes, etc. which have been set for console
output via the CSI strings.  Every time you write to the console device,
it has to take control of the window's RastPort, save old RastPort values,
copy in the ConUnit ones, parse for CSI and ESC sequences, calculate if
wrap or scroll is needed, finally call Text(), then replace the old
RastPort values.

This is fine for human-speed things like echoing typed keyboard characters.
However, if you are doing higher speed things like a terminal program,
you must avoid single character console writes (and also single character
serial input).  Instead, you should read all the serial characters that
are available (use SDCMD_QUERY to find out how many) and you should
write them to the console.device in large groups if possible.  This
is the method used by 9600 baud capable terminal programs such as
CBM's product "AmigaTerm".


>     C> As long as Im posting, Ill try my old Serial problem AGAIN. How
>       can I check the carrier( Pin 5 serial port) on a modem without 
>       directly looking at the memory location associated with the port?

And I'll answer it again.  You send an SDCMD_QUERY to the serial.device.
Among the information returned in the io_Status field is the state of
Carrier Detect.  See the serial.doc in the appendices of a Rom Kernel
manual.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=