from-a-file
A program of Generators.
main.ngp
include "atari/130xe.ngp"
include "atari/extension.ngp"
modules { "print.asm" "run.asm" "intro.asm" "level.asm"
; tag generator
binary( "maps/level1.map", section = levelMap, in = level ) as maps
; end generator
}
panes in ext { level }
resident { print, run }
phase intro { needs intro then level entry introStart }
phase level { needs level, maps entry levelStart }
entry intro
container xex
130xe.ngp project
; An Atari 130XE: five Banks as a unit set — the four of extended memory and,
; last, the machine's own memory under the Window — the Window PORTB brings
; one of them into, every Region of the address space, and the Modules a
; program on this machine needs. It declares no storage. A program that loads
; anything during a run includes `atari/extension.ngp` beside this, which makes
; the Banks its storage. What PORTB takes to show a state is the
; driver's and not here, and the OS is two Modules rather than a Region because
; it occupies memory for a while rather than being a truth about addresses: its
; variables for the whole of a program, its ROM in every Phase that does not
; say `without osrom` — see 0229. The same register switches the ROMs, so the
; driver is what declares them.
target {
cpu "6502"
; DOS loads a `.xex`, and a Project naming any other Container is refused
; here rather than at the writer.
containers xex
; No Window has a base, so the memory under this one is a Bank like the
; others and nothing of the program stands there but a Pane or storage — see
; docs/decisions/0229-no-window-has-a-base.md.
units extension 5
window ext $4000 .. $7FFF views extension
}
target {
region ram $0000 .. $CFFF ram
region $D800 .. $FFFF ram
region stack $0100 .. $01FF reserved
region io $D000 .. $D7FF register
; The RAM the OS ROM covers, named so that a Section may say `in underOsLow`
; and stand there: only in a Phase without `osrom`, or hidden under it where
; nothing needs it — see docs/decisions/0243-a-section-may-name-the-region-it-stands-in.md.
region underOsLow $C000 .. $CFFF ram
region underOsHigh $D800 .. $FFFF ram
; This machine takes a `.xex` and nothing else, and a `.xex` is loaded by a
; DOS, which stays where a DOS of the 2.x family stays. A Project whose DOS
; takes more says so with a `reserved` Region of its own, which narrows this
; one further.
region dos $0700 .. $1FFF reserved
; What the driver writes. A Project that wants more of the hardware by name
; declares it, as it declares the memory its DOS holds.
register PORTB $D301
; The hardware that holds a Section while a program has handed it one, by
; `.root NAME` before the taking of its address, until it hands another or
; `.release NAME`: what it holds stays where it is for that long. See
; docs/decisions/0247-the-hardware-holds-a-section-for-as-long-as-it-is-given-it.md.
holder dlist ; ANTIC's display list: SDLSTL, or DLISTL
holder dli ; the display list interrupt: VDSLST
holder vbi ; the immediate vertical blank: VVBLKI
holder vbd ; the deferred vertical blank: VVBLKD
holder nmi ; $FFFA, where the OS ROM is switched out
holder irq ; $FFFE, where the OS ROM is switched out
holder chbase ; the character set: CHBAS, or CHBASE
holder pmbase ; the player-missile memory: PMBASE
holder dosini ; DOSINI: called once a boot returns, and on every reset
}
; The OS and the driver, listed as a file of the Project's own would be. The
; driver is here and not beside the storage because it does more than read it:
; it shows a Pane's Bank and switches the ROMs, with or without storage. BASIC
; is not listed: a program that wants it lists `atari/basic.asm` and names it
; in a Phase's `needs`, and the driver switches it out everywhere else.
modules {
"atari/osram.asm" "atari/osrom.asm" "atari/mathpack.asm"
"atari/charsets.asm" "atari/portb.asm"
}
resident { osram, osrom, mathpack, charsets, portb }
extension.ngp project
; Storage in a 130XE's extended memory, for an `atari/130xe.ngp` program: the
; Banks of the unit set `extension`, read through the Window `ext`, and the
; decoders the tool ships. A Project includes this beside the machine. The
; driver is the machine's, since it shows a Pane's Bank whether or not there is
; storage.
storage { units extension }
; Every Transition calls the decoders, so they are resident; a decoder nothing
; uses is dropped.
modules { "stream/zx0.asm" }
resident { zx0 }
osram.asm osram
; The memory the Atari OS keeps its variables in: half the zero page and the
; pages from $0200 to $06FF. Sections that hold no bytes, pinned where the OS
; keeps them, so the solver sees memory that is taken rather than a Region it may
; never allocate from. See 0038 for why what occupies memory for a while is a
; Module, and 0229 for why the OS is two of them.
;
; **Resident wherever the OS is used at all**, and not only in the Phases whose
; ROM is in: a Phase without `atari/osrom.asm` runs with the ROM switched out and
; the OS asleep, and the variables have to be as the OS left them when a later
; Phase switches it back in.
;
; Every Section here is `root`: the OS and the hardware reach them with no
; Reference in any Chunk, so nothing else would keep them. None holds bytes, so
; none has a Payload and no Transition loads one. This is the OS as an XL or XE
; ships it; a machine whose OS lives elsewhere declares a Module of its own.
.export RTCLOK, SDMCTL, SDLSTL, SDLSTH, CH
; The OS's half of the zero page. The program's own variables live above it,
; in the half the variant leaves to the solver.
.section zeropage at $0000, root
osZero
.res $12
RTCLOK .res 3 ; $0012: the frame counter, three bytes
.res $6B
.ends
; The OS's variables and buffers. The shadow registers are among them and
; are Labels here rather than registers of the variant: they are the OS's
; memory, which the OS copies to the hardware on every vertical blank, and
; a `register` Region inside this Section would be an address the Section
; may not cover.
.section absolute at $0200, root
osRam
.res $2F
SDMCTL .res 1 ; $022F: shadows DMACTL
SDLSTL .res 1 ; $0230: the display list address, low
SDLSTH .res 1 ; $0231: and high
.res $CA
CH .res 1 ; $02FC: the last key pressed, $FF for none
.res $403
.ends
osrom.asm osrom
; The Atari OS ROM, in the two ranges the hardware registers leave between them,
; and the entry points a program calls in the second. Sections that hold no
; bytes, pinned where the ROM is, so that a Phase that needs this Module has
; the ranges taken and one without it has the RAM underneath — see 0229.
;
; **A ROM the driver switches out.** A variant lists this Module in `resident`,
; so every Phase has the OS unless it says `without osrom`, which the driver's
; `.driver rom osrom` is what allows; a Phase without it has the RAM under the
; ROM, its own vectors at $FFFA to look after, and no call into the OS — a
; `jsr` to an entry point below is a Reference to a Section that Phase does not
; have, and refused as one.
;
; The high range begins at **$E000 and not at $D800**: $D800-$DFFF is the
; floating-point pack, which a device on the parallel bus maps its own ROM
; over once it is selected, so it is `atari/mathpack.asm` — a Module a variant
; may leave out, and one whose absence is a fact about the machine rather than
; an omission. A variant that lists this file lists that one too, unless it
; has something else to say about those addresses.
;
; Every Section is `root`, since the OS and the hardware reach them with no
; Reference in any Chunk. This is the ROM an XL or XE ships.
.export SETVBV, XITVBV
.section absolute at $C000, root
osRomLow
.res $1000
.ends
.section absolute at $E000, root
osRomHigh
.res $45C
SETVBV .res 3 ; $E45C: A = the stage, X/Y = the routine
.res 3
XITVBV .res 3 ; $E462: the end of a deferred routine
.res $1B9B
.ends
mathpack.asm mathpack
; The floating-point routines the OS keeps at $D800-$DFFF, as a Section that
; holds no bytes, so that the solver sees memory that is taken.
;
; **A Module of its own and not part of `atari/osrom.asm`**, because this is the
; one range of the OS that something else can take away. A device on the
; parallel bus maps its ROM over the whole of it once it is selected — the
; kernel's own PBI scan says so in as many words, and looks for a device's
; identifying bytes at $D803 and $D80B, which is why the math pack must not
; begin with them. A variant for a machine whose PBI device is selected for
; the life of the program therefore does not list this file, and says what
; stands there instead.
;
; **Switched out with the OS.** On an XL the one bit of PORTB that takes the OS
; ROM out takes this out too, so a driver that switches ROMs declares it as
; `.driver rom mathpack osrom`: a Phase that needs this needs the OS's ranges
; taken as well, and cannot do without `osrom` — see 0229.
;
; Nothing is exported. The pack's entry points are documented by Atari and a
; program that calls one declares it, as it declares any address of the OS
; `atari/osrom.asm` does not name; nothing the tool ships calls into it.
;
; `root`, because the OS reaches it with no Reference in any Chunk of the
; program, and holding no bytes it has no Payload and no Transition loads it.
.section absolute at $D800, root
mathPack
.res $800
.ends
charsets.asm charsets
; The Atari's two codes for the same letters, as Charsets.
;
; `atascii` is what the character I/O takes: the machine's own code, with the
; graphics characters where an ASCII machine keeps its control codes, and the
; letters where ASCII has them — which is why an unprefixed literal of plain
; letters has always worked and why nothing else has. `\n` is `$9B`, the end of
; line, and not `$0A`.
;
; `screen` is what the display reads out of screen memory, which is the same
; letters at other numbers. A program that writes where the display looks
; rather than through the OS wants this one.
;
; The graphics characters are written here as the Unicode the box-drawing and
; block characters have, so a picture drawn in the source is the picture the
; machine draws. A letter in inverse video is one of those too — Unicode squares
; them off in a negative, and `atascii"PRESS 🆂"` is seven bytes with the last
; one inverse. A whole line of inverse text is better asked of a Charset
; derived from this one, `.charset bright : atascii ^ $80`, which is what a
; derivation is for. Two of them have no exact Unicode: `$02` and `$0D` are a
; quarter of a cell where the nearest character is an eighth, and are written
; as `▕` and `▔`. Everything else, the inverse entries included, was read off
; the machine's own font and matches it.
;
; This Module emits nothing: it is two names and two tables.
.export atascii, screen
; tag atascii
.charset atascii
"♥├▕┘┤┐╱╲◢▗◣▝▘▔▂▖♣┌─┼●▄▎┬┴▌└" = $00
"↑↓←→" = $1C
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" = $20
"♦" = $60
"abcdefghijklmnopqrstuvwxyz" = $61
"♠" = $7B
"│" = $7C
"\n" = $9B
; Inverse video is the same glyph with the bits the other way round, which
; for the blocks and the triangles is another character Unicode draws. Every
; one of these was read off the machine's own font and is exact; the rest of
; the inverse half has no glyph to be written as, and is reached by adding
; $80 or by a Charset derived from this one.
"▊" = $82 ; ▕
"◤" = $88 ; ◢
"▛" = $89 ; ▗
"◥" = $8A ; ◣
"▙" = $8B ; ▝
"▟" = $8C ; ▘
"▆" = $8D ; ▔
"▜" = $8F ; ▖
"▀" = $95 ; ▄
"▐" = $99 ; ▌
"█" = $A0 ; the space
; And the letters, which Unicode squares off in a negative.
"🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉" = $C1
.endch
; end atascii
.charset screen
" !\"#$%&'()*+,-./0123456789:;<=>?" = $00
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" = $20
"♥├▕┘┤┐╱╲◢▗◣▝▘▔▂▖♣┌─┼●▄▎┬┴▌└" = $40
"♦" = $60
"abcdefghijklmnopqrstuvwxyz" = $61
"♠" = $7B
"│" = $7C
; The same inverses, at the display's numbers.
"▊" = $C2
"◤" = $C8
"▛" = $C9
"◥" = $CA
"▙" = $CB
"▟" = $CC
"▆" = $CD
"▜" = $CF
"▀" = $D5
"▐" = $D9
"█" = $80
"🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉" = $A1
.endch
portb.asm portb
; The storage driver for extended memory behind PORTB: the units are the
; Banks of the variant's `extension`, which a value written to PORTB brings
; into the $4000-$7FFF window — `ext` in the variant — and the stream is a
; pointer into that window that walks on to the next unit at its end. Each
; role is a macro declared with `.driver`, which the routine, the loader's
; glue, the decoders and the tool's own Procs expand where they use it as
; `nga.open`, `nga.read`, `nga.show` and `nga.showAt`. What the hardware
; calls each state of a Window is this Module's alone: `portbValues` holds
; a PORTB value per state of `ext`, one per Bank, as many as the variant's
; `extension` counts — the last of the 130XE's five being the machine's own
; memory, which no Window keeps as a base — see 0229. `PORTB` is the variant's
; register.
;
; **The same register holds the OS ROM and BASIC**, bits 0 and 1, so this
; driver is also what switches them: `.driver rom` names the Modules that are
; those ROMs, and `select` is handed the set a Phase needs and writes the two
; bits, which every switch of a Bank keeps as they are — see 0229.
;
; Resident, and outside the window — the variant lists this Module in
; `resident`, and the tool holds it outside the window the stream reads
; through.
portbWindow = $4000
portbWindowEnd = portbWindow + $4000 ; one past the window: the high byte of the first address outside it
portbUnitPages = $40 ; a unit, in pages: what an offset carries by
.driver open portbOpen
.driver read portbRead
.driver unit portbUnit
.driver offset portbPtr
.driver stream ext
.driver show ext portbShow
.driver showAt ext portbShowAt
.driver init portbInit
.driver finalize portbFinalize
.driver rom osrom ; bit 0 of the set
.driver rom mathpack osrom ; bit 1, which one bit of PORTB shows with the OS
.driver rom basic ; bit 2
.driver select portbRoms
.driver mask portbMask
.driver unmask portbUnmask
.transform copy portbCopy
; PORTB as the program found it, kept by `init` and put back by `finalize`: the
; bits of BASIC and of the self-test are the user's, whatever the program does
; with them meanwhile, and a DOS returned to expects its machine as it left it
; — see docs/decisions/0229-no-window-has-a-base.md.
.macro portbInit
lda PORTB
sta portbFound
.endm
.macro portbFinalize
lda portbFound
sta PORTB
.endm
.section
portbFound .res 1
.ends
; What the load wraps a switch of every ROM out in, while the DOS's interrupts
; are still on: with the OS out, $FFFA is RAM the load is writing. IRQ masked,
; and NMI, which `sei` does not reach, off at ANTIC; then back as the OS keeps
; it, the vertical blank on — see
; docs/decisions/0241-bytes-kept-for-a-later-phase-may-lie-hidden-under-a-rom.md.
NMIEN = $D40E
.macro portbMask
sei
lda #0
sta NMIEN
.endm
.macro portbUnmask
lda #$40
sta NMIEN
cli
.endm
.macro portbOpen
jsr portbOpenStream
.endm
.macro portbRead
jsr portbReadByte
.endm
; The state to show, as the tool numbers ext's states: Bank n is n.
.macro portbShow state
ldx #state
jsr portbBank
.endm
; X = the state to show.
.macro portbShowAt
jsr portbBank
.endm
; A = the set of ROMs the Phase needs.
.macro portbRoms
jsr portbSelectRoms
.endm
; PORTB per state of ext, one value per Bank. The list runs to the 130XE's
; five — four of extended memory, and then $FF, the machine's own with the
; self-test out — and the variant's count trims it, so that a variant with
; fewer Banks takes a prefix; one with more lists its values here. Every value
; has bits 0 and 1 set, which is what lets portbBank keep the ROMs' bits as
; they are with one `and` and no scratch byte.
.macro portbBankValues n, values...
.if n > 0
.match values
.case first, rest...
.byte first
portbBankValues n - 1, rest...
.endmatch
.endif
.endm
; The table portbBank indexes, in a Section of its own: what has an
; address stands in one, and a Proc holds code alone.
.section
portbValues
portbBankValues extension, $E3, $E7, $EB, $EF, $FF
.ends
; The stream: where the next byte is, and which unit is in. A plain zero-page
; Section rather than Temporaries, because the value has to survive between
; one call and the next while nothing here is running. They are also the
; cells the routine writes a position into before it opens the stream,
; `portbPtr` the offset and `portbUnit` the unit.
.section zeropage
portbPtr .res 2
portbUnit .res 1
.ends
; X = the state of ext to show: its PORTB value, with the bits of the OS ROM
; and of BASIC left as they are, since those are what `select` said. Writes no
; memory, so that a loader running it leaves nothing behind but the register.
.proc portbBank
lda PORTB
ora #$FC
and portbValues,x
sta PORTB
rts
.endp
; A = the set of ROMs the Phase entered needs: bit 0 `osrom`, bit 1 `mathpack`,
; bit 2 `basic`. Bit 0 of PORTB is set for the OS ROM and the floating-point
; pack, which one bit shows together, and bit 1 is clear for BASIC; the bank
; bits are left as they are. Writes no memory, the set waiting on the stack
; while the register is worked out.
.proc portbSelectRoms
pha
lda PORTB
ora #$03 ; the OS in and BASIC out, to begin with
tax
pla
pha
and #$03 ; neither osrom nor mathpack: the OS out
bne @os
txa
and #$FE
tax
@os
pla
and #$04 ; basic: BASIC in
beq @basic
txa
and #$FD
tax
@basic
stx PORTB
rts
.endp
; The stream to the position in portbUnit and portbPtr. An offset past the
; unit's end carries into the units after, since the routine counts on in a
; Frame without knowing where a unit ends: a unit is $4000 bytes, so the
; offset's top two bits are units.
.proc portbOpenStream
lda portbPtr+1
@carry
cmp #portbUnitPages
bcc @within
sbc #portbUnitPages
inc portbUnit
jmp @carry
@within
clc
adc #>portbWindow
sta portbPtr+1
ldx portbUnit
jsr portbBank
rts
.endp
; A = the next byte of the stream. X and Y are not preserved.
.proc portbReadByte
ldy #0
lda (portbPtr),y
inc portbPtr
bne @done
inc portbPtr+1
ldy portbPtr+1
cpy #>portbWindowEnd
bne @done
pha
jsr portbNextUnit
pla
@done
rts
.endp
; The window's end: the next unit in, and the pointer back at its start.
.proc portbNextUnit
inc portbUnit
ldx portbUnit
jsr portbBank
lda #0
sta portbPtr
lda #>portbWindow
sta portbPtr+1
rts
.endp
; The decoder of `copy`: X/Y = the destination, the stream at the stored
; size and then the bytes. Reads the window through the pointer rather than
; through portbReadByte, which is what a driver's own decoder is for: a run at a
; time, where a run ends at the source's page end or at the size, so that
; the inner loop is `(zp),y` down to zero — the window's end is a page end,
; so a unit is never crossed inside a run.
portbDst .ztemp 2
portbSize .ztemp 2
portbRun .ztemp 1 ; bytes in the run, zero for 256
.proc portbCopy
stx portbDst
sty portbDst+1
jsr portbReadByte
sta portbSize
jsr portbReadByte
sta portbSize+1
@run
lda portbSize
ora portbSize+1
beq @done
lda portbPtr ; to the end of the source's page
eor #$FF
clc
adc #1
sta portbRun
lda portbSize+1
bne @copy ; at least a page left: the run stands
lda portbRun
beq @cap ; a whole page, and less than one left
cmp portbSize
bcc @copy
@cap
lda portbSize
sta portbRun
@copy
ldy portbRun
@byte
dey
lda (portbPtr),y
sta (portbDst),y
tya
bne @byte
ldx portbRun ; the run, as 256 where it is zero
bne @counted
inc portbPtr+1
inc portbDst+1
dec portbSize+1
jmp @crossed
@counted
txa
clc
adc portbPtr
sta portbPtr
bcc @source
inc portbPtr+1
@source
txa
clc
adc portbDst
sta portbDst
bcc @destination
inc portbDst+1
@destination
sec
lda portbSize
stx portbRun
sbc portbRun
sta portbSize
bcs @crossed
dec portbSize+1
@crossed
lda portbPtr+1
cmp #>portbWindowEnd
bne @run
jsr portbNextUnit ; the window's end: the next unit in
jmp @run
@done
rts
.endp
zx0.asm zx0
; The decoder of `zx0` over any driver's stream: Einar Saukas's ZX0, version
; 2's standard forward stream, decoded as the reference dzx0.c does, driven
; by the stream's own end marker. Written here from the format, not ported:
; nothing of the reference's text is in it, and it is licensed as everything
; under lib/ is, see lib/LICENSE. Entered with X/Y = the destination and the
; stream at the stored size, which it reads past. A match is copied a byte
; at a time, forward, from what was written, which is what makes an offset
; shorter than its length — the run — come out right. Resident, and outside
; the driver's window.
;
; zx0Bits the bit buffer, a sentinel one above the bits still unread
; zx0Offset the last offset
; zx0Length the length in hand, or an offset's MSB while one is read
; zx0Invert one while an offset's MSB is read, whose data bits the
; stream carries complemented; zero otherwise
.transform zx0 zx0Decode
zx0Dst .ztemp 2
zx0Src .ztemp 2
zx0Bits .ztemp 1
zx0Offset .ztemp 2
zx0Length .ztemp 2
zx0Invert .ztemp 1
; The next bit of the stream, in A as zero or one and in the Z flag. The
; buffer holds a sentinel above the unread bits, so shifting it to nothing is
; the signal to fetch the next byte and put the sentinel back below it.
.proc zx0Bit
asl zx0Bits
bne @have
nga.read
sec ; the sentinel the asl shifted out, which `read` may not keep
rol
sta zx0Bits
@have
lda #0
rol
rts
.endp
; An interlaced Elias gamma value into zx0Length: a control bit says whether
; a data bit follows, and the value begins at one. Three Procs chained by
; `then` because the value after an offset is entered with its first control
; bit already read, at zx0EliasData: the first falls through into the
; second, and the second branches into the third, which the chain is what
; allows.
.proc zx0Elias
lda #1
sta zx0Length
lda #0
sta zx0Length+1
.endp then zx0EliasMore
.proc zx0EliasMore
jsr zx0Bit
beq zx0EliasData ; zero: a data bit follows
rts
.endp then zx0EliasData
.proc zx0EliasData
jsr zx0Bit
eor zx0Invert
lsr
rol zx0Length
rol zx0Length+1
jmp zx0EliasMore
.endp
; One byte written: the destination moves on and the length in hand comes
; down, leaving Z set when it reaches zero.
.proc zx0Step
inc zx0Dst
bne @moved
inc zx0Dst+1
@moved
lda zx0Length
bne @low
dec zx0Length+1
@low
dec zx0Length
lda zx0Length
ora zx0Length+1
rts
.endp
; The length in hand copied from zx0Dst less the last offset to zx0Dst.
.proc zx0Copy
sec
lda zx0Dst
sbc zx0Offset
sta zx0Src
lda zx0Dst+1
sbc zx0Offset+1
sta zx0Src+1
@byte
ldy #0
lda (zx0Src),y
sta (zx0Dst),y
inc zx0Src
bne @from
inc zx0Src+1
@from
jsr zx0Step
bne @byte
rts
.endp
.proc zx0Decode
stx zx0Dst
sty zx0Dst+1
nga.read ; the stored size, which the end marker makes unnecessary
nga.read
lda #$80
sta zx0Bits ; an empty buffer: the sentinel alone
lda #1
sta zx0Offset
lda #0
sta zx0Offset+1 ; the last offset begins at one
sta zx0Invert
@literals
jsr zx0Elias
@literal
nga.read
ldy #0
sta (zx0Dst),y
jsr zx0Step
bne @literal
jsr zx0Bit
bne @offset
jsr zx0Elias ; a match at the last offset
jsr zx0Copy
jsr zx0Bit
beq @literals
@offset
lda #1
sta zx0Invert
jsr zx0Elias ; the new offset's MSB, complemented in the stream
lda #0
sta zx0Invert
lda zx0Length
beq @done ; 256 is the end marker, and the one value with a low byte of zero
lsr ; offset = MSB * 128 - LSB / 2
sta zx0Offset+1
lda #0
ror
sta zx0Offset
nga.read
lsr ; the LSB's low bit is the length's first control bit
php
eor #$FF
sec
adc zx0Offset
sta zx0Offset
bcs @subtracted
dec zx0Offset+1
@subtracted
plp
lda #1
sta zx0Length
lda #0
sta zx0Length+1
bcs @counted ; a control bit of one: the value is one
jsr zx0EliasData
@counted
inc zx0Length ; a match at a new offset is one longer than written
bne @copy
inc zx0Length+1
@copy
jsr zx0Copy
jsr zx0Bit
bne @offset
jmp @literals
@done
rts
.endp
print.asm
; The one thing both Phases need: a line on the screen, through the character
; I/O the OS opens on channel 0 before a program starts. `PUTREC` writes a
; record, so it ends the line itself.
CIOV = $E456
ICCOM = $0342
ICBAL = $0344
ICBLL = $0348
PUTREC = 9
; Both Phases call it, so both have to see the name.
.export printLine
; Where the line stands, and how long it is. Declaring where the two arguments
; are is what lets a Module of C call this one as a function.
.proc printLine
.declare arg xy
.declare arg a
stx ICBAL
sty ICBAL+1
sta ICBLL
lda #0
sta ICBLL+1
lda #PUTREC
sta ICCOM
ldx #0
jsr CIOV
rts
.endp
run.asm
; The shape every screen has: a title, and then whatever the Phase draws under
; it. Neither is here — this Module knows only that there are two of them, and
; which Phase is running it never learns.
; tag slot
.export title, draw, showScreen
.slot title, pointer, zeropage
.slot draw, vector
; end slot
; tag screen
.proc showScreen
ldy #0
@count lda (title),y ; the Phase's title, as long as it turns out
beq @print
iny
bne @count
@print
tya
ldx title
ldy title+1
jsr printLine
jsr draw
rts
.endp
; end screen
intro.asm
; tag fills
.implements title, introTitle
.implements draw, introDraw
.section
introTitle
.byte "INTRO", 0
.ends
; end fills
.section
introText
.byte "THE FIRST SCREEN"
introTextEnd
.ends
.proc introDraw
ldx #<introText
ldy #>introText
lda #introTextEnd - introText
jsr printLine
rts
.endp
.proc introStart
jsr showScreen
.transition level
.endp
level.asm
; The map is not here any more. What is here is what draws it, and the row
; width it walks by.
levelWidth = 37
; tag fills
.implements title, levelTitle
.implements draw, levelDraw
.section
levelTitle
.byte "LEVEL ONE", 0
.ends
; end fills
; A Trampoline: it stands outside the Window, but runs with `level` shown,
; which is what lets it name what the Pane holds.
.proc drawMap, under level
at .ztemp 2
left .ztemp 1
lda #<levelMap
sta at
lda #>levelMap
sta at+1
lda #levelMap.runtimeSectionSize / levelWidth
sta left
@row
ldx at
ldy at+1
lda #levelWidth
jsr printLine
clc
lda at
adc #levelWidth
sta at
bcc @counted
inc at+1
@counted
dec left
bne @row
rts
.endp
.proc levelDraw
.with level
jsr drawMap
rts
.endp
.proc levelStart
jsr showScreen
@stop jmp @stop
.endp
maps.asm maps
.source "maps/level1.map", 1
.section absolute, in level
levelMap
.export levelMap
.base64 "IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMuLi4uLi4uLi4u"
.base64 "Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLiMjLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
.base64 "Li4uLi4uLi4uLi4uLi4jIy4uLi4uLiMjIyMjIyMjLi4uLi4uLi4uLi4uLi4uLi4u"
.base64 "Li4uIyMuLi4uLi4jLi4uLi4uIy4uLi4uLi4uLi4uLi4uLi4uLi4uLiMjLi4uLi4u"
.base64 "Iy4uLi4uLiMuLi4uLi4uLi4uLi4uLi4uLi4uLi4jIy4uLi4uLiMjIyMjIyMjLi4u"
.base64 "Li4uLi4uLi4uLi4uLi4uLi4uIyMuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u"
.base64 "Li4uLi4uLiMjLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4jIyMj"
.base64 "IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw=="
.ends
transition.asm nga.transition
ngaFramesHeld = 0
ngaUnitBytes = 1
ngaEntrySize = 4
ngaBlockSize = 6
ngaFrameHeader = 3 + ngaSelects
; The Transition routine. Called by `jsr` from a `.transition`, with the
; statement's list right behind the call: the Phase to enter, and per Phase
; the code may be in, the unit and offset where the edge's Frame waits.
; nga.open and nga.read are the driver's roles, macros of the driver's
; Module expanded here, and nga.unit and nga.offset the cells its stream
; stands in, which open reads the position from; and ngaCurrentPhase is the
; Cell the tool generates. Everything else the edge has to say waits in the
; Frame, in storage. See docs/spec/transition.md.
;
; Its zero page is Temporaries: nothing of it is needed once the routine has
; jumped to the entered Phase's entry, and a `.transition` is a jump into the
; routine, so whatever the statement's Section had on the zero page is dead by
; then too. Two Temporaries never live at once share an address — see
; docs/decisions/0034-trace.md.
.export ngaTransition
ngaPtr .ztemp 2
ngaEntry .ztemp 2
ngaDst .ztemp 2
ngaValue .ztemp 2
ngaOffset .ztemp 2
ngaFrameAt .ztemp 2 + ngaUnitBytes ; where the Frame's stream stands: the offset, then the unit
ngaWanted .ztemp 1
ngaCount .ztemp 1
ngaUnit .ztemp ngaUnitBytes
.proc ngaTransition
pla
sta ngaPtr
pla
sta ngaPtr+1 ; the return address: one below the statement's list
ldy #1
lda (ngaPtr),y
sta ngaWanted ; the Phase to enter
iny
lda (ngaPtr),y
sta ngaCount ; entries that follow
lda ngaPtr
clc
adc #3
sta ngaPtr
bcc @scan
inc ngaPtr+1
@scan
lda ngaCount
bne @check
brk ; no entry for the current Phase: unreachable while the static rule holds
@check
ldy #0
lda (ngaPtr),y
cmp ngaCurrentPhase
beq @found
lda ngaPtr ; the next entry
clc
adc #ngaEntrySize
sta ngaPtr
bcc @skipped
inc ngaPtr+1
@skipped
dec ngaCount
jmp @scan
@found
iny
lda (ngaPtr),y
sta ngaFrameAt+2 ; the unit the Frame waits in
.if ngaUnitBytes > 1
iny
lda (ngaPtr),y
sta ngaFrameAt+3
.endif
iny
lda (ngaPtr),y
sta ngaFrameAt
iny
lda (ngaPtr),y
sta ngaFrameAt+1 ; and where in it
.endp then ngaEnter
; The rest of it, and the way in for a Container that has no current Phase to
; look one up by: ngaWanted holds the Phase to enter and ngaFrameAt where
; its Frame waits. The cold start comes here — see
; docs/decisions/0216-a-car-names-its-format-and-the-cold-start-is-an-edge.md.
.export ngaEnter
.proc ngaEnter
jsr ngaFrameOpen
.if ngaFramesHeld
nga.read
sta ngaPtr
nga.read
sta ngaPtr+1 ; where the descriptors are to be held, or zero
.endif
nga.read
sta ngaEntry
nga.read
sta ngaEntry+1
nga.read
sta ngaCount ; blocks that follow
.if ngaSelects
nga.read ; the ROMs the entered Phase needs, switched
nga.select ; before a byte of it lands
.endif
lda #ngaFrameHeader
jsr ngaFrameSkip
.if ngaFramesHeld
lda ngaPtr
ora ngaPtr+1
beq @block ; nowhere to hold them: one open a block
; A block's bytes, read in one pass from where the stream already stands. The
; write pointer, the counter and the index are Temporaries of the routine's own
; that nothing is keeping here: ngaValue belongs to the Cell writes, which come
; after the blocks, and ngaUnit and ngaDst to a block being loaded, which has
; not begun. Only ngaPtr is really spent, being live across the whole of the
; block loop and so no longer able to share with what a driver declares — which
; is the two bytes of zero page this way of fetching costs.
lda ngaPtr
sta ngaValue
lda ngaPtr+1
sta ngaValue+1
lda ngaCount
sta ngaUnit ; blocks still to hold
@hold
lda ngaUnit
beq @heldBlock
lda #0
sta ngaDst ; the index, which a read may take out of Y
@six
nga.read
ldy ngaDst
sta (ngaValue),y
iny
sty ngaDst
cpy #ngaBlockSize
bne @six
lda #ngaBlockSize
jsr ngaFrameSkip ; so the Frame stands past them at the end
lda ngaValue
clc
adc #ngaBlockSize
sta ngaValue
bcc @counted
inc ngaValue+1
@counted
dec ngaUnit
jmp @hold
; Then a block at a time out of memory, and the Frame opened once more at the
; end rather than once for every one of them.
@heldBlock
lda ngaCount
beq @cells
ldy #0
lda (ngaPtr),y
sta nga.unit ; straight into the driver's cells: the
iny ; descriptors are in memory, and nothing
.if ngaUnitBytes > 1 ; reads the stream before it is opened
lda (ngaPtr),y
sta nga.unit+1
iny
.endif
lda (ngaPtr),y
sta nga.offset
iny
lda (ngaPtr),y
sta nga.offset+1
iny
lda (ngaPtr),y
sta ngaDst
iny
lda (ngaPtr),y
sta ngaDst+1
iny
lda (ngaPtr),y
pha ; the decoder's number
lda ngaPtr
clc
adc #ngaBlockSize
sta ngaPtr
bcc @heldLoad
inc ngaPtr+1
@heldLoad
nga.open
pla
ldx ngaDst
ldy ngaDst+1
jsr ngaTransform
dec ngaCount
jmp @heldBlock
.endif
@block
lda ngaCount
beq @cells
jsr ngaFrameOpen ; back to the Frame: a block's stream replaced it
nga.read
sta ngaUnit
.if ngaUnitBytes > 1
nga.read
sta ngaUnit+1
.endif
nga.read
sta ngaOffset
nga.read
sta ngaOffset+1
nga.read
sta ngaDst
nga.read
sta ngaDst+1
nga.read
pha ; the decoder's number
lda #ngaBlockSize
jsr ngaFrameSkip
lda ngaUnit ; only now: the driver reads the Frame through
sta nga.unit ; these very cells, and writing them while it
.if ngaUnitBytes > 1 ; did would move the stream
lda ngaUnit+1
sta nga.unit+1
.endif
lda ngaOffset
sta nga.offset
lda ngaOffset+1
sta nga.offset+1
nga.open ; the block's stream: its stored size, then its bytes
pla
ldx ngaDst
ldy ngaDst+1
jsr ngaTransform
dec ngaCount
jmp @block
@cells
jsr ngaFrameOpen
nga.read
sta ngaCount ; Cell writes that follow, read in one stream
@cell
lda ngaCount
beq @enter
nga.read
sta ngaDst
nga.read
sta ngaDst+1
nga.read
sta ngaValue
nga.read
sta ngaValue+1
ldy #0
lda ngaValue
sta (ngaDst),y ; a Cell stands outside the driver's window
iny
lda ngaValue+1
sta (ngaDst),y
dec ngaCount
jmp @cell
@enter
lda ngaWanted
sta ngaCurrentPhase ; the Phase the program is in from here on
jmp (ngaEntry)
.endp
; The Frame's stream, from where the routine last left it.
.proc ngaFrameOpen
lda ngaFrameAt
sta nga.offset
lda ngaFrameAt+1
sta nga.offset+1
lda ngaFrameAt+2
sta nga.unit
.if ngaUnitBytes > 1
lda ngaFrameAt+3
sta nga.unit+1
.endif
nga.open
rts
.endp
; A bytes on in the Frame, which is where its stream is opened next. The
; offset carries into the unit, so that a Frame running past the last offset
; a unit's number can reach goes on into the next.
.proc ngaFrameSkip
clc
adc ngaFrameAt
sta ngaFrameAt
bcc @done
inc ngaFrameAt+1
bne @done
inc ngaFrameAt+2
.if ngaUnitBytes > 1
bne @done
inc ngaFrameAt+3
.endif
@done
rts
.endp
cell nga.cell
ngaCurrentPhasetransforms.asm nga.transforms
; The dispatcher over the decoders the program declared, in the order the
; tool numbered them. See docs/spec/transition.md.
.export ngaSelects
ngaSelects = 1
.export ngaLoadUnit, ngaLoadMap
.section root
ngaLoadUnit
.res 1
.ends
.proc ngaLoadMap, root
ldx ngaLoadUnit
nga.showAt ext
rts
.endp
.export ngaTransform
.proc ngaTransform
cmp #0
bne @not0
jmp portbCopy
@not0
brk
.endp
init.asm nga.init
; The driver's `init`, wrapped so that a Container has an address to call.
; See docs/spec/transition.md and docs/spec/xex.md.
.export ngaInit
.proc ngaInit, root
nga.init
rts
.endp
finish.asm nga.finish
; Where a program that returns ends: the driver's `finalize`, then back to
; what started it. See docs/decisions/0229-no-window-has-a-base.md.
.export ngaFinish
.proc ngaFinish, root
nga.finalize
rts
.endp
run.asm nga.run
; How the program is started: the ROMs its entry Phase needs selected, and
; where it ends left on the stack, so that its return lands on ngaFinish
; from whichever Phase it returns. See
; docs/decisions/0229-no-window-has-a-base.md.
.export ngaRun
.proc ngaRun, root
lda #3
nga.select
.own ; followed by the rts the program returns with
lda #>( ngaFinish - 1 )
pha
.own
lda #<( ngaFinish - 1 )
pha
jmp nga.entry
.endp
Memory map
- intro145 zero page, 16235 bytes
- level145 zero page, 16239 bytes
| Address | Bytes | Section | Module | Kind | Phases | Waits |
|---|---|---|---|---|---|---|
| $0000–$007F | 128 | osZero | osram | section | 0..1 | |
| $0080–$0082 | 3 | portbPtr | portb | section | 0..1 | |
| $0083–$0084 | 2 | ngaDst | nga.transition | temporary | 0..1 | |
| $0083–$0084 | 2 | ngaPtr | nga.transition | temporary | 0..1 | |
| $0083–$0084 | 2 | portbDst | portb | temporary | 0..1 | |
| $0085–$0086 | 2 | ngaOffset | nga.transition | temporary | 0..1 | |
| $0085–$0086 | 2 | ngaValue | nga.transition | temporary | 0..1 | |
| $0085–$0086 | 2 | portbSize | portb | temporary | 0..1 | |
| $0087–$0087 | 1 | ngaUnit | nga.transition | temporary | 0..1 | |
| $0087–$0087 | 1 | portbRun | portb | temporary | 0..1 | |
| $0088–$0089 | 2 | ngaEntry | nga.transition | temporary | 0..1 | |
| $008A–$008C | 3 | ngaFrameAt | nga.transition | temporary | 0..1 | |
| $008D–$008D | 1 | ngaWanted | nga.transition | temporary | 0..1 | |
| $008E–$008E | 1 | ngaCount | nga.transition | temporary | 0..1 | |
| $008F–$0090 | 2 | title | nga.slots | section | 0..1 | |
| $0200–$06FF | 1280 | osRam | osram | section | 0..1 | |
| $2000–$2000 | 1 | portbFound | portb | section | 0..1 | |
| $2001–$2005 | 5 | portbValues | portb | section | 0..1 | |
| $2006–$2011 | 12 | portbBank | portb | proc | 0..1 | |
| $2012–$202F | 30 | portbSelectRoms | portb | proc | 0..1 | |
| $2030–$2047 | 24 | portbOpenStream | portb | proc | 0..1 | |
| $2048–$205D | 22 | portbReadByte | portb | proc | 0..1 | |
| $205E–$206D | 16 | portbNextUnit | portb | proc | 0..1 | |
| $206E–$20DF | 114 | portbCopy | portb | proc | 0..1 | |
| $20E0–$20F8 | 25 | printLine | proc | 0..1 | ||
| $20F9–$210D | 21 | showScreen | run | proc | 0..1 | |
| $210E–$2113 | 6 | introTitle | intro | section | 0 | |
| $2114–$2123 | 16 | introText | intro | section | 0 | |
| $2124–$212D | 10 | introDraw | intro | proc | 0 | |
| $212E–$2139 | 12 | introStart | intro | proc | 0 | |
| $213A–$2147 | 14 | ngaRun | nga.run | proc | 0 | |
| $214C–$2194 | 73 | ngaTransition | nga.transition | proc | 0..1 | |
| $2195–$222E | 154 | ngaEnter | nga.transition | proc | 0..1 | |
| $222F–$223E | 16 | ngaFrameOpen | nga.transition | proc | 0..1 | |
| $223F–$224C | 14 | ngaFrameSkip | nga.transition | proc | 0..1 | |
| $224D–$224D | 1 | ngaCurrentPhase | nga.cell | section | 0..1 | |
| $224E–$2250 | 3 | draw | nga.slots | section | 0..1 | |
| $2251–$2251 | 1 | ngaLoadUnit | nga.transforms | section | 0..1 | |
| $2252–$2258 | 7 | ngaLoadMap | nga.transforms | proc | 0..1 | |
| $2259–$2260 | 8 | ngaTransform | nga.transforms | proc | 0..1 | |
| $2261–$2267 | 7 | ngaInit | nga.init | proc | 0..1 | |
| $2268–$226E | 7 | ngaFinish | nga.finish | proc | 0..1 | |
| $4000–$4171 | 370 | levelMap | maps | section | 0..1 | |
| $C000–$CFFF | 4096 | osRomLow | osrom | section | 0..1 | |
| $D800–$DFFF | 2048 | mathPack | mathpack | section | 0..1 | |
| $E000–$FFFF | 8192 | osRomHigh | osrom | section | 0..1 | |
| $0083–$0084 | 2 | drawMap.at | level | temporary | 1 | |
| $0085–$0085 | 1 | drawMap.left | level | temporary | 1 | |
| $210E–$2117 | 10 | levelTitle | level | section | 1 | bank 0 +$0025 (copy, 12 B) |
| $2118–$213C | 37 | drawMap | level | proc | 1 | bank 0 +$0031 (copy, 39 B) |
| $213D–$2145 | 9 | levelDraw | level | proc | 1 | bank 0 +$0058 (copy, 11 B) |
| $2146–$214B | 6 | levelStart | level | proc | 1 | bank 0 +$0063 (copy, 8 B) |
The xex
1164 bytes, 14 segments, 0 unaccounted.
| 0 | 2 | container header |
$2001–$2139 313 bytes at 2
| $2001 | 5 | portb.portbValues | portb.asm |
| $2006 | 3 | portb.portbBank | portb.asm |
| $2009 | 2 | portb.portbBank | portb.asm |
| $200B | 3 | portb.portbBank | portb.asm |
| $200E | 3 | portb.portbBank | portb.asm |
| $2011 | 1 | portb.portbBank | portb.asm |
| $2012 | 1 | portb.portbSelectRoms | portb.asm |
| $2013 | 3 | portb.portbSelectRoms | portb.asm |
| $2016 | 2 | portb.portbSelectRoms | portb.asm |
| $2018 | 1 | portb.portbSelectRoms | portb.asm |
| $2019 | 1 | portb.portbSelectRoms | portb.asm |
| $201A | 1 | portb.portbSelectRoms | portb.asm |
| $201B | 2 | portb.portbSelectRoms | portb.asm |
| $201D | 2 | portb.portbSelectRoms | portb.asm |
| $201F | 1 | portb.portbSelectRoms | portb.asm |
| $2020 | 2 | portb.portbSelectRoms | portb.asm |
| $2022 | 1 | portb.portbSelectRoms | portb.asm |
| $2023 | 1 | portb.portbSelectRoms | portb.asm |
| $2024 | 2 | portb.portbSelectRoms | portb.asm |
| $2026 | 2 | portb.portbSelectRoms | portb.asm |
| $2028 | 1 | portb.portbSelectRoms | portb.asm |
| $2029 | 2 | portb.portbSelectRoms | portb.asm |
| $202B | 1 | portb.portbSelectRoms | portb.asm |
| $202C | 3 | portb.portbSelectRoms | portb.asm |
| $202F | 1 | portb.portbSelectRoms | portb.asm |
| $2030 | 2 | portb.portbOpenStream | portb.asm |
| $2032 | 2 | portb.portbOpenStream | portb.asm |
| $2034 | 2 | portb.portbOpenStream | portb.asm |
| $2036 | 2 | portb.portbOpenStream | portb.asm |
| $2038 | 2 | portb.portbOpenStream | portb.asm |
| $203A | 3 | portb.portbOpenStream | portb.asm |
| $203D | 1 | portb.portbOpenStream | portb.asm |
| $203E | 2 | portb.portbOpenStream | portb.asm |
| $2040 | 2 | portb.portbOpenStream | portb.asm |
| $2042 | 2 | portb.portbOpenStream | portb.asm |
| $2044 | 3 | portb.portbOpenStream | portb.asm |
| $2047 | 1 | portb.portbOpenStream | portb.asm |
| $2048 | 2 | portb.portbReadByte | portb.asm |
| $204A | 2 | portb.portbReadByte | portb.asm |
| $204C | 2 | portb.portbReadByte | portb.asm |
| $204E | 2 | portb.portbReadByte | portb.asm |
| $2050 | 2 | portb.portbReadByte | portb.asm |
| $2052 | 2 | portb.portbReadByte | portb.asm |
| $2054 | 2 | portb.portbReadByte | portb.asm |
| $2056 | 2 | portb.portbReadByte | portb.asm |
| $2058 | 1 | portb.portbReadByte | portb.asm |
| $2059 | 3 | portb.portbReadByte | portb.asm |
| $205C | 1 | portb.portbReadByte | portb.asm |
| $205D | 1 | portb.portbReadByte | portb.asm |
| $205E | 2 | portb.portbNextUnit | portb.asm |
| $2060 | 2 | portb.portbNextUnit | portb.asm |
| $2062 | 3 | portb.portbNextUnit | portb.asm |
| $2065 | 2 | portb.portbNextUnit | portb.asm |
| $2067 | 2 | portb.portbNextUnit | portb.asm |
| $2069 | 2 | portb.portbNextUnit | portb.asm |
| $206B | 2 | portb.portbNextUnit | portb.asm |
| $206D | 1 | portb.portbNextUnit | portb.asm |
| $206E | 2 | portb.portbCopy | portb.asm |
| $2070 | 2 | portb.portbCopy | portb.asm |
| $2072 | 3 | portb.portbCopy | portb.asm |
| $2075 | 2 | portb.portbCopy | portb.asm |
| $2077 | 3 | portb.portbCopy | portb.asm |
| $207A | 2 | portb.portbCopy | portb.asm |
| $207C | 2 | portb.portbCopy | portb.asm |
| $207E | 2 | portb.portbCopy | portb.asm |
| $2080 | 2 | portb.portbCopy | portb.asm |
| $2082 | 2 | portb.portbCopy | portb.asm |
| $2084 | 2 | portb.portbCopy | portb.asm |
| $2086 | 1 | portb.portbCopy | portb.asm |
| $2087 | 2 | portb.portbCopy | portb.asm |
| $2089 | 2 | portb.portbCopy | portb.asm |
| $208B | 2 | portb.portbCopy | portb.asm |
| $208D | 2 | portb.portbCopy | portb.asm |
| $208F | 2 | portb.portbCopy | portb.asm |
| $2091 | 2 | portb.portbCopy | portb.asm |
| $2093 | 2 | portb.portbCopy | portb.asm |
| $2095 | 2 | portb.portbCopy | portb.asm |
| $2097 | 2 | portb.portbCopy | portb.asm |
| $2099 | 2 | portb.portbCopy | portb.asm |
| $209B | 2 | portb.portbCopy | portb.asm |
| $209D | 1 | portb.portbCopy | portb.asm |
| $209E | 2 | portb.portbCopy | portb.asm |
| $20A0 | 2 | portb.portbCopy | portb.asm |
| $20A2 | 1 | portb.portbCopy | portb.asm |
| $20A3 | 2 | portb.portbCopy | portb.asm |
| $20A5 | 2 | portb.portbCopy | portb.asm |
| $20A7 | 2 | portb.portbCopy | portb.asm |
| $20A9 | 2 | portb.portbCopy | portb.asm |
| $20AB | 2 | portb.portbCopy | portb.asm |
| $20AD | 2 | portb.portbCopy | portb.asm |
| $20AF | 3 | portb.portbCopy | portb.asm |
| $20B2 | 1 | portb.portbCopy | portb.asm |
| $20B3 | 1 | portb.portbCopy | portb.asm |
| $20B4 | 2 | portb.portbCopy | portb.asm |
| $20B6 | 2 | portb.portbCopy | portb.asm |
| $20B8 | 2 | portb.portbCopy | portb.asm |
| $20BA | 2 | portb.portbCopy | portb.asm |
| $20BC | 1 | portb.portbCopy | portb.asm |
| $20BD | 1 | portb.portbCopy | portb.asm |
| $20BE | 2 | portb.portbCopy | portb.asm |
| $20C0 | 2 | portb.portbCopy | portb.asm |
| $20C2 | 2 | portb.portbCopy | portb.asm |
| $20C4 | 2 | portb.portbCopy | portb.asm |
| $20C6 | 1 | portb.portbCopy | portb.asm |
| $20C7 | 2 | portb.portbCopy | portb.asm |
| $20C9 | 2 | portb.portbCopy | portb.asm |
| $20CB | 2 | portb.portbCopy | portb.asm |
| $20CD | 2 | portb.portbCopy | portb.asm |
| $20CF | 2 | portb.portbCopy | portb.asm |
| $20D1 | 2 | portb.portbCopy | portb.asm |
| $20D3 | 2 | portb.portbCopy | portb.asm |
| $20D5 | 2 | portb.portbCopy | portb.asm |
| $20D7 | 2 | portb.portbCopy | portb.asm |
| $20D9 | 3 | portb.portbCopy | portb.asm |
| $20DC | 3 | portb.portbCopy | portb.asm |
| $20DF | 1 | portb.portbCopy | portb.asm |
| $20E0 | 3 | print.printLine | print.asm |
| $20E3 | 3 | print.printLine | print.asm |
| $20E6 | 3 | print.printLine | print.asm |
| $20E9 | 2 | print.printLine | print.asm |
| $20EB | 3 | print.printLine | print.asm |
| $20EE | 2 | print.printLine | print.asm |
| $20F0 | 3 | print.printLine | print.asm |
| $20F3 | 2 | print.printLine | print.asm |
| $20F5 | 3 | print.printLine | print.asm |
| $20F8 | 1 | print.printLine | print.asm |
| $20F9 | 2 | run.showScreen | run.asm |
| $20FB | 2 | run.showScreen | run.asm |
| $20FD | 2 | run.showScreen | run.asm |
| $20FF | 1 | run.showScreen | run.asm |
| $2100 | 2 | run.showScreen | run.asm |
| $2102 | 1 | run.showScreen | run.asm |
| $2103 | 2 | run.showScreen | run.asm |
| $2105 | 2 | run.showScreen | run.asm |
| $2107 | 3 | run.showScreen | run.asm |
| $210A | 3 | run.showScreen | run.asm |
| $210D | 1 | run.showScreen | run.asm |
| $210E | 6 | intro.introTitle | intro.asm |
| $2114 | 16 | intro.introText | intro.asm |
| $2124 | 2 | intro.introDraw | intro.asm |
| $2126 | 2 | intro.introDraw | intro.asm |
| $2128 | 2 | intro.introDraw | intro.asm |
| $212A | 3 | intro.introDraw | intro.asm |
| $212D | 1 | intro.introDraw | intro.asm |
| $212E | 3 | intro.introStart | intro.asm |
| $2131 | 9 | intro.introStart | intro.asm |
$214C–$224D 258 bytes at 319
| $214C | 1 | nga.transition.ngaTransition | transition.asm |
| $214D | 2 | nga.transition.ngaTransition | transition.asm |
| $214F | 1 | nga.transition.ngaTransition | transition.asm |
| $2150 | 2 | nga.transition.ngaTransition | transition.asm |
| $2152 | 2 | nga.transition.ngaTransition | transition.asm |
| $2154 | 2 | nga.transition.ngaTransition | transition.asm |
| $2156 | 2 | nga.transition.ngaTransition | transition.asm |
| $2158 | 1 | nga.transition.ngaTransition | transition.asm |
| $2159 | 2 | nga.transition.ngaTransition | transition.asm |
| $215B | 2 | nga.transition.ngaTransition | transition.asm |
| $215D | 2 | nga.transition.ngaTransition | transition.asm |
| $215F | 1 | nga.transition.ngaTransition | transition.asm |
| $2160 | 2 | nga.transition.ngaTransition | transition.asm |
| $2162 | 2 | nga.transition.ngaTransition | transition.asm |
| $2164 | 2 | nga.transition.ngaTransition | transition.asm |
| $2166 | 2 | nga.transition.ngaTransition | transition.asm |
| $2168 | 2 | nga.transition.ngaTransition | transition.asm |
| $216A | 2 | nga.transition.ngaTransition | transition.asm |
| $216C | 1 | nga.transition.ngaTransition | transition.asm |
| $216D | 2 | nga.transition.ngaTransition | transition.asm |
| $216F | 2 | nga.transition.ngaTransition | transition.asm |
| $2171 | 3 | nga.transition.ngaTransition | transition.asm |
| $2174 | 2 | nga.transition.ngaTransition | transition.asm |
| $2176 | 2 | nga.transition.ngaTransition | transition.asm |
| $2178 | 1 | nga.transition.ngaTransition | transition.asm |
| $2179 | 2 | nga.transition.ngaTransition | transition.asm |
| $217B | 2 | nga.transition.ngaTransition | transition.asm |
| $217D | 2 | nga.transition.ngaTransition | transition.asm |
| $217F | 2 | nga.transition.ngaTransition | transition.asm |
| $2181 | 2 | nga.transition.ngaTransition | transition.asm |
| $2183 | 3 | nga.transition.ngaTransition | transition.asm |
| $2186 | 1 | nga.transition.ngaTransition | transition.asm |
| $2187 | 2 | nga.transition.ngaTransition | transition.asm |
| $2189 | 2 | nga.transition.ngaTransition | transition.asm |
| $218B | 1 | nga.transition.ngaTransition | transition.asm |
| $218C | 2 | nga.transition.ngaTransition | transition.asm |
| $218E | 2 | nga.transition.ngaTransition | transition.asm |
| $2190 | 1 | nga.transition.ngaTransition | transition.asm |
| $2191 | 2 | nga.transition.ngaTransition | transition.asm |
| $2193 | 2 | nga.transition.ngaTransition | transition.asm |
| $2195 | 3 | nga.transition.ngaEnter | transition.asm |
| $2198 | 3 | nga.transition.ngaEnter | transition.asm |
| $219B | 2 | nga.transition.ngaEnter | transition.asm |
| $219D | 3 | nga.transition.ngaEnter | transition.asm |
| $21A0 | 2 | nga.transition.ngaEnter | transition.asm |
| $21A2 | 3 | nga.transition.ngaEnter | transition.asm |
| $21A5 | 2 | nga.transition.ngaEnter | transition.asm |
| $21A7 | 3 | nga.transition.ngaEnter | transition.asm |
| $21AA | 3 | nga.transition.ngaEnter | transition.asm |
| $21AD | 2 | nga.transition.ngaEnter | transition.asm |
| $21AF | 3 | nga.transition.ngaEnter | transition.asm |
| $21B2 | 2 | nga.transition.ngaEnter | transition.asm |
| $21B4 | 2 | nga.transition.ngaEnter | transition.asm |
| $21B6 | 3 | nga.transition.ngaEnter | transition.asm |
| $21B9 | 3 | nga.transition.ngaEnter | transition.asm |
| $21BC | 2 | nga.transition.ngaEnter | transition.asm |
| $21BE | 3 | nga.transition.ngaEnter | transition.asm |
| $21C1 | 2 | nga.transition.ngaEnter | transition.asm |
| $21C3 | 3 | nga.transition.ngaEnter | transition.asm |
| $21C6 | 2 | nga.transition.ngaEnter | transition.asm |
| $21C8 | 3 | nga.transition.ngaEnter | transition.asm |
| $21CB | 2 | nga.transition.ngaEnter | transition.asm |
| $21CD | 3 | nga.transition.ngaEnter | transition.asm |
| $21D0 | 2 | nga.transition.ngaEnter | transition.asm |
| $21D2 | 3 | nga.transition.ngaEnter | transition.asm |
| $21D5 | 1 | nga.transition.ngaEnter | transition.asm |
| $21D6 | 2 | nga.transition.ngaEnter | transition.asm |
| $21D8 | 3 | nga.transition.ngaEnter | transition.asm |
| $21DB | 2 | nga.transition.ngaEnter | transition.asm |
| $21DD | 2 | nga.transition.ngaEnter | transition.asm |
| $21DF | 2 | nga.transition.ngaEnter | transition.asm |
| $21E1 | 2 | nga.transition.ngaEnter | transition.asm |
| $21E3 | 2 | nga.transition.ngaEnter | transition.asm |
| $21E5 | 2 | nga.transition.ngaEnter | transition.asm |
| $21E7 | 3 | nga.transition.ngaEnter | transition.asm |
| $21EA | 1 | nga.transition.ngaEnter | transition.asm |
| $21EB | 2 | nga.transition.ngaEnter | transition.asm |
| $21ED | 2 | nga.transition.ngaEnter | transition.asm |
| $21EF | 3 | nga.transition.ngaEnter | transition.asm |
| $21F2 | 2 | nga.transition.ngaEnter | transition.asm |
| $21F4 | 3 | nga.transition.ngaEnter | transition.asm |
| $21F7 | 3 | nga.transition.ngaEnter | transition.asm |
| $21FA | 3 | nga.transition.ngaEnter | transition.asm |
| $21FD | 2 | nga.transition.ngaEnter | transition.asm |
| $21FF | 2 | nga.transition.ngaEnter | transition.asm |
| $2201 | 2 | nga.transition.ngaEnter | transition.asm |
| $2203 | 3 | nga.transition.ngaEnter | transition.asm |
| $2206 | 2 | nga.transition.ngaEnter | transition.asm |
| $2208 | 3 | nga.transition.ngaEnter | transition.asm |
| $220B | 2 | nga.transition.ngaEnter | transition.asm |
| $220D | 3 | nga.transition.ngaEnter | transition.asm |
| $2210 | 2 | nga.transition.ngaEnter | transition.asm |
| $2212 | 3 | nga.transition.ngaEnter | transition.asm |
| $2215 | 2 | nga.transition.ngaEnter | transition.asm |
| $2217 | 2 | nga.transition.ngaEnter | transition.asm |
| $2219 | 2 | nga.transition.ngaEnter | transition.asm |
| $221B | 2 | nga.transition.ngaEnter | transition.asm |
| $221D | 1 | nga.transition.ngaEnter | transition.asm |
| $221E | 2 | nga.transition.ngaEnter | transition.asm |
| $2220 | 2 | nga.transition.ngaEnter | transition.asm |
| $2222 | 2 | nga.transition.ngaEnter | transition.asm |
| $2224 | 3 | nga.transition.ngaEnter | transition.asm |
| $2227 | 2 | nga.transition.ngaEnter | transition.asm |
| $2229 | 3 | nga.transition.ngaEnter | transition.asm |
| $222C | 3 | nga.transition.ngaEnter | transition.asm |
| $222F | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $2231 | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $2233 | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $2235 | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $2237 | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $2239 | 2 | nga.transition.ngaFrameOpen | transition.asm |
| $223B | 3 | nga.transition.ngaFrameOpen | transition.asm |
| $223E | 1 | nga.transition.ngaFrameOpen | transition.asm |
| $223F | 1 | nga.transition.ngaFrameSkip | transition.asm |
| $2240 | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $2242 | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $2244 | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $2246 | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $2248 | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $224A | 2 | nga.transition.ngaFrameSkip | transition.asm |
| $224C | 1 | nga.transition.ngaFrameSkip | transition.asm |
| $224D | 1 | nga.cell.ngaCurrentPhase |
$008F–$0090 2 bytes at 581
| $008F | 2 | nga.slots.title | run.asm |
$224E–$2250 3 bytes at 587
| $224E | 3 | nga.slots.draw | run.asm |
$2252–$226E 29 bytes at 594
| $2252 | 3 | nga.transforms.ngaLoadMap | transforms.asm |
| $2255 | 3 | nga.transforms.ngaLoadMap | transforms.asm |
| $2258 | 1 | nga.transforms.ngaLoadMap | transforms.asm |
| $2259 | 2 | nga.transforms.ngaTransform | transforms.asm |
| $225B | 2 | nga.transforms.ngaTransform | transforms.asm |
| $225D | 3 | nga.transforms.ngaTransform | transforms.asm |
| $2260 | 1 | nga.transforms.ngaTransform | transforms.asm |
| $2261 | 6 | nga.init.ngaInit | init.asm |
| $2267 | 1 | nga.init.ngaInit | init.asm |
| $2268 | 6 | nga.finish.ngaFinish | finish.asm |
| $226E | 1 | nga.finish.ngaFinish | finish.asm |
$213A–$2147 14 bytes at 627
$02E2–$02E3 2 bytes at 645
| $02E2 | 2 | initad |
$2251–$2251 1 bytes at 651
| $2251 | 1 | nga.transforms.ngaLoadUnit | transforms.asm |
$02E2–$02E3 2 bytes at 656
| $02E2 | 2 | initad |
$4000–$406A 107 bytes at 662
| $4000 | 107 | storage image |
$2251–$2251 1 bytes at 773
| $2251 | 1 | nga.transforms.ngaLoadUnit | transforms.asm |
$02E2–$02E3 2 bytes at 778
| $02E2 | 2 | initad |
$4000–$4171 370 bytes at 784
$02E0–$02E1 2 bytes at 1158
| $02E0 | 2 | runad |