Great Britain Ltd

by Alan Page

 

Issue 27

May/Jun 87

Next Article >>

<< Prev Article

 

 

Enthusiasts who started their hobby with the Sinclair ZX81 (shame on you! Ed.) may remember the original version of Great Britain Limited from Hessell Software. The player assumes the role of Chancellor of the Exchequer and each year for five years must carefully set the level of various taxes and social benefits. At the end of five years a General Election is held where only skilful Chancellors are re-elected to another five years in office. Get re-elected often enough and you are in the running for a Knighthood!

A permanent display keeps you in touch with the economic state of the Nation, quoting such things as unemployment, inflation, VAT, the balance of payments and, perhaps most important of all(!), your popularity rating. In the second and subsequent terms of office the going gets tougher and it takes considerable skill to get your party re-elected as any Prime Minister will tell you.

The Atari version is closely modelled on the ZX81 game with substantial additions to introduce colour and music. Two black panels containing information and instructions are found at the top and bottom of the screen, divided by a central panel of a colour appropriate for your chosen Party. Who said you can only have one background colour in Graphics 0?

A SPECIAL DISPLAY SCREEN

The program itself is quite straightforward but some of you may be interested in details of the display list so that you can use similar techniques in your own programs. I have included three tables which give most of the details necessary. Table 1 contains the complete display list. The first three numbers, and the number 16 which follows the two interrupts, represent blank scan lines which produce the border around the display and are set to divide the coloured panels of the display. Table 2 contains a full list of numbers to include in display lists to obtain different widths of blank border colour. Remember that in Mode 0, a normal line of text is 8 scan lines in depth. If you wish to set screen colours without having to type in the whole program, just type in lines 760 - 880.

The Assembly Language program of the two display list interrupts is shown in Table 3, together with an explanation of purpose of each machine code instruction. The machine code is stored in page 6, at location 1536 onwards. The third number of the DLI corresponds to the colour which is subsequently loaded into the background colour register located at D018 Hex. The colour number is shown as a 0 in Table 3 but before the DLI is used the colour DATA is POKEd into the third byte of the DLI by program lines 910 - 930. The formula for the colour data is : COLOUR NUMBER * 16 + LUMINANCE. For the Conservative Party, for example, instead of using SETCOLOR 2,7,4 to obtain blue, the machine code equivalent is 116 ('7 * 16 + 4). The colour data is loaded into the hardware register for immediate effect and not into the shadow register which is only copied into the hardware register during the Vertical Blank Interrupt occurring at the end of drawing the whole screen.

Since there are two DLI's during the drawing of the screen, each loading the hardware register with a different colour, it is necessary at the end of each interrupt to reset the start address of the interrupt to be used next. The low byte of this address is stored in location 512 ($200).

The most annoying thing about a program with multiple interrupts is the presence of the cursor and the question mark on the screen. The cursor is made invisible by POKE 752,1 and the question mark can be avoided by opening a channel to the screen editor for input and output at line 420. All inputs are then of the form INPUT #1, variable name. The screen editor echoes the input to the screen so that you can see what is typed in, and correct it if necessary, but does not display a question mark.

IN CONCLUSION

The music is provided to offer light relief in between your struggles with mounting inflation and unemployment. When you have heard enough just press START.

The original algorithms for calculating the effects of taxes and expenditures are unchanged from the ZX81 version. Now is the time for all you budding economists out there to fathom out how the algorithms work and to design some additional modules. How about the selling of National assets or Nationalisation or the effects of curbing local government spending?

ACKNOWLEDGEMENTS

My thanks to Simon Hessel for kind permission to publish Great Britain Limited.

My thanks to Michael Doolan for help and advice with the music.

________________

 

AtariLister - requires Java

 

Table 1 - Display List - Mode 0 Screen

Each display list entry is numbered for the sake of clarity. These line numbers are not entered into the program.

Line

Display List Instruction

Purpose

     

1

112

Eight blank scan lines

2

112

Eight blank scan lines

3

48

Four blank scan lines

4

66 (64+2)

Load Memory Scan plus one mode 0 line.

5

64

Low byte of start of screen memory.

6

156

High byte of start of screen memory.

7

2

Mode 0 line

8 - 11

2 (each line)

Total 4 mode 0 lines

12

130 (128+2)

Display List Interrupt plus mode 0 line

13

16

Two blank scan lines

14

2

Mode 0 line

15 - 25

2 (each line)

Total 11 mode 0 lines

26

130 (128+2)

Display List Interrupt plus mode 0 line

27

16

Two blank scan lines

28

2

Mode 0 line

29 - 31

2 (each line)

Total 3 mode 0 lines

32

65

Jump Vertical Blank (to following address)

33

50

Low byte of start address of display list

34

6

High byte of start of display list

 

 

Table 2 - Blank Lines

 

Display List Instruction

Number of blank

scan lines

   
0 1
16 2
32 3
48 4
64 5
80 6
96 7
112 8

 

 

Table 3 - DISPLAY LIST INTERRUPTS

 

Assembled code (Hexadecimal)

Assembly Language

Purpose

 

 

 

First Interrupt

 

 

48

PHA

Stores accumulator on stack.

A9 00

LDA# 50

Load accumulator with colour data.

8D OA D4

STA WSYNC

Synchronises interrupt with start of a new scan line.

8D 18 DO

STA COLOR

Stores colour data into hardware register for background colour.

A9 10

LDA# $10

Load accumulator with 16 decimal.

SD 00 02

STA $200

Store accumulator in $200 (location 512) to direct the next DLI to the 2nd interrupt.

68

PLA

Restore the original contents of the accumulator from the stack.

40

RTI

Return from Interrupt.

 

 

 

Second Interrupt

 

 

48

PHA

 

A9 00

LDA # $0

Load colour number - 0 for black.

8D 0A D4

 STA

WSYNC

8D 18 D0

STA

COLOR

8D 18 02

STA $200

Stores 0 in location 512 to point to first interrupt

68

PLA

 

40

RTI

 


top