It is possible to set a minimum and maximum address of the segment using the 'min' and 'max' parameters. If a block gets outside the given boundaries, it will give an error:
.segment Data [start=$c000, min=$c000, max=$cfff] .fill $1800, 0 // Error since range is $c000-$d7ff
In some cases it is useful to ensure a segment have a specific site. By setting the 'fill' parameter to true all non used values in the min-max range is set to the fill byte:
// This will generate $1000: 0,0,1,2,3,0,0,0 .segment Data [min=$1000, max=$1008, fill] *=$1002 .byte 1,2,3
In the above example the fill byte is zero, but it can be specified with the 'fillByte' parameter.
Restricting size can be used to avoid using the ROM area or simply enforcing the rules of a maximum size of 256 or 128 bytes.
The following entry was submitted to the 128 byte font competition on CSDb by Jesper Balman Gravgaard (Rex). It rotates the ROM font 90 degrees. The max size of 128 bytes includes the two address bytes of the prg file.
// 90 degree rotated ROM font in 69 bytes of code .segment Main [min=$0801, max=$0880-2, outPrg="out.prg"] .label SCREEN = $400 .label CHARGEN = $d000 .label CHARSET = $3000 *=$0801 "Basic" BasicUpstart(ch2) *=$080d "Program" ch4: dey // Wait for 8 char lines bne ch lda pix+1 // Next char clc adc #8 sta pix+1 ch2: sei // Start char lda #$32 sta $1 ldy #8 ch: lda CHARGEN // Start char line ldx #7 npi: asl // Start pixel pix: rol CHARSET,x dex bpl npi inc ch+1 // Next char line bne ch4 inc pix+2 // Inc both high bytes inc ch+2 bne ch4 // Run until CHARGEN is $0000 ee: lda #$37 sta $1 cli lda #SCREEN/$40|CHARSET/$400 sta $d018 rts