Ad Space — Top Banner

Improper argument

Amstrad Amstrad CPC

Severity: Minor

What Does This Error Mean?

Improper argument means you passed a value outside the valid range to a BASIC function or command. For example, INK with a colour above 26, or MODE with a value other than 0, 1, or 2. Check the command's documentation and fix the argument.

Affected Models

  • Amstrad CPC 464
  • Amstrad CPC 664
  • Amstrad CPC 6128
  • Amstrad CPC Plus
  • WinAPE emulator

Common Causes

  • INK, PAPER, or BORDER with a colour number above 26
  • MODE with a value other than 0, 1, or 2
  • SOUND command with out-of-range parameters
  • POKE with an address outside 0-65535
  • CHR$() with a value outside 0-255

How to Fix It

  1. Check the valid range for the command you are using.

    MODE: 0, 1, or 2 only. INK: colour 0-26. CHR$: 0-255. POKE: address 0-65535, value 0-255.

  2. Add a bounds check before the command.

    Before INK 0, C add: IF C < 0 OR C > 26 THEN PRINT "Colour out of range" : STOP

  3. Print the variable value before the failing line to debug.

    Add PRINT C (or whatever variable is causing the issue) before the line that fails. This shows you the actual value that triggered the error.

Frequently Asked Questions

Why does the Amstrad CPC have 27 colours?

The CPC's hardware can display 27 colours (numbered 0-26) from its palette. The Gate Array chip generates these colours using combinations of red, green, and blue at three intensity levels (off, half, full).

What is the difference between Improper argument and Type mismatch?

Improper argument means the value is the right type (a number) but out of range. Type mismatch means the value is the wrong type entirely (a string where a number was expected).