Skip to content

Releases

CopperBasic 1.2

Choose a tag to compare

@MaterzokMateusz MaterzokMateusz released this 15 Nov 08:37
d3f9b31

CopperBASIC 1.2 can now put the HUD at the top, bottom, left or right of the screen, and games can span up to 9 disks. Everything was checked in the built-in test emulator, not on a real Amiga, and the floppy loading code especially needs a real-hardware test.

HUD position. SCREEN now takes a third value: SCREEN 4, 32, HUD_TOP, SCREEN 4, 64, HUD_RIGHT, and so on.

Top and bottom panels cost nothing: the copper switches between the HUD and the playfield at the dividing line. Sprite y = 0 is still the first line of the playfield, below a top panel.
Left and right panels can be 16 to 128 pixels wide. The Amiga can’t split one screen line into two areas that scroll separately, so the playfield keeps all 256 lines and scrolls underneath. The blitter then draws the panel on top every frame.
A 64-pixel panel cost about 7% of a frame (22.6% → 29.9% frame load). An earlier version also had a bug where old copies of the panel scrolled away with the map; that is fixed.
Enemies drawn by the blitter (BOBs) go behind the panel. Hardware sprites always appear in front of it, so the game must keep its sprites out of the panel area.
The map and the camera still use the full 320-pixel width. Keep the action inside the play area using the new VIEWX and VIEWW constants.
Text and bars (TEXT, TEXTNUM, HUDBAR, HUDCLS) use the panel’s own coordinates wherever it sits, so tall, thin gauges work in a side panel.
New constants: VIEWX, VIEWY, VIEWW (where the playfield is on screen) and HUDX, HUDY, HUDW (where the panel is).

Multi-disk games

Banks: put asset lines between BANK name, disk and END BANK. They stay on that disk until LOADBANK name reads them in. All banks share the same memory, so only one is loaded at a time, but together they can be far bigger than the Amiga’s memory. A bank can have its own tiles, map, BOB images, sprites and music.
One file per disk: compiling writes game.adf (the boot disk) plus game_disk2.adf, game_disk3.adf, and so on.
Loading: once the game runs, the operating system is switched off, so I wrote a new low-level floppy loader. It drives the disk drive directly and checks every sector, re-reading any that come back damaged.
Disk identity: each disk carries a random ID for that build plus its disk number. Disks from other games, or from an older build of the same game, are refused.
New commands: WAITDISK n, DISKNUM() (which disk is in the drive), BANKLOADED().
During loading the screen keeps showing the last frame, so a “PLEASE INSERT DISK 2” message stays up. Music from the main program keeps playing; music that belongs to a bank is stopped first.

String Support:

What you can do with strings:

Variables: name$, arrays like names$(9) or two-dimensional grid$(2, 3), and an optional maximum length with * n (1–255 characters, default 255). Text longer than the maximum is cut.
Joining and comparing: + joins strings. =, <>, <, >, <= and >= work in IF, WHILE, UNTIL and SELECT CASE, including ranges like CASE "A" TO "M".
Functions: LEN, LEFT$, RIGHT$, MID$, STR$ (with optional zero padding), VAL (also reads $hex), CHR$, ASC, INSTR, UCASE$, LCASE$, TRIM$, STRING$, SPACE$ and HEX$.
Procedures: string parameters (PROC Show(msg$)), LOCAL strings, and functions that return strings (FUNC Pad$(n)), including recursive ones.
Data and printing: DATA "ALICE", 25000 with READ n$, s, SWAP a$, b$, and TEXT/PTEXT with any string expression..

INKEY$ (or INKEY$()) returns the next typed character, or "" if nothing was typed.
It uses the US keyboard layout, with Shift and Caps Lock working.
Special keys return character codes: Return 13, Backspace 8, Esc 27, Del 127, cursor keys 28–31, F1–F10 129–138, Help 139.
Up to 15 keys wait in a buffer, so nothing is lost even if a frame runs long.
KEYDOWN(code) is TRUE while a key is held. Any number of keys can be held at once, Shift, Ctrl, Alt and the Amiga keys included. It’s the keyboard version of JOY(), for steering and firing.
CLEARKEYS throws away keys typed earlier. Use it before asking a question so old keypresses aren’t taken as the answer.
KEY_ constants name every key for KEYDOWN: KEY_LEFT, KEY_SPACE, KEY_ESC, KEY_F1, KEY_A…KEY_Z, KEY_0…KEY_9 and more. They refer to key positions, so they work the same with any keyboard language.
--keys option for the test emulator, e.g. --keys "50:HELLO,100-160:left", to type text or hold keys in previews.

Release 1.1

Choose a tag to compare

@MaterzokMateusz MaterzokMateusz released this 15 Nov 04:12
d3f9b31
Release1.1

Create readme