Programming AmigaOS in BASIC

Opening a Screen

AmigaOS supports a concept called screens, which is a display setup of a specific resolution and color depth, limited by the Monitor drivers and the CRT or LCD used used. On the classic Amigas, they can use low or medium resolutions with colour depths from 4 to 256 colours. Amigas with graphic cards can support higher resolutions with 65K or 16M or more colours and use the Picasso96 or CyberGraphics libraries to support these cards. Screens are part of the intuition library.

If you do not wish to open a screen then an application can be opened on the current default Workbench screen. This is known as a public screen which means that multiple applications can run on the same screen rather than different screens.

A screen is useful, if you wish to use a specific resolution and colour depth for your application, games will commonly use their own screens to suit itself.

There are a number of functions available to open a screen:

SCREEN - Open a screen
SCREEN(n)
- Return information about a screen
SCREEN BACK n - Send a screen to the back of another screen
SCREEN FORWARD n - Send a screen to the front of other screens
SCREEN CLOSE n - Close a screen

Open a Screen using SCREEN command

This command allows you to create a new screen for your application.

Format of the command is:

SCREEN screen-id, width, height, depth, mode

where:
screen-id = 1 to 255
width = Width of the screen in pixels, e.g. 320,640 etc
height = Height of the screen in pixels e.g. 200, 256, 512
depth = Number of colour planes 1-8. Number of colours = 2 ^ depth
mode = screen mode (1-6)

Screen modes:
1 = low resolution (lores)
2 = high resolution (hires)
3 = lores, interlaced
4 = hires, interlaced
5 = HAM (hold and modify) ACE Basic only
6 = Extra halfbrite. ACE Basic only

Example, a high resolution screen with a depth of 8 planes (2^8 = 256 colours).

SCREEN 1,640, 480, 8, 4
SLEEP FOR 30 ' Wait for 30 seconds
SCREEN CLOSE 1
END

Using the Screen function

In ACE Basic the following SCREEN function will provide the following information about the current screen:

SCREEN(0) = Return pointer address to the intuition window.
SCREEN(1) = Return pointer address to the intuition screen.
SCREEN(2) = Return pointer to the rastport of the default or current window
SCREEN(3) = Return pointer to the screen's viewport.
SCREEN(4) = Return pointer to the screen's bitmap.
SCREEN(5) = Return width of the screen's font.
SCREEN(6) = Return height of the screen's font.

CLS - Clears the current window or screen.
CSRLIN - Returns the print line in the current user-defined screen or window.
PALETTE - Changes colour of palette using RGB values.

 

Next Page