[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.3.1 Mode (%M)

The Mode command is the primary means of setting the Graphics mode. The single argument specifies which Cogsys mode to switch into.

Currently, only PCX-format images can be used in Cogsys. A variety of pixel depths and image sizes can be used. The %M command, along with the %C command, work in concert to allow presentation of PCX images. If no images are used, the %C command is not needed.

NOTE: If Voice Recognition (#A) is used, the %M command MUST precede the #A command. Otherwise, Voice Recognition will not work.

This is the relationship between Cogsys modes and Graphics modes:

Cogsys Mode Images/Extensions Description
0 No/No Text Mode, 80 columns by 25 rows (30 rows after exiting from graphics mode)
1 Yes/No Black & White Graphics, 640x480, 2 colors
2 Yes/Yes Grayscale Graphics, 640x480, 256 grayscale levels
3 Yes/No Color Graphics, 640x480, 16 text colors, 256 image colors
4 No/No Text/Graphics Hybrid, 640x480, 26-point font
5 No/No Text/Graphics Hybrid, 640x480, 72-point font

If a testlist uses mode 1 or higher, the video adapter on the run time system must have a frame buffer video module available to be run by the code (1.2.1 Requirements). A typical video adapter is the ATI Mach64 adapter, which uses video module `atyfb.o'.

Cogsys will always start and stop in mode 0. However, once the video module is installed into the kernel, it is impossible to remove without rebooting. By default, the video module is installed only after a testlist requests "graphics" mode.

NOTE: Before the video module is installed the console is in "80 columns/25 rows" text mode. After the video module is installed (eg. after a testlist calls %M with a number higher than zero) the console is in "80 columns/30 rows" text mode.

The text modes are those which can only display a certain set of characters at fixed locations on the screen. Currently, the only Cogsys "true" text mode is 0. There are two "text/graphics hybrid" modes (4 and 5), which transform a "text" testlist into a "graphics" testlist by putting a %M4 or %M5 at the start of the testlist. Characters in Modes 0, 4, and 5 are placed on the screen in row/column coordinates using the @yyxx command.

The graphics modes 1, 2, and 3 can access every pixel on the display. Text can be output to the screen using the #G command, preceded by the %A 2.3.4.9 Graphics-Mode Text/Shape Attributes (%A) command, which specifies justification, x/y pixel location, color, and font type.

Switching into a graphics mode automatically loads the default fonts and initializes the graphics environment. Switching back to text mode automatically unloads the fonts, but does NOT remove the graphics driver.

If a testlist is going to switch modes, it is good practice to explicitly put a Mode command at the top of the testlist. This immediately identifies those lists which need graphics capabilities. It is possible to switch between modes -- from "graphic stimuli" to "text instructions", for example -- but this is not recommended in standard practice.

Name:
Mode
Class:
Video Control
Code:
%M
Syntax:
%Mmodenum
%M[modenum,fontpath]
modenum is a integer from 0-2 representing the Cogsys mode
fontpath is the path where fonts should be loaded from (hard-coded to `/fonts/'
System:
Switches into Cogsys mode modenum.
History:
The Cogsys 4 Mode command is completely redesigned.
Test Files:
MODE_T01.IN: Tests basic operation

 
@C%M0
This is "true" text Mode 0.  
The \@xxyy command places the
text at row/column locations (the top row is row zero, and
the first column is column zero).  
@0703This text starts at row "7", column "3".#W5000

Press any key to go to text/graphics hybrid mode 4#R

@C%M4
This is text/graphics "hybrid" Mode 4.  
The \@xxyy command places the
text at row/column locations (the top row is row zero, and
the first column is column zero).  
@0703This text starts at row "7", column "3".#W5000

Press any key to go to text/graphics hybrid mode 5#R

@C%M5
This is text/graphics 
"hybrid" Mode 5.  
@0603This text starts 
at row "6", column "3".#W5000

Press any key to go 
to full graphics mode 1#R

@C%M1
#G[Default location, justification, size, and color of text]
%A[Y270]#W3000
#G[This is Graphics Mode 1: Text is either black or white]
%A[Y300]#W3000
#G[No extensions are allowed in Mode 1]
%A[X100,Y320,J1,C1,F0]#W3000
#G[Text Command: %A|X100,Y320,J1,F2|]
%A[Y400,F3]#W3000
#G[Text Command: %A|Y400,F3|]
%A[Y430]#W3000
%C1%Q[m1c1.lst]#B[1,250]#B[1,250]
#G[This is an example 640x480 image]#W5000
@C#G[Press any key to go to Graphics Mode 2]#R

Examples:

input
%M2#G[hello from graphics mode!]#W5000%M0
cogsys
Switches to Cogsys mode 2 (640x480x256 colors), displays the string, waits 5 seconds, and returns to text mode. The string is displayed in the default font, size, color and justification at the location 0,0 (top left of the screen).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November, 24 2008 using texi2html