rgbasm-old - Man Page

obsolete language documentation

Description

This is the list of features that have been removed from the rgbasm(5) assembly language over its decades of evolution, along with their modern alternatives. Its goal is to be a reference for backwards incompatibility, when upgrading an old assembly codebase to work with the latest RGBDS release. It does not attempt to list syntax bugs that were fixed, nor new reserved keywords that may conflict with old identifiers.

Removed

These are features which have been completely removed, without any direct alternatives. Usually these features were limiting the addition of other features, or had awkward limits on their own intended effects.

Automatic LD to LDH conversion (rgbasm -l)

Deprecated in 0.7.0, removed in 0.8.0.

rgbasm(1) used to automatically treat ‘LD’ as ‘LDH’ if the address was known to be in the $FF00-$FFFF range, with the -L flag to opt out. rgbasm(1) 0.6.0 added a -l flag to opt in instead.

Instead, use ‘LDH’, and remove the -L and -l flags from rgbasm(1).

Automatic NOP after HALT (rgbasm -H)

Deprecated in 0.7.0, removed in 0.8.0.

rgbasm(1) used to automatically insert a ‘NOP’ after ‘HALT’, with the -h flag to opt out. rgbasm(1) 0.6.0 added a -H flag to opt in instead.

Instead, use an explicit ‘NOP’ after ‘HALT’, and remove the -h and -H flags from rgbasm(1).

Nested macro definitions

Removed in 0.4.2.

Instead, put the nested macro definition inside a quoted string (making sure that none of its lines start with ENDM), then interpolate that string. For example:

MACRO outer
    DEF definition EQUS """
        MACRO inner
            println (\1) - (\\1)
        \nENDM"""
    {definition}
    PURGE definition
ENDM
    outer 10
    inner 3 ; prints 7

Negative DS

Removed in 0.3.2.

This was used to "rewind" the value of @ in RAM sections, allowing labeled space allocations to overlap.

Instead, use UNION.

__FILE__ and __LINE__

Deprecated in 0.6.0, removed in 0.7.0.

Instead, use WARN or FAIL to print a complete trace of filenames and line numbers.

_pi

Deprecated in 0.5.0, removed in 0.6.0.

Instead, use ‘3.141592653’.

Treating multi-character strings as numbers

Deprecated in 0.9.0.

Instead, use a multi-value CHARMAP, or explicitly combine the values of individual characters.

rgbgfx -f/--fix and -F/--fix-and-save

Removed in 0.6.0.

Instead, use ‘rgbgfx -c/--colors’ to explicitly specify a color palette. If using ‘-c embedded’, arrange the PNG's indexed palette in a separate graphics editor.

rgbgfx -D/--debug

Removed in 0.6.0.

Replaced

These are features whose syntax has been changed without affecting functionality. They can generally be updated with a single search-and-replace.

Defining constants and variables without DEF

Deprecated in 0.7.0, removed in 0.8.0.

EQU, EQUS, =, RB, RW, and RL definitions used to just start with the symbol name, but had to be typed in column 1.

Instead, use DEF before constant and variable definitions. Note that EQUS expansion does not occur for the symbol name, so you have to use explicit ‘{interpolation}’.

Defining macros like labels

Deprecated in 0.6.0, removed in 0.7.0.

Macros used to be defined as ‘name: MACRO’.

Instead, use ‘MACRO name’. Note that EQUS expansion does not occur for the macro name, so you have to use explicit ‘{interpolation}’.

Defining variables with SET

Deprecated in 0.5.2, removed in 0.6.0.

Variables used to be defined as ‘name SET value’.

Instead, use ‘DEF name = value’.

Global labels without colons

Deprecated in 0.4.0, removed in 0.5.0.

Labels used to be definable with just a name, but had to be typed in column 1.

Instead, use explicit colons; for example, ‘Label:’ or exported ‘Label::’.

'\,' in strings within macro arguments

Deprecated in 0.5.0, removed in 0.7.0.

Macro arguments now handle quoted strings and parenthesized expressions as single arguments, so commas inside them are not argument separators and do not need escaping.

Instead, just use commas without backslashes.

'*' comments

Deprecated in 0.4.1, removed in 0.5.0.

