Allow negative from-the-end starting indexes in INCBIN (#2181)

This commit is contained in:
Rangi authored and GitHub committed 2026-09-28 20:43:14 -04:00
1 parent ad4e399018
commit c592d665a8
8 files changed
+38 -11

No files matched your search

+2 -1
View File
@@ -1906,13 +1906,14 @@ INCBIN "sprites/hero.bin"
.Pp
You can also include only part of a file with
.Ic INCBIN .
The example below includes 256 bytes from data.bin, starting from byte 78.
The example below includes 256 bytes from data.bin, starting from byte 78 (byte positions start from 0).
.Bd -literal -offset indent
INCBIN "data.bin", 78, 256
.Ed
.Pp
The length argument is optional.
If only the start position is specified, the bytes from the start position until the end of the file will be included.
Negative start positions count from the end of the file, so the last byte is at position -1.
.Ss Statically allocating space in RAM
.Ic DS
statically allocates a number of empty bytes.