Post by Jonathan Cauldwell on Jun 14, 2023 20:56:40 GMT
A while ago I promised to upload a very early still-in-development version of AGD Five for people to play with and let me know how they get on. Well, I've just resigned from my job and might have some free time to work on this soon - so here it is, attached to this thread.
The changes are massive, this is a huge step up from AGD 4.X so there will be lots of bugs. There's still stuff to implement but hopefully people can get a feel for how this is going to work and give me some feedback. Bear in mind that this is a RAM copy so you only have about 14K to play with for now, but then games like JetPac, Pssst and Sir Lancelot only used 8-9K and that included the engine. When this is finished it will go in a pair of 16K ROMs for the 128K machines and you'll have more RAM than AGD 4.X had.
The editors have a load of new surprises in. Three different sprite sizes are allowed in a game and as long as you have other sprites you can delete the first sprite. The terrible AGD 4.X sounds are gone and a new beeper sound editor is included; a variety of different sound effects can be constructed with a mixture of tones, white noise and silence at 3 different volumes. Echo effects are even possible. I've been inspired a little by AGDx and many other changes have been implemented.
I'm still working on documentation but basically the compiler has been written from scratch. You still have variables A-Z but they can now be paired together to form 16-bit variable pairs. So if A contains 0 and B contains 64 then AB contains 0 + 64 * 256, which is 16384, the first byte of the screen display. The second variable is multiplied by 256 and the first is added to it to give a 16-bit number. So LET A = 0 LET B = 64 POKE AB 255 writes a row of 8 pixels in the top left corner of the screen.
Functions are a new thing. For example, RND ( 100 ) returns a random number between 0 and 99 inclusive. Some functions return an 8-bit number to a variable, some return a 16-bit number to a variable pair and a few will work in both modes. For example, LET A = OBJSTATUS ( 1 ) puts the screen number of object 1 into A, whereas LET AB = OBJSTATUS ( 1 ) puts the address of that object's location into AB. The developer can then use PEEK and POKE with AB and the adjacent addresses to identify or manipulate the object's position and colour. Use your new powers carefully...
AGD 4.X would only allow evaluate single items at a time, so you could have (for example) LET A = 4. AGD Five allows two items separated by an operator. So LET A = B + C is okay. However, you can't go further than that so you can't do LET A = B + C + D because B + C + D is 3 items and 2 operators. You also have an extended range of operators where AGD 4.X only had 4, these include a bitwise AND, OR and EXCLUSIVE-OR. ADD, SUBTRACT, MULTIPLY and DIVIDE only work with variable pairs now so ADD A TO B won't work but ADD AB TO CD will add the 16-bit number held in AB (A and B) to the 16-bit number held in CD (C and D). To add A to B just use LET B = B + A as in Sinclair BASIC.
Did I mention we now have Currah Microspeech support? The new SAY command is followed by multiple numbers to indicate the sounds the unit should generate. You'll have to search for the documentation for the device (easy to find) and read the section for machine language programmers to understand which numbers represent the speech sounds you wish to use. Have a play, SAY 1 2 3 will probably produce some random nonsensical gibberish.
Here's the lexicon as it currently stands:
Operators
---------
= (equal)
<> (not equal)
<= (less than or equal to)
>= (greater than or equal to)
< (less than)
> (greater than)
+ (plus)
- (minus)
* (multiply)
/ (divide)
% (mod)
& (and)
| (or)
^ (xor)
8 Bit Variables
---------------
SCREEN
LIVES
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
LINE
COLUMN
CLOCK
OBJ
OPT
16-Bit Variable Pairs
---------------------
AB
CD
EF
GH
IJ
KL
MN
OP
QR
ST
UV
WZ
Sprite Parameters
-----------------
TYPE
IMAGE
FRAME
X
Y
DIRECTION
SETTINGA
SETTINGB
AIRBORNE
JUMPSPEED
Functions
---------
GOT
OBJSTATUS
RND
PEEK
IN
CANGOUP
CANGODOWN
CANGOLEFT
CANGORIGHT
LADDERABOVE
LADDERBELOW
TOUCHING
KEY
DETECTOBJ
COLLISION
SCRADD (16-bit screen address)
ATTRADD (16-bit attribute address)
BLOCKADD (16-bit block property address)
GETMESSAGE
SIN
COS
NEXTROW
( (function argument surround)
) (function argument surround)
Commands
--------
MESSAGE
LET
SPRITEUP
SPRITEDOWN
SPRITELEFT
SPRITERIGHT
CLS
CLW (clears window)
BORDER
COLOUR
SCREENUP
SCREENDOWN
SCREENLEFT
SCREENRIGHT
DISPLAY
GET
PUT
SHOWHIGH
SHOWSCORE
SHOWBONUS
SCORE
BONUS
ADDBONUS
ZEROBONUS
ANIMATE
ANIMBACK
NEXTLEVEL
RESTART
REMOVE
KILL
SOUND
BEEP
DELAY
MENU
INV
WAITKEY
JUMP
FALL
PUTBLOCK
SPRITEINK
ENDGAME
OTHER
SPAWNED
ORIGINAL
ASM (now takes multiple arguments)
EXIT
SPAWN
STOPFALL
REDRAW
SILENCE
EXPLODE
TRAIL
LASER
STAR
TICKER
DIG
PRINTMODE
POKE
OUT
CHR
AT
SAY (Currah Microspeech, multiple numeric arguments)
IF
ENDIF
ELSE
REPEAT
ENDREPEAT
ADD (16-bit variable pairs only)
SUBTRACT (16-bit variable pairs only)
MULTIPLY (16-bit variable pairs only)
DIVIDE (16-bit variable pairs only)
TO
FROM
BY
Have a play with it, enjoy yourselves, ask questions and give me some feedback please folks.
The changes are massive, this is a huge step up from AGD 4.X so there will be lots of bugs. There's still stuff to implement but hopefully people can get a feel for how this is going to work and give me some feedback. Bear in mind that this is a RAM copy so you only have about 14K to play with for now, but then games like JetPac, Pssst and Sir Lancelot only used 8-9K and that included the engine. When this is finished it will go in a pair of 16K ROMs for the 128K machines and you'll have more RAM than AGD 4.X had.
The editors have a load of new surprises in. Three different sprite sizes are allowed in a game and as long as you have other sprites you can delete the first sprite. The terrible AGD 4.X sounds are gone and a new beeper sound editor is included; a variety of different sound effects can be constructed with a mixture of tones, white noise and silence at 3 different volumes. Echo effects are even possible. I've been inspired a little by AGDx and many other changes have been implemented.
I'm still working on documentation but basically the compiler has been written from scratch. You still have variables A-Z but they can now be paired together to form 16-bit variable pairs. So if A contains 0 and B contains 64 then AB contains 0 + 64 * 256, which is 16384, the first byte of the screen display. The second variable is multiplied by 256 and the first is added to it to give a 16-bit number. So LET A = 0 LET B = 64 POKE AB 255 writes a row of 8 pixels in the top left corner of the screen.
Functions are a new thing. For example, RND ( 100 ) returns a random number between 0 and 99 inclusive. Some functions return an 8-bit number to a variable, some return a 16-bit number to a variable pair and a few will work in both modes. For example, LET A = OBJSTATUS ( 1 ) puts the screen number of object 1 into A, whereas LET AB = OBJSTATUS ( 1 ) puts the address of that object's location into AB. The developer can then use PEEK and POKE with AB and the adjacent addresses to identify or manipulate the object's position and colour. Use your new powers carefully...
AGD 4.X would only allow evaluate single items at a time, so you could have (for example) LET A = 4. AGD Five allows two items separated by an operator. So LET A = B + C is okay. However, you can't go further than that so you can't do LET A = B + C + D because B + C + D is 3 items and 2 operators. You also have an extended range of operators where AGD 4.X only had 4, these include a bitwise AND, OR and EXCLUSIVE-OR. ADD, SUBTRACT, MULTIPLY and DIVIDE only work with variable pairs now so ADD A TO B won't work but ADD AB TO CD will add the 16-bit number held in AB (A and B) to the 16-bit number held in CD (C and D). To add A to B just use LET B = B + A as in Sinclair BASIC.
Did I mention we now have Currah Microspeech support? The new SAY command is followed by multiple numbers to indicate the sounds the unit should generate. You'll have to search for the documentation for the device (easy to find) and read the section for machine language programmers to understand which numbers represent the speech sounds you wish to use. Have a play, SAY 1 2 3 will probably produce some random nonsensical gibberish.
Here's the lexicon as it currently stands:
Operators
---------
= (equal)
<> (not equal)
<= (less than or equal to)
>= (greater than or equal to)
< (less than)
> (greater than)
+ (plus)
- (minus)
* (multiply)
/ (divide)
% (mod)
& (and)
| (or)
^ (xor)
8 Bit Variables
---------------
SCREEN
LIVES
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
LINE
COLUMN
CLOCK
OBJ
OPT
16-Bit Variable Pairs
---------------------
AB
CD
EF
GH
IJ
KL
MN
OP
QR
ST
UV
WZ
Sprite Parameters
-----------------
TYPE
IMAGE
FRAME
X
Y
DIRECTION
SETTINGA
SETTINGB
AIRBORNE
JUMPSPEED
Functions
---------
GOT
OBJSTATUS
RND
PEEK
IN
CANGOUP
CANGODOWN
CANGOLEFT
CANGORIGHT
LADDERABOVE
LADDERBELOW
TOUCHING
KEY
DETECTOBJ
COLLISION
SCRADD (16-bit screen address)
ATTRADD (16-bit attribute address)
BLOCKADD (16-bit block property address)
GETMESSAGE
SIN
COS
NEXTROW
( (function argument surround)
) (function argument surround)
Commands
--------
MESSAGE
LET
SPRITEUP
SPRITEDOWN
SPRITELEFT
SPRITERIGHT
CLS
CLW (clears window)
BORDER
COLOUR
SCREENUP
SCREENDOWN
SCREENLEFT
SCREENRIGHT
DISPLAY
GET
PUT
SHOWHIGH
SHOWSCORE
SHOWBONUS
SCORE
BONUS
ADDBONUS
ZEROBONUS
ANIMATE
ANIMBACK
NEXTLEVEL
RESTART
REMOVE
KILL
SOUND
BEEP
DELAY
MENU
INV
WAITKEY
JUMP
FALL
PUTBLOCK
SPRITEINK
ENDGAME
OTHER
SPAWNED
ORIGINAL
ASM (now takes multiple arguments)
EXIT
SPAWN
STOPFALL
REDRAW
SILENCE
EXPLODE
TRAIL
LASER
STAR
TICKER
DIG
PRINTMODE
POKE
OUT
CHR
AT
SAY (Currah Microspeech, multiple numeric arguments)
IF
ENDIF
ELSE
REPEAT
ENDREPEAT
ADD (16-bit variable pairs only)
SUBTRACT (16-bit variable pairs only)
MULTIPLY (16-bit variable pairs only)
DIVIDE (16-bit variable pairs only)
TO
FROM
BY
Have a play with it, enjoy yourselves, ask questions and give me some feedback please folks.