These comments had to have the ‘*’ typed in column 1.

Instead, use ‘;’ comments.

PRINTT, PRINTI, PRINTV, and PRINTF

Deprecated in 0.5.0, removed in 0.6.0.

These directives were each specific to one type of value.

Instead, use PRINT and PRINTLN, with STRFMT or ‘{interpolation}’ for type-specific formatting.

IMPORT and XREF

Removed in 0.4.0.

Symbols are now automatically resolved if they were exported from elsewhere.

Instead, just remove these directives.

GLOBAL and XDEF

Deprecated in 0.4.2, removed in 0.5.0.

Instead, use EXPORT.

HOME, CODE, DATA, and BSS

Deprecated in 0.3.0, removed in 0.4.0.

Instead of HOME, use ROM0; instead of CODE and DATA, use ROMX; instead of BSS, use WRAM0.

JP [Hl]

Deprecated in 0.3.0, removed in 0.4.0.

Instead, use ‘JP HL’.

LDI A, HL and LDD A, HL

Deprecated in 0.3.0, removed in 0.4.0.

Instead, use ‘LDI A, [HL]’ and ‘LDD A, [HL]’ (or ‘LD A, [HLI]’ and ‘LD A, [HLD]’; or ‘LD A, [HL+]’ and ‘LD A, [HL-]’).

Ldio

Deprecated in 0.9.0.

Instead, use ‘LDH’.

LD [C], A and LD A, [C]

Deprecated in 0.9.0.

Instead, use ‘LDH [C], A’ and ‘LDH A, [C]’.

LDH [n8], A and LDH A, [n8]

Deprecated in 0.9.0.

LDH’ used to treat "addresses" from $00 to $FF as if they were the low byte of an address from $FF00 to $FFFF.

Instead, use ‘LDH [n16], A’ and ‘LDH A, [n16]’.

LD HL, [SP + e8]

Deprecated in 0.3.0, removed in 0.4.0.

Instead, use ‘LD HL, SP + e8’.

LDHL, SP, e8

Supported in ASMotor, removed in RGBDS.

Instead, use ‘LD HL, SP + e8’.

rgbasm -i

Deprecated in 0.6.0, removed in 0.8.0.

Instead, use -I or --include.

rgbgfx -h

Removed in 0.6.0.

Instead, use -Z or --columns.

rgbgfx --output-*

Deprecated in 0.7.0, removed in 0.8.0.

Instead, use --auto-*.

Changed

These are breaking changes that did not alter syntax, and so could not practically be deprecated.

Trigonometry function units

Changed in 0.6.0.

Instead of dividing a circle into 65536.0 "binary degrees", it is now divided into 1.0 "turns".

For example, previously we had:

  • SIN(0.25) == 0.00002’, because 0.25 binary degrees =

    0.25/65536.0

    turns =

    0.000004τ

    radians =

    0.000008π

    radians, and

    sin(0.000008π)=0.00002
  • SIN(16384.0) == 1.0’, because 16384.0 binary degrees =

    16384.0/65536.0

    turns =

    0.25τ

    radians =

    π/2

    radians, and

    sin(π/2)=1
  • ASIN(1.0) == 16384.0

Instead, now we have:

  • SIN(0.25) == 1.0’, because

    0.25

    turns =

    0.25τ

    radians =

    π/2

    radians, and

    sin(π/2)=1
  • SIN(16384.0) == 0.0’, because

    16384

    turns =

    16384τ

    radians =

    32768π

    radians, and

    sin(32768π)=0
  • ASIN(1.0) == 0.25

** operator associativity

Changed in 0.9.0.

Instead of being left-associative, ‘**’ is now right-associative.

Previously we had ‘p ** q ** r == (p ** q) ** r’.

Instead, now we have ‘p ** q ** r == p ** (q ** r)’.

See Also

rgbasm(1), gbz80(7), rgbds(5), rgbds(7)

History

rgbasm(1) was originally written by Carsten Sørensen as part of the ASMotor package, and was later repackaged in RGBDS by Justin Lloyd. It is now maintained by a number of contributors at https://github.com/gbdev/rgbds.

Referenced By

gbz80(7), rgbasm(1), rgbasm(5).

December 25, 2024