Web64 logo Web64 Documentation Web64 SDK Header Printouts

Web64 SDK Header Printouts

These are exact generated listings of the bundled read-only Web64 C SDK headers. Use this page when you want a print-friendly reference, or open the raw listing links when you want plain text that a browser can print or save directly.

HeaderPrintable raw listingSymbols
6502.hheaders/6502.h6 symbols
assets/generated.hheaders/assets__generated.h0 symbols
c64.hheaders/c64.h229 symbols
c64lib/64spec.hheaders/c64lib__64spec.h17 symbols
c64lib/bitmap.hheaders/c64lib__bitmap.h2 symbols
c64lib/chipset.hheaders/c64lib__chipset.h36 symbols
c64lib/common.hheaders/c64lib__common.h8 symbols
c64lib/copper64.hheaders/c64lib__copper64.h25 symbols
c64lib/magic-desk.hheaders/c64lib__magic-desk.h7 symbols
c64lib/sprites.hheaders/c64lib__sprites.h4 symbols
c64lib/text.hheaders/c64lib__text.h18 symbols
c64lib/vic2.hheaders/c64lib__vic2.h7 symbols
cbm.hheaders/cbm.h26 symbols
conio.hheaders/conio.h31 symbols
ctype.hheaders/ctype.h13 symbols
float.hheaders/float.h29 symbols
joy.hheaders/joy.h1 symbols
joystick.hheaders/joystick.h5 symbols
libc.hheaders/libc.h2 symbols
limits.hheaders/limits.h16 symbols
peekpoke.hheaders/peekpoke.h4 symbols
sprite.hheaders/sprite.h3 symbols
stdarg.hheaders/stdarg.h6 symbols
stdbool.hheaders/stdbool.h4 symbols
stddef.hheaders/stddef.h5 symbols
stdint.hheaders/stdint.h29 symbols
stdio.hheaders/stdio.h5 symbols
stdlib.hheaders/stdlib.h6 symbols
string.hheaders/string.h18 symbols
web64.hheaders/web64.h10 symbols
web64/actor-batch.hheaders/web64__actor-batch.h178 symbols
web64/actor-batch.incheaders/web64__actor-batch.inc0 symbols
web64/actors.hheaders/web64__actors.h17 symbols
web64/actors.incheaders/web64__actors.inc0 symbols
web64/animation.hheaders/web64__animation.h16 symbols
web64/animation.incheaders/web64__animation.inc0 symbols
web64/assets.hheaders/web64__assets.h62 symbols
web64/assets.incheaders/web64__assets.inc0 symbols
web64/bitmap.hheaders/web64__bitmap.h49 symbols
web64/bitmap.incheaders/web64__bitmap.inc0 symbols
web64/cartridge.hheaders/web64__cartridge.h25 symbols
web64/cartridge.incheaders/web64__cartridge.inc0 symbols
web64/collision.hheaders/web64__collision.h30 symbols
web64/collision.incheaders/web64__collision.inc0 symbols
web64/disk.hheaders/web64__disk.h21 symbols
web64/disk.incheaders/web64__disk.inc0 symbols
web64/fixed.hheaders/web64__fixed.h81 symbols
web64/fixed.incheaders/web64__fixed.inc0 symbols
web64/game-compose.hheaders/web64__game-compose.h3 symbols
web64/game.hheaders/web64__game.h12 symbols
web64/loader-decoder-runtime.incheaders/web64__loader-decoder-runtime.inc0 symbols
web64/loader-packed-runtime.incheaders/web64__loader-packed-runtime.inc0 symbols
web64/loader-raw-runtime.incheaders/web64__loader-raw-runtime.inc0 symbols
web64/loader-state-runtime.incheaders/web64__loader-state-runtime.inc0 symbols
web64/loader-transport-runtime.incheaders/web64__loader-transport-runtime.inc0 symbols
web64/loader.hheaders/web64__loader.h29 symbols
web64/loader.incheaders/web64__loader.inc0 symbols
web64/motion.hheaders/web64__motion.h17 symbols
web64/motion.incheaders/web64__motion.inc0 symbols
web64/reu.hheaders/web64__reu.h23 symbols
web64/reu.incheaders/web64__reu.inc0 symbols
web64/runtime.incheaders/web64__runtime.inc0 symbols
web64/sprite-mux.hheaders/web64__sprite-mux.h20 symbols
web64/sprite-mux.incheaders/web64__sprite-mux.inc0 symbols
web64/sprite-runtime.hheaders/web64__sprite-runtime.h14 symbols
web64/sprite-runtime.incheaders/web64__sprite-runtime.inc0 symbols
web64/trajectory.hheaders/web64__trajectory.h45 symbols
web64/trajectory.incheaders/web64__trajectory.inc0 symbols
web64/world.hheaders/web64__world.h14 symbols
web64/world.incheaders/web64__world.inc0 symbols

6502.h

#ifndef WEB64_6502_H
#define WEB64_6502_H
#include <stdint.h>
#define PEEK(address) (*(volatile uint8_t*)(address))
#define POKE(address, value) (*(volatile uint8_t*)(address) = (uint8_t)(value))
#define PEEKW(address) (*(volatile uint16_t*)(address))
#define POKEW(address, value) (*(volatile uint16_t*)(address) = (uint16_t)(value))
#define CLI() __asm__("cli")
#define SEI() __asm__("sei")
#endif

assets/generated.h

#ifndef WEB64_ASSETS_GENERATED_H
#define WEB64_ASSETS_GENERATED_H
#include <web64/assets.h>
#endif

c64.h

#ifndef WEB64_C64_H
#define WEB64_C64_H

/* Common C64 memory map. */
#define C64_RAM_BASE 0x0000
#define C64_BASIC_START 0x0801
#define C64_SCREEN_RAM 0x0400
#define C64_COLOR_RAM 0xd800
#define C64_CHAR_ROM 0xd000
#define C64_SCREEN_WIDTH 40
#define C64_SCREEN_HEIGHT 25
#define C64_SCREEN_CELL_COUNT 1000
#define C64_IO_BASE 0xd000
#define C64_KERNAL_ROM 0xe000

typedef unsigned char c64_reg8_t;

typedef struct c64_cpu_port_registers {
    volatile c64_reg8_t data_direction;
    volatile c64_reg8_t data;
} c64_cpu_port_registers;

typedef struct c64_screen_ram {
    volatile c64_reg8_t cells[1000];
} c64_screen_ram;

typedef struct c64_color_ram {
    volatile c64_reg8_t cells[1000];
} c64_color_ram;

#define C64_CPU_PORT ((volatile c64_cpu_port_registers*)0x0000)
#define C64_SCREEN ((volatile c64_screen_ram*)C64_SCREEN_RAM)
#define C64_COLOR ((volatile c64_color_ram*)C64_COLOR_RAM)
#define C64_SCREEN_ROWS ((volatile unsigned char (*)[40])C64_SCREEN_RAM)
#define C64_COLOR_ROWS ((volatile unsigned char (*)[40])C64_COLOR_RAM)
#define C64_CHAR_ROM_GLYPHS ((const unsigned char (*)[8])C64_CHAR_ROM)

/* VIC-II registers. */
typedef struct c64_vicii_registers {
    volatile c64_reg8_t sprite0_x;
    volatile c64_reg8_t sprite0_y;
    volatile c64_reg8_t sprite1_x;
    volatile c64_reg8_t sprite1_y;
    volatile c64_reg8_t sprite2_x;
    volatile c64_reg8_t sprite2_y;
    volatile c64_reg8_t sprite3_x;
    volatile c64_reg8_t sprite3_y;
    volatile c64_reg8_t sprite4_x;
    volatile c64_reg8_t sprite4_y;
    volatile c64_reg8_t sprite5_x;
    volatile c64_reg8_t sprite5_y;
    volatile c64_reg8_t sprite6_x;
    volatile c64_reg8_t sprite6_y;
    volatile c64_reg8_t sprite7_x;
    volatile c64_reg8_t sprite7_y;
    volatile c64_reg8_t sprite_x_msb;
    volatile c64_reg8_t control1;
    volatile c64_reg8_t raster;
    volatile c64_reg8_t lightpen_x;
    volatile c64_reg8_t lightpen_y;
    volatile c64_reg8_t sprite_enable;
    volatile c64_reg8_t control2;
    volatile c64_reg8_t sprite_y_expand;
    volatile c64_reg8_t memory_setup;
    volatile c64_reg8_t interrupt_status;
    volatile c64_reg8_t interrupt_enable;
    volatile c64_reg8_t sprite_priority;
    volatile c64_reg8_t sprite_multicolor;
    volatile c64_reg8_t sprite_x_expand;
    volatile c64_reg8_t sprite_collision;
    volatile c64_reg8_t data_collision;
    volatile c64_reg8_t border_color;
    volatile c64_reg8_t background_color0;
    volatile c64_reg8_t background_color1;
    volatile c64_reg8_t background_color2;
    volatile c64_reg8_t background_color3;
    volatile c64_reg8_t sprite_multicolor0;
    volatile c64_reg8_t sprite_multicolor1;
    volatile c64_reg8_t sprite0_color;
    volatile c64_reg8_t sprite1_color;
    volatile c64_reg8_t sprite2_color;
    volatile c64_reg8_t sprite3_color;
    volatile c64_reg8_t sprite4_color;
    volatile c64_reg8_t sprite5_color;
    volatile c64_reg8_t sprite6_color;
    volatile c64_reg8_t sprite7_color;
} c64_vicii_registers;

#define VIC_BASE 0xd000
#define VIC_SPRITE0_X 0xd000
#define VIC_SPRITE0_Y 0xd001
#define VIC_SPRITE1_X 0xd002
#define VIC_SPRITE1_Y 0xd003
#define VIC_SPRITE2_X 0xd004
#define VIC_SPRITE2_Y 0xd005
#define VIC_SPRITE3_X 0xd006
#define VIC_SPRITE3_Y 0xd007
#define VIC_SPRITE4_X 0xd008
#define VIC_SPRITE4_Y 0xd009
#define VIC_SPRITE5_X 0xd00a
#define VIC_SPRITE5_Y 0xd00b
#define VIC_SPRITE6_X 0xd00c
#define VIC_SPRITE6_Y 0xd00d
#define VIC_SPRITE7_X 0xd00e
#define VIC_SPRITE7_Y 0xd00f
#define VIC_SPRITE_X_MSB 0xd010
#define VIC_CONTROL1 0xd011
#define VIC_RASTER 0xd012
#define VIC_LIGHTPEN_X 0xd013
#define VIC_LIGHTPEN_Y 0xd014
#define VIC_SPRITE_ENABLE 0xd015
#define VIC_CONTROL2 0xd016
#define VIC_SPRITE_Y_EXPAND 0xd017
#define VIC_MEMORY_SETUP 0xd018
#define VIC_INTERRUPT_STATUS 0xd019
#define VIC_INTERRUPT_ENABLE 0xd01a
#define VIC_SPRITE_PRIORITY 0xd01b
#define VIC_SPRITE_MULTICOLOR 0xd01c
#define VIC_SPRITE_X_EXPAND 0xd01d
#define VIC_SPRITE_COLLISION 0xd01e
#define VIC_DATA_COLLISION 0xd01f
#define VIC_BORDER 0xd020
#define VIC_BACKGROUND 0xd021
#define VIC_BACKGROUND0 0xd021
#define VIC_BACKGROUND1 0xd022
#define VIC_BACKGROUND2 0xd023
#define VIC_BACKGROUND3 0xd024
#define VIC_SPRITE_MULTICOLOR0 0xd025
#define VIC_SPRITE_MULTICOLOR1 0xd026
#define VIC_SPRITE0_COLOR 0xd027
#define VIC_SPRITE1_COLOR 0xd028
#define VIC_SPRITE2_COLOR 0xd029
#define VIC_SPRITE3_COLOR 0xd02a
#define VIC_SPRITE4_COLOR 0xd02b
#define VIC_SPRITE5_COLOR 0xd02c
#define VIC_SPRITE6_COLOR 0xd02d
#define VIC_SPRITE7_COLOR 0xd02e
#define VIC_COLOR_BLACK 0x00
#define VIC_COLOR_WHITE 0x01
#define VIC_COLOR_RED 0x02
#define VIC_COLOR_CYAN 0x03
#define VIC_COLOR_PURPLE 0x04
#define VIC_COLOR_GREEN 0x05
#define VIC_COLOR_BLUE 0x06
#define VIC_COLOR_YELLOW 0x07
#define VIC_COLOR_ORANGE 0x08
#define VIC_COLOR_BROWN 0x09
#define VIC_COLOR_LIGHT_RED 0x0a
#define VIC_COLOR_DARK_GRAY 0x0b
#define VIC_COLOR_GRAY 0x0c
#define VIC_COLOR_LIGHT_GREEN 0x0d
#define VIC_COLOR_LIGHT_BLUE 0x0e
#define VIC_COLOR_LIGHT_GRAY 0x0f
#define COLOR_BLACK VIC_COLOR_BLACK
#define COLOR_WHITE VIC_COLOR_WHITE
#define COLOR_RED VIC_COLOR_RED
#define COLOR_CYAN VIC_COLOR_CYAN
#define COLOR_PURPLE VIC_COLOR_PURPLE
#define COLOR_GREEN VIC_COLOR_GREEN
#define COLOR_BLUE VIC_COLOR_BLUE
#define COLOR_YELLOW VIC_COLOR_YELLOW
#define COLOR_ORANGE VIC_COLOR_ORANGE
#define COLOR_BROWN VIC_COLOR_BROWN
#define COLOR_LIGHTRED VIC_COLOR_LIGHT_RED
#define COLOR_GRAY1 VIC_COLOR_DARK_GRAY
#define COLOR_GRAY2 VIC_COLOR_GRAY
#define COLOR_LIGHTGREEN VIC_COLOR_LIGHT_GREEN
#define COLOR_LIGHTBLUE VIC_COLOR_LIGHT_BLUE
#define COLOR_GRAY3 VIC_COLOR_LIGHT_GRAY
#define VIC_SPRITE_POINTER_BASE 0x07f8
#define VICII ((volatile c64_vicii_registers*)VIC_BASE)
#define VIC VICII

/* SID registers. */
typedef struct c64_sid_voice_registers {
    volatile c64_reg8_t freq_lo;
    volatile c64_reg8_t freq_hi;
    volatile c64_reg8_t pulse_lo;
    volatile c64_reg8_t pulse_hi;
    volatile c64_reg8_t control;
    volatile c64_reg8_t attack_decay;
    volatile c64_reg8_t sustain_release;
} c64_sid_voice_registers;

typedef struct c64_sid_registers {
    volatile c64_reg8_t voice1_freq_lo;
    volatile c64_reg8_t voice1_freq_hi;
    volatile c64_reg8_t voice1_pulse_lo;
    volatile c64_reg8_t voice1_pulse_hi;
    volatile c64_reg8_t voice1_control;
    volatile c64_reg8_t voice1_attack_decay;
    volatile c64_reg8_t voice1_sustain_release;
    volatile c64_reg8_t voice2_freq_lo;
    volatile c64_reg8_t voice2_freq_hi;
    volatile c64_reg8_t voice2_pulse_lo;
    volatile c64_reg8_t voice2_pulse_hi;
    volatile c64_reg8_t voice2_control;
    volatile c64_reg8_t voice2_attack_decay;
    volatile c64_reg8_t voice2_sustain_release;
    volatile c64_reg8_t voice3_freq_lo;
    volatile c64_reg8_t voice3_freq_hi;
    volatile c64_reg8_t voice3_pulse_lo;
    volatile c64_reg8_t voice3_pulse_hi;
    volatile c64_reg8_t voice3_control;
    volatile c64_reg8_t voice3_attack_decay;
    volatile c64_reg8_t voice3_sustain_release;
    volatile c64_reg8_t filter_cutoff_lo;
    volatile c64_reg8_t filter_cutoff_hi;
    volatile c64_reg8_t filter_resonance;
    volatile c64_reg8_t volume_filter_mode;
    volatile c64_reg8_t pot_x;
    volatile c64_reg8_t pot_y;
    volatile c64_reg8_t osc3_random;
    volatile c64_reg8_t env3;
} c64_sid_registers;

#define SID_BASE 0xd400
#define SID_VOICE1_FREQ_LO 0xd400
#define SID_VOICE1_FREQ_HI 0xd401
#define SID_VOICE1_PULSE_LO 0xd402
#define SID_VOICE1_PULSE_HI 0xd403
#define SID_VOICE1_CONTROL 0xd404
#define SID_VOICE1_ATTACK_DECAY 0xd405
#define SID_VOICE1_SUSTAIN_RELEASE 0xd406
#define SID_VOICE2_FREQ_LO 0xd407
#define SID_VOICE2_FREQ_HI 0xd408
#define SID_VOICE2_PULSE_LO 0xd409
#define SID_VOICE2_PULSE_HI 0xd40a
#define SID_VOICE2_CONTROL 0xd40b
#define SID_VOICE2_ATTACK_DECAY 0xd40c
#define SID_VOICE2_SUSTAIN_RELEASE 0xd40d
#define SID_VOICE3_FREQ_LO 0xd40e
#define SID_VOICE3_FREQ_HI 0xd40f
#define SID_VOICE3_PULSE_LO 0xd410
#define SID_VOICE3_PULSE_HI 0xd411
#define SID_VOICE3_CONTROL 0xd412
#define SID_VOICE3_ATTACK_DECAY 0xd413
#define SID_VOICE3_SUSTAIN_RELEASE 0xd414
#define SID_FILTER_CUTOFF_LO 0xd415
#define SID_FILTER_CUTOFF_HI 0xd416
#define SID_FILTER_RESONANCE 0xd417
#define SID_VOLUME_FILTER_MODE 0xd418
#define SID_POT_X 0xd419
#define SID_POT_Y 0xd41a
#define SID_OSC3_RANDOM 0xd41b
#define SID_ENV3 0xd41c
#define SID_WAVE_TRIANGLE 0x10
#define SID_WAVE_SAW 0x20
#define SID_WAVE_PULSE 0x40
#define SID_WAVE_NOISE 0x80
#define SID_GATE 0x01
#define SID_SYNC 0x02
#define SID_RING_MOD 0x04
#define SID_TEST 0x08

/* CIA, keyboard, and joyport registers. */
typedef struct c64_cia_registers {
    volatile c64_reg8_t pra;
    volatile c64_reg8_t prb;
    volatile c64_reg8_t ddra;
    volatile c64_reg8_t ddrb;
    volatile c64_reg8_t timer_a_lo;
    volatile c64_reg8_t timer_a_hi;
    volatile c64_reg8_t timer_b_lo;
    volatile c64_reg8_t timer_b_hi;
    volatile c64_reg8_t tod_10ths;
    volatile c64_reg8_t tod_seconds;
    volatile c64_reg8_t tod_minutes;
    volatile c64_reg8_t tod_hours;
    volatile c64_reg8_t serial_data;
    volatile c64_reg8_t interrupt_control;
    volatile c64_reg8_t control_a;
    volatile c64_reg8_t control_b;
} c64_cia_registers;

#define SID ((volatile c64_sid_registers*)SID_BASE)

/* CIA, keyboard, and joyport registers. */
#define CIA1_BASE 0xdc00
#define CIA1_PRA 0xdc00
#define CIA1_PRB 0xdc01
#define CIA1_DDRA 0xdc02
#define CIA1_DDRB 0xdc03
#define CIA1_TIMER_A_LO 0xdc04
#define CIA1_TIMER_A_HI 0xdc05
#define CIA1_TIMER_B_LO 0xdc06
#define CIA1_TIMER_B_HI 0xdc07
#define CIA1_TOD_10THS 0xdc08
#define CIA1_TOD_SECONDS 0xdc09
#define CIA1_TOD_MINUTES 0xdc0a
#define CIA1_TOD_HOURS 0xdc0b
#define CIA1_SERIAL_DATA 0xdc0c
#define CIA1_INTERRUPT_CONTROL 0xdc0d
#define CIA1_CONTROL_A 0xdc0e
#define CIA1_CONTROL_B 0xdc0f
#define CIA2_BASE 0xdd00
#define CIA2_PRA 0xdd00
#define CIA2_PRB 0xdd01
#define CIA2_DDRA 0xdd02
#define CIA2_DDRB 0xdd03
#define CIA2_TIMER_A_LO 0xdd04
#define CIA2_TIMER_A_HI 0xdd05
#define CIA2_TIMER_B_LO 0xdd06
#define CIA2_TIMER_B_HI 0xdd07
#define CIA2_TOD_10THS 0xdd08
#define CIA2_TOD_SECONDS 0xdd09
#define CIA2_TOD_MINUTES 0xdd0a
#define CIA2_TOD_HOURS 0xdd0b
#define CIA2_SERIAL_DATA 0xdd0c
#define CIA2_INTERRUPT_CONTROL 0xdd0d
#define CIA2_CONTROL_A 0xdd0e
#define CIA2_CONTROL_B 0xdd0f
#define CIA1 ((volatile c64_cia_registers*)CIA1_BASE)
#define CIA2 ((volatile c64_cia_registers*)CIA2_BASE)
#define KEYBOARD_COLUMN_PORT 0xdc00
#define KEYBOARD_ROW_PORT 0xdc01
#define KEYBOARD_COLUMN_DDR 0xdc02
#define KEYBOARD_ROW_DDR 0xdc03
#define KEYBOARD_ACTIVE_MASK 0xff
#define JOYPORT_1 0xdc01
#define JOYPORT_2 0xdc00
/* Joystick masks are active-low: (sample & JOY_FIRE) == 0 means pressed. */
#define JOY_UP 0x01
#define JOY_DOWN 0x02
#define JOY_LEFT 0x04
#define JOY_RIGHT 0x08
#define JOY_FIRE 0x10
#define JOY_ACTIVE_LOW 0x00
#define JOY_RELEASED_MASK 0x1f
#define JOY2_UP() (!(CIA1->pra & JOY_UP))
#define JOY2_DOWN() (!(CIA1->pra & JOY_DOWN))
#define JOY2_LEFT() (!(CIA1->pra & JOY_LEFT))
#define JOY2_RIGHT() (!(CIA1->pra & JOY_RIGHT))
#define JOY2_FIRE() (!(CIA1->pra & JOY_FIRE))
#define JOY_UP_P(v) (!((v) & JOY_UP))
#define JOY_DOWN_P(v) (!((v) & JOY_DOWN))
#define JOY_LEFT_P(v) (!((v) & JOY_LEFT))
#define JOY_RIGHT_P(v) (!((v) & JOY_RIGHT))
#define JOY_FIRE_P(v) (!((v) & JOY_FIRE))

/* Convenience aliases. */
#define VIC_BORDER_COLOR VIC_BORDER
#define VIC_BACKGROUND_COLOR VIC_BACKGROUND
#define VIC_SPRITE_POINTERS VIC_SPRITE_POINTER_BASE
#define BORDER_COLOR VIC->border_color
#define BACKGROUND_COLOR VIC->background_color0
#define SPRITE_ENABLE VIC->sprite_enable
#define SPRITE_MULTICOLOR VIC->sprite_multicolor

/* Common KERNAL entry points. */
#define KERNAL_CHROUT 0xffd2
#define KERNAL_CHRIN 0xffcf
#define KERNAL_READST 0xffb7
#define KERNAL_OPEN 0xffc0
#define KERNAL_CLOSE 0xffc3
#define KERNAL_CHKIN 0xffc6
#define KERNAL_CHKOUT 0xffc9
#define KERNAL_CLRCHN 0xffcc
#define KERNAL_GETIN 0xffe4
#define KERNAL_SCNKEY 0xff9f
#define KERNAL_PLOT 0xfff0
#define KERNAL_SETLFS 0xffba
#define KERNAL_SETNAM 0xffbd
#define KERNAL_LOAD 0xffd5
#define KERNAL_SAVE 0xffd8

#endif

c64lib/64spec.h

#ifndef WEB64_C64LIB_64SPEC_H
#define WEB64_C64LIB_64SPEC_H
#include <stdint.h>
#define C64LIB_64SPEC_STATUS_IDLE 0
#define C64LIB_64SPEC_STATUS_RUNNING 1
#define C64LIB_64SPEC_STATUS_PASSED 2
#define C64LIB_64SPEC_STATUS_FAILED 3
typedef struct {
    uint8_t magic[2];
    uint8_t status;
    uint16_t passed;
    uint16_t failed;
} C64lib64specResult;
void c64lib_64spec_reset(void);
void c64lib_64spec_assert_equal(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_not_equal(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_unsigned_less(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_unsigned_less_or_equal(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_unsigned_greater(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_unsigned_greater_or_equal(uint8_t actual, uint8_t expected);
void c64lib_64spec_assert_mask_set(uint8_t actual, uint8_t mask);
void c64lib_64spec_assert_mask_clear(uint8_t actual, uint8_t mask);
void c64lib_64spec_assert_bytes_equal(const uint8_t *actual, const uint8_t *expected, uint16_t count);
void c64lib_64spec_assert_bytes_not_equal(const uint8_t *actual, const uint8_t *expected, uint16_t count);
void c64lib_64spec_finish(void);
extern volatile C64lib64specResult c64lib_64spec_result;
#endif

c64lib/bitmap.h

#ifndef WEB64_C64LIB_BITMAP_H
#define WEB64_C64LIB_BITMAP_H
#include <stdint.h>
#define C64LIB_BITMAP_TILE_CONFIG_SIZE 6
typedef struct {
    uint8_t tile_width;
    uint8_t tile_height;
    uint8_t left;
    uint8_t right;
    uint8_t top;
    uint8_t bottom;
} C64libBitmapTileConfig;
#endif

c64lib/chipset.h

#ifndef WEB64_C64LIB_CHIPSET_H
#define WEB64_C64LIB_CHIPSET_H
#include <stdint.h>
#define C64LIB_RAM_RAM_RAM 0
#define C64LIB_RAM_CHAR_RAM 1
#define C64LIB_RAM_CHAR_KERNAL 2
#define C64LIB_BASIC_CHAR_KERNAL 3
#define C64LIB_RAM_IO_RAM 5
#define C64LIB_RAM_IO_KERNAL 6
#define C64LIB_BASIC_IO_KERNAL 7
#define C64LIB_BANK_0 3
#define C64LIB_BANK_1 2
#define C64LIB_BANK_2 1
#define C64LIB_BANK_3 0
#define C64LIB_STANDARD_TEXT_MODE 0
#define C64LIB_MULTICOLOR_TEXT_MODE 1
#define C64LIB_STANDARD_BITMAP_MODE 2
#define C64LIB_MULTICOLOR_BITMAP_MODE 3
#define C64LIB_EXTENDED_TEXT_MODE 4
#define C64LIB_IRQ_LIGHTPEN 8
#define C64LIB_IRQ_SPRITE_SPRITE 4
#define C64LIB_IRQ_SPRITE_BACKGROUND 2
#define C64LIB_IRQ_RASTER 1
#define C64LIB_JOY_UP 1
#define C64LIB_JOY_DOWN 2
#define C64LIB_JOY_LEFT 4
#define C64LIB_JOY_RIGHT 8
#define C64LIB_JOY_FIRE 16
#define C64LIB_TEXT_OFFSET(x, y) ((uint16_t)(x) + ((uint16_t)(y) * 40u))
#define C64LIB_TEXT_MEMORY(screen_slot, charset_slot) ((uint8_t)(((screen_slot) << 4) | ((charset_slot) << 1)))
#define C64LIB_BITMAP_MEMORY(screen_slot, bitmap_slot) ((uint8_t)(((screen_slot) << 4) | ((bitmap_slot) << 3)))
void c64lib_set_vic_bank(uint8_t bank);
void c64lib_disable_cia_interrupts(void);
void c64lib_configure_memory(uint8_t config);
void c64lib_set_raster(uint16_t raster);
uint8_t c64lib_detect_ntsc(void);
void c64lib_sprite_set_x(uint8_t sprite, uint16_t x);
void c64lib_sprite_set_y(uint8_t sprite, uint8_t y);
void c64lib_sprite_set_position(uint8_t sprite, uint16_t x, uint8_t y);
#endif

c64lib/common.h

#ifndef WEB64_C64LIB_COMMON_H
#define WEB64_C64LIB_COMMON_H
#include <stdint.h>
#include <stddef.h>
#define WEB64_C64LIB_COMPAT_VERSION 2
void c64lib_decompress_rle(const uint8_t *source, uint8_t *destination);
/* Decrunches a backward Exomizer 3.1.2 P39 mem stream. source_end points one byte past the stream. */
void c64lib_exomizer_decrunch(const uint8_t *source_end);
void c64lib_copy_large_forward(const void *source, void *destination, uint16_t count);
void c64lib_copy_large_backward(const void *source, void *destination, uint16_t count);
void c64lib_fill_memory(void *destination, uint8_t value, uint16_t count);
void c64lib_fill_screen(void *destination, uint8_t value);
void c64lib_rotate_memory_right(void *address, uint8_t count);
#endif

c64lib/copper64.h

#ifndef WEB64_C64LIB_COPPER64_H
#define WEB64_C64LIB_COPPER64_H
#include <stdint.h>
#define C64LIB_IRQH_BORDER_COL 1
#define C64LIB_IRQH_BG_COL_0 2
#define C64LIB_IRQH_BG_COL_1 3
#define C64LIB_IRQH_BG_COL_2 4
#define C64LIB_IRQH_BG_COL_3 5
#define C64LIB_IRQH_BORDER_BG_0_COL 6
#define C64LIB_IRQH_BORDER_BG_0_DIFF 7
#define C64LIB_IRQH_MEM_BANK 8
#define C64LIB_IRQH_MODE_MEM 9
#define C64LIB_IRQH_JSR 10
#define C64LIB_IRQH_MODE_HIRES_BITMAP 11
#define C64LIB_IRQH_MODE_MULTIC_BITMAP 12
#define C64LIB_IRQH_MODE_HIRES_TEXT 13
#define C64LIB_IRQH_MODE_MULTIC_TEXT 14
#define C64LIB_IRQH_MODE_EXTENDED_TEXT 15
#define C64LIB_IRQH_FULL_RASTER_BAR 16
#define C64LIB_IRQH_BG_RASTER_BAR 17
#define C64LIB_IRQH_HSCROLL 18
#define C64LIB_IRQH_HSCROLL_MAP 19
#define C64LIB_IRQH_MEMORY_CONTROL 20
#define C64LIB_IRQH_VSCROLL 21
#define C64LIB_IRQH_VSCROLL_NTSC 22
#define C64LIB_IRQH_SKIP 0
#define C64LIB_IRQH_LOOP 255
typedef struct { uint8_t control; uint8_t raster; uint8_t arg1; uint8_t arg2; } C64libCopperEntry;
void c64lib_copper_start(const C64libCopperEntry *list);
void c64lib_copper_stop(void);
#endif

c64lib/magic-desk.h

#ifndef WEB64_C64LIB_MAGIC_DESK_H
#define WEB64_C64LIB_MAGIC_DESK_H
#include <stdint.h>
#define C64LIB_MAGIC_DESK_BANK_SELECT 0xde00u
#define C64LIB_MAGIC_DESK_WINDOW 0x8000u
#define C64LIB_MAGIC_DESK_BANK_SIZE 0x2000u
#define C64LIB_MAGIC_DESK_CARTRIDGE_TYPE 19u
void c64lib_magic_desk_set_target(void *target);
void c64lib_magic_desk_copy(uint8_t first_bank, uint16_t size);
#define c64lib_magic_desk_load c64lib_magic_desk_copy
#endif

c64lib/sprites.h

#ifndef WEB64_C64LIB_SPRITES_H
#define WEB64_C64LIB_SPRITES_H
#include <c64lib/chipset.h>
#define C64LIB_SPRITE_MASK(sprite) ((uint8_t)(1u << (sprite)))
#define C64LIB_SPRITE_X_REGISTER(sprite) ((volatile uint8_t*)(0xd000u + ((uint16_t)(sprite) * 2u)))
#define C64LIB_SPRITE_Y_REGISTER(sprite) ((volatile uint8_t*)(0xd001u + ((uint16_t)(sprite) * 2u)))
#define C64LIB_SPRITE_COLOR_REGISTER(sprite) ((volatile uint8_t*)(0xd027u + (sprite)))
#endif

c64lib/text.h

#ifndef WEB64_C64LIB_TEXT_H
#define WEB64_C64LIB_TEXT_H
#include <stdint.h>
void c64lib_text_putxy(const char *text, uint8_t x, uint8_t y, uint8_t color);
void c64lib_text_hex8(uint8_t value, uint8_t x, uint8_t y, uint8_t color);
void c64lib_increment_text(uint8_t *text, uint8_t count, uint8_t increment);
void c64lib_copy_screen_block(const uint8_t *source, uint8_t width, uint8_t height, uint16_t screen_target, const uint8_t *color_source, uint16_t color_target);
void c64lib_scroll1x1(uint16_t screen_address);
void c64lib_shift_left(uint16_t address, uint8_t start_row, uint8_t end_row);
void c64lib_shift_right(uint16_t address, uint8_t start_row, uint8_t end_row);
void c64lib_shift_up(uint16_t address, uint8_t start_row, uint8_t end_row);
void c64lib_shift_down(uint16_t address, uint8_t start_row, uint8_t end_row);
void c64lib_draw_tile2(const uint8_t *characters, uint16_t screen_address, uint16_t color_address, uint8_t color);
typedef struct {
    const uint8_t *map;
    const uint8_t *tile_planes;
    const uint8_t *block_colors;
    const uint8_t *block_materials;
    const uint8_t *map_colors;
    const uint8_t *map_materials;
    uint8_t *screen;
    uint8_t *color_ram;
    uint8_t *row_offsets_lo;
    uint8_t *row_offsets_hi;
    uint8_t map_width;
    uint8_t map_height;
    uint8_t screen_width;
    uint8_t screen_height;
    uint8_t start_row;
    uint8_t end_row;
    uint16_t map_x;
    uint16_t map_y;
    uint8_t default_color;
} C64libTile2Config;
void c64lib_tile2_init(const C64libTile2Config *config);
void c64lib_tile2_render(void);
void c64lib_tile2_scroll_left(void);
void c64lib_tile2_scroll_right(void);
void c64lib_tile2_scroll_up(void);
void c64lib_tile2_scroll_down(void);
uint8_t c64lib_tile2_material_at(uint8_t x, uint8_t y);
#endif

c64lib/vic2.h

#ifndef WEB64_C64LIB_VIC2_H
#define WEB64_C64LIB_VIC2_H
#include <c64lib/chipset.h>
#include <c64.h>
#define C64LIB_VIC2 VIC_BASE
#define C64LIB_RASTER VIC_RASTER
#define C64LIB_CONTROL_1 VIC_CONTROL1
#define C64LIB_CONTROL_2 VIC_CONTROL2
#define C64LIB_MEMORY_CONTROL VIC_MEMORY_CONTROL
#define C64LIB_BORDER_COLOR VIC_BORDER
#define C64LIB_BACKGROUND_COLOR_0 VIC_BACKGROUND0
#endif

cbm.h

#ifndef WEB64_CBM_H
#define WEB64_CBM_H
#include <stdint.h>
#include <c64.h>
#define CHRIN KERNAL_CHRIN
#define CHROUT KERNAL_CHROUT
#define GETIN KERNAL_GETIN
#define READST KERNAL_READST
#define LOAD KERNAL_LOAD
#define SAVE KERNAL_SAVE
#define SETLFS KERNAL_SETLFS
#define SETNAM KERNAL_SETNAM
#define OPEN KERNAL_OPEN
#define CLOSE KERNAL_CLOSE
#define CHKIN KERNAL_CHKIN
#define CHKOUT KERNAL_CHKOUT
#define CLRCHN KERNAL_CLRCHN
uint8_t cbm_k_readst(void);
/* 0 on success; otherwise 0x0100 | KERNAL A (including STOP code 0). */
uint16_t cbm_k_last_error(void);
void cbm_k_setlfs(uint8_t logical_file, uint8_t device, uint8_t secondary);
void cbm_k_setnam(const char *name, uint8_t length);
uint8_t cbm_k_open(void);
void cbm_k_close(uint8_t logical_file);
uint8_t cbm_k_chkin(uint8_t logical_file);
uint8_t cbm_k_chkout(uint8_t logical_file);
void cbm_k_clrchn(void);
uint8_t cbm_k_chrin(void);
void cbm_k_chrout(uint8_t value);
uint16_t cbm_k_load(uint8_t verify, uint16_t address);
uint8_t cbm_k_save(uint16_t start_address, uint16_t end_address);
#endif

conio.h

#ifndef WEB64_CONIO_H
#define WEB64_CONIO_H
#include <stdint.h>
#include <c64.h>
#include <web64.h>
#define COLOR_BLACK VIC_COLOR_BLACK
#define COLOR_WHITE VIC_COLOR_WHITE
#define COLOR_RED VIC_COLOR_RED
#define COLOR_CYAN VIC_COLOR_CYAN
#define COLOR_PURPLE VIC_COLOR_PURPLE
#define COLOR_GREEN VIC_COLOR_GREEN
#define COLOR_BLUE VIC_COLOR_BLUE
#define COLOR_YELLOW VIC_COLOR_YELLOW
#define COLOR_ORANGE VIC_COLOR_ORANGE
#define COLOR_BROWN VIC_COLOR_BROWN
#define COLOR_LIGHTRED VIC_COLOR_LIGHT_RED
#define COLOR_GRAY1 VIC_COLOR_DARK_GRAY
#define COLOR_GRAY2 VIC_COLOR_GRAY
#define COLOR_LIGHTGREEN VIC_COLOR_LIGHT_GREEN
#define COLOR_LIGHTBLUE VIC_COLOR_LIGHT_BLUE
#define COLOR_GRAY3 VIC_COLOR_LIGHT_GRAY
extern _fastcall int cputc(int ch);
extern _fastcall int cputs(char *text);
extern _fastcall int textcolor(int color);
extern _fastcall int bordercolor(int color);
extern _fastcall int bgcolor(int color);
extern _fastcall int wherex(void);
extern _fastcall int wherey(void);
extern _fastcall int cputhex8(int value);
#define CH_ENTER 13
#define CH_ESC 27
#define CH_DEL 20
#define CH_CURS_LEFT 157
#define CH_CURS_RIGHT 29
#define CH_CURS_UP 145
#define CH_CURS_DOWN 17
#endif

ctype.h

#ifndef WEB64_CTYPE_H
#define WEB64_CTYPE_H
/* Web64 tiny ctype parameter: c is the byte character/classification value in A for _fastcall calls. */
extern _fastcall int isdigit(int c);
extern _fastcall int isalnum(int c);
extern _fastcall int isalpha(int c);
extern _fastcall int iscntrl(int c);
extern _fastcall int isspace(int c);
extern _fastcall int isgraph(int c);
extern _fastcall int islower(int c);
extern _fastcall int isprint(int c);
extern _fastcall int ispunct(int c);
extern _fastcall int isupper(int c);
extern _fastcall int isxdigit(int c);
extern _fastcall int tolower(int c);
extern _fastcall int toupper(int c);
#endif

float.h

#ifndef WEB64_FLOAT_H
#define WEB64_FLOAT_H
#define FLT_RADIX 2
#define FLT_ROUNDS 1
#define FLT_MANT_DIG 24
#define DBL_MANT_DIG 53
#define LDBL_MANT_DIG 53
#define FLT_DIG 6
#define DBL_DIG 15
#define LDBL_DIG 15
#define FLT_MIN_EXP (-125)
#define DBL_MIN_EXP (-1021)
#define LDBL_MIN_EXP (-1021)
#define FLT_MIN_10_EXP (-37)
#define DBL_MIN_10_EXP (-307)
#define LDBL_MIN_10_EXP (-307)
#define FLT_MAX_EXP 128
#define DBL_MAX_EXP 1024
#define LDBL_MAX_EXP 1024
#define FLT_MAX_10_EXP 38
#define DBL_MAX_10_EXP 308
#define LDBL_MAX_10_EXP 308
#define FLT_MAX 3.402823466e+38F
#define DBL_MAX 1.7976931348623157e+308
#define LDBL_MAX 1.7976931348623157e+308L
#define FLT_EPSILON 1.192092896e-7F
#define DBL_EPSILON 2.2204460492503131e-16
#define LDBL_EPSILON 2.2204460492503131e-16L
#define FLT_MIN 1.175494351e-38F
#define DBL_MIN 2.2250738585072014e-308
#define LDBL_MIN 2.2250738585072014e-308L
#endif

joy.h

#ifndef WEB64_JOY_H
#define WEB64_JOY_H
#include <stdint.h>
#include <c64.h>
uint8_t joy_read(void);
#endif

joystick.h

#ifndef WEB64_JOYSTICK_H
#define WEB64_JOYSTICK_H
#include <stdint.h>
#include <c64.h>
#define JOY_1 1
#define JOY_2 2
#define JOY_BTN_1 JOY_FIRE
/* Raw active-low CIA sample: zero input bit = pressed; one = released. */
/* Use JOY_1 or JOY_2. Example: uint8_t joy = web64_joy_read(JOY_2); */
/* if ((joy & JOY_FIRE) == 0) { ... }  JOY_LEFT/JOY_RIGHT use the same test. */
extern _fastcall uint8_t joy_read(uint8_t port);
extern _fastcall uint8_t web64_joy_read(uint8_t port);
#endif

libc.h

#ifndef WEB64_LIBC_H
#define WEB64_LIBC_H
/* Web64 aggregate convenience header. Implementations are linked only when called. */
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define INT_MAX 0x7fff
#define INT_MIN 0x8000
#endif

limits.h

#ifndef WEB64_LIMITS_H
#define WEB64_LIMITS_H
#define CHAR_BIT 8
#define SCHAR_MIN (-127-1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255U
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#define MB_LEN_MAX 1
#define SHRT_MIN (-32767-1)
#define SHRT_MAX 32767
#define USHRT_MAX 65535U
#define INT_MIN (-32767-1)
#define INT_MAX 32767
#define UINT_MAX 65535U
#define LONG_MIN (-2147483647L-1L)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
#endif

peekpoke.h

#ifndef WEB64_PEEKPOKE_H
#define WEB64_PEEKPOKE_H
#include <stdint.h>
#define PEEK(address) (*(volatile uint8_t*)(address))
#define POKE(address, value) (*(volatile uint8_t*)(address) = (uint8_t)(value))
#define PEEKW(address) (*(volatile uint16_t*)(address))
#define POKEW(address, value) (*(volatile uint16_t*)(address) = (uint16_t)(value))
#endif

sprite.h

#ifndef WEB64_SPRITE_H
#define WEB64_SPRITE_H
#include <stdint.h>
#include <c64.h>
void sprite_set_pos(uint8_t sprite_id, uint16_t x, uint8_t y);
void sprite_enable(uint8_t mask);
void sprite_set_color(uint8_t sprite_id, uint8_t color);
#endif

stdarg.h

#ifndef WEB64_STDARG_H
#define WEB64_STDARG_H
typedef unsigned char *va_list;
void __web64_va_start(va_list ap, void *last);
unsigned long __web64_va_arg(va_list ap, unsigned int size);
void __web64_va_end(va_list ap);
#define va_start(ap, last) __web64_va_start(ap, last)
#define va_arg(ap, type) ((type)__web64_va_arg(ap, sizeof(type)))
#define va_end(ap) __web64_va_end(ap)
#endif

stdbool.h

#ifndef WEB64_STDBOOL_H
#define WEB64_STDBOOL_H
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif

stddef.h

#ifndef WEB64_STDDEF_H
#define WEB64_STDDEF_H
typedef unsigned int size_t;
typedef signed int ptrdiff_t;
typedef unsigned int wchar_t;
#define NULL ((void*)0)
#define offsetof(type, member) ((size_t)&(((type*)0)->member))
#endif

stdint.h

#ifndef WEB64_STDINT_H
#define WEB64_STDINT_H
typedef unsigned char uint8_t;
typedef unsigned int uint16_t;
typedef unsigned long uint32_t;
typedef signed char int8_t;
typedef signed int int16_t;
typedef signed long int32_t;
typedef int16_t intptr_t;
typedef uint16_t uintptr_t;
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
typedef int8_t int_fast8_t;
typedef uint8_t uint_fast8_t;
typedef int16_t int_fast16_t;
typedef uint16_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
#define INT8_MIN 0x80
#define INT8_MAX 0x7f
#define UINT8_MAX 0xff
#define INT16_MIN 0x8000
#define INT16_MAX 0x7fff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffffUL
#endif

stdio.h

#ifndef WEB64_STDIO_H
#define WEB64_STDIO_H
#define EOF 0xffff
/* Web64 tiny stdio surface: getchar/putchar/puts are runtime calls; printf is compiler-lowered for literal formats with %d values. */
extern _fastcall int getchar(void);
extern _fastcall int putchar(int c);
extern _fastcall int puts(const char *str);
extern int printf(const char *format, ...);
#endif

stdlib.h

#ifndef WEB64_STDLIB_H
#define WEB64_STDLIB_H
#define RAND_MAX 0x00ff
/* Web64 tiny stdlib parameters: j=value, s=C string pointer, seed=byte random seed. */
extern int abs(int j);
extern int atoi(const char *s);
extern _fastcall int rand(void);
extern _fastcall void srand(unsigned int seed);
void abort(void);
#endif

string.h

#ifndef WEB64_STRING_H
#define WEB64_STRING_H
#include <stddef.h>
/* Web64 tiny string runtime parameters: s/s1=destination pointer, s2=source/search pointer, c=byte value, n=count. */
extern void *memchr(const void *s, int c, size_t n);
extern int memcmp(const void *s1, const void *s2, size_t n);
extern void *memcpy(void *s1, const void *s2, size_t n);
extern void *memmove(void *s1, const void *s2, size_t n);
extern void *memset(void *s, int c, size_t n);
extern char *strcat(char *s1, const char *s2);
extern char *strchr(const char *s, int c);
extern int strcmp(const char *s1, const char *s2);
extern char *strcpy(char *s1, const char *s2);
extern size_t strcspn(const char *s1, const char *s2);
extern size_t strlen(const char *s);
extern char *strncat(char *s1, const char *s2, size_t n);
extern int strncmp(const char *s1, const char *s2, size_t n);
extern char *strncpy(char *s1, const char *s2, size_t n);
extern char *strpbrk(const char *s1, const char *s2);
extern char *strrchr(const char *s, int c);
extern size_t strspn(const char *s1, const char *s2);
extern char *strstr(const char *s1, const char *s2);
#endif

web64.h

#ifndef WEB64_CORE_H
#define WEB64_CORE_H
#include <stdint.h>
#include <c64.h>
#define VoidCall(addr) (*(void (*)(void))(addr))()
#define CURSOFF() (*(volatile uint8_t*)0x00cc = 1)
#define CURSON() (*(volatile uint8_t*)0x00cc = 0)
void delay_frames(uint8_t frames);
void delay_ms(uint16_t milliseconds);
uint8_t random8(void);
void clrscr(void);
void gotoxy(uint8_t x, uint8_t y);
void cprintf(const char *text);
void plot_pixel(uint16_t address, uint8_t value);
#endif

web64/actor-batch.h

#ifndef WEB64_ACTOR_BATCH_H
#define WEB64_ACTOR_BATCH_H
#include <web64/actors.h>
#include <web64/sprite-mux.h>
#define WEB64_ACTOR_BATCH_ABI_VERSION 2
#define WEB64_ACTOR_BATCH_OK 0
#define WEB64_ACTOR_BATCH_INVALID_ARGUMENT 1
#define WEB64_ACTOR_BATCH_CAPACITY 2
#define WEB64_ACTOR_BATCH_INVALID_ID 4
#define WEB64_ACTOR_BATCH_INVALID_FRAME 8
#define WEB64_ACTOR_BATCH_POINTER_OVERFLOW 16
#define WEB64_ACTOR_BATCH_PALETTE_MISMATCH 32
#define WEB64_ACTOR_BATCH_INVALID_BINDING 64
#define WEB64_ACTOR_BATCH_UNSUPPORTED 128
#define WEB64_ACTOR_SPRITE_NONE 0
#define WEB64_ACTOR_SPRITE_RAW_SINGLE 1
#define WEB64_ACTOR_SPRITE_ASSET_SINGLE 2
#define WEB64_ACTOR_SPRITE_ASSET_PAIR 3
#define WEB64_ACTOR_RENDER_SINGLE 1
#define WEB64_ACTOR_RENDER_PAIR 2
#define WEB64_ACTOR_MUX_PIPELINE_BOUNDS_STABLE 1
#define WEB64_ACTOR_MUX_PIPELINE_ANIMATION_TICKS_READY 2
#define WEB64_ACTOR_MUX_PIPELINE_DENSE_ACTIVE_IDS 4
#define WEB64_ACTOR_MUX_PIPELINE_ANIMATION_PRETICKED 8
#define WEB64_ACTOR_MUX_PIPELINE_PAIRS_PRECOMPUTED 16
#define WEB64_ACTOR_MUX_PIPELINE_STABLE_TOPOLOGY 32
#define WEB64_ACTOR_MUX_PIPELINE_STABLE_ORDER_IDENTITY 64
#define WEB64_ACTOR_MUX_PIPELINE_DENSE_MOTION_PREINTEGRATED 128
#define WEB64_ACTOR_VIEW_ACTIVE_IDS 0
#define WEB64_ACTOR_VIEW_ACTIVE 2
#define WEB64_ACTOR_VIEW_ACTIVE_COUNT 4
#define WEB64_ACTOR_VIEW_CAPACITY 6
#define WEB64_ACTOR_VIEW_X 7
#define WEB64_ACTOR_VIEW_Y 9
#define WEB64_ACTOR_VIEW_VX 11
#define WEB64_ACTOR_VIEW_VY 13
#define WEB64_ACTOR_VIEW_WIDTH 15
#define WEB64_ACTOR_VIEW_HEIGHT 17
#define WEB64_ACTOR_VIEW_CATEGORY 19
#define WEB64_ACTOR_VIEW_MASK 21
#define WEB64_ACTOR_VIEW_SIZE 23
#define WEB64_ACTOR_ANIMATION_BANK 0
#define WEB64_ACTOR_ANIMATION_SEQUENCE 2
#define WEB64_ACTOR_ANIMATION_QUEUED 4
#define WEB64_ACTOR_ANIMATION_STEP 6
#define WEB64_ACTOR_ANIMATION_TICKS 8
#define WEB64_ACTOR_ANIMATION_FRAME 10
#define WEB64_ACTOR_ANIMATION_OVERLAY_FRAME 12
#define WEB64_ACTOR_ANIMATION_EVENTS 14
#define WEB64_ACTOR_ANIMATION_STATUS 16
#define WEB64_ACTOR_ANIMATION_DIRECTION 18
#define WEB64_ACTOR_ANIMATION_SIZE 20
#define WEB64_ACTOR_SPRITE_SET_KIND 0
#define WEB64_ACTOR_SPRITE_SET_ASSET 2
#define WEB64_ACTOR_SPRITE_SET_BASE_POINTER 4
#define WEB64_ACTOR_SPRITE_SET_OVERLAY_POINTER 6
#define WEB64_ACTOR_SPRITE_SET_FRAME_COUNT 8
#define WEB64_ACTOR_SPRITE_SET_BASE_COLOR 10
#define WEB64_ACTOR_SPRITE_SET_OVERLAY_COLOR 12
#define WEB64_ACTOR_SPRITE_SET_MULTICOLOR_1 14
#define WEB64_ACTOR_SPRITE_SET_MULTICOLOR_2 16
#define WEB64_ACTOR_SPRITE_SET_FLAGS 18
#define WEB64_ACTOR_SPRITE_SET_PRIORITY 20
#define WEB64_ACTOR_SPRITE_SET_BASE_FRAME 22
#define WEB64_ACTOR_SPRITE_SET_OVERLAY_FRAME 24
#define WEB64_ACTOR_SPRITE_SET_CAPACITY 26
#define WEB64_ACTOR_SPRITE_SET_SIZE 27
#define WEB64_ACTOR_VIEWPORT_WORLD_X 0
#define WEB64_ACTOR_VIEWPORT_WORLD_Y 2
#define WEB64_ACTOR_VIEWPORT_VIC_ORIGIN_X 4
#define WEB64_ACTOR_VIEWPORT_VIC_ORIGIN_Y 6
#define WEB64_ACTOR_VIEWPORT_WIDTH 7
#define WEB64_ACTOR_VIEWPORT_HEIGHT 9
#define WEB64_ACTOR_VIEWPORT_SIZE 11
#define WEB64_ACTOR_VISIBLE_ENTRY_ACTOR 0
#define WEB64_ACTOR_VISIBLE_ENTRY_X 1
#define WEB64_ACTOR_VISIBLE_ENTRY_Y 3
#define WEB64_ACTOR_VISIBLE_ENTRY_ORDER 4
#define WEB64_ACTOR_VISIBLE_ENTRY_SIZE 5
#define WEB64_ACTOR_VISIBLE_BUFFER_ENTRIES 0
#define WEB64_ACTOR_VISIBLE_BUFFER_CAPACITY 2
#define WEB64_ACTOR_VISIBLE_BUFFER_COUNT 3
#define WEB64_ACTOR_VISIBLE_BUFFER_DROPPED 4
#define WEB64_ACTOR_VISIBLE_BUFFER_SIZE 5
#define WEB64_ACTOR_PAIR_ACTOR_A 0
#define WEB64_ACTOR_PAIR_ACTOR_B 1
#define WEB64_ACTOR_PAIR_SIZE 2
#define WEB64_ACTOR_PAIR_WORKSPACE_SORTED_IDS 0
#define WEB64_ACTOR_PAIR_WORKSPACE_COUNT 2
#define WEB64_ACTOR_PAIR_WORKSPACE_CAPACITY 3
#define WEB64_ACTOR_PAIR_WORKSPACE_INITIALIZED 4
#define WEB64_ACTOR_PAIR_WORKSPACE_SIZE 5
#define WEB64_ACTOR_PAIR_BUFFER_PAIRS 0
#define WEB64_ACTOR_PAIR_BUFFER_CAPACITY 2
#define WEB64_ACTOR_PAIR_BUFFER_COUNT 3
#define WEB64_ACTOR_PAIR_BUFFER_OVERFLOW 4
#define WEB64_ACTOR_PAIR_BUFFER_SIZE 5
#define WEB64_ACTOR_BOUNDS_WORKSPACE_LEFT 0
#define WEB64_ACTOR_BOUNDS_WORKSPACE_RIGHT 2
#define WEB64_ACTOR_BOUNDS_WORKSPACE_TOP 4
#define WEB64_ACTOR_BOUNDS_WORKSPACE_BOTTOM 6
#define WEB64_ACTOR_BOUNDS_WORKSPACE_CAPACITY 8
#define WEB64_ACTOR_BOUNDS_WORKSPACE_SIZE 9
#define WEB64_ACTOR_COMMAND_ACTOR 0
#define WEB64_ACTOR_COMMAND_X 1
#define WEB64_ACTOR_COMMAND_Y 3
#define WEB64_ACTOR_COMMAND_BASE_POINTER 4
#define WEB64_ACTOR_COMMAND_OVERLAY_POINTER 5
#define WEB64_ACTOR_COMMAND_BASE_COLOR 6
#define WEB64_ACTOR_COMMAND_OVERLAY_COLOR 7
#define WEB64_ACTOR_COMMAND_FLAGS 8
#define WEB64_ACTOR_COMMAND_PRIORITY 9
#define WEB64_ACTOR_COMMAND_LAYERS 10
#define WEB64_ACTOR_COMMAND_MULTICOLOR_1 11
#define WEB64_ACTOR_COMMAND_MULTICOLOR_2 12
#define WEB64_ACTOR_COMMAND_ORDER 13
#define WEB64_ACTOR_COMMAND_SIZE 14
#define WEB64_ACTOR_COMMAND_BUFFER_COMMANDS 0
#define WEB64_ACTOR_COMMAND_BUFFER_CAPACITY 2
#define WEB64_ACTOR_COMMAND_BUFFER_COUNT 3
#define WEB64_ACTOR_COMMAND_BUFFER_ACCEPTED_LAYERS 4
#define WEB64_ACTOR_COMMAND_BUFFER_DROPPED_ENTRIES 5
#define WEB64_ACTOR_COMMAND_BUFFER_DROPPED_LAYERS 6
#define WEB64_ACTOR_COMMAND_BUFFER_SIZE 7
#define WEB64_ACTOR_MUX_PIPELINE_VIEW 0
#define WEB64_ACTOR_MUX_PIPELINE_ANIMATION 2
#define WEB64_ACTOR_MUX_PIPELINE_VIEWPORT 4
#define WEB64_ACTOR_MUX_PIPELINE_VISIBLE 6
#define WEB64_ACTOR_MUX_PIPELINE_BOUNDS 8
#define WEB64_ACTOR_MUX_PIPELINE_PAIR_WORKSPACE 10
#define WEB64_ACTOR_MUX_PIPELINE_PAIRS 12
#define WEB64_ACTOR_MUX_PIPELINE_SPRITES 14
#define WEB64_ACTOR_MUX_PIPELINE_COMMANDS 16
#define WEB64_ACTOR_MUX_PIPELINE_MUX 18
#define WEB64_ACTOR_MUX_PIPELINE_STATUS 20
#define WEB64_ACTOR_MUX_PIPELINE_FLAGS 22
#define WEB64_ACTOR_MUX_PIPELINE_SIZE 23
#define WEB64_ACTOR_STATUS_PROCESSED 0
#define WEB64_ACTOR_STATUS_EMITTED 1
#define WEB64_ACTOR_STATUS_DROPPED_ENTRIES 2
#define WEB64_ACTOR_STATUS_EMITTED_LAYERS 3
#define WEB64_ACTOR_STATUS_DROPPED_LAYERS 4
#define WEB64_ACTOR_STATUS_PAIRS 5
#define WEB64_ACTOR_STATUS_REASONS 6
#define WEB64_ACTOR_STATUS_SIZE 7
typedef struct { uint8_t *active_ids; uint8_t *active; uint8_t *active_count; uint8_t capacity; web64_pos_t *x; web64_pos_t *y; web64_vel_t *vx; web64_vel_t *vy; uint8_t *width; uint8_t *height; uint8_t *category; uint8_t *mask; } Web64ActorBatchView;
typedef struct { uint16_t *bank; uint8_t *sequence; uint8_t *queued; uint8_t *step; uint8_t *ticks; uint8_t *frame; uint8_t *overlay_frame; uint8_t *events; uint8_t *status; uint8_t *direction; } Web64ActorAnimationBatch;
typedef struct { uint8_t *kind; Web64AssetRef *asset; uint8_t *base_pointer; uint8_t *overlay_pointer; uint16_t *frame_count; uint8_t *base_color; uint8_t *overlay_color; uint8_t *multicolor_1; uint8_t *multicolor_2; uint8_t *flags; uint8_t *priority; uint8_t *base_frame; uint8_t *overlay_frame; uint8_t capacity; } Web64ActorSpriteSet;
typedef struct { uint16_t world_x; uint16_t world_y; uint16_t vic_origin_x; uint8_t vic_origin_y; uint16_t width; uint16_t height; } Web64ActorViewport;
typedef struct { uint8_t actor; uint16_t x; uint8_t y; uint8_t order; } Web64ActorVisibleEntry;
typedef struct { Web64ActorVisibleEntry *entries; uint8_t capacity; uint8_t count; uint8_t dropped; } Web64ActorVisibleBuffer;
typedef struct { uint8_t actor_a; uint8_t actor_b; } Web64ActorPair;
typedef struct { uint8_t *sorted_ids; uint8_t count; uint8_t capacity; uint8_t initialized; } Web64ActorPairWorkspace;
typedef struct { Web64ActorPair *pairs; uint8_t capacity; uint8_t count; uint8_t overflow; } Web64ActorPairBuffer;
typedef struct { uint8_t *left; uint8_t *right; uint8_t *top; uint8_t *bottom; uint8_t capacity; } Web64ActorBoundsWorkspace;
typedef struct { uint8_t actor; uint16_t x; uint8_t y; uint8_t base_pointer; uint8_t overlay_pointer; uint8_t base_color; uint8_t overlay_color; uint8_t flags; uint8_t priority; uint8_t layers; uint8_t multicolor_1; uint8_t multicolor_2; uint8_t order; } Web64ActorRenderCommand;
typedef struct { Web64ActorRenderCommand *commands; uint8_t capacity; uint8_t count; uint8_t accepted_layers; uint8_t dropped_entries; uint8_t dropped_layers; } Web64ActorCommandBuffer;
typedef struct { Web64ActorBatchView *view; Web64ActorAnimationBatch *animation; Web64ActorViewport *viewport; Web64ActorVisibleBuffer *visible; Web64ActorBoundsWorkspace *bounds; Web64ActorPairWorkspace *pair_workspace; Web64ActorPairBuffer *pairs; Web64ActorSpriteSet *sprites; Web64ActorCommandBuffer *commands; Web64SpriteMultiplexer *mux; Web64ActorBatchStatus *status; uint8_t flags; } Web64ActorMuxPipeline;
typedef struct { uint8_t processed; uint8_t emitted; uint8_t dropped_entries; uint8_t emitted_layers; uint8_t dropped_layers; uint8_t pairs; uint8_t reasons; } Web64ActorBatchStatus;
#define WEB64_ACTOR_ANIMATION_STORAGE(name, capacity) Web64ActorAnimationBatch name; uint16_t name##_bank[capacity]; uint8_t name##_sequence[capacity]; uint8_t name##_queued[capacity]; uint8_t name##_step[capacity]; uint8_t name##_ticks[capacity]; uint8_t name##_frame[capacity]; uint8_t name##_overlay_frame[capacity]; uint8_t name##_events[capacity]; uint8_t name##_status[capacity]; uint8_t name##_direction[capacity]
#define WEB64_ACTOR_SPRITE_SET_STORAGE(name, capacity) Web64ActorSpriteSet name; uint8_t name##_kind[capacity]; uint16_t name##_asset[capacity]; uint8_t name##_base_pointer[capacity]; uint8_t name##_overlay_pointer[capacity]; uint16_t name##_frame_count[capacity]; uint8_t name##_base_color[capacity]; uint8_t name##_overlay_color[capacity]; uint8_t name##_multicolor_1[capacity]; uint8_t name##_multicolor_2[capacity]; uint8_t name##_flags[capacity]; uint8_t name##_priority[capacity]; uint8_t name##_base_frame[capacity]; uint8_t name##_overlay_frame[capacity]
#define WEB64_ACTOR_VISIBLE_STORAGE(name, capacity) Web64ActorVisibleBuffer name; Web64ActorVisibleEntry name##_entries[capacity]
#define WEB64_ACTOR_PAIR_STORAGE(name, actor_capacity, pair_capacity) Web64ActorPairWorkspace name##_workspace; uint8_t name##_sorted_ids[actor_capacity]; Web64ActorPairBuffer name##_pairs; Web64ActorPair name##_pair_entries[pair_capacity]
#define WEB64_ACTOR_BOUNDS_STORAGE(name, capacity) Web64ActorBoundsWorkspace name; uint8_t name##_left[capacity]; uint8_t name##_right[capacity]; uint8_t name##_top[capacity]; uint8_t name##_bottom[capacity]
#define WEB64_ACTOR_COMMAND_STORAGE(name, capacity) Web64ActorCommandBuffer name; Web64ActorRenderCommand name##_commands[capacity]
_web64_rt uint8_t web64_actor_sprite_bind_raw(Web64ActorSpriteSet *sprites, uint8_t actor, uint8_t pointer_base, uint16_t frame_count, uint8_t color, uint8_t flags, uint8_t priority);
_web64_rt uint8_t web64_actor_sprite_bind_asset(Web64ActorSpriteSet *sprites, uint8_t actor, const Web64SpriteAsset *asset, uint8_t pointer_base, uint8_t flags, uint8_t priority);
_web64_rt uint8_t web64_actor_sprite_bind_asset_pair(Web64ActorSpriteSet *sprites, uint8_t actor, const Web64SpriteOverlayBinding *binding, uint8_t flags, uint8_t priority);
_web64_rt void web64_actor_sprite_unbind(Web64ActorSpriteSet *sprites, uint8_t actor);
/* _web64_rt uses registry-generated named absolute argument windows; see runtime.inc and actor-batch.inc. */
_web64_rt uint8_t web64_actor_batch_integrate_x(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_integrate_x_fast(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_integrate_y(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_integrate_y_fast(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_integrate_xy(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_integrate_xy_fast(const Web64ActorBatchView *view, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_animation_tick(const Web64ActorBatchView *view, Web64ActorAnimationBatch *animation, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_animation_tick_fast(const Web64ActorBatchView *view, Web64ActorAnimationBatch *animation, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_cull(const Web64ActorBatchView *view, const Web64ActorViewport *viewport, Web64ActorVisibleBuffer *visible, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_cull_fast(const Web64ActorBatchView *view, const Web64ActorViewport *viewport, Web64ActorVisibleBuffer *visible, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_pairs_x(const Web64ActorBatchView *view, Web64ActorPairWorkspace *workspace, Web64ActorPairBuffer *pairs, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_pairs_x_fast(const Web64ActorBatchView *view, Web64ActorPairWorkspace *workspace, Web64ActorPairBuffer *pairs, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_build_commands(const Web64ActorBatchView *view, const Web64ActorVisibleBuffer *visible, const Web64ActorSpriteSet *sprites, Web64ActorCommandBuffer *commands, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_build_commands_fast(const Web64ActorBatchView *view, const Web64ActorVisibleBuffer *visible, const Web64ActorSpriteSet *sprites, Web64ActorCommandBuffer *commands, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_commands_render_direct(Web64SpriteRenderer *renderer, const Web64ActorCommandBuffer *commands, uint8_t owned_slots, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_commands_render_direct_fast(Web64SpriteRenderer *renderer, const Web64ActorCommandBuffer *commands, uint8_t owned_slots, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_commands_submit_mux(Web64SpriteMultiplexer *mux, const Web64ActorCommandBuffer *commands, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_commands_submit_mux_fast(Web64SpriteMultiplexer *mux, const Web64ActorCommandBuffer *commands, Web64ActorBatchStatus *status);
_web64_rt uint8_t web64_actor_batch_run_mux(const Web64ActorMuxPipeline *pipeline);
_web64_rt uint8_t web64_actor_batch_run_mux_fast(const Web64ActorMuxPipeline *pipeline);
#endif

web64/actor-batch.inc

; Web64 v2 actor-batch public ABI v2
; Mainline-only prepared kernels. Buffers and assets remain caller-owned.
; Linked _web64_rt entries publish _function__arg_<name>, _function__argN,
; exact __width/__offset constants, and _function__arg_window_size before _function.
; Populate the complete named window before JSR. Each function window is non-reentrant.
WEB64_ACTOR_BATCH_ABI_VERSION = 2
WEB64_ACTOR_BATCH_OK = 0
WEB64_ACTOR_BATCH_INVALID_ARGUMENT = 1
WEB64_ACTOR_BATCH_CAPACITY = 2
WEB64_ACTOR_BATCH_INVALID_ID = 4
WEB64_ACTOR_BATCH_INVALID_FRAME = 8
WEB64_ACTOR_BATCH_POINTER_OVERFLOW = 16
WEB64_ACTOR_BATCH_PALETTE_MISMATCH = 32
WEB64_ACTOR_BATCH_INVALID_BINDING = 64
WEB64_ACTOR_BATCH_UNSUPPORTED = 128
WEB64_ACTOR_SPRITE_NONE = 0
WEB64_ACTOR_SPRITE_RAW_SINGLE = 1
WEB64_ACTOR_SPRITE_ASSET_SINGLE = 2
WEB64_ACTOR_SPRITE_ASSET_PAIR = 3
WEB64_ACTOR_RENDER_SINGLE = 1
WEB64_ACTOR_RENDER_PAIR = 2
WEB64_ACTOR_MUX_PIPELINE_BOUNDS_STABLE = 1
WEB64_ACTOR_MUX_PIPELINE_ANIMATION_TICKS_READY = 2
WEB64_ACTOR_MUX_PIPELINE_DENSE_ACTIVE_IDS = 4
WEB64_ACTOR_MUX_PIPELINE_ANIMATION_PRETICKED = 8
WEB64_ACTOR_MUX_PIPELINE_PAIRS_PRECOMPUTED = 16
WEB64_ACTOR_MUX_PIPELINE_STABLE_TOPOLOGY = 32
WEB64_ACTOR_MUX_PIPELINE_STABLE_ORDER_IDENTITY = 64
WEB64_ACTOR_MUX_PIPELINE_DENSE_MOTION_PREINTEGRATED = 128
WEB64_ACTOR_VIEW_ACTIVE_IDS = 0
WEB64_ACTOR_VIEW_ACTIVE = 2
WEB64_ACTOR_VIEW_ACTIVE_COUNT = 4
WEB64_ACTOR_VIEW_CAPACITY = 6
WEB64_ACTOR_VIEW_X = 7
WEB64_ACTOR_VIEW_Y = 9
WEB64_ACTOR_VIEW_VX = 11
WEB64_ACTOR_VIEW_VY = 13
WEB64_ACTOR_VIEW_WIDTH = 15
WEB64_ACTOR_VIEW_HEIGHT = 17
WEB64_ACTOR_VIEW_CATEGORY = 19
WEB64_ACTOR_VIEW_MASK = 21
WEB64_ACTOR_VIEW_SIZE = 23
WEB64_ACTOR_ANIMATION_BANK = 0
WEB64_ACTOR_ANIMATION_SEQUENCE = 2
WEB64_ACTOR_ANIMATION_QUEUED = 4
WEB64_ACTOR_ANIMATION_STEP = 6
WEB64_ACTOR_ANIMATION_TICKS = 8
WEB64_ACTOR_ANIMATION_FRAME = 10
WEB64_ACTOR_ANIMATION_OVERLAY_FRAME = 12
WEB64_ACTOR_ANIMATION_EVENTS = 14
WEB64_ACTOR_ANIMATION_STATUS = 16
WEB64_ACTOR_ANIMATION_DIRECTION = 18
WEB64_ACTOR_ANIMATION_SIZE = 20
WEB64_ACTOR_SPRITE_SET_KIND = 0
WEB64_ACTOR_SPRITE_SET_ASSET = 2
WEB64_ACTOR_SPRITE_SET_BASE_POINTER = 4
WEB64_ACTOR_SPRITE_SET_OVERLAY_POINTER = 6
WEB64_ACTOR_SPRITE_SET_FRAME_COUNT = 8
WEB64_ACTOR_SPRITE_SET_BASE_COLOR = 10
WEB64_ACTOR_SPRITE_SET_OVERLAY_COLOR = 12
WEB64_ACTOR_SPRITE_SET_MULTICOLOR_1 = 14
WEB64_ACTOR_SPRITE_SET_MULTICOLOR_2 = 16
WEB64_ACTOR_SPRITE_SET_FLAGS = 18
WEB64_ACTOR_SPRITE_SET_PRIORITY = 20
WEB64_ACTOR_SPRITE_SET_BASE_FRAME = 22
WEB64_ACTOR_SPRITE_SET_OVERLAY_FRAME = 24
WEB64_ACTOR_SPRITE_SET_CAPACITY = 26
WEB64_ACTOR_SPRITE_SET_SIZE = 27
WEB64_ACTOR_VIEWPORT_WORLD_X = 0
WEB64_ACTOR_VIEWPORT_WORLD_Y = 2
WEB64_ACTOR_VIEWPORT_VIC_ORIGIN_X = 4
WEB64_ACTOR_VIEWPORT_VIC_ORIGIN_Y = 6
WEB64_ACTOR_VIEWPORT_WIDTH = 7
WEB64_ACTOR_VIEWPORT_HEIGHT = 9
WEB64_ACTOR_VIEWPORT_SIZE = 11
WEB64_ACTOR_VISIBLE_ENTRY_ACTOR = 0
WEB64_ACTOR_VISIBLE_ENTRY_X = 1
WEB64_ACTOR_VISIBLE_ENTRY_Y = 3
WEB64_ACTOR_VISIBLE_ENTRY_ORDER = 4
WEB64_ACTOR_VISIBLE_ENTRY_SIZE = 5
WEB64_ACTOR_VISIBLE_BUFFER_ENTRIES = 0
WEB64_ACTOR_VISIBLE_BUFFER_CAPACITY = 2
WEB64_ACTOR_VISIBLE_BUFFER_COUNT = 3
WEB64_ACTOR_VISIBLE_BUFFER_DROPPED = 4
WEB64_ACTOR_VISIBLE_BUFFER_SIZE = 5
WEB64_ACTOR_PAIR_ACTOR_A = 0
WEB64_ACTOR_PAIR_ACTOR_B = 1
WEB64_ACTOR_PAIR_SIZE = 2
WEB64_ACTOR_PAIR_WORKSPACE_SORTED_IDS = 0
WEB64_ACTOR_PAIR_WORKSPACE_COUNT = 2
WEB64_ACTOR_PAIR_WORKSPACE_CAPACITY = 3
WEB64_ACTOR_PAIR_WORKSPACE_INITIALIZED = 4
WEB64_ACTOR_PAIR_WORKSPACE_SIZE = 5
WEB64_ACTOR_PAIR_BUFFER_PAIRS = 0
WEB64_ACTOR_PAIR_BUFFER_CAPACITY = 2
WEB64_ACTOR_PAIR_BUFFER_COUNT = 3
WEB64_ACTOR_PAIR_BUFFER_OVERFLOW = 4
WEB64_ACTOR_PAIR_BUFFER_SIZE = 5
WEB64_ACTOR_BOUNDS_WORKSPACE_LEFT = 0
WEB64_ACTOR_BOUNDS_WORKSPACE_RIGHT = 2
WEB64_ACTOR_BOUNDS_WORKSPACE_TOP = 4
WEB64_ACTOR_BOUNDS_WORKSPACE_BOTTOM = 6
WEB64_ACTOR_BOUNDS_WORKSPACE_CAPACITY = 8
WEB64_ACTOR_BOUNDS_WORKSPACE_SIZE = 9
WEB64_ACTOR_COMMAND_ACTOR = 0
WEB64_ACTOR_COMMAND_X = 1
WEB64_ACTOR_COMMAND_Y = 3
WEB64_ACTOR_COMMAND_BASE_POINTER = 4
WEB64_ACTOR_COMMAND_OVERLAY_POINTER = 5
WEB64_ACTOR_COMMAND_BASE_COLOR = 6
WEB64_ACTOR_COMMAND_OVERLAY_COLOR = 7
WEB64_ACTOR_COMMAND_FLAGS = 8
WEB64_ACTOR_COMMAND_PRIORITY = 9
WEB64_ACTOR_COMMAND_LAYERS = 10
WEB64_ACTOR_COMMAND_MULTICOLOR_1 = 11
WEB64_ACTOR_COMMAND_MULTICOLOR_2 = 12
WEB64_ACTOR_COMMAND_ORDER = 13
WEB64_ACTOR_COMMAND_SIZE = 14
WEB64_ACTOR_COMMAND_BUFFER_COMMANDS = 0
WEB64_ACTOR_COMMAND_BUFFER_CAPACITY = 2
WEB64_ACTOR_COMMAND_BUFFER_COUNT = 3
WEB64_ACTOR_COMMAND_BUFFER_ACCEPTED_LAYERS = 4
WEB64_ACTOR_COMMAND_BUFFER_DROPPED_ENTRIES = 5
WEB64_ACTOR_COMMAND_BUFFER_DROPPED_LAYERS = 6
WEB64_ACTOR_COMMAND_BUFFER_SIZE = 7
WEB64_ACTOR_MUX_PIPELINE_VIEW = 0
WEB64_ACTOR_MUX_PIPELINE_ANIMATION = 2
WEB64_ACTOR_MUX_PIPELINE_VIEWPORT = 4
WEB64_ACTOR_MUX_PIPELINE_VISIBLE = 6
WEB64_ACTOR_MUX_PIPELINE_BOUNDS = 8
WEB64_ACTOR_MUX_PIPELINE_PAIR_WORKSPACE = 10
WEB64_ACTOR_MUX_PIPELINE_PAIRS = 12
WEB64_ACTOR_MUX_PIPELINE_SPRITES = 14
WEB64_ACTOR_MUX_PIPELINE_COMMANDS = 16
WEB64_ACTOR_MUX_PIPELINE_MUX = 18
WEB64_ACTOR_MUX_PIPELINE_STATUS = 20
WEB64_ACTOR_MUX_PIPELINE_FLAGS = 22
WEB64_ACTOR_MUX_PIPELINE_SIZE = 23
WEB64_ACTOR_STATUS_PROCESSED = 0
WEB64_ACTOR_STATUS_EMITTED = 1
WEB64_ACTOR_STATUS_DROPPED_ENTRIES = 2
WEB64_ACTOR_STATUS_EMITTED_LAYERS = 3
WEB64_ACTOR_STATUS_DROPPED_LAYERS = 4
WEB64_ACTOR_STATUS_PAIRS = 5
WEB64_ACTOR_STATUS_REASONS = 6
WEB64_ACTOR_STATUS_SIZE = 7

; Web64 _web64_rt C/assembly call helpers for <web64/actor-batch.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_ACTOR_BATCH_CALL_COUNT = 24
WEB64_RT_ACTOR_BATCH_WINDOW_CALL_COUNT = 24

; web64_actor_batch_animation_tick: 6-byte window; entry _web64_actor_batch_animation_tick
.macro web64_rt_prepare_actor_batch_animation_tick view, animation, status
    lda #<view
    sta _web64_actor_batch_animation_tick__arg_view
    lda #>view
    sta _web64_actor_batch_animation_tick__arg_view+1
    lda #<animation
    sta _web64_actor_batch_animation_tick__arg_animation
    lda #>animation
    sta _web64_actor_batch_animation_tick__arg_animation+1
    lda #<status
    sta _web64_actor_batch_animation_tick__arg_status
    lda #>status
    sta _web64_actor_batch_animation_tick__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_animation_tick view, animation, status
    web64_rt_prepare_actor_batch_animation_tick view, animation, status
    jsr _web64_actor_batch_animation_tick
.endmacro

; web64_actor_batch_animation_tick_fast: 6-byte window; entry _web64_actor_batch_animation_tick_fast
.macro web64_rt_prepare_actor_batch_animation_tick_fast view, animation, status
    lda #<view
    sta _web64_actor_batch_animation_tick_fast__arg_view
    lda #>view
    sta _web64_actor_batch_animation_tick_fast__arg_view+1
    lda #<animation
    sta _web64_actor_batch_animation_tick_fast__arg_animation
    lda #>animation
    sta _web64_actor_batch_animation_tick_fast__arg_animation+1
    lda #<status
    sta _web64_actor_batch_animation_tick_fast__arg_status
    lda #>status
    sta _web64_actor_batch_animation_tick_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_animation_tick_fast view, animation, status
    web64_rt_prepare_actor_batch_animation_tick_fast view, animation, status
    jsr _web64_actor_batch_animation_tick_fast
.endmacro

; web64_actor_batch_build_commands: 10-byte window; entry _web64_actor_batch_build_commands
.macro web64_rt_prepare_actor_batch_build_commands view, visible, sprites, commands, status
    lda #<view
    sta _web64_actor_batch_build_commands__arg_view
    lda #>view
    sta _web64_actor_batch_build_commands__arg_view+1
    lda #<visible
    sta _web64_actor_batch_build_commands__arg_visible
    lda #>visible
    sta _web64_actor_batch_build_commands__arg_visible+1
    lda #<sprites
    sta _web64_actor_batch_build_commands__arg_sprites
    lda #>sprites
    sta _web64_actor_batch_build_commands__arg_sprites+1
    lda #<commands
    sta _web64_actor_batch_build_commands__arg_commands
    lda #>commands
    sta _web64_actor_batch_build_commands__arg_commands+1
    lda #<status
    sta _web64_actor_batch_build_commands__arg_status
    lda #>status
    sta _web64_actor_batch_build_commands__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_build_commands view, visible, sprites, commands, status
    web64_rt_prepare_actor_batch_build_commands view, visible, sprites, commands, status
    jsr _web64_actor_batch_build_commands
.endmacro

; web64_actor_batch_build_commands_fast: 10-byte window; entry _web64_actor_batch_build_commands_fast
.macro web64_rt_prepare_actor_batch_build_commands_fast view, visible, sprites, commands, status
    lda #<view
    sta _web64_actor_batch_build_commands_fast__arg_view
    lda #>view
    sta _web64_actor_batch_build_commands_fast__arg_view+1
    lda #<visible
    sta _web64_actor_batch_build_commands_fast__arg_visible
    lda #>visible
    sta _web64_actor_batch_build_commands_fast__arg_visible+1
    lda #<sprites
    sta _web64_actor_batch_build_commands_fast__arg_sprites
    lda #>sprites
    sta _web64_actor_batch_build_commands_fast__arg_sprites+1
    lda #<commands
    sta _web64_actor_batch_build_commands_fast__arg_commands
    lda #>commands
    sta _web64_actor_batch_build_commands_fast__arg_commands+1
    lda #<status
    sta _web64_actor_batch_build_commands_fast__arg_status
    lda #>status
    sta _web64_actor_batch_build_commands_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_build_commands_fast view, visible, sprites, commands, status
    web64_rt_prepare_actor_batch_build_commands_fast view, visible, sprites, commands, status
    jsr _web64_actor_batch_build_commands_fast
.endmacro

; web64_actor_batch_cull: 8-byte window; entry _web64_actor_batch_cull
.macro web64_rt_prepare_actor_batch_cull view, viewport, visible, status
    lda #<view
    sta _web64_actor_batch_cull__arg_view
    lda #>view
    sta _web64_actor_batch_cull__arg_view+1
    lda #<viewport
    sta _web64_actor_batch_cull__arg_viewport
    lda #>viewport
    sta _web64_actor_batch_cull__arg_viewport+1
    lda #<visible
    sta _web64_actor_batch_cull__arg_visible
    lda #>visible
    sta _web64_actor_batch_cull__arg_visible+1
    lda #<status
    sta _web64_actor_batch_cull__arg_status
    lda #>status
    sta _web64_actor_batch_cull__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_cull view, viewport, visible, status
    web64_rt_prepare_actor_batch_cull view, viewport, visible, status
    jsr _web64_actor_batch_cull
.endmacro

; web64_actor_batch_cull_fast: 8-byte window; entry _web64_actor_batch_cull_fast
.macro web64_rt_prepare_actor_batch_cull_fast view, viewport, visible, status
    lda #<view
    sta _web64_actor_batch_cull_fast__arg_view
    lda #>view
    sta _web64_actor_batch_cull_fast__arg_view+1
    lda #<viewport
    sta _web64_actor_batch_cull_fast__arg_viewport
    lda #>viewport
    sta _web64_actor_batch_cull_fast__arg_viewport+1
    lda #<visible
    sta _web64_actor_batch_cull_fast__arg_visible
    lda #>visible
    sta _web64_actor_batch_cull_fast__arg_visible+1
    lda #<status
    sta _web64_actor_batch_cull_fast__arg_status
    lda #>status
    sta _web64_actor_batch_cull_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_cull_fast view, viewport, visible, status
    web64_rt_prepare_actor_batch_cull_fast view, viewport, visible, status
    jsr _web64_actor_batch_cull_fast
.endmacro

; web64_actor_batch_integrate_x: 4-byte window; entry _web64_actor_batch_integrate_x
.macro web64_rt_prepare_actor_batch_integrate_x view, status
    lda #<view
    sta _web64_actor_batch_integrate_x__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_x__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_x__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_x__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_x view, status
    web64_rt_prepare_actor_batch_integrate_x view, status
    jsr _web64_actor_batch_integrate_x
.endmacro

; web64_actor_batch_integrate_x_fast: 4-byte window; entry _web64_actor_batch_integrate_x_fast
.macro web64_rt_prepare_actor_batch_integrate_x_fast view, status
    lda #<view
    sta _web64_actor_batch_integrate_x_fast__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_x_fast__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_x_fast__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_x_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_x_fast view, status
    web64_rt_prepare_actor_batch_integrate_x_fast view, status
    jsr _web64_actor_batch_integrate_x_fast
.endmacro

; web64_actor_batch_integrate_xy: 4-byte window; entry _web64_actor_batch_integrate_xy
.macro web64_rt_prepare_actor_batch_integrate_xy view, status
    lda #<view
    sta _web64_actor_batch_integrate_xy__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_xy__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_xy__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_xy__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_xy view, status
    web64_rt_prepare_actor_batch_integrate_xy view, status
    jsr _web64_actor_batch_integrate_xy
.endmacro

; web64_actor_batch_integrate_xy_fast: 4-byte window; entry _web64_actor_batch_integrate_xy_fast
.macro web64_rt_prepare_actor_batch_integrate_xy_fast view, status
    lda #<view
    sta _web64_actor_batch_integrate_xy_fast__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_xy_fast__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_xy_fast__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_xy_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_xy_fast view, status
    web64_rt_prepare_actor_batch_integrate_xy_fast view, status
    jsr _web64_actor_batch_integrate_xy_fast
.endmacro

; web64_actor_batch_integrate_y: 4-byte window; entry _web64_actor_batch_integrate_y
.macro web64_rt_prepare_actor_batch_integrate_y view, status
    lda #<view
    sta _web64_actor_batch_integrate_y__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_y__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_y__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_y__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_y view, status
    web64_rt_prepare_actor_batch_integrate_y view, status
    jsr _web64_actor_batch_integrate_y
.endmacro

; web64_actor_batch_integrate_y_fast: 4-byte window; entry _web64_actor_batch_integrate_y_fast
.macro web64_rt_prepare_actor_batch_integrate_y_fast view, status
    lda #<view
    sta _web64_actor_batch_integrate_y_fast__arg_view
    lda #>view
    sta _web64_actor_batch_integrate_y_fast__arg_view+1
    lda #<status
    sta _web64_actor_batch_integrate_y_fast__arg_status
    lda #>status
    sta _web64_actor_batch_integrate_y_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_integrate_y_fast view, status
    web64_rt_prepare_actor_batch_integrate_y_fast view, status
    jsr _web64_actor_batch_integrate_y_fast
.endmacro

; web64_actor_batch_pairs_x: 8-byte window; entry _web64_actor_batch_pairs_x
.macro web64_rt_prepare_actor_batch_pairs_x view, workspace, pairs, status
    lda #<view
    sta _web64_actor_batch_pairs_x__arg_view
    lda #>view
    sta _web64_actor_batch_pairs_x__arg_view+1
    lda #<workspace
    sta _web64_actor_batch_pairs_x__arg_workspace
    lda #>workspace
    sta _web64_actor_batch_pairs_x__arg_workspace+1
    lda #<pairs
    sta _web64_actor_batch_pairs_x__arg_pairs
    lda #>pairs
    sta _web64_actor_batch_pairs_x__arg_pairs+1
    lda #<status
    sta _web64_actor_batch_pairs_x__arg_status
    lda #>status
    sta _web64_actor_batch_pairs_x__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_pairs_x view, workspace, pairs, status
    web64_rt_prepare_actor_batch_pairs_x view, workspace, pairs, status
    jsr _web64_actor_batch_pairs_x
.endmacro

; web64_actor_batch_pairs_x_fast: 8-byte window; entry _web64_actor_batch_pairs_x_fast
.macro web64_rt_prepare_actor_batch_pairs_x_fast view, workspace, pairs, status
    lda #<view
    sta _web64_actor_batch_pairs_x_fast__arg_view
    lda #>view
    sta _web64_actor_batch_pairs_x_fast__arg_view+1
    lda #<workspace
    sta _web64_actor_batch_pairs_x_fast__arg_workspace
    lda #>workspace
    sta _web64_actor_batch_pairs_x_fast__arg_workspace+1
    lda #<pairs
    sta _web64_actor_batch_pairs_x_fast__arg_pairs
    lda #>pairs
    sta _web64_actor_batch_pairs_x_fast__arg_pairs+1
    lda #<status
    sta _web64_actor_batch_pairs_x_fast__arg_status
    lda #>status
    sta _web64_actor_batch_pairs_x_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_batch_pairs_x_fast view, workspace, pairs, status
    web64_rt_prepare_actor_batch_pairs_x_fast view, workspace, pairs, status
    jsr _web64_actor_batch_pairs_x_fast
.endmacro

; web64_actor_batch_run_mux: 2-byte window; entry _web64_actor_batch_run_mux
.macro web64_rt_prepare_actor_batch_run_mux pipeline
    lda #<pipeline
    sta _web64_actor_batch_run_mux__arg_pipeline
    lda #>pipeline
    sta _web64_actor_batch_run_mux__arg_pipeline+1
.endmacro

.macro web64_rt_call_actor_batch_run_mux pipeline
    web64_rt_prepare_actor_batch_run_mux pipeline
    jsr _web64_actor_batch_run_mux
.endmacro

; web64_actor_batch_run_mux_fast: 2-byte window; entry _web64_actor_batch_run_mux_fast
.macro web64_rt_prepare_actor_batch_run_mux_fast pipeline
    lda #<pipeline
    sta _web64_actor_batch_run_mux_fast__arg_pipeline
    lda #>pipeline
    sta _web64_actor_batch_run_mux_fast__arg_pipeline+1
.endmacro

.macro web64_rt_call_actor_batch_run_mux_fast pipeline
    web64_rt_prepare_actor_batch_run_mux_fast pipeline
    jsr _web64_actor_batch_run_mux_fast
.endmacro

; web64_actor_commands_render_direct: 7-byte window; entry _web64_actor_commands_render_direct
.macro web64_rt_prepare_actor_commands_render_direct renderer, commands, owned_slots, status
    lda #<renderer
    sta _web64_actor_commands_render_direct__arg_renderer
    lda #>renderer
    sta _web64_actor_commands_render_direct__arg_renderer+1
    lda #<commands
    sta _web64_actor_commands_render_direct__arg_commands
    lda #>commands
    sta _web64_actor_commands_render_direct__arg_commands+1
    lda #owned_slots
    sta _web64_actor_commands_render_direct__arg_owned_slots
    lda #<status
    sta _web64_actor_commands_render_direct__arg_status
    lda #>status
    sta _web64_actor_commands_render_direct__arg_status+1
.endmacro

.macro web64_rt_call_actor_commands_render_direct renderer, commands, owned_slots, status
    web64_rt_prepare_actor_commands_render_direct renderer, commands, owned_slots, status
    jsr _web64_actor_commands_render_direct
.endmacro

; web64_actor_commands_render_direct_fast: 7-byte window; entry _web64_actor_commands_render_direct_fast
.macro web64_rt_prepare_actor_commands_render_direct_fast renderer, commands, owned_slots, status
    lda #<renderer
    sta _web64_actor_commands_render_direct_fast__arg_renderer
    lda #>renderer
    sta _web64_actor_commands_render_direct_fast__arg_renderer+1
    lda #<commands
    sta _web64_actor_commands_render_direct_fast__arg_commands
    lda #>commands
    sta _web64_actor_commands_render_direct_fast__arg_commands+1
    lda #owned_slots
    sta _web64_actor_commands_render_direct_fast__arg_owned_slots
    lda #<status
    sta _web64_actor_commands_render_direct_fast__arg_status
    lda #>status
    sta _web64_actor_commands_render_direct_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_commands_render_direct_fast renderer, commands, owned_slots, status
    web64_rt_prepare_actor_commands_render_direct_fast renderer, commands, owned_slots, status
    jsr _web64_actor_commands_render_direct_fast
.endmacro

; web64_actor_commands_submit_mux: 6-byte window; entry _web64_actor_commands_submit_mux
.macro web64_rt_prepare_actor_commands_submit_mux mux, commands, status
    lda #<mux
    sta _web64_actor_commands_submit_mux__arg_mux
    lda #>mux
    sta _web64_actor_commands_submit_mux__arg_mux+1
    lda #<commands
    sta _web64_actor_commands_submit_mux__arg_commands
    lda #>commands
    sta _web64_actor_commands_submit_mux__arg_commands+1
    lda #<status
    sta _web64_actor_commands_submit_mux__arg_status
    lda #>status
    sta _web64_actor_commands_submit_mux__arg_status+1
.endmacro

.macro web64_rt_call_actor_commands_submit_mux mux, commands, status
    web64_rt_prepare_actor_commands_submit_mux mux, commands, status
    jsr _web64_actor_commands_submit_mux
.endmacro

; web64_actor_commands_submit_mux_fast: 6-byte window; entry _web64_actor_commands_submit_mux_fast
.macro web64_rt_prepare_actor_commands_submit_mux_fast mux, commands, status
    lda #<mux
    sta _web64_actor_commands_submit_mux_fast__arg_mux
    lda #>mux
    sta _web64_actor_commands_submit_mux_fast__arg_mux+1
    lda #<commands
    sta _web64_actor_commands_submit_mux_fast__arg_commands
    lda #>commands
    sta _web64_actor_commands_submit_mux_fast__arg_commands+1
    lda #<status
    sta _web64_actor_commands_submit_mux_fast__arg_status
    lda #>status
    sta _web64_actor_commands_submit_mux_fast__arg_status+1
.endmacro

.macro web64_rt_call_actor_commands_submit_mux_fast mux, commands, status
    web64_rt_prepare_actor_commands_submit_mux_fast mux, commands, status
    jsr _web64_actor_commands_submit_mux_fast
.endmacro

; web64_actor_sprite_bind_asset: 8-byte window; entry _web64_actor_sprite_bind_asset
.macro web64_rt_prepare_actor_sprite_bind_asset sprites, actor, asset, pointer_base, flags, priority
    lda #<sprites
    sta _web64_actor_sprite_bind_asset__arg_sprites
    lda #>sprites
    sta _web64_actor_sprite_bind_asset__arg_sprites+1
    lda #actor
    sta _web64_actor_sprite_bind_asset__arg_actor
    lda #<asset
    sta _web64_actor_sprite_bind_asset__arg_asset
    lda #>asset
    sta _web64_actor_sprite_bind_asset__arg_asset+1
    lda #pointer_base
    sta _web64_actor_sprite_bind_asset__arg_pointer_base
    lda #flags
    sta _web64_actor_sprite_bind_asset__arg_flags
    lda #priority
    sta _web64_actor_sprite_bind_asset__arg_priority
.endmacro

.macro web64_rt_call_actor_sprite_bind_asset sprites, actor, asset, pointer_base, flags, priority
    web64_rt_prepare_actor_sprite_bind_asset sprites, actor, asset, pointer_base, flags, priority
    jsr _web64_actor_sprite_bind_asset
.endmacro

; web64_actor_sprite_bind_asset_pair: 7-byte window; entry _web64_actor_sprite_bind_asset_pair
.macro web64_rt_prepare_actor_sprite_bind_asset_pair sprites, actor, binding, flags, priority
    lda #<sprites
    sta _web64_actor_sprite_bind_asset_pair__arg_sprites
    lda #>sprites
    sta _web64_actor_sprite_bind_asset_pair__arg_sprites+1
    lda #actor
    sta _web64_actor_sprite_bind_asset_pair__arg_actor
    lda #<binding
    sta _web64_actor_sprite_bind_asset_pair__arg_binding
    lda #>binding
    sta _web64_actor_sprite_bind_asset_pair__arg_binding+1
    lda #flags
    sta _web64_actor_sprite_bind_asset_pair__arg_flags
    lda #priority
    sta _web64_actor_sprite_bind_asset_pair__arg_priority
.endmacro

.macro web64_rt_call_actor_sprite_bind_asset_pair sprites, actor, binding, flags, priority
    web64_rt_prepare_actor_sprite_bind_asset_pair sprites, actor, binding, flags, priority
    jsr _web64_actor_sprite_bind_asset_pair
.endmacro

; web64_actor_sprite_bind_raw: 9-byte window; entry _web64_actor_sprite_bind_raw
.macro web64_rt_prepare_actor_sprite_bind_raw sprites, actor, pointer_base, frame_count, color, flags, priority
    lda #<sprites
    sta _web64_actor_sprite_bind_raw__arg_sprites
    lda #>sprites
    sta _web64_actor_sprite_bind_raw__arg_sprites+1
    lda #actor
    sta _web64_actor_sprite_bind_raw__arg_actor
    lda #pointer_base
    sta _web64_actor_sprite_bind_raw__arg_pointer_base
    lda #<frame_count
    sta _web64_actor_sprite_bind_raw__arg_frame_count
    lda #>frame_count
    sta _web64_actor_sprite_bind_raw__arg_frame_count+1
    lda #color
    sta _web64_actor_sprite_bind_raw__arg_color
    lda #flags
    sta _web64_actor_sprite_bind_raw__arg_flags
    lda #priority
    sta _web64_actor_sprite_bind_raw__arg_priority
.endmacro

.macro web64_rt_call_actor_sprite_bind_raw sprites, actor, pointer_base, frame_count, color, flags, priority
    web64_rt_prepare_actor_sprite_bind_raw sprites, actor, pointer_base, frame_count, color, flags, priority
    jsr _web64_actor_sprite_bind_raw
.endmacro

; web64_actor_sprite_unbind: 3-byte window; entry _web64_actor_sprite_unbind
.macro web64_rt_prepare_actor_sprite_unbind sprites, actor
    lda #<sprites
    sta _web64_actor_sprite_unbind__arg_sprites
    lda #>sprites
    sta _web64_actor_sprite_unbind__arg_sprites+1
    lda #actor
    sta _web64_actor_sprite_unbind__arg_actor
.endmacro

.macro web64_rt_call_actor_sprite_unbind sprites, actor
    web64_rt_prepare_actor_sprite_unbind sprites, actor
    jsr _web64_actor_sprite_unbind
.endmacro

web64/actors.h

#ifndef WEB64_ACTORS_H
#define WEB64_ACTORS_H
#include <web64/game.h>
#include <web64/animation.h>
#include <web64/sprite-runtime.h>
#define WEB64_ACTOR_NONE 0xff
#define WEB64_ACTOR_STORAGE_NONE 0
#define WEB64_ACTOR_STORAGE_ANIMATION 1
#define WEB64_ACTOR_STORAGE_SPRITE_BINDING 2
#define WEB64_ACTOR_POOL_CORE(name, capacity) int16_t name##_x[capacity]; int16_t name##_y[capacity]; int16_t name##_vx[capacity]; int16_t name##_vy[capacity]; uint8_t name##_width[capacity]; uint8_t name##_height[capacity]; uint8_t name##_category[capacity]; uint8_t name##_mask[capacity]; uint8_t name##_state[capacity]; uint8_t name##_facing[capacity]; uint8_t name##_active[capacity]; uint8_t name##_active_ids[capacity]; uint8_t name##_active_count
#define WEB64_ACTOR_POOL_ANIMATION_STORAGE(name, capacity) Web64AnimationPlayer name##_animation[capacity]
#define WEB64_ACTOR_POOL_SPRITE_STORAGE(name, capacity) uint8_t name##_sprite_slot[capacity]; uint8_t name##_sprite_frame[capacity]; uint8_t name##_sprite_flags[capacity]
#define WEB64_ACTOR_POOL_OPTIONAL_NONE(name, capacity)
#define WEB64_ACTOR_POOL_OPTIONAL_ANIMATION(name, capacity) WEB64_ACTOR_POOL_ANIMATION_STORAGE(name, capacity)
#define WEB64_ACTOR_POOL_OPTIONAL_SPRITES(name, capacity) WEB64_ACTOR_POOL_SPRITE_STORAGE(name, capacity)
#define WEB64_ACTOR_POOL_OPTIONAL_ANIMATION_SPRITES(name, capacity) WEB64_ACTOR_POOL_ANIMATION_STORAGE(name, capacity); WEB64_ACTOR_POOL_SPRITE_STORAGE(name, capacity)
#define WEB64_ACTOR_POOL_DECLARE(name, capacity, optional_storage) WEB64_ACTOR_POOL_CORE(name, capacity); optional_storage(name, capacity)
#define WEB64_ACTOR_POOL(name, capacity) WEB64_ACTOR_POOL_CORE(name, capacity)
#define WEB64_ACTOR_POOL_WITH_ANIMATION(name, capacity) WEB64_ACTOR_POOL_CORE(name, capacity); WEB64_ACTOR_POOL_ANIMATION_STORAGE(name, capacity)
#define WEB64_ACTOR_POOL_WITH_SPRITES(name, capacity) WEB64_ACTOR_POOL_CORE(name, capacity); WEB64_ACTOR_POOL_SPRITE_STORAGE(name, capacity)
#define WEB64_ACTOR_POOL_WITH_ANIMATION_SPRITES(name, capacity) WEB64_ACTOR_POOL_CORE(name, capacity); WEB64_ACTOR_POOL_ANIMATION_STORAGE(name, capacity); WEB64_ACTOR_POOL_SPRITE_STORAGE(name, capacity)
_web64_rt uint8_t web64_actor_activate(uint8_t *active, uint8_t *active_ids, uint8_t *active_count, uint8_t capacity, uint8_t actor);
_web64_rt uint8_t web64_actor_deactivate(uint8_t *active, uint8_t *active_ids, uint8_t *active_count, uint8_t actor);
#endif

web64/actors.inc

; Web64 _web64_rt C/assembly call helpers for <web64/actors.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_ACTORS_CALL_COUNT = 2
WEB64_RT_ACTORS_WINDOW_CALL_COUNT = 2

; web64_actor_activate: 8-byte window; entry _web64_actor_activate
.macro web64_rt_prepare_actor_activate active, active_ids, active_count, capacity, actor
    lda #<active
    sta _web64_actor_activate__arg_active
    lda #>active
    sta _web64_actor_activate__arg_active+1
    lda #<active_ids
    sta _web64_actor_activate__arg_active_ids
    lda #>active_ids
    sta _web64_actor_activate__arg_active_ids+1
    lda #<active_count
    sta _web64_actor_activate__arg_active_count
    lda #>active_count
    sta _web64_actor_activate__arg_active_count+1
    lda #capacity
    sta _web64_actor_activate__arg_capacity
    lda #actor
    sta _web64_actor_activate__arg_actor
.endmacro

.macro web64_rt_call_actor_activate active, active_ids, active_count, capacity, actor
    web64_rt_prepare_actor_activate active, active_ids, active_count, capacity, actor
    jsr _web64_actor_activate
.endmacro

; web64_actor_deactivate: 7-byte window; entry _web64_actor_deactivate
.macro web64_rt_prepare_actor_deactivate active, active_ids, active_count, actor
    lda #<active
    sta _web64_actor_deactivate__arg_active
    lda #>active
    sta _web64_actor_deactivate__arg_active+1
    lda #<active_ids
    sta _web64_actor_deactivate__arg_active_ids
    lda #>active_ids
    sta _web64_actor_deactivate__arg_active_ids+1
    lda #<active_count
    sta _web64_actor_deactivate__arg_active_count
    lda #>active_count
    sta _web64_actor_deactivate__arg_active_count+1
    lda #actor
    sta _web64_actor_deactivate__arg_actor
.endmacro

.macro web64_rt_call_actor_deactivate active, active_ids, active_count, actor
    web64_rt_prepare_actor_deactivate active, active_ids, active_count, actor
    jsr _web64_actor_deactivate
.endmacro

web64/animation.h

#ifndef WEB64_ANIMATION_H
#define WEB64_ANIMATION_H
#include <stdint.h>
#define WEB64_ANIMATION_LOOP 1
#define WEB64_ANIMATION_ONCE 2
#define WEB64_ANIMATION_PINGPONG 4
#define WEB64_ANIMATION_HOLD 8
#define WEB64_ANIMATION_HIDE 16
#define WEB64_ANIMATION_PLAY_IF_CHANGED 1
#define WEB64_ANIMATION_PLAY_RESTART 2
#define WEB64_ANIMATION_STATUS_COMPLETE 1
#define WEB64_ANIMATION_STATUS_HIDDEN 2
typedef struct { uint8_t frame; uint8_t duration; uint8_t event; uint8_t overlay_frame; } Web64AnimationStep;
typedef struct { uint16_t steps; uint8_t count; uint8_t flags; } Web64AnimationSequence;
typedef struct { uint16_t sequences; uint8_t count; } Web64AnimationBank;
typedef struct { uint16_t bank; uint8_t sequence; uint8_t queued; uint8_t step; uint8_t ticks; uint8_t frame; uint8_t overlay_frame; uint8_t events; uint8_t status; int8_t direction; } Web64AnimationPlayer;
_web64_rt void web64_animation_init(Web64AnimationPlayer *player, uint16_t bank);
_web64_rt void web64_animation_play(Web64AnimationPlayer *player, uint8_t sequence, uint8_t policy);
_web64_rt void web64_animation_queue(Web64AnimationPlayer *player, uint8_t sequence);
_web64_rt uint8_t web64_animation_tick(Web64AnimationPlayer *player);
_web64_rt uint8_t web64_animation_take_events(Web64AnimationPlayer *player);
#endif

web64/animation.inc

; Web64 _web64_rt C/assembly call helpers for <web64/animation.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_ANIMATION_CALL_COUNT = 5
WEB64_RT_ANIMATION_WINDOW_CALL_COUNT = 5

; web64_animation_init: 4-byte window; entry _web64_animation_init
.macro web64_rt_prepare_animation_init player, bank
    lda #<player
    sta _web64_animation_init__arg_player
    lda #>player
    sta _web64_animation_init__arg_player+1
    lda #<bank
    sta _web64_animation_init__arg_bank
    lda #>bank
    sta _web64_animation_init__arg_bank+1
.endmacro

.macro web64_rt_call_animation_init player, bank
    web64_rt_prepare_animation_init player, bank
    jsr _web64_animation_init
.endmacro

; web64_animation_play: 4-byte window; entry _web64_animation_play
.macro web64_rt_prepare_animation_play player, sequence, policy
    lda #<player
    sta _web64_animation_play__arg_player
    lda #>player
    sta _web64_animation_play__arg_player+1
    lda #sequence
    sta _web64_animation_play__arg_sequence
    lda #policy
    sta _web64_animation_play__arg_policy
.endmacro

.macro web64_rt_call_animation_play player, sequence, policy
    web64_rt_prepare_animation_play player, sequence, policy
    jsr _web64_animation_play
.endmacro

; web64_animation_queue: 3-byte window; entry _web64_animation_queue
.macro web64_rt_prepare_animation_queue player, sequence
    lda #<player
    sta _web64_animation_queue__arg_player
    lda #>player
    sta _web64_animation_queue__arg_player+1
    lda #sequence
    sta _web64_animation_queue__arg_sequence
.endmacro

.macro web64_rt_call_animation_queue player, sequence
    web64_rt_prepare_animation_queue player, sequence
    jsr _web64_animation_queue
.endmacro

; web64_animation_take_events: 2-byte window; entry _web64_animation_take_events
.macro web64_rt_prepare_animation_take_events player
    lda #<player
    sta _web64_animation_take_events__arg_player
    lda #>player
    sta _web64_animation_take_events__arg_player+1
.endmacro

.macro web64_rt_call_animation_take_events player
    web64_rt_prepare_animation_take_events player
    jsr _web64_animation_take_events
.endmacro

; web64_animation_tick: 2-byte window; entry _web64_animation_tick
.macro web64_rt_prepare_animation_tick player
    lda #<player
    sta _web64_animation_tick__arg_player
    lda #>player
    sta _web64_animation_tick__arg_player+1
.endmacro

.macro web64_rt_call_animation_tick player
    web64_rt_prepare_animation_tick player
    jsr _web64_animation_tick
.endmacro

web64/assets.h

#ifndef WEB64_ASSETS_H
#define WEB64_ASSETS_H
#include <stdint.h>
#define WEB64_ASSET_MODEL_VERSION 0x0001
#define WEB64_GENERATED_ASSETS_VERSION 0x0001
#define WEB64_ASSET_ADDRESS_NONE 0x0000
#define WEB64_ASSET_REF_NONE 0x0000
#define WEB64_SPRITE_BLOCK_NONE 0xff
#define WEB64_ASSET_KIND_BINARY 1
#define WEB64_ASSET_KIND_CHAR 2
#define WEB64_ASSET_KIND_CHARSET 3
#define WEB64_ASSET_KIND_SPRITE_MONO 4
#define WEB64_ASSET_KIND_SPRITE_MC 5
#define WEB64_ASSET_KIND_SPRITE_OVERLAY 6
#define WEB64_ASSET_KIND_BLOCK 7
#define WEB64_ASSET_KIND_BLOCKSET 8
#define WEB64_ASSET_KIND_MAP 9
#define WEB64_ASSET_KIND_SID 10
#define WEB64_ASSET_KIND_SOURCE 11
#define WEB64_SPRITE_MODE_MONO 1
#define WEB64_SPRITE_MODE_MULTICOLOR 2
#define WEB64_MAP_CELL_CHAR 1
#define WEB64_MAP_CELL_BLOCK 2
#define WEB64_SPRITE_FLAG_ENABLED 1
#define WEB64_SPRITE_FLAG_MULTICOLOR 2
#define WEB64_SPRITE_FLAG_EXPAND_X 4
#define WEB64_SPRITE_FLAG_EXPAND_Y 8
#define WEB64_SPRITE_FLAG_BEHIND_BACKGROUND 16
#define WEB64_CHAR_FLAG_MULTICOLOR 1
#define WEB64_BLOCK_FLAG_HAS_COLORS 1
#define WEB64_BLOCK_FLAG_HAS_ATTRIBUTES 2
#define WEB64_MAP_FLAG_BLOCK_CELLS 1
#define WEB64_MAP_FLAG_HAS_COLORS 2
#define WEB64_MAP_FLAG_HAS_ATTRIBUTES 4
#define WEB64_MAP_FLAG_HAS_SCREEN 8
#define WEB64_ASSET_COPY_OK 0
#define WEB64_ASSET_COPY_INVALID_DESCRIPTOR 1
#define WEB64_ASSET_COPY_INVALID_PLANE 2
#define WEB64_ASSET_COPY_LENGTH_OVERFLOW 4
#define WEB64_MAP_PLANE_CELLS 0
#define WEB64_MAP_PLANE_COLORS 1
#define WEB64_MAP_PLANE_ATTRIBUTES 2
#define WEB64_MAP_PLANE_SCREEN 3
typedef uint8_t Web64AssetKind;
typedef uint8_t Web64SpriteMode;
typedef uint8_t Web64MapCellType;
typedef uint8_t Web64AssetFlags;
typedef uint8_t Web64Bool;
typedef uint16_t Web64AssetAddress;
typedef uint16_t Web64AssetRef;
typedef struct { Web64AssetAddress data; uint8_t width_pixels; uint8_t height_pixels; uint8_t bytes_per_char; uint8_t mode; uint8_t default_color; } Web64CharAsset;
typedef struct { Web64AssetAddress data; uint16_t byte_size; uint16_t char_count; uint8_t bytes_per_char; uint8_t mode; } Web64CharsetAsset;
typedef struct { Web64AssetAddress data; uint16_t byte_size; uint16_t frame_count; uint8_t bytes_per_frame; uint8_t payload_bytes_per_frame; uint8_t width_pixels; uint8_t height_pixels; uint8_t mode; uint8_t default_color; uint8_t multicolor_1; uint8_t multicolor_2; uint8_t data_block; } Web64SpriteAsset;
typedef struct { Web64AssetRef base; Web64AssetRef overlay; uint16_t frame_count; uint8_t base_color; uint8_t overlay_color; uint8_t multicolor_1; uint8_t multicolor_2; uint8_t flags; } Web64SpriteOverlayAsset;
typedef struct { Web64AssetAddress data; uint16_t byte_size; uint8_t width_chars; uint8_t height_chars; uint8_t char_index_width; uint8_t flags; } Web64BlockAsset;
typedef struct { Web64AssetAddress data; Web64AssetRef charset; uint16_t byte_size; uint16_t block_count; uint8_t width_chars; uint8_t height_chars; uint16_t bytes_per_block; uint8_t index_width; uint8_t flags; } Web64BlockSetAsset;
typedef struct { Web64AssetAddress cells; Web64AssetAddress colors; Web64AssetAddress attributes; Web64AssetRef source; uint16_t width; uint16_t height; uint16_t cell_count; uint8_t cell_type; uint8_t index_width; uint8_t flags; Web64AssetAddress screen; } Web64MapAsset;
typedef struct { Web64AssetAddress data; uint16_t file_size; uint16_t c64_data_offset; uint16_t c64_data_size; uint16_t load_address; uint16_t init_address; uint16_t play_address; uint16_t song_count; uint16_t start_song; uint32_t speed_flags; uint16_t flags; } Web64SidAsset;
_web64_rt void web64_asset_copy(uint8_t *destination, const uint8_t *source, uint16_t length);
_web64_rt uint8_t web64_asset_copy_char(uint8_t *destination, const Web64CharAsset *asset);
_web64_rt uint8_t web64_asset_copy_charset(uint8_t *destination, const Web64CharsetAsset *asset);
_web64_rt uint8_t web64_asset_copy_sprite(uint8_t *destination, const Web64SpriteAsset *asset);
_web64_rt uint8_t web64_asset_copy_sprite_pair(uint8_t *base_destination, uint8_t *overlay_destination, const Web64SpriteOverlayAsset *asset);
_web64_rt uint8_t web64_asset_copy_block(uint8_t *destination, const Web64BlockAsset *asset);
_web64_rt uint8_t web64_asset_copy_blockset(uint8_t *destination, const Web64BlockSetAsset *asset);
_web64_rt uint8_t web64_asset_copy_map_plane(uint8_t *destination, const Web64MapAsset *asset, uint8_t plane);
_web64_rt uint8_t web64_asset_copy_sid_payload(uint8_t *destination, const Web64SidAsset *asset);
typedef struct { Web64AssetRef asset; uint16_t x; uint8_t y; uint8_t frame; uint8_t hardware_sprite; uint8_t data_block; uint8_t color; uint8_t flags; } Web64Sprite;
typedef struct { Web64AssetRef asset; uint16_t x; uint8_t y; uint8_t frame; uint8_t base_hardware_sprite; uint8_t overlay_hardware_sprite; uint8_t flags; } Web64SpriteOverlay;
typedef struct { Web64AssetRef asset; uint16_t map_x; uint16_t map_y; uint8_t screen_x; uint8_t screen_y; uint8_t viewport_width; uint8_t viewport_height; uint8_t flags; } Web64MapView;
#endif

web64/assets.inc

; Web64 _web64_rt C/assembly call helpers for <web64/assets.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_ASSETS_CALL_COUNT = 9
WEB64_RT_ASSETS_WINDOW_CALL_COUNT = 9

; web64_asset_copy: 6-byte window; entry _web64_asset_copy
.macro web64_rt_prepare_asset_copy destination, source, length
    lda #<destination
    sta _web64_asset_copy__arg_destination
    lda #>destination
    sta _web64_asset_copy__arg_destination+1
    lda #<source
    sta _web64_asset_copy__arg_source
    lda #>source
    sta _web64_asset_copy__arg_source+1
    lda #<length
    sta _web64_asset_copy__arg_length
    lda #>length
    sta _web64_asset_copy__arg_length+1
.endmacro

.macro web64_rt_call_asset_copy destination, source, length
    web64_rt_prepare_asset_copy destination, source, length
    jsr _web64_asset_copy
.endmacro

; web64_asset_copy_block: 4-byte window; entry _web64_asset_copy_block
.macro web64_rt_prepare_asset_copy_block destination, asset
    lda #<destination
    sta _web64_asset_copy_block__arg_destination
    lda #>destination
    sta _web64_asset_copy_block__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_block__arg_asset
    lda #>asset
    sta _web64_asset_copy_block__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_block destination, asset
    web64_rt_prepare_asset_copy_block destination, asset
    jsr _web64_asset_copy_block
.endmacro

; web64_asset_copy_blockset: 4-byte window; entry _web64_asset_copy_blockset
.macro web64_rt_prepare_asset_copy_blockset destination, asset
    lda #<destination
    sta _web64_asset_copy_blockset__arg_destination
    lda #>destination
    sta _web64_asset_copy_blockset__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_blockset__arg_asset
    lda #>asset
    sta _web64_asset_copy_blockset__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_blockset destination, asset
    web64_rt_prepare_asset_copy_blockset destination, asset
    jsr _web64_asset_copy_blockset
.endmacro

; web64_asset_copy_char: 4-byte window; entry _web64_asset_copy_char
.macro web64_rt_prepare_asset_copy_char destination, asset
    lda #<destination
    sta _web64_asset_copy_char__arg_destination
    lda #>destination
    sta _web64_asset_copy_char__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_char__arg_asset
    lda #>asset
    sta _web64_asset_copy_char__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_char destination, asset
    web64_rt_prepare_asset_copy_char destination, asset
    jsr _web64_asset_copy_char
.endmacro

; web64_asset_copy_charset: 4-byte window; entry _web64_asset_copy_charset
.macro web64_rt_prepare_asset_copy_charset destination, asset
    lda #<destination
    sta _web64_asset_copy_charset__arg_destination
    lda #>destination
    sta _web64_asset_copy_charset__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_charset__arg_asset
    lda #>asset
    sta _web64_asset_copy_charset__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_charset destination, asset
    web64_rt_prepare_asset_copy_charset destination, asset
    jsr _web64_asset_copy_charset
.endmacro

; web64_asset_copy_map_plane: 5-byte window; entry _web64_asset_copy_map_plane
.macro web64_rt_prepare_asset_copy_map_plane destination, asset, plane
    lda #<destination
    sta _web64_asset_copy_map_plane__arg_destination
    lda #>destination
    sta _web64_asset_copy_map_plane__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_map_plane__arg_asset
    lda #>asset
    sta _web64_asset_copy_map_plane__arg_asset+1
    lda #plane
    sta _web64_asset_copy_map_plane__arg_plane
.endmacro

.macro web64_rt_call_asset_copy_map_plane destination, asset, plane
    web64_rt_prepare_asset_copy_map_plane destination, asset, plane
    jsr _web64_asset_copy_map_plane
.endmacro

; web64_asset_copy_sid_payload: 4-byte window; entry _web64_asset_copy_sid_payload
.macro web64_rt_prepare_asset_copy_sid_payload destination, asset
    lda #<destination
    sta _web64_asset_copy_sid_payload__arg_destination
    lda #>destination
    sta _web64_asset_copy_sid_payload__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_sid_payload__arg_asset
    lda #>asset
    sta _web64_asset_copy_sid_payload__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_sid_payload destination, asset
    web64_rt_prepare_asset_copy_sid_payload destination, asset
    jsr _web64_asset_copy_sid_payload
.endmacro

; web64_asset_copy_sprite: 4-byte window; entry _web64_asset_copy_sprite
.macro web64_rt_prepare_asset_copy_sprite destination, asset
    lda #<destination
    sta _web64_asset_copy_sprite__arg_destination
    lda #>destination
    sta _web64_asset_copy_sprite__arg_destination+1
    lda #<asset
    sta _web64_asset_copy_sprite__arg_asset
    lda #>asset
    sta _web64_asset_copy_sprite__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_sprite destination, asset
    web64_rt_prepare_asset_copy_sprite destination, asset
    jsr _web64_asset_copy_sprite
.endmacro

; web64_asset_copy_sprite_pair: 6-byte window; entry _web64_asset_copy_sprite_pair
.macro web64_rt_prepare_asset_copy_sprite_pair base_destination, overlay_destination, asset
    lda #<base_destination
    sta _web64_asset_copy_sprite_pair__arg_base_destination
    lda #>base_destination
    sta _web64_asset_copy_sprite_pair__arg_base_destination+1
    lda #<overlay_destination
    sta _web64_asset_copy_sprite_pair__arg_overlay_destination
    lda #>overlay_destination
    sta _web64_asset_copy_sprite_pair__arg_overlay_destination+1
    lda #<asset
    sta _web64_asset_copy_sprite_pair__arg_asset
    lda #>asset
    sta _web64_asset_copy_sprite_pair__arg_asset+1
.endmacro

.macro web64_rt_call_asset_copy_sprite_pair base_destination, overlay_destination, asset
    web64_rt_prepare_asset_copy_sprite_pair base_destination, overlay_destination, asset
    jsr _web64_asset_copy_sprite_pair
.endmacro

web64/bitmap.h

#ifndef WEB64_BITMAP_H
#define WEB64_BITMAP_H
#include <stdint.h>
#include <web64/assets.h>

#define WEB64_BITMAP_MODE_HIRES 0
#define WEB64_BITMAP_MODE_MULTICOLOR 1
#define WEB64_BITMAP_OP_REPLACE 0
#define WEB64_BITMAP_OP_XOR 1

#define WEB64_BITMAP_OK 0
#define WEB64_BITMAP_CLIPPED 1
#define WEB64_BITMAP_INVALID_CONTEXT 2
#define WEB64_BITMAP_INVALID_LAYOUT 4
#define WEB64_BITMAP_INVALID_PIXEL 8
#define WEB64_BITMAP_INVALID_OPERATION 16
#define WEB64_BITMAP_PALETTE_CONFLICT 32
#define WEB64_BITMAP_INVALID_ARGUMENT 64
#define WEB64_BITMAP_WORKSPACE_EXHAUSTED 128
#define WEB64_BITMAP_PIXEL_INVALID 0xff

typedef struct {
    uint16_t pixels;
    uint16_t screen;
    uint8_t mode;
    uint8_t background;
    uint8_t vic_bank;
    uint8_t memory_setup;
    uint8_t flags;
} Web64Bitmap;

typedef struct {
    uint8_t color0;
    uint8_t color1;
    uint8_t color2;
    uint8_t color3;
} Web64BitmapPalette;

typedef struct {
    uint16_t first_x;
    uint16_t last_x;
    uint8_t y;
} Web64BitmapFloodSpan;

typedef struct {
    Web64BitmapFloodSpan *spans;
    uint16_t capacity;
    uint16_t used;
} Web64BitmapFloodWorkspace;

#define WEB64_BITMAP_FLOOD_STORAGE(name, capacity) Web64BitmapFloodSpan name##_span_storage[(capacity)]; Web64BitmapFloodWorkspace name
#define WEB64_BITMAP_FLOOD_WORKSPACE_INIT(name, span_count) (name).spans = name##_span_storage; (name).capacity = (span_count); (name).used = 0

_web64_rt uint8_t web64_bitmap_configure(Web64Bitmap *bitmap, uint8_t *pixels, uint8_t *screen, uint8_t mode);
_web64_rt uint8_t web64_bitmap_activate(const Web64Bitmap *bitmap);
_web64_rt uint8_t web64_bitmap_clear(Web64Bitmap *bitmap, uint8_t pixel);
_web64_rt uint8_t web64_bitmap_palette_uniform(Web64Bitmap *bitmap, const Web64BitmapPalette *palette);
_web64_rt uint8_t web64_bitmap_palette_cell(Web64Bitmap *bitmap, uint8_t column, uint8_t row, const Web64BitmapPalette *palette);
_web64_rt uint8_t web64_bitmap_init(Web64Bitmap *bitmap, uint8_t *pixels, uint8_t *screen, uint8_t mode, const Web64BitmapPalette *palette);
/* Expand a 40x25 imported character map into bitmap RAM and copy its screen/Color RAM planes. Configure first; activate after loading. */
_web64_rt uint8_t web64_bitmap_load_map(Web64Bitmap *bitmap, const Web64MapAsset *map, const Web64CharsetAsset *charset);

_web64_rt uint8_t web64_bitmap_plot(Web64Bitmap *bitmap, int16_t x, int16_t y, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_plot_fast(Web64Bitmap *bitmap, uint16_t x, uint8_t y, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_get(const Web64Bitmap *bitmap, int16_t x, int16_t y);
_web64_rt uint8_t web64_bitmap_get_fast(const Web64Bitmap *bitmap, uint16_t x, uint8_t y);

_web64_rt uint8_t web64_bitmap_hline(Web64Bitmap *bitmap, int16_t x, int16_t y, uint16_t width, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_hline_fast(Web64Bitmap *bitmap, uint16_t x, uint8_t y, uint16_t width, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_vline(Web64Bitmap *bitmap, int16_t x, int16_t y, uint16_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_vline_fast(Web64Bitmap *bitmap, uint16_t x, uint8_t y, uint16_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_line(Web64Bitmap *bitmap, int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_line_fast(Web64Bitmap *bitmap, uint16_t x0, uint8_t y0, uint16_t x1, uint8_t y1, uint8_t pixel, uint8_t operation);

_web64_rt uint8_t web64_bitmap_rect(Web64Bitmap *bitmap, int16_t x, int16_t y, uint16_t width, uint16_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_rect_fast(Web64Bitmap *bitmap, uint16_t x, uint8_t y, uint16_t width, uint8_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_fill_rect(Web64Bitmap *bitmap, int16_t x, int16_t y, uint16_t width, uint16_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_fill_rect_fast(Web64Bitmap *bitmap, uint16_t x, uint8_t y, uint16_t width, uint8_t height, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_ellipse(Web64Bitmap *bitmap, int16_t center_x, int16_t center_y, uint16_t radius_x, uint16_t radius_y, uint8_t pixel, uint8_t operation);
_web64_rt uint8_t web64_bitmap_ellipse_fast(Web64Bitmap *bitmap, uint16_t center_x, uint8_t center_y, uint16_t radius_x, uint8_t radius_y, uint8_t pixel, uint8_t operation);

_web64_rt uint8_t web64_bitmap_flood_fill(Web64Bitmap *bitmap, int16_t seed_x, int16_t seed_y, uint8_t replacement, Web64BitmapFloodWorkspace *workspace);
_web64_rt uint8_t web64_bitmap_flood_fill_fast(Web64Bitmap *bitmap, uint16_t seed_x, uint8_t seed_y, uint8_t replacement, Web64BitmapFloodWorkspace *workspace);

#define web64_bitmap_dot(bitmap, x, y, pixel, operation) web64_bitmap_plot((bitmap), (x), (y), (pixel), (operation))
#define web64_bitmap_dot_fast(bitmap, x, y, pixel, operation) web64_bitmap_plot_fast((bitmap), (x), (y), (pixel), (operation))
#define web64_bitmap_circle(bitmap, center_x, center_y, radius, pixel, operation) web64_bitmap_ellipse((bitmap), (center_x), (center_y), (radius), (radius), (pixel), (operation))
#define web64_bitmap_circle_fast(bitmap, center_x, center_y, radius, pixel, operation) web64_bitmap_ellipse_fast((bitmap), (center_x), (center_y), (radius), (radius), (pixel), (operation))

#endif

web64/bitmap.inc

; Web64 Bitmap Drawing Runtime public layouts and constants.
; Runtime call helpers are appended from the authoritative native registry.
WEB64_BITMAP_MODE_HIRES = 0
WEB64_BITMAP_MODE_MULTICOLOR = 1
WEB64_BITMAP_OP_REPLACE = 0
WEB64_BITMAP_OP_XOR = 1
WEB64_BITMAP_OK = 0
WEB64_BITMAP_CLIPPED = 1
WEB64_BITMAP_INVALID_CONTEXT = 2
WEB64_BITMAP_INVALID_LAYOUT = 4
WEB64_BITMAP_INVALID_PIXEL = 8
WEB64_BITMAP_INVALID_OPERATION = 16
WEB64_BITMAP_PALETTE_CONFLICT = 32
WEB64_BITMAP_INVALID_ARGUMENT = 64
WEB64_BITMAP_WORKSPACE_EXHAUSTED = 128
WEB64_BITMAP_PIXEL_INVALID = $ff

WEB64_BITMAP_PIXELS = 0
WEB64_BITMAP_SCREEN = 2
WEB64_BITMAP_MODE = 4
WEB64_BITMAP_BACKGROUND = 5
WEB64_BITMAP_VIC_BANK = 6
WEB64_BITMAP_MEMORY_SETUP = 7
WEB64_BITMAP_FLAGS = 8
WEB64_BITMAP_SIZE = 9

WEB64_BITMAP_PALETTE_COLOR0 = 0
WEB64_BITMAP_PALETTE_COLOR1 = 1
WEB64_BITMAP_PALETTE_COLOR2 = 2
WEB64_BITMAP_PALETTE_COLOR3 = 3
WEB64_BITMAP_PALETTE_SIZE = 4

WEB64_BITMAP_FLOOD_SPAN_FIRST_X = 0
WEB64_BITMAP_FLOOD_SPAN_LAST_X = 2
WEB64_BITMAP_FLOOD_SPAN_Y = 4
WEB64_BITMAP_FLOOD_SPAN_SIZE = 5

WEB64_BITMAP_FLOOD_WORKSPACE_SPANS = 0
WEB64_BITMAP_FLOOD_WORKSPACE_CAPACITY = 2
WEB64_BITMAP_FLOOD_WORKSPACE_USED = 4
WEB64_BITMAP_FLOOD_WORKSPACE_SIZE = 6

; Web64 _web64_rt C/assembly call helpers for <web64/bitmap.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_BITMAP_CALL_COUNT = 25
WEB64_RT_BITMAP_WINDOW_CALL_COUNT = 25

; web64_bitmap_activate: 2-byte window; entry _web64_bitmap_activate
.macro web64_rt_prepare_bitmap_activate bitmap
    lda #<bitmap
    sta _web64_bitmap_activate__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_activate__arg_bitmap+1
.endmacro

.macro web64_rt_call_bitmap_activate bitmap
    web64_rt_prepare_bitmap_activate bitmap
    jsr _web64_bitmap_activate
.endmacro

; web64_bitmap_clear: 3-byte window; entry _web64_bitmap_clear
.macro web64_rt_prepare_bitmap_clear bitmap, pixel
    lda #<bitmap
    sta _web64_bitmap_clear__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_clear__arg_bitmap+1
    lda #pixel
    sta _web64_bitmap_clear__arg_pixel
.endmacro

.macro web64_rt_call_bitmap_clear bitmap, pixel
    web64_rt_prepare_bitmap_clear bitmap, pixel
    jsr _web64_bitmap_clear
.endmacro

; web64_bitmap_configure: 7-byte window; entry _web64_bitmap_configure
.macro web64_rt_prepare_bitmap_configure bitmap, pixels, screen, mode
    lda #<bitmap
    sta _web64_bitmap_configure__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_configure__arg_bitmap+1
    lda #<pixels
    sta _web64_bitmap_configure__arg_pixels
    lda #>pixels
    sta _web64_bitmap_configure__arg_pixels+1
    lda #<screen
    sta _web64_bitmap_configure__arg_screen
    lda #>screen
    sta _web64_bitmap_configure__arg_screen+1
    lda #mode
    sta _web64_bitmap_configure__arg_mode
.endmacro

.macro web64_rt_call_bitmap_configure bitmap, pixels, screen, mode
    web64_rt_prepare_bitmap_configure bitmap, pixels, screen, mode
    jsr _web64_bitmap_configure
.endmacro

; web64_bitmap_ellipse: 12-byte window; entry _web64_bitmap_ellipse
.macro web64_rt_prepare_bitmap_ellipse bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_ellipse__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_ellipse__arg_bitmap+1
    lda #<center_x
    sta _web64_bitmap_ellipse__arg_center_x
    lda #>center_x
    sta _web64_bitmap_ellipse__arg_center_x+1
    lda #<center_y
    sta _web64_bitmap_ellipse__arg_center_y
    lda #>center_y
    sta _web64_bitmap_ellipse__arg_center_y+1
    lda #<radius_x
    sta _web64_bitmap_ellipse__arg_radius_x
    lda #>radius_x
    sta _web64_bitmap_ellipse__arg_radius_x+1
    lda #<radius_y
    sta _web64_bitmap_ellipse__arg_radius_y
    lda #>radius_y
    sta _web64_bitmap_ellipse__arg_radius_y+1
    lda #pixel
    sta _web64_bitmap_ellipse__arg_pixel
    lda #operation
    sta _web64_bitmap_ellipse__arg_operation
.endmacro

.macro web64_rt_call_bitmap_ellipse bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    web64_rt_prepare_bitmap_ellipse bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    jsr _web64_bitmap_ellipse
.endmacro

; web64_bitmap_ellipse_fast: 10-byte window; entry _web64_bitmap_ellipse_fast
.macro web64_rt_prepare_bitmap_ellipse_fast bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_ellipse_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_ellipse_fast__arg_bitmap+1
    lda #<center_x
    sta _web64_bitmap_ellipse_fast__arg_center_x
    lda #>center_x
    sta _web64_bitmap_ellipse_fast__arg_center_x+1
    lda #center_y
    sta _web64_bitmap_ellipse_fast__arg_center_y
    lda #<radius_x
    sta _web64_bitmap_ellipse_fast__arg_radius_x
    lda #>radius_x
    sta _web64_bitmap_ellipse_fast__arg_radius_x+1
    lda #radius_y
    sta _web64_bitmap_ellipse_fast__arg_radius_y
    lda #pixel
    sta _web64_bitmap_ellipse_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_ellipse_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_ellipse_fast bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    web64_rt_prepare_bitmap_ellipse_fast bitmap, center_x, center_y, radius_x, radius_y, pixel, operation
    jsr _web64_bitmap_ellipse_fast
.endmacro

; web64_bitmap_fill_rect: 12-byte window; entry _web64_bitmap_fill_rect
.macro web64_rt_prepare_bitmap_fill_rect bitmap, x, y, width, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_fill_rect__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_fill_rect__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_fill_rect__arg_x
    lda #>x
    sta _web64_bitmap_fill_rect__arg_x+1
    lda #<y
    sta _web64_bitmap_fill_rect__arg_y
    lda #>y
    sta _web64_bitmap_fill_rect__arg_y+1
    lda #<width
    sta _web64_bitmap_fill_rect__arg_width
    lda #>width
    sta _web64_bitmap_fill_rect__arg_width+1
    lda #<height
    sta _web64_bitmap_fill_rect__arg_height
    lda #>height
    sta _web64_bitmap_fill_rect__arg_height+1
    lda #pixel
    sta _web64_bitmap_fill_rect__arg_pixel
    lda #operation
    sta _web64_bitmap_fill_rect__arg_operation
.endmacro

.macro web64_rt_call_bitmap_fill_rect bitmap, x, y, width, height, pixel, operation
    web64_rt_prepare_bitmap_fill_rect bitmap, x, y, width, height, pixel, operation
    jsr _web64_bitmap_fill_rect
.endmacro

; web64_bitmap_fill_rect_fast: 10-byte window; entry _web64_bitmap_fill_rect_fast
.macro web64_rt_prepare_bitmap_fill_rect_fast bitmap, x, y, width, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_fill_rect_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_fill_rect_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_fill_rect_fast__arg_x
    lda #>x
    sta _web64_bitmap_fill_rect_fast__arg_x+1
    lda #y
    sta _web64_bitmap_fill_rect_fast__arg_y
    lda #<width
    sta _web64_bitmap_fill_rect_fast__arg_width
    lda #>width
    sta _web64_bitmap_fill_rect_fast__arg_width+1
    lda #height
    sta _web64_bitmap_fill_rect_fast__arg_height
    lda #pixel
    sta _web64_bitmap_fill_rect_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_fill_rect_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_fill_rect_fast bitmap, x, y, width, height, pixel, operation
    web64_rt_prepare_bitmap_fill_rect_fast bitmap, x, y, width, height, pixel, operation
    jsr _web64_bitmap_fill_rect_fast
.endmacro

; web64_bitmap_flood_fill: 9-byte window; entry _web64_bitmap_flood_fill
.macro web64_rt_prepare_bitmap_flood_fill bitmap, seed_x, seed_y, replacement, workspace
    lda #<bitmap
    sta _web64_bitmap_flood_fill__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_flood_fill__arg_bitmap+1
    lda #<seed_x
    sta _web64_bitmap_flood_fill__arg_seed_x
    lda #>seed_x
    sta _web64_bitmap_flood_fill__arg_seed_x+1
    lda #<seed_y
    sta _web64_bitmap_flood_fill__arg_seed_y
    lda #>seed_y
    sta _web64_bitmap_flood_fill__arg_seed_y+1
    lda #replacement
    sta _web64_bitmap_flood_fill__arg_replacement
    lda #<workspace
    sta _web64_bitmap_flood_fill__arg_workspace
    lda #>workspace
    sta _web64_bitmap_flood_fill__arg_workspace+1
.endmacro

.macro web64_rt_call_bitmap_flood_fill bitmap, seed_x, seed_y, replacement, workspace
    web64_rt_prepare_bitmap_flood_fill bitmap, seed_x, seed_y, replacement, workspace
    jsr _web64_bitmap_flood_fill
.endmacro

; web64_bitmap_flood_fill_fast: 8-byte window; entry _web64_bitmap_flood_fill_fast
.macro web64_rt_prepare_bitmap_flood_fill_fast bitmap, seed_x, seed_y, replacement, workspace
    lda #<bitmap
    sta _web64_bitmap_flood_fill_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_flood_fill_fast__arg_bitmap+1
    lda #<seed_x
    sta _web64_bitmap_flood_fill_fast__arg_seed_x
    lda #>seed_x
    sta _web64_bitmap_flood_fill_fast__arg_seed_x+1
    lda #seed_y
    sta _web64_bitmap_flood_fill_fast__arg_seed_y
    lda #replacement
    sta _web64_bitmap_flood_fill_fast__arg_replacement
    lda #<workspace
    sta _web64_bitmap_flood_fill_fast__arg_workspace
    lda #>workspace
    sta _web64_bitmap_flood_fill_fast__arg_workspace+1
.endmacro

.macro web64_rt_call_bitmap_flood_fill_fast bitmap, seed_x, seed_y, replacement, workspace
    web64_rt_prepare_bitmap_flood_fill_fast bitmap, seed_x, seed_y, replacement, workspace
    jsr _web64_bitmap_flood_fill_fast
.endmacro

; web64_bitmap_get: 6-byte window; entry _web64_bitmap_get
.macro web64_rt_prepare_bitmap_get bitmap, x, y
    lda #<bitmap
    sta _web64_bitmap_get__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_get__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_get__arg_x
    lda #>x
    sta _web64_bitmap_get__arg_x+1
    lda #<y
    sta _web64_bitmap_get__arg_y
    lda #>y
    sta _web64_bitmap_get__arg_y+1
.endmacro

.macro web64_rt_call_bitmap_get bitmap, x, y
    web64_rt_prepare_bitmap_get bitmap, x, y
    jsr _web64_bitmap_get
.endmacro

; web64_bitmap_get_fast: 5-byte window; entry _web64_bitmap_get_fast
.macro web64_rt_prepare_bitmap_get_fast bitmap, x, y
    lda #<bitmap
    sta _web64_bitmap_get_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_get_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_get_fast__arg_x
    lda #>x
    sta _web64_bitmap_get_fast__arg_x+1
    lda #y
    sta _web64_bitmap_get_fast__arg_y
.endmacro

.macro web64_rt_call_bitmap_get_fast bitmap, x, y
    web64_rt_prepare_bitmap_get_fast bitmap, x, y
    jsr _web64_bitmap_get_fast
.endmacro

; web64_bitmap_hline: 10-byte window; entry _web64_bitmap_hline
.macro web64_rt_prepare_bitmap_hline bitmap, x, y, width, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_hline__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_hline__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_hline__arg_x
    lda #>x
    sta _web64_bitmap_hline__arg_x+1
    lda #<y
    sta _web64_bitmap_hline__arg_y
    lda #>y
    sta _web64_bitmap_hline__arg_y+1
    lda #<width
    sta _web64_bitmap_hline__arg_width
    lda #>width
    sta _web64_bitmap_hline__arg_width+1
    lda #pixel
    sta _web64_bitmap_hline__arg_pixel
    lda #operation
    sta _web64_bitmap_hline__arg_operation
.endmacro

.macro web64_rt_call_bitmap_hline bitmap, x, y, width, pixel, operation
    web64_rt_prepare_bitmap_hline bitmap, x, y, width, pixel, operation
    jsr _web64_bitmap_hline
.endmacro

; web64_bitmap_hline_fast: 9-byte window; entry _web64_bitmap_hline_fast
.macro web64_rt_prepare_bitmap_hline_fast bitmap, x, y, width, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_hline_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_hline_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_hline_fast__arg_x
    lda #>x
    sta _web64_bitmap_hline_fast__arg_x+1
    lda #y
    sta _web64_bitmap_hline_fast__arg_y
    lda #<width
    sta _web64_bitmap_hline_fast__arg_width
    lda #>width
    sta _web64_bitmap_hline_fast__arg_width+1
    lda #pixel
    sta _web64_bitmap_hline_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_hline_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_hline_fast bitmap, x, y, width, pixel, operation
    web64_rt_prepare_bitmap_hline_fast bitmap, x, y, width, pixel, operation
    jsr _web64_bitmap_hline_fast
.endmacro

; web64_bitmap_init: 9-byte window; entry _web64_bitmap_init
.macro web64_rt_prepare_bitmap_init bitmap, pixels, screen, mode, palette
    lda #<bitmap
    sta _web64_bitmap_init__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_init__arg_bitmap+1
    lda #<pixels
    sta _web64_bitmap_init__arg_pixels
    lda #>pixels
    sta _web64_bitmap_init__arg_pixels+1
    lda #<screen
    sta _web64_bitmap_init__arg_screen
    lda #>screen
    sta _web64_bitmap_init__arg_screen+1
    lda #mode
    sta _web64_bitmap_init__arg_mode
    lda #<palette
    sta _web64_bitmap_init__arg_palette
    lda #>palette
    sta _web64_bitmap_init__arg_palette+1
.endmacro

.macro web64_rt_call_bitmap_init bitmap, pixels, screen, mode, palette
    web64_rt_prepare_bitmap_init bitmap, pixels, screen, mode, palette
    jsr _web64_bitmap_init
.endmacro

; web64_bitmap_line: 12-byte window; entry _web64_bitmap_line
.macro web64_rt_prepare_bitmap_line bitmap, x0, y0, x1, y1, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_line__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_line__arg_bitmap+1
    lda #<x0
    sta _web64_bitmap_line__arg_x0
    lda #>x0
    sta _web64_bitmap_line__arg_x0+1
    lda #<y0
    sta _web64_bitmap_line__arg_y0
    lda #>y0
    sta _web64_bitmap_line__arg_y0+1
    lda #<x1
    sta _web64_bitmap_line__arg_x1
    lda #>x1
    sta _web64_bitmap_line__arg_x1+1
    lda #<y1
    sta _web64_bitmap_line__arg_y1
    lda #>y1
    sta _web64_bitmap_line__arg_y1+1
    lda #pixel
    sta _web64_bitmap_line__arg_pixel
    lda #operation
    sta _web64_bitmap_line__arg_operation
.endmacro

.macro web64_rt_call_bitmap_line bitmap, x0, y0, x1, y1, pixel, operation
    web64_rt_prepare_bitmap_line bitmap, x0, y0, x1, y1, pixel, operation
    jsr _web64_bitmap_line
.endmacro

; web64_bitmap_line_fast: 10-byte window; entry _web64_bitmap_line_fast
.macro web64_rt_prepare_bitmap_line_fast bitmap, x0, y0, x1, y1, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_line_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_line_fast__arg_bitmap+1
    lda #<x0
    sta _web64_bitmap_line_fast__arg_x0
    lda #>x0
    sta _web64_bitmap_line_fast__arg_x0+1
    lda #y0
    sta _web64_bitmap_line_fast__arg_y0
    lda #<x1
    sta _web64_bitmap_line_fast__arg_x1
    lda #>x1
    sta _web64_bitmap_line_fast__arg_x1+1
    lda #y1
    sta _web64_bitmap_line_fast__arg_y1
    lda #pixel
    sta _web64_bitmap_line_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_line_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_line_fast bitmap, x0, y0, x1, y1, pixel, operation
    web64_rt_prepare_bitmap_line_fast bitmap, x0, y0, x1, y1, pixel, operation
    jsr _web64_bitmap_line_fast
.endmacro

; web64_bitmap_load_map: 6-byte window; entry _web64_bitmap_load_map
.macro web64_rt_prepare_bitmap_load_map bitmap, map, charset
    lda #<bitmap
    sta _web64_bitmap_load_map__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_load_map__arg_bitmap+1
    lda #<map
    sta _web64_bitmap_load_map__arg_map
    lda #>map
    sta _web64_bitmap_load_map__arg_map+1
    lda #<charset
    sta _web64_bitmap_load_map__arg_charset
    lda #>charset
    sta _web64_bitmap_load_map__arg_charset+1
.endmacro

.macro web64_rt_call_bitmap_load_map bitmap, map, charset
    web64_rt_prepare_bitmap_load_map bitmap, map, charset
    jsr _web64_bitmap_load_map
.endmacro

; web64_bitmap_palette_cell: 6-byte window; entry _web64_bitmap_palette_cell
.macro web64_rt_prepare_bitmap_palette_cell bitmap, column, row, palette
    lda #<bitmap
    sta _web64_bitmap_palette_cell__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_palette_cell__arg_bitmap+1
    lda #column
    sta _web64_bitmap_palette_cell__arg_column
    lda #row
    sta _web64_bitmap_palette_cell__arg_row
    lda #<palette
    sta _web64_bitmap_palette_cell__arg_palette
    lda #>palette
    sta _web64_bitmap_palette_cell__arg_palette+1
.endmacro

.macro web64_rt_call_bitmap_palette_cell bitmap, column, row, palette
    web64_rt_prepare_bitmap_palette_cell bitmap, column, row, palette
    jsr _web64_bitmap_palette_cell
.endmacro

; web64_bitmap_palette_uniform: 4-byte window; entry _web64_bitmap_palette_uniform
.macro web64_rt_prepare_bitmap_palette_uniform bitmap, palette
    lda #<bitmap
    sta _web64_bitmap_palette_uniform__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_palette_uniform__arg_bitmap+1
    lda #<palette
    sta _web64_bitmap_palette_uniform__arg_palette
    lda #>palette
    sta _web64_bitmap_palette_uniform__arg_palette+1
.endmacro

.macro web64_rt_call_bitmap_palette_uniform bitmap, palette
    web64_rt_prepare_bitmap_palette_uniform bitmap, palette
    jsr _web64_bitmap_palette_uniform
.endmacro

; web64_bitmap_plot: 8-byte window; entry _web64_bitmap_plot
.macro web64_rt_prepare_bitmap_plot bitmap, x, y, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_plot__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_plot__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_plot__arg_x
    lda #>x
    sta _web64_bitmap_plot__arg_x+1
    lda #<y
    sta _web64_bitmap_plot__arg_y
    lda #>y
    sta _web64_bitmap_plot__arg_y+1
    lda #pixel
    sta _web64_bitmap_plot__arg_pixel
    lda #operation
    sta _web64_bitmap_plot__arg_operation
.endmacro

.macro web64_rt_call_bitmap_plot bitmap, x, y, pixel, operation
    web64_rt_prepare_bitmap_plot bitmap, x, y, pixel, operation
    jsr _web64_bitmap_plot
.endmacro

; web64_bitmap_plot_fast: 7-byte window; entry _web64_bitmap_plot_fast
.macro web64_rt_prepare_bitmap_plot_fast bitmap, x, y, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_plot_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_plot_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_plot_fast__arg_x
    lda #>x
    sta _web64_bitmap_plot_fast__arg_x+1
    lda #y
    sta _web64_bitmap_plot_fast__arg_y
    lda #pixel
    sta _web64_bitmap_plot_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_plot_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_plot_fast bitmap, x, y, pixel, operation
    web64_rt_prepare_bitmap_plot_fast bitmap, x, y, pixel, operation
    jsr _web64_bitmap_plot_fast
.endmacro

; web64_bitmap_rect: 12-byte window; entry _web64_bitmap_rect
.macro web64_rt_prepare_bitmap_rect bitmap, x, y, width, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_rect__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_rect__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_rect__arg_x
    lda #>x
    sta _web64_bitmap_rect__arg_x+1
    lda #<y
    sta _web64_bitmap_rect__arg_y
    lda #>y
    sta _web64_bitmap_rect__arg_y+1
    lda #<width
    sta _web64_bitmap_rect__arg_width
    lda #>width
    sta _web64_bitmap_rect__arg_width+1
    lda #<height
    sta _web64_bitmap_rect__arg_height
    lda #>height
    sta _web64_bitmap_rect__arg_height+1
    lda #pixel
    sta _web64_bitmap_rect__arg_pixel
    lda #operation
    sta _web64_bitmap_rect__arg_operation
.endmacro

.macro web64_rt_call_bitmap_rect bitmap, x, y, width, height, pixel, operation
    web64_rt_prepare_bitmap_rect bitmap, x, y, width, height, pixel, operation
    jsr _web64_bitmap_rect
.endmacro

; web64_bitmap_rect_fast: 10-byte window; entry _web64_bitmap_rect_fast
.macro web64_rt_prepare_bitmap_rect_fast bitmap, x, y, width, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_rect_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_rect_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_rect_fast__arg_x
    lda #>x
    sta _web64_bitmap_rect_fast__arg_x+1
    lda #y
    sta _web64_bitmap_rect_fast__arg_y
    lda #<width
    sta _web64_bitmap_rect_fast__arg_width
    lda #>width
    sta _web64_bitmap_rect_fast__arg_width+1
    lda #height
    sta _web64_bitmap_rect_fast__arg_height
    lda #pixel
    sta _web64_bitmap_rect_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_rect_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_rect_fast bitmap, x, y, width, height, pixel, operation
    web64_rt_prepare_bitmap_rect_fast bitmap, x, y, width, height, pixel, operation
    jsr _web64_bitmap_rect_fast
.endmacro

; web64_bitmap_vline: 10-byte window; entry _web64_bitmap_vline
.macro web64_rt_prepare_bitmap_vline bitmap, x, y, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_vline__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_vline__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_vline__arg_x
    lda #>x
    sta _web64_bitmap_vline__arg_x+1
    lda #<y
    sta _web64_bitmap_vline__arg_y
    lda #>y
    sta _web64_bitmap_vline__arg_y+1
    lda #<height
    sta _web64_bitmap_vline__arg_height
    lda #>height
    sta _web64_bitmap_vline__arg_height+1
    lda #pixel
    sta _web64_bitmap_vline__arg_pixel
    lda #operation
    sta _web64_bitmap_vline__arg_operation
.endmacro

.macro web64_rt_call_bitmap_vline bitmap, x, y, height, pixel, operation
    web64_rt_prepare_bitmap_vline bitmap, x, y, height, pixel, operation
    jsr _web64_bitmap_vline
.endmacro

; web64_bitmap_vline_fast: 9-byte window; entry _web64_bitmap_vline_fast
.macro web64_rt_prepare_bitmap_vline_fast bitmap, x, y, height, pixel, operation
    lda #<bitmap
    sta _web64_bitmap_vline_fast__arg_bitmap
    lda #>bitmap
    sta _web64_bitmap_vline_fast__arg_bitmap+1
    lda #<x
    sta _web64_bitmap_vline_fast__arg_x
    lda #>x
    sta _web64_bitmap_vline_fast__arg_x+1
    lda #y
    sta _web64_bitmap_vline_fast__arg_y
    lda #<height
    sta _web64_bitmap_vline_fast__arg_height
    lda #>height
    sta _web64_bitmap_vline_fast__arg_height+1
    lda #pixel
    sta _web64_bitmap_vline_fast__arg_pixel
    lda #operation
    sta _web64_bitmap_vline_fast__arg_operation
.endmacro

.macro web64_rt_call_bitmap_vline_fast bitmap, x, y, height, pixel, operation
    web64_rt_prepare_bitmap_vline_fast bitmap, x, y, height, pixel, operation
    jsr _web64_bitmap_vline_fast
.endmacro

web64/cartridge.h

#ifndef WEB64_CARTRIDGE_H
#define WEB64_CARTRIDGE_H
#include <stdint.h>
#define WEB64_CART_PROFILE_STANDARD_8K 0
#define WEB64_CART_PROFILE_STANDARD_16K 1
#define WEB64_CART_PROFILE_MAGIC_DESK 2
#define WEB64_CART_PROFILE_EASYFLASH 3
#define WEB64_CART_ROML 0
#define WEB64_CART_ROMH 1
#define WEB64_CART_OK 0
#define WEB64_CART_PROFILE 1
#define WEB64_CART_BANK 2
#define WEB64_CART_MODE 3
#define WEB64_CART_RANGE 4
#define WEB64_CART_DESTINATION 5
#define WEB64_CART_BUSY 6
#define WEB64_CART_NOT_INITIALIZED 7
#define WEB64_CART_RESOURCE 8
#define WEB64_CART_DIRECTORY 9
#define WEB64_CART_UNSAFE 10
#define WEB64_CART_MAX_TRANSFER 256
#define WEB64_CART_MODE_BOOT 0
#define WEB64_CART_MODE_OFF 4
#define WEB64_CART_MODE_ULTIMAX 5
#define WEB64_CART_MODE_8K 6
#define WEB64_CART_MODE_16K 7
typedef struct { uint8_t profile; uint8_t bank; uint8_t window; uint16_t offset; uint8_t *destination; uint16_t length; } web64_cart_transfer;
typedef struct { uint8_t resource; uint32_t offset; uint8_t *destination; uint16_t length; } web64_cart_resource_request;
typedef struct { uint16_t completed; } web64_cart_resource_result;
_web64_rt uint8_t web64_cart_select_bank(uint8_t profile, uint8_t bank);
_web64_rt uint8_t web64_cart_set_mode(uint8_t profile, uint8_t mode);
_web64_rt uint8_t web64_cart_copy(const web64_cart_transfer *request);
_web64_rt uint8_t web64_cart_read(const web64_cart_transfer *request);
_web64_rt uint8_t web64_cart_resources_init(void);
_web64_rt uint8_t web64_cart_resource_read(const web64_cart_resource_request *request, web64_cart_resource_result *result);
_web64_rt uint8_t web64_cart_resource_copy(const web64_cart_resource_request *request, web64_cart_resource_result *result);
#endif

web64/cartridge.inc

WEB64_CART_PROFILE_STANDARD_8K = 0
WEB64_CART_PROFILE_STANDARD_16K = 1
WEB64_CART_PROFILE_MAGIC_DESK = 2
WEB64_CART_PROFILE_EASYFLASH = 3
WEB64_CART_ROML = 0
WEB64_CART_ROMH = 1
WEB64_CART_OK = 0
WEB64_CART_PROFILE = 1
WEB64_CART_BANK = 2
WEB64_CART_MODE = 3
WEB64_CART_RANGE = 4
WEB64_CART_DESTINATION = 5
WEB64_CART_BUSY = 6
WEB64_CART_NOT_INITIALIZED = 7
WEB64_CART_RESOURCE = 8
WEB64_CART_DIRECTORY = 9
WEB64_CART_UNSAFE = 10
WEB64_CART_MAX_TRANSFER = 256
WEB64_CART_TRANSFER_PROFILE = 0
WEB64_CART_TRANSFER_BANK = 1
WEB64_CART_TRANSFER_WINDOW = 2
WEB64_CART_TRANSFER_OFFSET = 3
WEB64_CART_TRANSFER_DESTINATION = 5
WEB64_CART_TRANSFER_LENGTH = 7
WEB64_CART_TRANSFER_SIZE = 9
WEB64_CART_RESOURCE_REQUEST_RESOURCE = 0
WEB64_CART_RESOURCE_REQUEST_OFFSET = 1
WEB64_CART_RESOURCE_REQUEST_DESTINATION = 5
WEB64_CART_RESOURCE_REQUEST_LENGTH = 7
WEB64_CART_RESOURCE_REQUEST_SIZE = 9
WEB64_CART_RESOURCE_RESULT_COMPLETED = 0
WEB64_CART_RESOURCE_RESULT_SIZE = 2
WEB64_CART_MODE_BOOT = 0
WEB64_CART_MODE_OFF = 4
WEB64_CART_MODE_ULTIMAX = 5
WEB64_CART_MODE_8K = 6
WEB64_CART_MODE_16K = 7

; Web64 _web64_rt C/assembly call helpers for <web64/cartridge.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_CARTRIDGE_CALL_COUNT = 7
WEB64_RT_CARTRIDGE_WINDOW_CALL_COUNT = 7

; web64_cart_copy: 2-byte window; entry _web64_cart_copy
.macro web64_rt_prepare_cart_copy request
    lda #<request
    sta _web64_cart_copy__arg_request
    lda #>request
    sta _web64_cart_copy__arg_request+1
.endmacro

.macro web64_rt_call_cart_copy request
    web64_rt_prepare_cart_copy request
    jsr _web64_cart_copy
.endmacro

; web64_cart_read: 2-byte window; entry _web64_cart_read
.macro web64_rt_prepare_cart_read request
    lda #<request
    sta _web64_cart_read__arg_request
    lda #>request
    sta _web64_cart_read__arg_request+1
.endmacro

.macro web64_rt_call_cart_read request
    web64_rt_prepare_cart_read request
    jsr _web64_cart_read
.endmacro

; web64_cart_resource_copy: 4-byte window; entry _web64_cart_resource_copy
.macro web64_rt_prepare_cart_resource_copy request, result
    lda #<request
    sta _web64_cart_resource_copy__arg_request
    lda #>request
    sta _web64_cart_resource_copy__arg_request+1
    lda #<result
    sta _web64_cart_resource_copy__arg_result
    lda #>result
    sta _web64_cart_resource_copy__arg_result+1
.endmacro

.macro web64_rt_call_cart_resource_copy request, result
    web64_rt_prepare_cart_resource_copy request, result
    jsr _web64_cart_resource_copy
.endmacro

; web64_cart_resource_read: 4-byte window; entry _web64_cart_resource_read
.macro web64_rt_prepare_cart_resource_read request, result
    lda #<request
    sta _web64_cart_resource_read__arg_request
    lda #>request
    sta _web64_cart_resource_read__arg_request+1
    lda #<result
    sta _web64_cart_resource_read__arg_result
    lda #>result
    sta _web64_cart_resource_read__arg_result+1
.endmacro

.macro web64_rt_call_cart_resource_read request, result
    web64_rt_prepare_cart_resource_read request, result
    jsr _web64_cart_resource_read
.endmacro

; web64_cart_resources_init: 0-byte window; entry _web64_cart_resources_init
.macro web64_rt_prepare_cart_resources_init
.endmacro

.macro web64_rt_call_cart_resources_init
    web64_rt_prepare_cart_resources_init
    jsr _web64_cart_resources_init
.endmacro

; web64_cart_select_bank: 2-byte window; entry _web64_cart_select_bank
.macro web64_rt_prepare_cart_select_bank profile, bank
    lda #profile
    sta _web64_cart_select_bank__arg_profile
    lda #bank
    sta _web64_cart_select_bank__arg_bank
.endmacro

.macro web64_rt_call_cart_select_bank profile, bank
    web64_rt_prepare_cart_select_bank profile, bank
    jsr _web64_cart_select_bank
.endmacro

; web64_cart_set_mode: 2-byte window; entry _web64_cart_set_mode
.macro web64_rt_prepare_cart_set_mode profile, mode
    lda #profile
    sta _web64_cart_set_mode__arg_profile
    lda #mode
    sta _web64_cart_set_mode__arg_mode
.endmacro

.macro web64_rt_call_cart_set_mode profile, mode
    web64_rt_prepare_cart_set_mode profile, mode
    jsr _web64_cart_set_mode
.endmacro

web64/collision.h

#ifndef WEB64_COLLISION_H
#define WEB64_COLLISION_H
#include <web64/game.h>
#define WEB64_MATERIAL_SOLID 1
#define WEB64_MATERIAL_ONE_WAY 2
#define WEB64_MATERIAL_LADDER 4
#define WEB64_MATERIAL_HAZARD 8
#define WEB64_MATERIAL_TRIGGER 16
#define WEB64_MATERIAL_COLLECTIBLE 32
#define WEB64_MATERIAL_MODIFIER 64
#define WEB64_MATERIAL_USER 128
#define WEB64_CONTACT_LEFT 1
#define WEB64_CONTACT_RIGHT 2
#define WEB64_CONTACT_CEILING 4
#define WEB64_CONTACT_FLOOR 8
#define WEB64_CONTACT_LADDER 16
#define WEB64_CONTACT_HAZARD 32
#define WEB64_CONTACT_TRIGGER 64
#define WEB64_CONTACT_COLLECTIBLE 128
typedef struct { uint16_t materials; uint16_t properties; uint16_t width; uint16_t height; uint16_t row_stride; uint8_t tile_shift; uint8_t outside_material; } Web64CollisionMap;
typedef struct { uint16_t x; uint16_t y; uint8_t width; uint8_t height; uint8_t category; uint8_t mask; } Web64Aabb;
typedef struct { uint16_t previous_x; uint16_t desired_x; uint8_t material_mask; uint8_t contacts; uint8_t material; uint8_t properties; } Web64CollisionSweepX;
typedef struct { uint16_t previous_y; uint16_t desired_y; uint8_t material_mask; uint8_t contacts; uint8_t material; uint8_t properties; } Web64CollisionSweepY;
typedef struct { uint16_t cell; uint8_t column; uint8_t row; uint8_t material; uint8_t properties; uint8_t contacts; uint8_t actor; } Web64CollisionEvent;
typedef struct { uint16_t events; uint8_t capacity; uint8_t count; uint8_t overflow; } Web64CollisionQueue;
_web64_rt uint8_t web64_collision_material_at(const Web64CollisionMap *map, uint16_t pixel_x, uint16_t pixel_y);
_web64_rt uint8_t web64_collision_material_flags(const Web64CollisionMap *map, uint8_t material);
_web64_rt uint8_t web64_collision_probe_point(const Web64CollisionMap *map, uint16_t pixel_x, uint16_t pixel_y, uint8_t material_mask);
_web64_rt uint8_t web64_collision_probe_edge(const Web64CollisionMap *map, uint16_t pixel_x, uint16_t pixel_y0, uint16_t pixel_y1, uint8_t material_mask);
_web64_rt uint8_t web64_collision_probe_span(const Web64CollisionMap *map, uint16_t pixel_x0, uint16_t pixel_x1, uint16_t pixel_y, uint8_t material_mask);
_web64_rt uint16_t web64_collision_find_material_rect(uint8_t *materials, uint8_t row_stride, uint8_t first_column, uint8_t last_column, uint8_t first_row, uint8_t last_row, uint8_t material);
_web64_rt uint8_t web64_collision_sweep_x(const Web64CollisionMap *map, Web64Aabb *box, Web64CollisionSweepX *sweep);
_web64_rt uint8_t web64_collision_sweep_y(const Web64CollisionMap *map, Web64Aabb *box, Web64CollisionSweepY *sweep);
_web64_rt uint8_t web64_collision_aabb(const Web64Aabb *a, const Web64Aabb *b);
_web64_rt uint8_t web64_collision_event_push(Web64CollisionQueue *queue, const Web64CollisionEvent *event);
_web64_rt void web64_collision_map_write(uint8_t *plane, uint16_t row_stride, uint8_t column, uint8_t row, uint8_t value);
#endif

web64/collision.inc

; Web64 _web64_rt C/assembly call helpers for <web64/collision.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_COLLISION_CALL_COUNT = 11
WEB64_RT_COLLISION_WINDOW_CALL_COUNT = 11

; web64_collision_aabb: 4-byte window; entry _web64_collision_aabb
.macro web64_rt_prepare_collision_aabb a, b
    lda #<a
    sta _web64_collision_aabb__arg_a
    lda #>a
    sta _web64_collision_aabb__arg_a+1
    lda #<b
    sta _web64_collision_aabb__arg_b
    lda #>b
    sta _web64_collision_aabb__arg_b+1
.endmacro

.macro web64_rt_call_collision_aabb a, b
    web64_rt_prepare_collision_aabb a, b
    jsr _web64_collision_aabb
.endmacro

; web64_collision_event_push: 4-byte window; entry _web64_collision_event_push
.macro web64_rt_prepare_collision_event_push queue, event
    lda #<queue
    sta _web64_collision_event_push__arg_queue
    lda #>queue
    sta _web64_collision_event_push__arg_queue+1
    lda #<event
    sta _web64_collision_event_push__arg_event
    lda #>event
    sta _web64_collision_event_push__arg_event+1
.endmacro

.macro web64_rt_call_collision_event_push queue, event
    web64_rt_prepare_collision_event_push queue, event
    jsr _web64_collision_event_push
.endmacro

; web64_collision_find_material_rect: 8-byte window; entry _web64_collision_find_material_rect
.macro web64_rt_prepare_collision_find_material_rect materials, row_stride, first_column, last_column, first_row, last_row, material
    lda #<materials
    sta _web64_collision_find_material_rect__arg_materials
    lda #>materials
    sta _web64_collision_find_material_rect__arg_materials+1
    lda #row_stride
    sta _web64_collision_find_material_rect__arg_row_stride
    lda #first_column
    sta _web64_collision_find_material_rect__arg_first_column
    lda #last_column
    sta _web64_collision_find_material_rect__arg_last_column
    lda #first_row
    sta _web64_collision_find_material_rect__arg_first_row
    lda #last_row
    sta _web64_collision_find_material_rect__arg_last_row
    lda #material
    sta _web64_collision_find_material_rect__arg_material
.endmacro

.macro web64_rt_call_collision_find_material_rect materials, row_stride, first_column, last_column, first_row, last_row, material
    web64_rt_prepare_collision_find_material_rect materials, row_stride, first_column, last_column, first_row, last_row, material
    jsr _web64_collision_find_material_rect
.endmacro

; web64_collision_map_write: 7-byte window; entry _web64_collision_map_write
.macro web64_rt_prepare_collision_map_write plane, row_stride, column, row, value
    lda #<plane
    sta _web64_collision_map_write__arg_plane
    lda #>plane
    sta _web64_collision_map_write__arg_plane+1
    lda #<row_stride
    sta _web64_collision_map_write__arg_row_stride
    lda #>row_stride
    sta _web64_collision_map_write__arg_row_stride+1
    lda #column
    sta _web64_collision_map_write__arg_column
    lda #row
    sta _web64_collision_map_write__arg_row
    lda #value
    sta _web64_collision_map_write__arg_value
.endmacro

.macro web64_rt_call_collision_map_write plane, row_stride, column, row, value
    web64_rt_prepare_collision_map_write plane, row_stride, column, row, value
    jsr _web64_collision_map_write
.endmacro

; web64_collision_material_at: 6-byte window; entry _web64_collision_material_at
.macro web64_rt_prepare_collision_material_at map, pixel_x, pixel_y
    lda #<map
    sta _web64_collision_material_at__arg_map
    lda #>map
    sta _web64_collision_material_at__arg_map+1
    lda #<pixel_x
    sta _web64_collision_material_at__arg_pixel_x
    lda #>pixel_x
    sta _web64_collision_material_at__arg_pixel_x+1
    lda #<pixel_y
    sta _web64_collision_material_at__arg_pixel_y
    lda #>pixel_y
    sta _web64_collision_material_at__arg_pixel_y+1
.endmacro

.macro web64_rt_call_collision_material_at map, pixel_x, pixel_y
    web64_rt_prepare_collision_material_at map, pixel_x, pixel_y
    jsr _web64_collision_material_at
.endmacro

; web64_collision_material_flags: 3-byte window; entry _web64_collision_material_flags
.macro web64_rt_prepare_collision_material_flags map, material
    lda #<map
    sta _web64_collision_material_flags__arg_map
    lda #>map
    sta _web64_collision_material_flags__arg_map+1
    lda #material
    sta _web64_collision_material_flags__arg_material
.endmacro

.macro web64_rt_call_collision_material_flags map, material
    web64_rt_prepare_collision_material_flags map, material
    jsr _web64_collision_material_flags
.endmacro

; web64_collision_probe_edge: 9-byte window; entry _web64_collision_probe_edge
.macro web64_rt_prepare_collision_probe_edge map, pixel_x, pixel_y0, pixel_y1, material_mask
    lda #<map
    sta _web64_collision_probe_edge__arg_map
    lda #>map
    sta _web64_collision_probe_edge__arg_map+1
    lda #<pixel_x
    sta _web64_collision_probe_edge__arg_pixel_x
    lda #>pixel_x
    sta _web64_collision_probe_edge__arg_pixel_x+1
    lda #<pixel_y0
    sta _web64_collision_probe_edge__arg_pixel_y0
    lda #>pixel_y0
    sta _web64_collision_probe_edge__arg_pixel_y0+1
    lda #<pixel_y1
    sta _web64_collision_probe_edge__arg_pixel_y1
    lda #>pixel_y1
    sta _web64_collision_probe_edge__arg_pixel_y1+1
    lda #material_mask
    sta _web64_collision_probe_edge__arg_material_mask
.endmacro

.macro web64_rt_call_collision_probe_edge map, pixel_x, pixel_y0, pixel_y1, material_mask
    web64_rt_prepare_collision_probe_edge map, pixel_x, pixel_y0, pixel_y1, material_mask
    jsr _web64_collision_probe_edge
.endmacro

; web64_collision_probe_point: 7-byte window; entry _web64_collision_probe_point
.macro web64_rt_prepare_collision_probe_point map, pixel_x, pixel_y, material_mask
    lda #<map
    sta _web64_collision_probe_point__arg_map
    lda #>map
    sta _web64_collision_probe_point__arg_map+1
    lda #<pixel_x
    sta _web64_collision_probe_point__arg_pixel_x
    lda #>pixel_x
    sta _web64_collision_probe_point__arg_pixel_x+1
    lda #<pixel_y
    sta _web64_collision_probe_point__arg_pixel_y
    lda #>pixel_y
    sta _web64_collision_probe_point__arg_pixel_y+1
    lda #material_mask
    sta _web64_collision_probe_point__arg_material_mask
.endmacro

.macro web64_rt_call_collision_probe_point map, pixel_x, pixel_y, material_mask
    web64_rt_prepare_collision_probe_point map, pixel_x, pixel_y, material_mask
    jsr _web64_collision_probe_point
.endmacro

; web64_collision_probe_span: 9-byte window; entry _web64_collision_probe_span
.macro web64_rt_prepare_collision_probe_span map, pixel_x0, pixel_x1, pixel_y, material_mask
    lda #<map
    sta _web64_collision_probe_span__arg_map
    lda #>map
    sta _web64_collision_probe_span__arg_map+1
    lda #<pixel_x0
    sta _web64_collision_probe_span__arg_pixel_x0
    lda #>pixel_x0
    sta _web64_collision_probe_span__arg_pixel_x0+1
    lda #<pixel_x1
    sta _web64_collision_probe_span__arg_pixel_x1
    lda #>pixel_x1
    sta _web64_collision_probe_span__arg_pixel_x1+1
    lda #<pixel_y
    sta _web64_collision_probe_span__arg_pixel_y
    lda #>pixel_y
    sta _web64_collision_probe_span__arg_pixel_y+1
    lda #material_mask
    sta _web64_collision_probe_span__arg_material_mask
.endmacro

.macro web64_rt_call_collision_probe_span map, pixel_x0, pixel_x1, pixel_y, material_mask
    web64_rt_prepare_collision_probe_span map, pixel_x0, pixel_x1, pixel_y, material_mask
    jsr _web64_collision_probe_span
.endmacro

; web64_collision_sweep_x: 6-byte window; entry _web64_collision_sweep_x
.macro web64_rt_prepare_collision_sweep_x map, box, sweep
    lda #<map
    sta _web64_collision_sweep_x__arg_map
    lda #>map
    sta _web64_collision_sweep_x__arg_map+1
    lda #<box
    sta _web64_collision_sweep_x__arg_box
    lda #>box
    sta _web64_collision_sweep_x__arg_box+1
    lda #<sweep
    sta _web64_collision_sweep_x__arg_sweep
    lda #>sweep
    sta _web64_collision_sweep_x__arg_sweep+1
.endmacro

.macro web64_rt_call_collision_sweep_x map, box, sweep
    web64_rt_prepare_collision_sweep_x map, box, sweep
    jsr _web64_collision_sweep_x
.endmacro

; web64_collision_sweep_y: 6-byte window; entry _web64_collision_sweep_y
.macro web64_rt_prepare_collision_sweep_y map, box, sweep
    lda #<map
    sta _web64_collision_sweep_y__arg_map
    lda #>map
    sta _web64_collision_sweep_y__arg_map+1
    lda #<box
    sta _web64_collision_sweep_y__arg_box
    lda #>box
    sta _web64_collision_sweep_y__arg_box+1
    lda #<sweep
    sta _web64_collision_sweep_y__arg_sweep
    lda #>sweep
    sta _web64_collision_sweep_y__arg_sweep+1
.endmacro

.macro web64_rt_call_collision_sweep_y map, box, sweep
    web64_rt_prepare_collision_sweep_y map, box, sweep
    jsr _web64_collision_sweep_y
.endmacro

web64/disk.h

#ifndef WEB64_DISK_H
#define WEB64_DISK_H
#include <stdint.h>
#define WEB64_DISK_OK 0x00
#define WEB64_DISK_STATUS_TIMEOUT_WRITE 0x01
#define WEB64_DISK_STATUS_TIMEOUT_READ 0x02
#define WEB64_DISK_STATUS_EOI 0x40
#define WEB64_DISK_STATUS_DEVICE_NOT_PRESENT 0x80
#define WEB64_DISK_REQUEST_MAGIC_ADDRESS 0x02fe
#define WEB64_DISK_REQUEST_ID_ADDRESS 0x02ff
#define WEB64_DISK_NAME(text) (text), ((uint8_t)(sizeof(text) - 1))
typedef uint8_t Web64DiskStatus;
typedef struct Web64DiskDescriptor {
    uint8_t index;
    uint8_t unit;
    const char *marker_name;
    uint8_t marker_length;
} Web64DiskDescriptor;
typedef struct Web64DiskFileDescriptor {
    const char *name;
    uint8_t name_length;
    uint8_t type;
} Web64DiskFileDescriptor;
_web64_rt uint8_t web64_disk_load(const char *name, uint8_t length, uint8_t device, uint16_t address);
_web64_rt uint8_t web64_disk_save(const char *name, uint8_t length, uint8_t device, uint16_t start_address, uint16_t end_address);
_web64_rt uint8_t web64_disk_require(const char *marker_name, uint8_t marker_length, uint8_t device);
_web64_rt void web64_disk_request(uint8_t disk_index);
uint16_t web64_disk_last_end(void);
/* Separate from READST and DOS channel 15; 0 or 0x0100 | KERNAL A. */
uint16_t web64_disk_last_error(void);
_web64_rt uint8_t web64_file_open(const char *name, uint8_t length, uint8_t logical_file, uint8_t device, uint8_t secondary);
_web64_rt uint8_t web64_file_close(uint8_t logical_file);
_web64_rt uint8_t web64_file_read(uint8_t logical_file, void *destination);
_web64_rt uint8_t web64_file_write(uint8_t logical_file, uint8_t value);
#endif

web64/disk.inc

; Web64 _web64_rt C/assembly call helpers for <web64/disk.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_DISK_CALL_COUNT = 10
WEB64_RT_DISK_WINDOW_CALL_COUNT = 8

; web64_disk_last_end: parameterless entry _web64_disk_last_end
.macro web64_rt_call_disk_last_end
    jsr _web64_disk_last_end
.endmacro

; web64_disk_last_error: parameterless entry _web64_disk_last_error
.macro web64_rt_call_disk_last_error
    jsr _web64_disk_last_error
.endmacro

; web64_disk_load: 6-byte window; entry _web64_disk_load
.macro web64_rt_prepare_disk_load name, length, device, address
    lda #<name
    sta _web64_disk_load__arg_name
    lda #>name
    sta _web64_disk_load__arg_name+1
    lda #length
    sta _web64_disk_load__arg_length
    lda #device
    sta _web64_disk_load__arg_device
    lda #<address
    sta _web64_disk_load__arg_address
    lda #>address
    sta _web64_disk_load__arg_address+1
.endmacro

.macro web64_rt_call_disk_load name, length, device, address
    web64_rt_prepare_disk_load name, length, device, address
    jsr _web64_disk_load
.endmacro

; web64_disk_request: 1-byte window; entry _web64_disk_request
.macro web64_rt_prepare_disk_request disk_index
    lda #disk_index
    sta _web64_disk_request__arg_disk_index
.endmacro

.macro web64_rt_call_disk_request disk_index
    web64_rt_prepare_disk_request disk_index
    jsr _web64_disk_request
.endmacro

; web64_disk_require: 4-byte window; entry _web64_disk_require
.macro web64_rt_prepare_disk_require marker_name, marker_length, device
    lda #<marker_name
    sta _web64_disk_require__arg_marker_name
    lda #>marker_name
    sta _web64_disk_require__arg_marker_name+1
    lda #marker_length
    sta _web64_disk_require__arg_marker_length
    lda #device
    sta _web64_disk_require__arg_device
.endmacro

.macro web64_rt_call_disk_require marker_name, marker_length, device
    web64_rt_prepare_disk_require marker_name, marker_length, device
    jsr _web64_disk_require
.endmacro

; web64_disk_save: 8-byte window; entry _web64_disk_save
.macro web64_rt_prepare_disk_save name, length, device, start_address, end_address
    lda #<name
    sta _web64_disk_save__arg_name
    lda #>name
    sta _web64_disk_save__arg_name+1
    lda #length
    sta _web64_disk_save__arg_length
    lda #device
    sta _web64_disk_save__arg_device
    lda #<start_address
    sta _web64_disk_save__arg_start_address
    lda #>start_address
    sta _web64_disk_save__arg_start_address+1
    lda #<end_address
    sta _web64_disk_save__arg_end_address
    lda #>end_address
    sta _web64_disk_save__arg_end_address+1
.endmacro

.macro web64_rt_call_disk_save name, length, device, start_address, end_address
    web64_rt_prepare_disk_save name, length, device, start_address, end_address
    jsr _web64_disk_save
.endmacro

; web64_file_close: 1-byte window; entry _web64_file_close
.macro web64_rt_prepare_file_close logical_file
    lda #logical_file
    sta _web64_file_close__arg_logical_file
.endmacro

.macro web64_rt_call_file_close logical_file
    web64_rt_prepare_file_close logical_file
    jsr _web64_file_close
.endmacro

; web64_file_open: 6-byte window; entry _web64_file_open
.macro web64_rt_prepare_file_open name, length, logical_file, device, secondary
    lda #<name
    sta _web64_file_open__arg_name
    lda #>name
    sta _web64_file_open__arg_name+1
    lda #length
    sta _web64_file_open__arg_length
    lda #logical_file
    sta _web64_file_open__arg_logical_file
    lda #device
    sta _web64_file_open__arg_device
    lda #secondary
    sta _web64_file_open__arg_secondary
.endmacro

.macro web64_rt_call_file_open name, length, logical_file, device, secondary
    web64_rt_prepare_file_open name, length, logical_file, device, secondary
    jsr _web64_file_open
.endmacro

; web64_file_read: 3-byte window; entry _web64_file_read
.macro web64_rt_prepare_file_read logical_file, destination
    lda #logical_file
    sta _web64_file_read__arg_logical_file
    lda #<destination
    sta _web64_file_read__arg_destination
    lda #>destination
    sta _web64_file_read__arg_destination+1
.endmacro

.macro web64_rt_call_file_read logical_file, destination
    web64_rt_prepare_file_read logical_file, destination
    jsr _web64_file_read
.endmacro

; web64_file_write: 2-byte window; entry _web64_file_write
.macro web64_rt_prepare_file_write logical_file, value
    lda #logical_file
    sta _web64_file_write__arg_logical_file
    lda #value
    sta _web64_file_write__arg_value
.endmacro

.macro web64_rt_call_file_write logical_file, value
    web64_rt_prepare_file_write logical_file, value
    jsr _web64_file_write
.endmacro

web64/fixed.h

#ifndef WEB64_FIXED_H
#define WEB64_FIXED_H
#include <stdint.h>

/* Web64 fixed-point ABI contract v1.
   8.8 layout: high byte is integer part, low byte is fraction; signed range -128.0..+127.99609375.
   16.16 layout: high word is integer part, low word is fraction; this secondary tier exposes no-runtime constants, conversions, floor/to-int, and wrapping add/sub macros.
   16.16 multiply/divide helpers are intentionally absent until executable 6502 implementations and tests exist.
   Default add/sub helpers wrap; saturation, rounding, and checked/debug behavior use explicit public names.
   web64_fix8_mul truncates toward zero; web64_fix8_mul_round rounds nearest with half ties away from zero.
   web64_fix8_div reports compile-time zero divisors and returns 0 for dynamic zero in v1.
   web64_fix8_lerp uses amount/256; amount 255 approaches b but is not endpoint-exact.
   web64_angle8 maps 0..255 to one full turn; sin/cos return signed 8.8 from a 256-entry full-wave table.
   Trig endpoints are exact: sin(64)=0x0100 and sin(192)=0xff00; cosine is sine(angle+64).
   Negative conversions, floor, ceil, and shift-derived lowering must be emitted from this contract, not host-language shifts.
   WEB64_FIX8_FROM_INT keeps standard shift semantics; typed 8-bit inputs lower directly to fraction=0/integer=value byte placement.
   Runtime helper modules are dependency-selected by referenced helper family.
   Vector helpers accept overlapping out/a/b pointers; invalid pointers are caller error.
 */
typedef int16_t web64_fix8_8;
typedef uint16_t web64_ufix8_8;
typedef int32_t web64_fix16_16;
typedef uint32_t web64_ufix16_16;
typedef uint8_t web64_angle8;
typedef struct { web64_fix8_8 x; web64_fix8_8 y; } Web64FixVec2;
typedef struct { Web64FixVec2 position; Web64FixVec2 velocity; Web64FixVec2 acceleration; } Web64Motion2D;

#define WEB64_FIX8_ONE 0x0100
#define WEB64_FIX8_HALF 0x0080
#define WEB64_FIX8_MIN 0x8000
#define WEB64_FIX8_MAX 0x7fff
#define WEB64_FIX8_FROM_RAW(value) ((web64_fix8_8)(value))
#define WEB64_FIX8_RAW(value) ((uint16_t)(value))
#define WEB64_FIX8_FROM_INT(value) ((value) << 8)
#define WEB64_FIX8_TO_INT(value) ((value) >> 8)
#define WEB64_FIX8_FRACTION(value) ((value) & 0x00ff)
#define WEB64_FIX8_FROM_RATIO(numerator, denominator) (((numerator) << 8) / (denominator))
#define web64_fix8_from_int(value) WEB64_FIX8_FROM_INT(value)
#define web64_fix8_to_int(value) WEB64_FIX8_TO_INT(value)
#define web64_fix8_floor(value) ((value) & 0xff00)
#define web64_fix8_round(value) (((value) + 0x0080) & 0xff00)
#define web64_fix8_ceil(value) (((value) + 0x00ff) & 0xff00)
#define web64_fix8_add_wrap(a, b) ((web64_fix8_8)((a) + (b)))
#define web64_fix8_sub_wrap(a, b) ((web64_fix8_8)((a) - (b)))
#define WEB64_UFIX8_FROM_RAW(value) ((web64_ufix8_8)(value))
#define WEB64_UFIX8_RAW(value) ((uint16_t)(value))
#define WEB64_UFIX8_FROM_INT(value) ((web64_ufix8_8)((value) << 8))
#define WEB64_UFIX8_TO_INT(value) ((uint8_t)((value) >> 8))
#define WEB64_UFIX8_FRACTION(value) ((value) & 0x00ff)
#define WEB64_UFIX8_FROM_RATIO(numerator, denominator) (((uint16_t)(numerator) << 8) / (denominator))
#define web64_ufix8_from_int(value) WEB64_UFIX8_FROM_INT(value)
#define web64_ufix8_to_int(value) WEB64_UFIX8_TO_INT(value)
#define web64_ufix8_add_wrap(a, b) ((web64_ufix8_8)((a) + (b)))
#define web64_ufix8_sub_wrap(a, b) ((web64_ufix8_8)((a) - (b)))

#define WEB64_FIX16_ONE 0x00010000
#define WEB64_FIX16_HALF 0x00008000
#define WEB64_FIX16_MIN 0x80000000
#define WEB64_FIX16_MAX 0x7fffffff
#define WEB64_FIX16_FROM_INT(value) ((web64_fix16_16)(value) << 16)
#define WEB64_FIX16_TO_INT(value) ((value) >> 16)
#define WEB64_FIX16_FRACTION(value) ((value) & 0x0000ffff)
#define WEB64_FIX16_FROM_RATIO(numerator, denominator) (((web64_fix16_16)(numerator) << 16) / (denominator))
#define web64_fix16_from_int(value) WEB64_FIX16_FROM_INT(value)
#define web64_fix16_to_int(value) WEB64_FIX16_TO_INT(value)
#define web64_fix16_floor(value) ((value) & 0xffff0000)
#define web64_fix16_add_wrap(a, b) ((web64_fix16_16)((a) + (b)))
#define web64_fix16_sub_wrap(a, b) ((web64_fix16_16)((a) - (b)))

_web64_rt web64_fix8_8 web64_fix8_mul(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_mul_round(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_div(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_sin8(web64_angle8 angle);
_web64_rt web64_fix8_8 web64_cos8(web64_angle8 angle);
_web64_rt web64_ufix8_8 web64_ufix8_mul(web64_ufix8_8 a, web64_ufix8_8 b);
_web64_rt web64_ufix8_8 web64_ufix8_div(web64_ufix8_8 a, web64_ufix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_lerp(web64_fix8_8 a, web64_fix8_8 b, uint8_t amount);
_web64_rt web64_fix8_8 web64_fix8_abs(web64_fix8_8 value);
_web64_rt web64_fix8_8 web64_fix8_min(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_max(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_clamp(web64_fix8_8 value, web64_fix8_8 min_value, web64_fix8_8 max_value);
_web64_rt web64_fix8_8 web64_fix8_add_sat(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt web64_fix8_8 web64_fix8_sub_sat(web64_fix8_8 a, web64_fix8_8 b);
_web64_rt void web64_fixvec2_add(Web64FixVec2 *out, const Web64FixVec2 *a, const Web64FixVec2 *b);
_web64_rt void web64_fixvec2_sub(Web64FixVec2 *out, const Web64FixVec2 *a, const Web64FixVec2 *b);
_web64_rt void web64_fixvec2_scale(Web64FixVec2 *out, const Web64FixVec2 *value, web64_fix8_8 scale);
_web64_rt void web64_motion2d_integrate(Web64Motion2D *motion);

/* Short 8.8 helper aliases. */
#define f8_mul_round web64_fix8_mul_round
#define f8_div web64_fix8_div
#define uf8_mul web64_ufix8_mul
#define uf8_div web64_ufix8_div
#define f8_lerp web64_fix8_lerp
#define f8_abs web64_fix8_abs
#define f8_min web64_fix8_min
#define f8_max web64_fix8_max
#define f8_clamp web64_fix8_clamp
#define f8_add_sat web64_fix8_add_sat
#define f8_sub_sat web64_fix8_sub_sat
#define f8_sin web64_sin8
#define f8_cos web64_cos8
#define v2f8_add web64_fixvec2_add
#define v2f8_sub web64_fixvec2_sub
#define v2f8_scale web64_fixvec2_scale
#define m2d_int web64_motion2d_integrate
#endif

web64/fixed.inc

; Web64 _web64_rt C/assembly call helpers for <web64/fixed.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_FIXED_CALL_COUNT = 18
WEB64_RT_FIXED_WINDOW_CALL_COUNT = 18

; web64_cos8: 1-byte window; entry _web64_cos8
.macro web64_rt_prepare_cos8 angle
    lda #angle
    sta _web64_cos8__arg_angle
.endmacro

.macro web64_rt_call_cos8 angle
    web64_rt_prepare_cos8 angle
    jsr _web64_cos8
.endmacro

; web64_fix8_abs: 2-byte window; entry _web64_fix8_abs
.macro web64_rt_prepare_fix8_abs value
    lda #<value
    sta _web64_fix8_abs__arg_value
    lda #>value
    sta _web64_fix8_abs__arg_value+1
.endmacro

.macro web64_rt_call_fix8_abs value
    web64_rt_prepare_fix8_abs value
    jsr _web64_fix8_abs
.endmacro

; web64_fix8_add_sat: 4-byte window; entry _web64_fix8_add_sat
.macro web64_rt_prepare_fix8_add_sat a, b
    lda #<a
    sta _web64_fix8_add_sat__arg_a
    lda #>a
    sta _web64_fix8_add_sat__arg_a+1
    lda #<b
    sta _web64_fix8_add_sat__arg_b
    lda #>b
    sta _web64_fix8_add_sat__arg_b+1
.endmacro

.macro web64_rt_call_fix8_add_sat a, b
    web64_rt_prepare_fix8_add_sat a, b
    jsr _web64_fix8_add_sat
.endmacro

; web64_fix8_clamp: 6-byte window; entry _web64_fix8_clamp
.macro web64_rt_prepare_fix8_clamp value, min_value, max_value
    lda #<value
    sta _web64_fix8_clamp__arg_value
    lda #>value
    sta _web64_fix8_clamp__arg_value+1
    lda #<min_value
    sta _web64_fix8_clamp__arg_min_value
    lda #>min_value
    sta _web64_fix8_clamp__arg_min_value+1
    lda #<max_value
    sta _web64_fix8_clamp__arg_max_value
    lda #>max_value
    sta _web64_fix8_clamp__arg_max_value+1
.endmacro

.macro web64_rt_call_fix8_clamp value, min_value, max_value
    web64_rt_prepare_fix8_clamp value, min_value, max_value
    jsr _web64_fix8_clamp
.endmacro

; web64_fix8_div: 4-byte window; entry _web64_fix8_div
.macro web64_rt_prepare_fix8_div a, b
    lda #<a
    sta _web64_fix8_div__arg_a
    lda #>a
    sta _web64_fix8_div__arg_a+1
    lda #<b
    sta _web64_fix8_div__arg_b
    lda #>b
    sta _web64_fix8_div__arg_b+1
.endmacro

.macro web64_rt_call_fix8_div a, b
    web64_rt_prepare_fix8_div a, b
    jsr _web64_fix8_div
.endmacro

; web64_fix8_lerp: 5-byte window; entry _web64_fix8_lerp
.macro web64_rt_prepare_fix8_lerp a, b, amount
    lda #<a
    sta _web64_fix8_lerp__arg_a
    lda #>a
    sta _web64_fix8_lerp__arg_a+1
    lda #<b
    sta _web64_fix8_lerp__arg_b
    lda #>b
    sta _web64_fix8_lerp__arg_b+1
    lda #amount
    sta _web64_fix8_lerp__arg_amount
.endmacro

.macro web64_rt_call_fix8_lerp a, b, amount
    web64_rt_prepare_fix8_lerp a, b, amount
    jsr _web64_fix8_lerp
.endmacro

; web64_fix8_max: 4-byte window; entry _web64_fix8_max
.macro web64_rt_prepare_fix8_max a, b
    lda #<a
    sta _web64_fix8_max__arg_a
    lda #>a
    sta _web64_fix8_max__arg_a+1
    lda #<b
    sta _web64_fix8_max__arg_b
    lda #>b
    sta _web64_fix8_max__arg_b+1
.endmacro

.macro web64_rt_call_fix8_max a, b
    web64_rt_prepare_fix8_max a, b
    jsr _web64_fix8_max
.endmacro

; web64_fix8_min: 4-byte window; entry _web64_fix8_min
.macro web64_rt_prepare_fix8_min a, b
    lda #<a
    sta _web64_fix8_min__arg_a
    lda #>a
    sta _web64_fix8_min__arg_a+1
    lda #<b
    sta _web64_fix8_min__arg_b
    lda #>b
    sta _web64_fix8_min__arg_b+1
.endmacro

.macro web64_rt_call_fix8_min a, b
    web64_rt_prepare_fix8_min a, b
    jsr _web64_fix8_min
.endmacro

; web64_fix8_mul: 4-byte window; entry _web64_fix8_mul
.macro web64_rt_prepare_fix8_mul a, b
    lda #<a
    sta _web64_fix8_mul__arg_a
    lda #>a
    sta _web64_fix8_mul__arg_a+1
    lda #<b
    sta _web64_fix8_mul__arg_b
    lda #>b
    sta _web64_fix8_mul__arg_b+1
.endmacro

.macro web64_rt_call_fix8_mul a, b
    web64_rt_prepare_fix8_mul a, b
    jsr _web64_fix8_mul
.endmacro

; web64_fix8_mul_round: 4-byte window; entry _web64_fix8_mul_round
.macro web64_rt_prepare_fix8_mul_round a, b
    lda #<a
    sta _web64_fix8_mul_round__arg_a
    lda #>a
    sta _web64_fix8_mul_round__arg_a+1
    lda #<b
    sta _web64_fix8_mul_round__arg_b
    lda #>b
    sta _web64_fix8_mul_round__arg_b+1
.endmacro

.macro web64_rt_call_fix8_mul_round a, b
    web64_rt_prepare_fix8_mul_round a, b
    jsr _web64_fix8_mul_round
.endmacro

; web64_fix8_sub_sat: 4-byte window; entry _web64_fix8_sub_sat
.macro web64_rt_prepare_fix8_sub_sat a, b
    lda #<a
    sta _web64_fix8_sub_sat__arg_a
    lda #>a
    sta _web64_fix8_sub_sat__arg_a+1
    lda #<b
    sta _web64_fix8_sub_sat__arg_b
    lda #>b
    sta _web64_fix8_sub_sat__arg_b+1
.endmacro

.macro web64_rt_call_fix8_sub_sat a, b
    web64_rt_prepare_fix8_sub_sat a, b
    jsr _web64_fix8_sub_sat
.endmacro

; web64_fixvec2_add: 6-byte window; entry _web64_fixvec2_add
.macro web64_rt_prepare_fixvec2_add out, a, b
    lda #<out
    sta _web64_fixvec2_add__arg_out
    lda #>out
    sta _web64_fixvec2_add__arg_out+1
    lda #<a
    sta _web64_fixvec2_add__arg_a
    lda #>a
    sta _web64_fixvec2_add__arg_a+1
    lda #<b
    sta _web64_fixvec2_add__arg_b
    lda #>b
    sta _web64_fixvec2_add__arg_b+1
.endmacro

.macro web64_rt_call_fixvec2_add out, a, b
    web64_rt_prepare_fixvec2_add out, a, b
    jsr _web64_fixvec2_add
.endmacro

; web64_fixvec2_scale: 6-byte window; entry _web64_fixvec2_scale
.macro web64_rt_prepare_fixvec2_scale out, value, scale
    lda #<out
    sta _web64_fixvec2_scale__arg_out
    lda #>out
    sta _web64_fixvec2_scale__arg_out+1
    lda #<value
    sta _web64_fixvec2_scale__arg_value
    lda #>value
    sta _web64_fixvec2_scale__arg_value+1
    lda #<scale
    sta _web64_fixvec2_scale__arg_scale
    lda #>scale
    sta _web64_fixvec2_scale__arg_scale+1
.endmacro

.macro web64_rt_call_fixvec2_scale out, value, scale
    web64_rt_prepare_fixvec2_scale out, value, scale
    jsr _web64_fixvec2_scale
.endmacro

; web64_fixvec2_sub: 6-byte window; entry _web64_fixvec2_sub
.macro web64_rt_prepare_fixvec2_sub out, a, b
    lda #<out
    sta _web64_fixvec2_sub__arg_out
    lda #>out
    sta _web64_fixvec2_sub__arg_out+1
    lda #<a
    sta _web64_fixvec2_sub__arg_a
    lda #>a
    sta _web64_fixvec2_sub__arg_a+1
    lda #<b
    sta _web64_fixvec2_sub__arg_b
    lda #>b
    sta _web64_fixvec2_sub__arg_b+1
.endmacro

.macro web64_rt_call_fixvec2_sub out, a, b
    web64_rt_prepare_fixvec2_sub out, a, b
    jsr _web64_fixvec2_sub
.endmacro

; web64_motion2d_integrate: 2-byte window; entry _web64_motion2d_integrate
.macro web64_rt_prepare_motion2d_integrate motion
    lda #<motion
    sta _web64_motion2d_integrate__arg_motion
    lda #>motion
    sta _web64_motion2d_integrate__arg_motion+1
.endmacro

.macro web64_rt_call_motion2d_integrate motion
    web64_rt_prepare_motion2d_integrate motion
    jsr _web64_motion2d_integrate
.endmacro

; web64_sin8: 1-byte window; entry _web64_sin8
.macro web64_rt_prepare_sin8 angle
    lda #angle
    sta _web64_sin8__arg_angle
.endmacro

.macro web64_rt_call_sin8 angle
    web64_rt_prepare_sin8 angle
    jsr _web64_sin8
.endmacro

; web64_ufix8_div: 4-byte window; entry _web64_ufix8_div
.macro web64_rt_prepare_ufix8_div a, b
    lda #<a
    sta _web64_ufix8_div__arg_a
    lda #>a
    sta _web64_ufix8_div__arg_a+1
    lda #<b
    sta _web64_ufix8_div__arg_b
    lda #>b
    sta _web64_ufix8_div__arg_b+1
.endmacro

.macro web64_rt_call_ufix8_div a, b
    web64_rt_prepare_ufix8_div a, b
    jsr _web64_ufix8_div
.endmacro

; web64_ufix8_mul: 4-byte window; entry _web64_ufix8_mul
.macro web64_rt_prepare_ufix8_mul a, b
    lda #<a
    sta _web64_ufix8_mul__arg_a
    lda #>a
    sta _web64_ufix8_mul__arg_a+1
    lda #<b
    sta _web64_ufix8_mul__arg_b
    lda #>b
    sta _web64_ufix8_mul__arg_b+1
.endmacro

.macro web64_rt_call_ufix8_mul a, b
    web64_rt_prepare_ufix8_mul a, b
    jsr _web64_ufix8_mul
.endmacro

web64/game-compose.h

#ifndef WEB64_GAME_COMPOSE_H
#define WEB64_GAME_COMPOSE_H
#include <web64/motion.h>
#define web64_compose_motion_axis_integrate(position, velocity, intent, accel, brake, max_speed) velocity = web64_motion_axis(velocity, intent, accel, brake, max_speed); web64_motion_integrate(&(position), velocity)
#define web64_compose_actor_motion_step(x, y, vx, vy) web64_motion_integrate(&(x), vx); web64_motion_integrate(&(y), vy)
#define web64_actor_motion_step(x, y, vx, vy) (web64_motion_integrate(&(x), (vx)), web64_motion_integrate(&(y), (vy)))
#endif

web64/game.h

#ifndef WEB64_GAME_H
#define WEB64_GAME_H
#include <stdint.h>
#ifndef WEB64_SUBPIXEL_BITS
#define WEB64_SUBPIXEL_BITS 4
#endif
#if WEB64_SUBPIXEL_BITS < 1 || WEB64_SUBPIXEL_BITS > 6
#error WEB64_SUBPIXEL_BITS must be between 1 and 6
#endif
#define WEB64_SUBPIXEL_ONE ((uint16_t)(1U << WEB64_SUBPIXEL_BITS))
#define WEB64_ADDRESS(pointer) ((uint16_t)(pointer))
#define WEB64_POS_FROM_PX(value) ((web64_pos_t)((uint16_t)(value) << WEB64_SUBPIXEL_BITS))
#define WEB64_POS_TO_PX(value) ((uint16_t)(value) >> WEB64_SUBPIXEL_BITS)
#define WEB64_POS_FRACTION(value) ((uint8_t)((value) & (WEB64_SUBPIXEL_ONE - 1U)))
#define WEB64_VEL_FROM_PX(value) ((web64_vel_t)((int16_t)(value) << WEB64_SUBPIXEL_BITS))
#define WEB64_VEL_TO_PX(value) ((int16_t)(value) >> WEB64_SUBPIXEL_BITS)
typedef uint16_t web64_pos_t;
typedef int16_t web64_vel_t;
typedef struct { web64_pos_t x; web64_pos_t y; } Web64GamePoint;
typedef struct { web64_vel_t x; web64_vel_t y; } Web64GameDelta;
typedef struct { uint16_t x; uint16_t y; uint8_t width; uint8_t height; } Web64GameBox;
#endif

web64/loader-decoder-runtime.inc

; Caller-owned RAM image: define WEB64_LOADER_DECODER_ADDRESS, include once and copy before use.
web64_loader_decoder_image:

; Altered Exomizer 3.1.2 backward P39/M255 decruncher.
; Copyright (c) 2002-2020 Magnus Lind and contributors.
;
; This software is provided 'as-is', without any express or implied warranty.
; In no event will the authors be held liable for any damages arising from
; the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
; 1. The origin of this software must not be misrepresented; you must not
;    claim that you wrote the original software. An acknowledgment in product
;    documentation is appreciated but not required.
; 2. Altered source versions must be plainly marked as such and must not be
;    represented as the original software.
; 3. This notice may not be removed or altered from a source distribution.
; Neither the Exomizer name nor copyright-holder names may endorse derived
; products without prior written permission.
;
; This altered Web64 port adds bounded input/output/history, scratch-only
; decoding and error unwinding. It is not the original Exomizer source.
__w64ld_unpack__image:
__w64ld_unpack = __w64ld_unpack__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    tsx
    stx __w64ld_unpack_sp

    lda __w64ld_source_end
    sta __w64ld_exo_read+1
    lda __w64ld_source_end+1
    sta __w64ld_exo_read+2
    jsr __w64ld_exo_decrunch
    lda __w64ld_output_left
    ora __w64ld_output_left+1
    beq __w64ld_unpack_ok__image
    jmp __w64ld_unpack_bad
__w64ld_unpack_ok__image:
__w64ld_unpack_ok = __w64ld_unpack_ok__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    lda #0
    rts

__w64ld_exo_get_byte__image:
__w64ld_exo_get_byte = __w64ld_exo_get_byte__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    php
    lda __w64loader_abort_requested
    beq __w64ld_not_aborted__image
    jmp __w64ld_unpack_bad
__w64ld_not_aborted__image:
__w64ld_not_aborted = __w64ld_not_aborted__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    lda __w64ld_input_left
    bne __w64ld_input_low__image
    lda __w64ld_input_left+1
    bne __w64ld_input_high__image
    jmp __w64ld_unpack_bad
__w64ld_input_high__image:
__w64ld_input_high = __w64ld_input_high__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dec __w64ld_input_left+1
__w64ld_input_low__image:
__w64ld_input_low = __w64ld_input_low__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dec __w64ld_input_left
    lda __w64ld_exo_read+1
    bne __w64ld_exo_get_dec_low__image
    dec __w64ld_exo_read+2
__w64ld_exo_get_dec_low__image:
__w64ld_exo_get_dec_low = __w64ld_exo_get_dec_low__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dec __w64ld_exo_read+1
__w64ld_exo_read__image:
__w64ld_exo_read = __w64ld_exo_read__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    lda $ffff
    plp
    rts

__w64ld_exo_get_bits__image:
__w64ld_exo_get_bits = __w64ld_exo_get_bits__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    adc #$80
    asl
    bpl __w64ld_exo_gb_skip__image
__w64ld_exo_gb_next__image:
__w64ld_exo_gb_next = __w64ld_exo_gb_next__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    asl $66
    bne __w64ld_exo_gb_ok__image
    pha
    jsr __w64ld_exo_get_byte
    rol
    sta $66
    pla
__w64ld_exo_gb_ok__image:
__w64ld_exo_gb_ok = __w64ld_exo_gb_ok__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    rol
    bmi __w64ld_exo_gb_next__image
__w64ld_exo_gb_skip__image:
__w64ld_exo_gb_skip = __w64ld_exo_gb_skip__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    bvs __w64ld_exo_gb_get_hi__image
    rts
__w64ld_exo_gb_get_hi__image:
__w64ld_exo_gb_get_hi = __w64ld_exo_gb_get_hi__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    sec
    sta $64
    jmp __w64ld_exo_get_byte

__w64ld_exo_decrunch__image:
__w64ld_exo_decrunch = __w64ld_exo_decrunch__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    ldx #3
__w64ld_exo_init_zp__image:
__w64ld_exo_init_zp = __w64ld_exo_init_zp__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    jsr __w64ld_exo_get_byte
    sta $65,x
    dex
    bne __w64ld_exo_init_zp__image
    ; Stream trailer is checked by the container layer. Restore into scratch,
    ; never into the address named by untrusted stream bytes.
    lda __w64ld_output_end
    sta $67
    lda __w64ld_output_end+1
    sta $68
    ldy #0
    clc
__w64ld_exo_table_gen__image:
__w64ld_exo_table_gen = __w64ld_exo_table_gen__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    tax
    tya
    and #$0f
    sta __w64ld_exo_table+52,y
    beq __w64ld_exo_table_shortcut__image
    txa
    adc __w64ld_exo_table+51,y
    sta __w64ld_exo_table+52,y
    lda $61
    adc __w64ld_exo_table+103,y
__w64ld_exo_table_shortcut__image:
__w64ld_exo_table_shortcut = __w64ld_exo_table_shortcut__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    sta __w64ld_exo_table+104,y
    lda #1
    sta $61
    lda #$78
    jsr __w64ld_exo_get_bits
    lsr
    tax
    beq __w64ld_exo_rolled__image
    php
__w64ld_exo_rolle__image:
__w64ld_exo_rolle = __w64ld_exo_rolle__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    asl $61
    sec
    ror
    dex
    bne __w64ld_exo_rolle__image
    plp
__w64ld_exo_rolled__image:
__w64ld_exo_rolled = __w64ld_exo_rolled__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    ror
    sta __w64ld_exo_table,y
    bmi __w64ld_exo_no_fixup__image
    lda $61
    stx $61
    .byte $24
__w64ld_exo_no_fixup__image:
__w64ld_exo_no_fixup = __w64ld_exo_no_fixup__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    txa
    iny
    cpy #52
    bne __w64ld_exo_table_gen__image
    ror $65
    sec
    ldy $67
    stx $67
    stx $64

__w64ld_exo_literal_start__image:
__w64ld_exo_literal_start = __w64ld_exo_literal_start__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    tya
    bne __w64ld_exo_no_hi_decr__image
    dec $68
    dec $63
__w64ld_exo_no_hi_decr__image:
__w64ld_exo_no_hi_decr = __w64ld_exo_no_hi_decr__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dey
    jsr __w64ld_exo_get_byte
    jsr __w64ld_checked_store
__w64ld_exo_next_round__image:
__w64ld_exo_next_round = __w64ld_exo_next_round__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    ror $65
    dex
    lda $66
__w64ld_exo_no_literal__image:
__w64ld_exo_no_literal = __w64ld_exo_no_literal__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    asl
    bne __w64ld_exo_nofetch__image
    jsr __w64ld_exo_get_byte
    rol
__w64ld_exo_nofetch__image:
__w64ld_exo_nofetch = __w64ld_exo_nofetch__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    inx
    bcc __w64ld_exo_no_literal__image
    sta $66
    beq __w64ld_exo_literal_start__image
    cpx #$11
    bcs __w64ld_exo_exit_or_literal__image
    lda __w64ld_exo_table-1,x
    jsr __w64ld_exo_get_bits
    adc __w64ld_exo_table+51,x
    sta $60
    lda $64
    adc __w64ld_exo_table+103,x
    sta $61
    ldx $60
    lda #0
    bit $65
    bmi __w64ld_exo_test_reuse__image
__w64ld_exo_no_reuse__image:
__w64ld_exo_no_reuse = __w64ld_exo_no_reuse__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    sta $64
    lda #$e1
    cpx #3
    bcs __w64ld_exo_offset_next__image
    lda __w64ld_exo_table_bit-1,x
__w64ld_exo_offset_next__image:
__w64ld_exo_offset_next = __w64ld_exo_offset_next__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    asl $66
    bne __w64ld_exo_offset_ok__image
    tax
    jsr __w64ld_exo_get_byte
    rol
    sta $66
    txa
__w64ld_exo_offset_ok__image:
__w64ld_exo_offset_ok = __w64ld_exo_offset_ok__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    rol
    bcs __w64ld_exo_offset_next__image
    tax
    lda __w64ld_exo_table,x
    jsr __w64ld_exo_get_bits
    adc __w64ld_exo_table+52,x
    sta $62
    lda $64
    adc __w64ld_exo_table+104,x
    adc $68
    sta $63
    ldx $60

__w64ld_copy_sequence__image:
__w64ld_copy_sequence = __w64ld_copy_sequence__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    jsr __w64ld_checked_sequence
__w64ld_exo_copy_next__image:
__w64ld_exo_copy_next = __w64ld_exo_copy_next__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    tya
    bne __w64ld_exo_copy_skip_hi__image
    dec $68
    dec $63
__w64ld_exo_copy_skip_hi__image:
__w64ld_exo_copy_skip_hi = __w64ld_exo_copy_skip_hi__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dey
    bcs __w64ld_exo_get_literal__image
    lda ($62),y
__w64ld_exo_literal_gotten__image:
__w64ld_exo_literal_gotten = __w64ld_exo_literal_gotten__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    ; The complete bounded sequence was reserved before its first write.
    sta ($67),y
    dex
    bne __w64ld_exo_copy_next__image
    lda $61
    stx $64
    beq __w64ld_exo_next_round__image
    dec $61
    jmp __w64ld_exo_copy_next

__w64ld_exo_test_reuse__image:
__w64ld_exo_test_reuse = __w64ld_exo_test_reuse__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    bvs __w64ld_exo_no_reuse__image
    asl $66
    bne __w64ld_exo_reuse_ok__image
    pha
    jsr __w64ld_exo_get_byte
    rol
    sta $66
    pla
__w64ld_exo_reuse_ok__image:
__w64ld_exo_reuse_ok = __w64ld_exo_reuse_ok__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    rol
    beq __w64ld_exo_no_reuse__image
    bne __w64ld_copy_sequence__image

__w64ld_exo_exit_or_literal__image:
__w64ld_exo_exit_or_literal = __w64ld_exo_exit_or_literal__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    beq __w64ld_exo_exit__image
    jsr __w64ld_exo_get_byte
    sta $61
    jsr __w64ld_exo_get_byte
    tax
    stx $60
    jsr __w64ld_checked_literals
    bcs __w64ld_exo_copy_next__image
__w64ld_exo_exit__image:
__w64ld_exo_exit = __w64ld_exo_exit__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    rts
__w64ld_exo_get_literal__image:
__w64ld_exo_get_literal = __w64ld_exo_get_literal__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    jsr __w64ld_exo_get_byte
    bcs __w64ld_exo_literal_gotten__image

__w64ld_exo_table_bit__image:
__w64ld_exo_table_bit = __w64ld_exo_table_bit__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    .byte $8c,$e2
__w64ld_exo_table__image:
__w64ld_exo_table = __w64ld_exo_table__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    .byte 0,0,0,0
__w64ld_checked_store__image:
__w64ld_checked_store = __w64ld_checked_store__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    php
    pha
    lda __w64ld_output_left
    bne __w64ld_output_low__image
    lda __w64ld_output_left+1
    beq __w64ld_unpack_bad__image
    dec __w64ld_output_left+1
__w64ld_output_low__image:
__w64ld_output_low = __w64ld_output_low__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    dec __w64ld_output_left
    pla
    sta ($67),y
    plp
    rts
__w64ld_unpack_bad__image:
__w64ld_unpack_bad = __w64ld_unpack_bad__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS


    ldx __w64ld_unpack_sp
    txs
    lda #10
    rts
__w64ld_unpack_sp__image:
__w64ld_unpack_sp = __w64ld_unpack_sp__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

 .byte 0
__w64ld_source_end__image:
__w64ld_source_end = __w64ld_source_end__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

 .word 0
__w64ld_input_left__image:
__w64ld_input_left = __w64ld_input_left__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

 .word 0
__w64ld_output_left__image:
__w64ld_output_left = __w64ld_output_left__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

 .word 0

; Validate once per match: source and destination descend together, so a
; positive, bounded history distance stays valid for every byte in the match.
; Compare one-past addresses before the copy loop decrements Y. Preserve X/Y/P.
__w64ld_checked_sequence__image:
__w64ld_checked_sequence = __w64ld_checked_sequence__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    php
    lda $61
    bne __w64ld_match_bad__image
    lda $60
    beq __w64ld_match_bad__image
    tya
    clc
    adc $62
    sta __w64ld_match_address
    lda $63
    adc #0
    bcc __w64ld_match_no_wrap__image
    ; Exactly $10000 is a valid one-past bound, never an address to read.
    ora __w64ld_match_address
    ora __w64ld_output_end
    ora __w64ld_output_end+1
    beq __w64ld_match_ok__image
    jmp __w64ld_unpack_bad
__w64ld_match_no_wrap__image:
__w64ld_match_no_wrap = __w64ld_match_no_wrap__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    sta __w64ld_match_address+1
    cmp $68
    bcc __w64ld_match_bad__image
    bne __w64ld_match_after_cursor__image
    tya
    cmp __w64ld_match_address
    bcs __w64ld_match_bad__image
__w64ld_match_after_cursor__image:
__w64ld_match_after_cursor = __w64ld_match_after_cursor__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    lda __w64ld_output_end
    ora __w64ld_output_end+1
    beq __w64ld_match_ok__image
    lda __w64ld_match_address+1
    cmp __w64ld_output_end+1
    bcc __w64ld_match_ok__image
    bne __w64ld_match_bad__image
    lda __w64ld_match_address
    cmp __w64ld_output_end
    bcc __w64ld_match_ok__image
    beq __w64ld_match_ok__image
__w64ld_match_bad__image:
__w64ld_match_bad = __w64ld_match_bad__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    jmp __w64ld_unpack_bad
__w64ld_match_ok__image:
__w64ld_match_ok = __w64ld_match_ok__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    jmp __w64ld_reserve_sequence
__w64ld_checked_literals__image:
__w64ld_checked_literals = __w64ld_checked_literals__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    php
    ; The IDE's P39/M255 encoder bounds literal runs as well as matches.
    lda $61
    bne __w64ld_match_bad__image
    cpx #0
    beq __w64ld_match_bad__image
__w64ld_reserve_sequence__image:
__w64ld_reserve_sequence = __w64ld_reserve_sequence__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    sec
    lda __w64ld_output_left
    sbc $60
    sta __w64ld_output_left
    lda __w64ld_output_left+1
    sbc #0
    bcc __w64ld_match_bad__image
    sta __w64ld_output_left+1
    plp
    rts
__w64ld_output_end__image:
__w64ld_output_end = __w64ld_output_end__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    .word 0
__w64ld_match_address__image:
__w64ld_match_address = __w64ld_match_address__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS

    .word 0
__w64ld_end__image:
__w64ld_end = __w64ld_end__image - web64_loader_decoder_image + WEB64_LOADER_DECODER_ADDRESS



web64_loader_decoder_image_end:
web64_loader_decoder_image_size = web64_loader_decoder_image_end - web64_loader_decoder_image

web64/loader-packed-runtime.inc

; Caller-owned RAM image: define WEB64_LOADER_PACKED_ADDRESS, include once and copy before use.
web64_loader_packed_image:

; Synchronous W64X checked installation. Caller owns bank configuration and IRQ.
; Fixed scratch: $fb-$fe and the decoder's separately registered $60-$68.
__w64lp_begin__image:
__w64lp_begin = __w64lp_begin__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

; _web64_rt exact-width named argument window for web64_loader_unpack
_web64_loader_unpack__arg_window__image:
_web64_loader_unpack__arg_window = _web64_loader_unpack__arg_window__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

_web64_loader_unpack__arg_window_size = 2
_web64_loader_unpack__arg0 = _web64_loader_unpack__arg_request
_web64_loader_unpack__arg_request__width = 2
_web64_loader_unpack__arg_request__offset = 0
_web64_loader_unpack__arg_request__image:
_web64_loader_unpack__arg_request = _web64_loader_unpack__arg_request__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__web64_fn_web64_loader_unpack_param_request_0__image:
__web64_fn_web64_loader_unpack_param_request_0 = __web64_fn_web64_loader_unpack_param_request_0__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    .word 0
_web64_loader_unpack__image:
_web64_loader_unpack = _web64_loader_unpack__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    cld
    lda __w64loader_phase
    beq __w64lp_idle__image
    lda #15
    rts
__w64lp_idle__image:
__w64lp_idle = __w64lp_idle__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #1
    sta __w64loader_phase
    lda #0
    sta __w64loader_abort_requested
    sta __w64loader_nested
__w64lp_from_load__image:
__w64lp_from_load = __w64lp_from_load__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda _web64_loader_unpack__arg_request
sta $fb
lda _web64_loader_unpack__arg_request+1
sta $fb+1
    ldy #12
__w64lp_read_request__image:
__w64lp_read_request = __w64lp_read_request__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
    sta __w64lp_request,y
    dey
    bpl __w64lp_read_request__image

        lda __w64lp_length
        ora __w64lp_length+1
    bne __w64loader_placed_packed_macro_1_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_1_ok__image:
__w64loader_placed_packed_macro_1_ok = __w64loader_placed_packed_macro_1_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda __w64lp_stage+1
        cmp #2
    bcs __w64loader_placed_packed_macro_2_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_2_ok__image:
__w64loader_placed_packed_macro_2_ok = __w64loader_placed_packed_macro_2_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        sec
lda __w64lp_length
sbc __w64lp_one
sta __w64lp_stage_end
lda __w64lp_length+1
sbc __w64lp_one+1
sta __w64lp_stage_end+1
        clc
lda __w64lp_stage
adc __w64lp_stage_end
sta __w64lp_stage_end
lda __w64lp_stage+1
adc __w64lp_stage_end+1
sta __w64lp_stage_end+1
    bcc __w64loader_placed_packed_macro_3_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_3_ok__image:
__w64loader_placed_packed_macro_3_ok = __w64loader_placed_packed_macro_3_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS


        lda __w64lp_capacity
        ora __w64lp_capacity+1
    bne __w64loader_placed_packed_macro_4_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_4_ok__image:
__w64loader_placed_packed_macro_4_ok = __w64loader_placed_packed_macro_4_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda __w64lp_destination+1
        cmp #2
    bcs __w64loader_placed_packed_macro_5_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_5_ok__image:
__w64loader_placed_packed_macro_5_ok = __w64loader_placed_packed_macro_5_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        sec
lda __w64lp_capacity
sbc __w64lp_one
sta __w64lp_destination_end
lda __w64lp_capacity+1
sbc __w64lp_one+1
sta __w64lp_destination_end+1
        clc
lda __w64lp_destination
adc __w64lp_destination_end
sta __w64lp_destination_end
lda __w64lp_destination+1
adc __w64lp_destination_end+1
sta __w64lp_destination_end+1
    bcc __w64loader_placed_packed_macro_6_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_6_ok__image:
__w64loader_placed_packed_macro_6_ok = __w64loader_placed_packed_macro_6_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS


        lda __w64lp_workspace_capacity
        ora __w64lp_workspace_capacity+1
    bne __w64loader_placed_packed_macro_7_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_7_ok__image:
__w64loader_placed_packed_macro_7_ok = __w64loader_placed_packed_macro_7_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda __w64lp_workspace+1
        cmp #2
    bcs __w64loader_placed_packed_macro_8_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_8_ok__image:
__w64loader_placed_packed_macro_8_ok = __w64loader_placed_packed_macro_8_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        sec
lda __w64lp_workspace_capacity
sbc __w64lp_one
sta __w64lp_workspace_end
lda __w64lp_workspace_capacity+1
sbc __w64lp_one+1
sta __w64lp_workspace_end+1
        clc
lda __w64lp_workspace
adc __w64lp_workspace_end
sta __w64lp_workspace_end
lda __w64lp_workspace+1
adc __w64lp_workspace_end+1
sta __w64lp_workspace_end+1
    bcc __w64loader_placed_packed_macro_9_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_9_ok__image:
__w64loader_placed_packed_macro_9_ok = __w64loader_placed_packed_macro_9_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_stage_end+1
    cmp __w64lp_destination+1
    bne __w64loader_placed_packed_macro_11_done__image
    lda __w64lp_stage_end
    cmp __w64lp_destination
__w64loader_placed_packed_macro_11_done__image:
__w64loader_placed_packed_macro_11_done = __w64loader_placed_packed_macro_11_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_10_ok__image
    lda __w64lp_destination_end+1
    cmp __w64lp_stage+1
    bne __w64loader_placed_packed_macro_12_done__image
    lda __w64lp_destination_end
    cmp __w64lp_stage
__w64loader_placed_packed_macro_12_done__image:
__w64loader_placed_packed_macro_12_done = __w64loader_placed_packed_macro_12_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_10_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_10_ok__image:
__w64loader_placed_packed_macro_10_ok = __w64loader_placed_packed_macro_10_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_stage_end+1
    cmp __w64lp_workspace+1
    bne __w64loader_placed_packed_macro_14_done__image
    lda __w64lp_stage_end
    cmp __w64lp_workspace
__w64loader_placed_packed_macro_14_done__image:
__w64loader_placed_packed_macro_14_done = __w64loader_placed_packed_macro_14_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_13_ok__image
    lda __w64lp_workspace_end+1
    cmp __w64lp_stage+1
    bne __w64loader_placed_packed_macro_15_done__image
    lda __w64lp_workspace_end
    cmp __w64lp_stage
__w64loader_placed_packed_macro_15_done__image:
__w64loader_placed_packed_macro_15_done = __w64loader_placed_packed_macro_15_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_13_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_13_ok__image:
__w64loader_placed_packed_macro_13_ok = __w64loader_placed_packed_macro_13_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_workspace_end+1
    cmp __w64lp_destination+1
    bne __w64loader_placed_packed_macro_17_done__image
    lda __w64lp_workspace_end
    cmp __w64lp_destination
__w64loader_placed_packed_macro_17_done__image:
__w64loader_placed_packed_macro_17_done = __w64loader_placed_packed_macro_17_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_16_ok__image
    lda __w64lp_destination_end+1
    cmp __w64lp_workspace+1
    bne __w64loader_placed_packed_macro_18_done__image
    lda __w64lp_destination_end
    cmp __w64lp_workspace
__w64loader_placed_packed_macro_18_done__image:
__w64loader_placed_packed_macro_18_done = __w64loader_placed_packed_macro_18_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_16_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_16_ok__image:
__w64loader_placed_packed_macro_16_ok = __w64loader_placed_packed_macro_16_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_stage_end+1
    cmp __w64lp_code_start+1
    bne __w64loader_placed_packed_macro_20_done__image
    lda __w64lp_stage_end
    cmp __w64lp_code_start
__w64loader_placed_packed_macro_20_done__image:
__w64loader_placed_packed_macro_20_done = __w64loader_placed_packed_macro_20_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_19_ok__image
    lda __w64lp_code_last+1
    cmp __w64lp_stage+1
    bne __w64loader_placed_packed_macro_21_done__image
    lda __w64lp_code_last
    cmp __w64lp_stage
__w64loader_placed_packed_macro_21_done__image:
__w64loader_placed_packed_macro_21_done = __w64loader_placed_packed_macro_21_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_19_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_19_ok__image:
__w64loader_placed_packed_macro_19_ok = __w64loader_placed_packed_macro_19_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_destination_end+1
    cmp __w64lp_code_start+1
    bne __w64loader_placed_packed_macro_23_done__image
    lda __w64lp_destination_end
    cmp __w64lp_code_start
__w64loader_placed_packed_macro_23_done__image:
__w64loader_placed_packed_macro_23_done = __w64loader_placed_packed_macro_23_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_22_ok__image
    lda __w64lp_code_last+1
    cmp __w64lp_destination+1
    bne __w64loader_placed_packed_macro_24_done__image
    lda __w64lp_code_last
    cmp __w64lp_destination
__w64loader_placed_packed_macro_24_done__image:
__w64loader_placed_packed_macro_24_done = __w64loader_placed_packed_macro_24_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_22_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_22_ok__image:
__w64loader_placed_packed_macro_22_ok = __w64loader_placed_packed_macro_22_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_workspace_end+1
    cmp __w64lp_code_start+1
    bne __w64loader_placed_packed_macro_26_done__image
    lda __w64lp_workspace_end
    cmp __w64lp_code_start
__w64loader_placed_packed_macro_26_done__image:
__w64loader_placed_packed_macro_26_done = __w64loader_placed_packed_macro_26_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_25_ok__image
    lda __w64lp_code_last+1
    cmp __w64lp_workspace+1
    bne __w64loader_placed_packed_macro_27_done__image
    lda __w64lp_code_last
    cmp __w64lp_workspace
__w64loader_placed_packed_macro_27_done__image:
__w64loader_placed_packed_macro_27_done = __w64loader_placed_packed_macro_27_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_25_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_25_ok__image:
__w64loader_placed_packed_macro_25_ok = __w64loader_placed_packed_macro_25_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_stage_end+1
    cmp __w64lp_decoder_start+1
    bne __w64loader_placed_packed_macro_29_done__image
    lda __w64lp_stage_end
    cmp __w64lp_decoder_start
__w64loader_placed_packed_macro_29_done__image:
__w64loader_placed_packed_macro_29_done = __w64loader_placed_packed_macro_29_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_28_ok__image
    lda __w64lp_decoder_last+1
    cmp __w64lp_stage+1
    bne __w64loader_placed_packed_macro_30_done__image
    lda __w64lp_decoder_last
    cmp __w64lp_stage
__w64loader_placed_packed_macro_30_done__image:
__w64loader_placed_packed_macro_30_done = __w64loader_placed_packed_macro_30_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_28_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_28_ok__image:
__w64loader_placed_packed_macro_28_ok = __w64loader_placed_packed_macro_28_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_destination_end+1
    cmp __w64lp_decoder_start+1
    bne __w64loader_placed_packed_macro_32_done__image
    lda __w64lp_destination_end
    cmp __w64lp_decoder_start
__w64loader_placed_packed_macro_32_done__image:
__w64loader_placed_packed_macro_32_done = __w64loader_placed_packed_macro_32_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_31_ok__image
    lda __w64lp_decoder_last+1
    cmp __w64lp_destination+1
    bne __w64loader_placed_packed_macro_33_done__image
    lda __w64lp_decoder_last
    cmp __w64lp_destination
__w64loader_placed_packed_macro_33_done__image:
__w64loader_placed_packed_macro_33_done = __w64loader_placed_packed_macro_33_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_31_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_31_ok__image:
__w64loader_placed_packed_macro_31_ok = __w64loader_placed_packed_macro_31_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_workspace_end+1
    cmp __w64lp_decoder_start+1
    bne __w64loader_placed_packed_macro_35_done__image
    lda __w64lp_workspace_end
    cmp __w64lp_decoder_start
__w64loader_placed_packed_macro_35_done__image:
__w64loader_placed_packed_macro_35_done = __w64loader_placed_packed_macro_35_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_34_ok__image
    lda __w64lp_decoder_last+1
    cmp __w64lp_workspace+1
    bne __w64loader_placed_packed_macro_36_done__image
    lda __w64lp_decoder_last
    cmp __w64lp_workspace
__w64loader_placed_packed_macro_36_done__image:
__w64loader_placed_packed_macro_36_done = __w64loader_placed_packed_macro_36_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_34_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_34_ok__image:
__w64loader_placed_packed_macro_34_ok = __w64loader_placed_packed_macro_34_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_length+1
    bne __w64lp_header_size_ok__image
    lda __w64lp_length
    cmp #23
    bcs __w64loader_placed_packed_macro_37_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_37_ok__image:
__w64loader_placed_packed_macro_37_ok = __w64loader_placed_packed_macro_37_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_header_size_ok__image:
__w64lp_header_size_ok = __w64lp_header_size_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_stage
sta $fb
lda __w64lp_stage+1
sta $fb+1
    ldy #4
__w64lp_magic_loop__image:
__w64lp_magic_loop = __w64lp_magic_loop__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
    cmp __w64lp_magic,y
    beq __w64loader_placed_packed_macro_38_ok__image
    lda #4
    jmp __w64lp_exit
__w64loader_placed_packed_macro_38_ok__image:
__w64loader_placed_packed_macro_38_ok = __w64loader_placed_packed_macro_38_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    dey
    bpl __w64lp_magic_loop__image
    ldy #5
    lda ($fb),y
    sta __w64lp_count
    bne __w64loader_placed_packed_macro_39_ok__image
    lda #4
    jmp __w64lp_exit
__w64loader_placed_packed_macro_39_ok__image:
__w64loader_placed_packed_macro_39_ok = __w64loader_placed_packed_macro_39_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    cmp #65
    bcc __w64loader_placed_packed_macro_40_ok__image
    lda #4
    jmp __w64lp_exit
__w64loader_placed_packed_macro_40_ok__image:
__w64loader_placed_packed_macro_40_ok = __w64loader_placed_packed_macro_40_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_block
    cmp #255
    beq __w64lp_selection_ok__image
    cmp __w64lp_count
    bcc __w64loader_placed_packed_macro_41_ok__image
    lda #13
    jmp __w64lp_exit
__w64loader_placed_packed_macro_41_ok__image:
__w64loader_placed_packed_macro_41_ok = __w64loader_placed_packed_macro_41_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_selection_ok__image:
__w64lp_selection_ok = __w64lp_selection_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    ldy #6
    lda ($fb),y
    cmp __w64lp_length
    beq __w64loader_placed_packed_macro_42_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_42_ok__image:
__w64loader_placed_packed_macro_42_ok = __w64loader_placed_packed_macro_42_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    iny
    lda ($fb),y
    cmp __w64lp_length+1
    beq __w64loader_placed_packed_macro_43_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_43_ok__image:
__w64loader_placed_packed_macro_43_ok = __w64loader_placed_packed_macro_43_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    sec
lda __w64lp_length
sbc __w64lp_two
sta __w64lp_crc_length
lda __w64lp_length+1
sbc __w64lp_two+1
sta __w64lp_crc_length+1
    lda __w64lp_crc_length
sta __w64lp_payload_end
lda __w64lp_crc_length+1
sta __w64lp_payload_end+1
    jsr __w64lp_crc
    ldy #0
    lda ($fb),y
    cmp __w64lp_crc_value
    beq __w64loader_placed_packed_macro_44_ok__image
    lda #5
    jmp __w64lp_exit
__w64loader_placed_packed_macro_44_ok__image:
__w64loader_placed_packed_macro_44_ok = __w64loader_placed_packed_macro_44_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    iny
    lda ($fb),y
    cmp __w64lp_crc_value+1
    beq __w64loader_placed_packed_macro_45_ok__image
    lda #5
    jmp __w64lp_exit
__w64loader_placed_packed_macro_45_ok__image:
__w64loader_placed_packed_macro_45_ok = __w64loader_placed_packed_macro_45_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #<(8)
sta __w64lp_next_offset
lda #>(8)
sta __w64lp_next_offset+1
    ldx __w64lp_count
__w64lp_directory_size__image:
__w64lp_directory_size = __w64lp_directory_size__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda __w64lp_next_offset
adc __w64lp_record_size
sta __w64lp_next_offset
lda __w64lp_next_offset+1
adc __w64lp_record_size+1
sta __w64lp_next_offset+1
    dex
    bne __w64lp_directory_size__image
    lda __w64lp_next_offset+1
    cmp __w64lp_payload_end+1
    bne __w64loader_placed_packed_macro_46_done__image
    lda __w64lp_next_offset
    cmp __w64lp_payload_end
__w64loader_placed_packed_macro_46_done__image:
__w64loader_placed_packed_macro_46_done = __w64loader_placed_packed_macro_46_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcc __w64loader_placed_packed_macro_47_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_47_ok__image:
__w64loader_placed_packed_macro_47_ok = __w64loader_placed_packed_macro_47_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #<(0)
sta __w64lp_used
lda #>(0)
sta __w64lp_used+1
    lda #0
    sta __w64lp_index
__w64lp_validate_record__image:
__w64lp_validate_record = __w64lp_validate_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    jsr __w64lp_record
    lda __w64lp_decoded_length
    ora __w64lp_decoded_length+1
    bne __w64loader_placed_packed_macro_48_ok__image
    lda #7
    jmp __w64lp_exit
__w64loader_placed_packed_macro_48_ok__image:
__w64loader_placed_packed_macro_48_ok = __w64loader_placed_packed_macro_48_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    sec
lda __w64lp_decoded_length
sbc __w64lp_one
sta __w64lp_decoded_end
lda __w64lp_decoded_length+1
sbc __w64lp_one+1
sta __w64lp_decoded_end+1
    clc
lda __w64lp_decoded_end
adc __w64lp_record_destination
sta __w64lp_decoded_end
lda __w64lp_decoded_end+1
adc __w64lp_record_destination+1
sta __w64lp_decoded_end+1
    bcc __w64loader_placed_packed_macro_49_ok__image
    lda #7
    jmp __w64lp_exit
__w64loader_placed_packed_macro_49_ok__image:
__w64loader_placed_packed_macro_49_ok = __w64loader_placed_packed_macro_49_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_record_offset+1
    cmp __w64lp_next_offset+1
    bne __w64loader_placed_packed_macro_50_done__image
    lda __w64lp_record_offset
    cmp __w64lp_next_offset
__w64loader_placed_packed_macro_50_done__image:
__w64loader_placed_packed_macro_50_done = __w64loader_placed_packed_macro_50_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    beq __w64loader_placed_packed_macro_51_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_51_ok__image:
__w64loader_placed_packed_macro_51_ok = __w64loader_placed_packed_macro_51_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_packed_length+1
    bne __w64lp_stream_min_ok__image
    lda __w64lp_packed_length
    cmp #3
    bcs __w64loader_placed_packed_macro_52_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_52_ok__image:
__w64loader_placed_packed_macro_52_ok = __w64loader_placed_packed_macro_52_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_stream_min_ok__image:
__w64lp_stream_min_ok = __w64lp_stream_min_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda __w64lp_next_offset
adc __w64lp_packed_length
sta __w64lp_next_offset
lda __w64lp_next_offset+1
adc __w64lp_packed_length+1
sta __w64lp_next_offset+1
    bcc __w64loader_placed_packed_macro_53_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_53_ok__image:
__w64loader_placed_packed_macro_53_ok = __w64loader_placed_packed_macro_53_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_payload_end+1
    cmp __w64lp_next_offset+1
    bne __w64loader_placed_packed_macro_54_done__image
    lda __w64lp_payload_end
    cmp __w64lp_next_offset
__w64loader_placed_packed_macro_54_done__image:
__w64loader_placed_packed_macro_54_done = __w64loader_placed_packed_macro_54_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcs __w64loader_placed_packed_macro_55_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_55_ok__image:
__w64loader_placed_packed_macro_55_ok = __w64loader_placed_packed_macro_55_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    sec
lda __w64lp_next_offset
sbc __w64lp_two
sta $fb
lda __w64lp_next_offset+1
sbc __w64lp_two+1
sta $fb+1
    clc
lda $fb
adc __w64lp_stage
sta $fb
lda $fb+1
adc __w64lp_stage+1
sta $fb+1
    clc
lda __w64lp_decoded_end
adc __w64lp_one
sta __w64lp_decoded_after
lda __w64lp_decoded_end+1
adc __w64lp_one+1
sta __w64lp_decoded_after+1
    ldy #0
    lda ($fb),y
    cmp __w64lp_decoded_after
    beq __w64loader_placed_packed_macro_56_ok__image
    lda #4
    jmp __w64lp_exit
__w64loader_placed_packed_macro_56_ok__image:
__w64loader_placed_packed_macro_56_ok = __w64loader_placed_packed_macro_56_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    iny
    lda ($fb),y
    cmp __w64lp_decoded_after+1
    beq __w64loader_placed_packed_macro_57_ok__image
    lda #4
    jmp __w64lp_exit
__w64loader_placed_packed_macro_57_ok__image:
__w64loader_placed_packed_macro_57_ok = __w64loader_placed_packed_macro_57_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    jsr __w64lp_selected
    bne __w64lp_validated_record__image
    lda __w64lp_record_destination+1
    cmp __w64lp_destination+1
    bne __w64loader_placed_packed_macro_58_done__image
    lda __w64lp_record_destination
    cmp __w64lp_destination
__w64loader_placed_packed_macro_58_done__image:
__w64loader_placed_packed_macro_58_done = __w64loader_placed_packed_macro_58_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcs __w64loader_placed_packed_macro_59_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_59_ok__image:
__w64loader_placed_packed_macro_59_ok = __w64loader_placed_packed_macro_59_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_destination_end+1
    cmp __w64lp_decoded_end+1
    bne __w64loader_placed_packed_macro_60_done__image
    lda __w64lp_destination_end
    cmp __w64lp_decoded_end
__w64loader_placed_packed_macro_60_done__image:
__w64loader_placed_packed_macro_60_done = __w64loader_placed_packed_macro_60_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcs __w64loader_placed_packed_macro_61_ok__image
    lda #8
    jmp __w64lp_exit
__w64loader_placed_packed_macro_61_ok__image:
__w64loader_placed_packed_macro_61_ok = __w64loader_placed_packed_macro_61_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda __w64lp_used
adc __w64lp_decoded_length
sta __w64lp_used
lda __w64lp_used+1
adc __w64lp_decoded_length+1
sta __w64lp_used+1
    bcc __w64loader_placed_packed_macro_62_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_62_ok__image:
__w64loader_placed_packed_macro_62_ok = __w64loader_placed_packed_macro_62_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_workspace_capacity+1
    cmp __w64lp_used+1
    bne __w64loader_placed_packed_macro_63_done__image
    lda __w64lp_workspace_capacity
    cmp __w64lp_used
__w64loader_placed_packed_macro_63_done__image:
__w64loader_placed_packed_macro_63_done = __w64loader_placed_packed_macro_63_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    bcs __w64loader_placed_packed_macro_64_ok__image
    lda #9
    jmp __w64lp_exit
__w64loader_placed_packed_macro_64_ok__image:
__w64loader_placed_packed_macro_64_ok = __w64loader_placed_packed_macro_64_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_validated_record__image:
__w64lp_validated_record = __w64lp_validated_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    inc __w64lp_index
        lda __w64lp_index
        cmp __w64lp_count
    beq __w64lp_records_valid__image
    jmp __w64lp_validate_record
__w64lp_records_valid__image:
__w64lp_records_valid = __w64lp_records_valid__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_next_offset+1
    cmp __w64lp_payload_end+1
    bne __w64loader_placed_packed_macro_65_done__image
    lda __w64lp_next_offset
    cmp __w64lp_payload_end
__w64loader_placed_packed_macro_65_done__image:
__w64loader_placed_packed_macro_65_done = __w64loader_placed_packed_macro_65_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    beq __w64loader_placed_packed_macro_66_ok__image
    lda #6
    jmp __w64lp_exit
__w64loader_placed_packed_macro_66_ok__image:
__w64loader_placed_packed_macro_66_ok = __w64loader_placed_packed_macro_66_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_workspace
sta __w64lp_work_cursor
lda __w64lp_workspace+1
sta __w64lp_work_cursor+1
    lda #0
    sta __w64lp_index
__w64lp_decode_record__image:
__w64lp_decode_record = __w64lp_decode_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    jsr __w64lp_selected
    beq __w64lp_decode_selected__image
    jmp __w64lp_decoded_record
__w64lp_decode_selected__image:
__w64lp_decode_selected = __w64lp_decode_selected__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    jsr __w64lp_record
    clc
lda __w64lp_record_offset
adc __w64lp_packed_length
sta __w64ld_source_end
lda __w64lp_record_offset+1
adc __w64lp_packed_length+1
sta __w64ld_source_end+1
    clc
lda __w64ld_source_end
adc __w64lp_stage
sta __w64ld_source_end
lda __w64ld_source_end+1
adc __w64lp_stage+1
sta __w64ld_source_end+1
    lda __w64lp_packed_length
sta __w64ld_input_left
lda __w64lp_packed_length+1
sta __w64ld_input_left+1
    lda __w64lp_decoded_length
sta __w64ld_output_left
lda __w64lp_decoded_length+1
sta __w64ld_output_left+1
    clc
lda __w64lp_work_cursor
adc __w64lp_decoded_length
sta __w64ld_output_end
lda __w64lp_work_cursor+1
adc __w64lp_decoded_length+1
sta __w64ld_output_end+1
    jsr __w64ld_unpack
    beq __w64loader_placed_packed_macro_67_ok__image
    lda #10
    jmp __w64lp_exit
__w64loader_placed_packed_macro_67_ok__image:
__w64loader_placed_packed_macro_67_ok = __w64loader_placed_packed_macro_67_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64ld_input_left
    ora __w64ld_input_left+1
    beq __w64loader_placed_packed_macro_68_ok__image
    lda #10
    jmp __w64lp_exit
__w64loader_placed_packed_macro_68_ok__image:
__w64loader_placed_packed_macro_68_ok = __w64loader_placed_packed_macro_68_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_work_cursor
sta $fb
lda __w64lp_work_cursor+1
sta $fb+1
    lda __w64lp_decoded_length
sta __w64lp_crc_length
lda __w64lp_decoded_length+1
sta __w64lp_crc_length+1
    jsr __w64lp_crc
    lda __w64lp_crc_value+1
    cmp __w64lp_decoded_crc+1
    bne __w64loader_placed_packed_macro_69_done__image
    lda __w64lp_crc_value
    cmp __w64lp_decoded_crc
__w64loader_placed_packed_macro_69_done__image:
__w64loader_placed_packed_macro_69_done = __w64loader_placed_packed_macro_69_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    beq __w64loader_placed_packed_macro_70_ok__image
    lda #5
    jmp __w64lp_exit
__w64loader_placed_packed_macro_70_ok__image:
__w64loader_placed_packed_macro_70_ok = __w64loader_placed_packed_macro_70_ok__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda $fb
sta __w64lp_work_cursor
lda $fb+1
sta __w64lp_work_cursor+1
__w64lp_decoded_record__image:
__w64lp_decoded_record = __w64lp_decoded_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    inc __w64lp_index
        lda __w64lp_index
        cmp __w64lp_count
    beq __w64lp_decode_complete__image
    jmp __w64lp_decode_record
__w64lp_decode_complete__image:
__w64lp_decode_complete = __w64lp_decode_complete__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    ; Transaction boundary: all requested decoded CRCs are now verified.
    ; No fallible validation/decompression remains after the first live write.
    ; Atomically close the abort window without changing the caller's I flag.
    php
    sei
    lda __w64loader_abort_requested
    beq __w64lp_commit_allowed__image
    plp
    lda #11
    jmp __w64lp_exit
__w64lp_commit_allowed__image:
__w64lp_commit_allowed = __w64lp_commit_allowed__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #2
    sta __w64loader_phase
    plp
    lda __w64lp_workspace
sta __w64lp_work_cursor
lda __w64lp_workspace+1
sta __w64lp_work_cursor+1
    lda #0
    sta __w64lp_index
__w64lp_commit_record__image:
__w64lp_commit_record = __w64lp_commit_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    jsr __w64lp_selected
    bne __w64lp_committed_record__image
    jsr __w64lp_record
    lda __w64lp_work_cursor
sta $fb
lda __w64lp_work_cursor+1
sta $fb+1
    lda __w64lp_record_destination
sta $fd
lda __w64lp_record_destination+1
sta $fd+1
    ldy #0
    ldx __w64lp_decoded_length+1
    beq __w64lp_copy_tail__image
__w64lp_copy_page__image:
__w64lp_copy_page = __w64lp_copy_page__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
    sta ($fd),y
    iny
    bne __w64lp_copy_page__image
    inc $fc
    inc $fe
    dex
    bne __w64lp_copy_page__image
__w64lp_copy_tail__image:
__w64lp_copy_tail = __w64lp_copy_tail__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    ldx __w64lp_decoded_length
    beq __w64lp_copy_done__image
__w64lp_copy_byte__image:
__w64lp_copy_byte = __w64lp_copy_byte__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
    sta ($fd),y
    iny
    dex
    bne __w64lp_copy_byte__image
__w64lp_copy_done__image:
__w64lp_copy_done = __w64lp_copy_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda __w64lp_work_cursor
adc __w64lp_decoded_length
sta __w64lp_work_cursor
lda __w64lp_work_cursor+1
adc __w64lp_decoded_length+1
sta __w64lp_work_cursor+1
__w64lp_committed_record__image:
__w64lp_committed_record = __w64lp_committed_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    inc __w64lp_index
        lda __w64lp_index
        cmp __w64lp_count
    bne __w64lp_commit_record__image
    lda #0
__w64lp_exit__image:
__w64lp_exit = __w64lp_exit__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    sta __w64loader_status
    cmp #0
    beq __w64lp_exit_status__image
    lda __w64loader_abort_requested
    beq __w64lp_exit_status__image
    lda #11
    sta __w64loader_status
__w64lp_exit_status__image:
__w64lp_exit_status = __w64lp_exit_status__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #0
    sta __w64loader_phase
    lda __w64loader_status
    rts

; Z set for ALL or the requested block; otherwise Z clear.
__w64lp_selected__image:
__w64lp_selected = __w64lp_selected__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_block
    cmp #255
    beq __w64lp_selected_return__image
    cmp __w64lp_index
__w64lp_selected_return__image:
__w64lp_selected_return = __w64lp_selected_return__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    rts
__w64lp_record__image:
__w64lp_record = __w64lp_record__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda __w64lp_stage
adc __w64lp_header_size
sta $fb
lda __w64lp_stage+1
adc __w64lp_header_size+1
sta $fb+1
    ldx __w64lp_index
    beq __w64lp_record_read__image
__w64lp_record_seek__image:
__w64lp_record_seek = __w64lp_record_seek__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    clc
lda $fb
adc __w64lp_record_size
sta $fb
lda $fb+1
adc __w64lp_record_size+1
sta $fb+1
    dex
    bne __w64lp_record_seek__image
__w64lp_record_read__image:
__w64lp_record_read = __w64lp_record_read__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    ldy #9
__w64lp_record_read_loop__image:
__w64lp_record_read_loop = __w64lp_record_read_loop__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
    sta __w64lp_record_data,y
    dey
    bpl __w64lp_record_read_loop__image
    rts
__w64lp_crc__image:
__w64lp_crc = __w64lp_crc__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda #0
    sta __w64lp_crc_hi_page+1
    sta __w64lp_crc_lo_page+1
    ldy #0
    lda __w64lp_crc_length+1
    beq __w64lp_crc_tail_setup__image
__w64lp_crc_page__image:
__w64lp_crc_page = __w64lp_crc_page__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    ; Four-byte page kernel: CRC state travels through immediate operands.
    ; Each page is exactly 256 bytes; the bounded tail remains bytewise.
    lda ($fb),y
__w64lp_crc_hi_page__image:
__w64lp_crc_hi_page = __w64lp_crc_hi_page__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        eor #0
        tax
__w64lp_crc_lo_page__image:
__w64lp_crc_lo_page = __w64lp_crc_lo_page__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda #0
        eor __w64lp_crc_high,x
        sta __w64lp_crc_hi_p1+1
        lda __w64lp_crc_low,x
        sta __w64lp_crc_lo_p1+1
    iny
    lda ($fb),y
__w64lp_crc_hi_p1__image:
__w64lp_crc_hi_p1 = __w64lp_crc_hi_p1__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        eor #0
        tax
__w64lp_crc_lo_p1__image:
__w64lp_crc_lo_p1 = __w64lp_crc_lo_p1__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda #0
        eor __w64lp_crc_high,x
        sta __w64lp_crc_hi_p2+1
        lda __w64lp_crc_low,x
        sta __w64lp_crc_lo_p2+1
    iny
    lda ($fb),y
__w64lp_crc_hi_p2__image:
__w64lp_crc_hi_p2 = __w64lp_crc_hi_p2__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        eor #0
        tax
__w64lp_crc_lo_p2__image:
__w64lp_crc_lo_p2 = __w64lp_crc_lo_p2__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda #0
        eor __w64lp_crc_high,x
        sta __w64lp_crc_hi_p3+1
        lda __w64lp_crc_low,x
        sta __w64lp_crc_lo_p3+1
    iny
    lda ($fb),y
__w64lp_crc_hi_p3__image:
__w64lp_crc_hi_p3 = __w64lp_crc_hi_p3__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        eor #0
        tax
__w64lp_crc_lo_p3__image:
__w64lp_crc_lo_p3 = __w64lp_crc_lo_p3__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda #0
        eor __w64lp_crc_high,x
        sta __w64lp_crc_hi_page+1
        lda __w64lp_crc_low,x
        sta __w64lp_crc_lo_page+1
    iny
    bne __w64lp_crc_page__image
    inc $fc
    dec __w64lp_crc_length+1
    bne __w64lp_crc_page__image
__w64lp_crc_tail_setup__image:
__w64lp_crc_tail_setup = __w64lp_crc_tail_setup__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_crc_hi_page+1
    sta __w64lp_crc_hi_tail+1
    lda __w64lp_crc_lo_page+1
    sta __w64lp_crc_lo_tail+1
    cpy __w64lp_crc_length
    beq __w64lp_crc_done__image
__w64lp_crc_byte__image:
__w64lp_crc_byte = __w64lp_crc_byte__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda ($fb),y
__w64lp_crc_hi_tail__image:
__w64lp_crc_hi_tail = __w64lp_crc_hi_tail__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        eor #0
        tax
__w64lp_crc_lo_tail__image:
__w64lp_crc_lo_tail = __w64lp_crc_lo_tail__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

        lda #0
        eor __w64lp_crc_high,x
        sta __w64lp_crc_hi_tail+1
        lda __w64lp_crc_low,x
        sta __w64lp_crc_lo_tail+1
    iny
    cpy __w64lp_crc_length
    bne __w64lp_crc_byte__image
__w64lp_crc_done__image:
__w64lp_crc_done = __w64lp_crc_done__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    lda __w64lp_crc_hi_tail+1
    sta __w64lp_crc_value+1
    lda __w64lp_crc_lo_tail+1
    sta __w64lp_crc_value
    tya
    clc
    adc $fb
    sta $fb
    bcc __w64lp_crc_return__image
    inc $fc
__w64lp_crc_return__image:
__w64lp_crc_return = __w64lp_crc_return__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

    rts
__w64lp_magic__image:
__w64lp_magic = __w64lp_magic__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 87,54,52,88,1
__w64lp_one__image:
__w64lp_one = __w64lp_one__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 1
__w64lp_two__image:
__w64lp_two = __w64lp_two__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 2
__w64lp_header_size__image:
__w64lp_header_size = __w64lp_header_size__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 8
__w64lp_record_size__image:
__w64lp_record_size = __w64lp_record_size__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 10
__w64lp_code_start__image:
__w64lp_code_start = __w64lp_code_start__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word __w64lp_begin
__w64lp_code_last__image:
__w64lp_code_last = __w64lp_code_last__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word __w64lp_end-1
__w64lp_decoder_start__image:
__w64lp_decoder_start = __w64lp_decoder_start__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word __w64ld_unpack
__w64lp_decoder_last__image:
__w64lp_decoder_last = __w64lp_decoder_last__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word __w64ld_end-1
__w64lp_request__image:
__w64lp_request = __w64lp_request__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_stage__image:
__w64lp_stage = __w64lp_stage__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_length__image:
__w64lp_length = __w64lp_length__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_destination__image:
__w64lp_destination = __w64lp_destination__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_capacity__image:
__w64lp_capacity = __w64lp_capacity__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_workspace__image:
__w64lp_workspace = __w64lp_workspace__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_workspace_capacity__image:
__w64lp_workspace_capacity = __w64lp_workspace_capacity__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_block__image:
__w64lp_block = __w64lp_block__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 0
__w64lp_stage_end__image:
__w64lp_stage_end = __w64lp_stage_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_destination_end__image:
__w64lp_destination_end = __w64lp_destination_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_workspace_end__image:
__w64lp_workspace_end = __w64lp_workspace_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_payload_end__image:
__w64lp_payload_end = __w64lp_payload_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_next_offset__image:
__w64lp_next_offset = __w64lp_next_offset__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_used__image:
__w64lp_used = __w64lp_used__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_work_cursor__image:
__w64lp_work_cursor = __w64lp_work_cursor__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_decoded_end__image:
__w64lp_decoded_end = __w64lp_decoded_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_decoded_after__image:
__w64lp_decoded_after = __w64lp_decoded_after__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_count__image:
__w64lp_count = __w64lp_count__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 0
__w64lp_index__image:
__w64lp_index = __w64lp_index__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 0
__w64lp_record_data__image:
__w64lp_record_data = __w64lp_record_data__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS

__w64lp_record_destination__image:
__w64lp_record_destination = __w64lp_record_destination__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_decoded_length__image:
__w64lp_decoded_length = __w64lp_decoded_length__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_record_offset__image:
__w64lp_record_offset = __w64lp_record_offset__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_packed_length__image:
__w64lp_packed_length = __w64lp_packed_length__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_decoded_crc__image:
__w64lp_decoded_crc = __w64lp_decoded_crc__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_crc_length__image:
__w64lp_crc_length = __w64lp_crc_length__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_crc_value__image:
__w64lp_crc_value = __w64lp_crc_value__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .word 0
__w64lp_crc_low__image:
__w64lp_crc_low = __w64lp_crc_low__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 0,33,66,99,132,165,198,231,8,41,74,107,140,173,206,239,49,16,115,82,181,148,247,214,57,24,123,90,189,156,255,222,98,67,32,1,230,199,164,133,106,75,40,9,238,207,172,141,83,114,17,48,215,246,149,180,91,122,25,56,223,254,157,188,196,229,134,167,64,97,2,35,204,237,142,175,72,105,10,43,245,212,183,150,113,80,51,18,253,220,191,158,121,88,59,26,166,135,228,197,34,3,96,65,174,143,236,205,42,11,104,73,151,182,213,244,19,50,81,112,159,190,221,252,27,58,89,120,136,169,202,235,12,45,78,111,128,161,194,227,4,37,70,103,185,152,251,218,61,28,127,94,177,144,243,210,53,20,119,86,234,203,168,137,110,79,44,13,226,195,160,129,102,71,36,5,219,250,153,184,95,126,29,60,211,242,145,176,87,118,21,52,76,109,14,47,200,233,138,171,68,101,6,39,192,225,130,163,125,92,63,30,249,216,187,154,117,84,55,22,241,208,179,146,46,15,108,77,170,139,232,201,38,7,100,69,162,131,224,193,31,62,93,124,155,186,217,248,23,54,85,116,147,178,209,240
__w64lp_crc_high__image:
__w64lp_crc_high = __w64lp_crc_high__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS
 .byte 0,16,32,48,64,80,96,112,129,145,161,177,193,209,225,241,18,2,50,34,82,66,114,98,147,131,179,163,211,195,243,227,36,52,4,20,100,116,68,84,165,181,133,149,229,245,197,213,54,38,22,6,118,102,86,70,183,167,151,135,247,231,215,199,72,88,104,120,8,24,40,56,201,217,233,249,137,153,169,185,90,74,122,106,26,10,58,42,219,203,251,235,155,139,187,171,108,124,76,92,44,60,12,28,237,253,205,221,173,189,141,157,126,110,94,78,62,46,30,14,255,239,223,207,191,175,159,143,145,129,177,161,209,193,241,225,16,0,48,32,80,64,112,96,131,147,163,179,195,211,227,243,2,18,34,50,66,82,98,114,181,165,149,133,245,229,213,197,52,36,20,4,116,100,84,68,167,183,135,151,231,247,199,215,38,54,6,22,102,118,70,86,217,201,249,233,153,137,185,169,88,72,120,104,24,8,56,40,203,219,235,251,139,155,171,187,74,90,106,122,10,26,42,58,253,237,221,205,189,173,157,141,124,108,92,76,60,44,28,12,239,255,207,223,175,191,143,159,110,126,78,94,46,62,14,30
__w64lp_end__image:
__w64lp_end = __w64lp_end__image - web64_loader_packed_image + WEB64_LOADER_PACKED_ADDRESS


web64_loader_packed_image_end:
web64_loader_packed_image_size = web64_loader_packed_image_end - web64_loader_packed_image

web64/loader-raw-runtime.inc

; Caller-owned RAM image: define WEB64_LOADER_RAW_ADDRESS, include once and copy before use.
web64_loader_raw_image:

__w64lr_begin__image:
__w64lr_begin = __w64lr_begin__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

; _web64_rt exact-width named argument window for web64_loader_read
_web64_loader_read__arg_window__image:
_web64_loader_read__arg_window = _web64_loader_read__arg_window__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

_web64_loader_read__arg_window_size = 7
_web64_loader_read__arg0 = _web64_loader_read__arg_name
_web64_loader_read__arg_name__width = 2
_web64_loader_read__arg_name__offset = 0
_web64_loader_read__arg_name__image:
_web64_loader_read__arg_name = _web64_loader_read__arg_name__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

__web64_fn_web64_loader_read_param_name_0__image:
__web64_fn_web64_loader_read_param_name_0 = __web64_fn_web64_loader_read_param_name_0__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    .word 0
_web64_loader_read__arg1 = _web64_loader_read__arg_length
_web64_loader_read__arg_length__width = 1
_web64_loader_read__arg_length__offset = 2
_web64_loader_read__arg_length__image:
_web64_loader_read__arg_length = _web64_loader_read__arg_length__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

__web64_fn_web64_loader_read_param_length_1__image:
__web64_fn_web64_loader_read_param_length_1 = __web64_fn_web64_loader_read_param_length_1__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    .byte 0
_web64_loader_read__arg2 = _web64_loader_read__arg_stage
_web64_loader_read__arg_stage__width = 2
_web64_loader_read__arg_stage__offset = 3
_web64_loader_read__arg_stage__image:
_web64_loader_read__arg_stage = _web64_loader_read__arg_stage__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

__web64_fn_web64_loader_read_param_stage_2__image:
__web64_fn_web64_loader_read_param_stage_2 = __web64_fn_web64_loader_read_param_stage_2__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    .word 0
_web64_loader_read__arg3 = _web64_loader_read__arg_capacity
_web64_loader_read__arg_capacity__width = 2
_web64_loader_read__arg_capacity__offset = 5
_web64_loader_read__arg_capacity__image:
_web64_loader_read__arg_capacity = _web64_loader_read__arg_capacity__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

__web64_fn_web64_loader_read_param_capacity_3__image:
__web64_fn_web64_loader_read_param_capacity_3 = __web64_fn_web64_loader_read_param_capacity_3__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    .word 0
_web64_loader_read__image:
_web64_loader_read = _web64_loader_read__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cld
    lda __w64loader_phase
    beq __w64lr_idle__image
    lda #15
    rts
__w64lr_idle__image:
__w64lr_idle = __w64lr_idle__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda #0
    sta __w64loader_nested
    sta __w64loader_abort_requested
__w64lr_read_body__image:
__w64lr_read_body = __w64lr_read_body__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda __w64loader_ready
    bne __w64loader_placed_raw_macro_1_ok__image
    lda #12
    jmp __w64lr_result
__w64loader_placed_raw_macro_1_ok__image:
__w64loader_placed_raw_macro_1_ok = __w64loader_placed_raw_macro_1_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda __w64lt_fastloadstatus
    bne __w64loader_placed_raw_macro_2_ok__image
    lda #12
    jmp __w64lr_result
__w64loader_placed_raw_macro_2_ok__image:
__w64loader_placed_raw_macro_2_ok = __w64loader_placed_raw_macro_2_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    ; No hidden banking/vector changes in the fluid read path. RAM and I/O
    ; must be visible, with the caller's IRQ clock running.
    lda $01
    and #7
    cmp #5
    beq __w64loader_placed_raw_macro_3_ok__image
    lda #13
    jmp __w64lr_result
__w64loader_placed_raw_macro_3_ok__image:
__w64loader_placed_raw_macro_3_ok = __w64loader_placed_raw_macro_3_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    php
    pla
    and #4
    beq __w64loader_placed_raw_macro_4_ok__image
    lda #13
    jmp __w64lr_result
__w64loader_placed_raw_macro_4_ok__image:
__w64loader_placed_raw_macro_4_ok = __w64loader_placed_raw_macro_4_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda _web64_loader_read__arg_length
    bne __w64loader_placed_raw_macro_5_ok__image
    lda #13
    jmp __w64lr_result
__w64loader_placed_raw_macro_5_ok__image:
__w64loader_placed_raw_macro_5_ok = __w64loader_placed_raw_macro_5_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #17
    bcc __w64loader_placed_raw_macro_6_ok__image
    lda #13
    jmp __w64lr_result
__w64loader_placed_raw_macro_6_ok__image:
__w64loader_placed_raw_macro_6_ok = __w64loader_placed_raw_macro_6_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda _web64_loader_read__arg_capacity
    ora _web64_loader_read__arg_capacity+1
    bne __w64loader_placed_raw_macro_7_ok__image
    lda #8
    jmp __w64lr_result
__w64loader_placed_raw_macro_7_ok__image:
__w64loader_placed_raw_macro_7_ok = __w64loader_placed_raw_macro_7_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sec
    lda _web64_loader_read__arg_capacity
    sbc #1
    sta __w64lr_last
    lda _web64_loader_read__arg_capacity+1
    sbc #0
    sta __w64lr_last+1
    clc
    lda __w64lr_last
    adc _web64_loader_read__arg_stage
    sta __w64lr_last
    lda __w64lr_last+1
    adc _web64_loader_read__arg_stage+1
    sta __w64lr_last+1
    bcc __w64loader_placed_raw_macro_8_ok__image
    lda #8
    jmp __w64lr_result
__w64loader_placed_raw_macro_8_ok__image:
__w64loader_placed_raw_macro_8_ok = __w64loader_placed_raw_macro_8_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda _web64_loader_read__arg_stage+1
    cmp #2
    bcs __w64loader_placed_raw_macro_9_ok__image
    lda #8
    jmp __w64lr_result
__w64loader_placed_raw_macro_9_ok__image:
__w64loader_placed_raw_macro_9_ok = __w64loader_placed_raw_macro_9_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #$e0
    bcs __w64lr_ram_range__image
    lda __w64lr_last+1
    cmp #$d0
    bcc __w64loader_placed_raw_macro_10_ok__image
    lda #8
    jmp __w64lr_result
__w64loader_placed_raw_macro_10_ok__image:
__w64loader_placed_raw_macro_10_ok = __w64loader_placed_raw_macro_10_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

__w64lr_ram_range__image:
__w64lr_ram_range = __w64lr_ram_range__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    ; Sector receive storage cannot also be the accumulating file buffer.
    lda __w64loader_sector_page
    cmp _web64_loader_read__arg_stage+1
    bcc __w64lr_sector_separate__image
    cmp __w64lr_last+1
    beq __w64lr_sector_collision__image
    bcs __w64lr_sector_separate__image
__w64lr_sector_collision__image:
__w64lr_sector_collision = __w64lr_sector_collision__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda #9
    jmp __w64lr_result
__w64lr_sector_separate__image:
__w64lr_sector_separate = __w64lr_sector_separate__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda _web64_loader_read__arg_name
    sta $fb
    lda _web64_loader_read__arg_name+1
    sta $fc
    ldy #0
__w64lr_filename_loop__image:
__w64lr_filename_loop = __w64lr_filename_loop__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda ($fb),y
    bne __w64loader_placed_raw_macro_11_ok__image
    lda #13
    jmp __w64lr_result
__w64loader_placed_raw_macro_11_ok__image:
__w64loader_placed_raw_macro_11_ok = __w64loader_placed_raw_macro_11_ok__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sta __w64lr_filename,y
    iny
    cpy _web64_loader_read__arg_length
    bne __w64lr_filename_loop__image
    lda #0
    sta __w64lr_filename,y
    sta __w64lr_size
    sta __w64lr_size+1
    sta __w64lr_origin
    sta __w64lr_origin+1
    lda #1
    sta __w64loader_phase
    lda _web64_loader_read__arg_stage
    sta __w64lr_store+1
    lda _web64_loader_read__arg_stage+1
    sta __w64lr_store+2
    jsr __w64loader_sample_clock
    sta __w64lt_wait_start
    ; The filename has been copied. Reuse call scratch for the immutable clock
    ; address, avoiding two subroutine envelopes around every received byte.
    lda __w64loader_sample_clock+1
    sta $fb
    lda __w64loader_sample_clock+2
    sta $fc
    ldx #<__w64lr_filename
    ldy #>__w64lr_filename
    jsr __w64lt_openfile
    bcc __w64lr_opened__image
    jmp __w64lr_transport_failure
__w64lr_opened__image:
__w64lr_opened = __w64lr_opened__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    ldy #0
    lda ($fb),y
    sta __w64lt_wait_start
    jsr __w64lt_getbyte
    bcc __w64lr_origin_low__image
    jmp __w64lr_short_header
__w64lr_origin_low__image:
__w64lr_origin_low = __w64lr_origin_low__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sta __w64lr_origin
    ldy #0
    lda ($fb),y
    sta __w64lt_wait_start
    jsr __w64lt_getbyte
    bcc __w64lr_origin_high__image
    jmp __w64lr_short_header
__w64lr_origin_high__image:
__w64lr_origin_high = __w64lr_origin_high__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sta __w64lr_origin+1
__w64lr_byte_loop__image:
__w64lr_byte_loop = __w64lr_byte_loop__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    ldy #0
    lda ($fb),y
    sta __w64lt_wait_start
    jsr __w64lt_getbyte
    bcs __w64lr_end__image
    tax
    lda __w64loader_abort_requested
    bne __w64lr_transport_failure__image
    lda __w64lr_size+1
    cmp _web64_loader_read__arg_capacity+1
    bne __w64lr_store_byte__image
    lda __w64lr_size
    cmp _web64_loader_read__arg_capacity
    bne __w64lr_store_byte__image
    jsr __w64lt_abort
    lda #6
    jmp __w64lr_result
__w64lr_store_byte__image:
__w64lr_store_byte = __w64lr_store_byte__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    txa
__w64lr_store__image:
__w64lr_store = __w64lr_store__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sta $ffff
    inc __w64lr_store+1
    bne __w64lr_store_next__image
    inc __w64lr_store+2
__w64lr_store_next__image:
__w64lr_store_next = __w64lr_store_next__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    inc __w64lr_size
    bne __w64lr_byte_loop__image
    inc __w64lr_size+1
    jmp __w64lr_byte_loop
__w64lr_end__image:
__w64lr_end = __w64lr_end__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #0
    bne __w64lr_drive_error__image
    lda __w64loader_abort_requested
    bne __w64lr_transport_failure__image
    beq __w64lr_result__image
__w64lr_short_header__image:
__w64lr_short_header = __w64lr_short_header__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #0
    bne __w64lr_drive_error__image
    lda #2
    bne __w64lr_result__image
__w64lr_drive_error__image:
__w64lr_drive_error = __w64lr_drive_error__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #2
    bne __w64lr_not_missing__image
    lda __w64lt_fastloadstatus
    beq __w64lr_transport_failure__image
    lda #1
    bne __w64lr_result__image
__w64lr_not_missing__image:
__w64lr_not_missing = __w64lr_not_missing__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    cmp #4
    bne __w64lr_transport_failure__image
    lda #3
    bne __w64lr_result__image
__w64lr_transport_failure__image:
__w64lr_transport_failure = __w64lr_transport_failure__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    jsr __w64lt_abort
    lda #0
    sta __w64loader_ready
    lda __w64loader_abort_requested
    beq __w64lr_not_aborted__image
    lda #11
    bne __w64lr_result__image
__w64lr_not_aborted__image:
__w64lr_not_aborted = __w64lr_not_aborted__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda #2
__w64lr_result__image:
__w64lr_result = __w64lr_result__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    sta __w64loader_status
    lda __w64loader_nested
    bne __w64lr_nested_return__image
    lda #0
    sta __w64loader_phase
__w64lr_nested_return__image:
__w64lr_nested_return = __w64lr_nested_return__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda __w64loader_status
    rts
_web64_loader_last_size__image:
_web64_loader_last_size = _web64_loader_last_size__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda __w64lr_size
    ldx __w64lr_size+1
    rts
_web64_loader_last_origin__image:
_web64_loader_last_origin = _web64_loader_last_origin__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS

    lda __w64lr_origin
    ldx __w64lr_origin+1
    rts
__w64lr_size__image:
__w64lr_size = __w64lr_size__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS
 .word 0
__w64lr_origin__image:
__w64lr_origin = __w64lr_origin__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS
 .word 0
__w64lr_last__image:
__w64lr_last = __w64lr_last__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS
 .word 0
__w64lr_filename__image:
__w64lr_filename = __w64lr_filename__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS
 .fill 17,0
__w64lr_end_address__image:
__w64lr_end_address = __w64lr_end_address__image - web64_loader_raw_image + WEB64_LOADER_RAW_ADDRESS


web64_loader_raw_image_end:
web64_loader_raw_image_size = web64_loader_raw_image_end - web64_loader_raw_image

web64/loader-state-runtime.inc

; Caller-owned RAM image: define WEB64_LOADER_STATE_ADDRESS, include once and copy before use.
web64_loader_state_image:

_web64_loader_status__image:
_web64_loader_status = _web64_loader_status__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS

    lda __w64loader_status
    rts
_web64_loader_abort__image:
_web64_loader_abort = _web64_loader_abort__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS

    ; IRQ-safe request only. A commit already in progress is irrevocable.
    lda __w64loader_phase
    cmp #1
    bne __w64loader_abort_idle__image
    sta __w64loader_abort_requested
__w64loader_abort_idle__image:
__w64loader_abort_idle = __w64loader_abort_idle__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS

    rts
__w64loader_status__image:
__w64loader_status = __w64loader_status__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS
 .byte 0
__w64loader_phase__image:
__w64loader_phase = __w64loader_phase__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS
 .byte 0
__w64loader_nested__image:
__w64loader_nested = __w64loader_nested__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS
 .byte 0
__w64loader_abort_requested__image:
__w64loader_abort_requested = __w64loader_abort_requested__image - web64_loader_state_image + WEB64_LOADER_STATE_ADDRESS
 .byte 0

web64_loader_state_image_end:
web64_loader_state_image_size = web64_loader_state_image_end - web64_loader_state_image

web64/loader-transport-runtime.inc

; Caller-owned RAM image: define WEB64_LOADER_TRANSPORT_ADDRESS, include once and copy before use.
web64_loader_transport_image:

__w64loader_transport_begin__image:
__w64loader_transport_begin = __w64loader_transport_begin__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS


; Altered Covert Bitops Loadersystem 2.29, one-bit long-name 1541 protocol.
; Copyright (c) 2002-2019 Lasse Oorni
;
; Permission is hereby granted, free of charge, to any person obtaining a
; copy of this software and associated documentation files (the "Software"),
; to deal in the Software without restriction, including without limitation
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
; and/or sell copies of the Software, and to permit persons to whom the
; Software is furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
; DEALINGS IN THE SOFTWARE.
;
; Web64 adds bounded cancellation/recovery and explicit RAM/lifecycle policy;
; this is an altered port, not the original source. See loader-licenses.md.
__w64lt_TWOBIT_PROTOCOL = $0
__w64lt_LONG_NAMES = $1
__w64lt_BORDER_FLASHING = $0
__w64lt_LOAD_UNDER_IO = $0
__w64lt_LOADFILE_UNPACKED = $0
__w64lt_LOADFILE_EXOMIZER = $0
__w64lt_LOADFILE_PUCRUNCH = $0
__w64lt_LITERAL_SEQUENCES_NOT_USED = $0
__w64lt_FORWARD_DECRUNCHING = $0
__w64lt_MAX_SEQUENCE_LENGTH_256 = $0
__w64lt_EXOMIZER_VERSION_3 = $0
__w64lt_RETRIES = $5
__w64lt_loadbuffer = $ff00
__w64lt_zpbase = $74
__w64lt_zpbase2 = $76
; C64 code is ordinary linked ASM; drive aliases refer to drive RAM only.
__w64lt_runtime_image__image:
__w64lt_runtime_image = __w64lt_runtime_image__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_loadtempreg = __w64lt_zpbase2+0
__w64lt_bufferstatus = __w64lt_zpbase2+1
__w64lt_fileopen = __w64lt_zpbase2+2
__w64lt_fastloadstatus = __w64lt_zpbase2+3
__w64lt_destlo = __w64lt_zpbase+0
__w64lt_desthi = __w64lt_zpbase+1
__w64lt_MW_LENGTH = 32
__w64lt_status = $90
__w64lt_messages = $9d
__w64lt_fa = $ba
__w64lt_acsbf = $01
__w64lt_trkbf = $08
__w64lt_sctbf = $09
__w64lt_iddrv0 = $12
__w64lt_drvtemp = $06
__w64lt_id = $16
__w64lt_buf = $0400
__w64lt_drvstart = $0500
__w64lt_drv_sendtblhigh = $0700
__w64lt_initialize = $d005
__w64lt_ciout = $ffa8
__w64lt_listen = $ffb1
__w64lt_second = $ff93
__w64lt_unlsn = $ffae
__w64lt_talk = $ffb4
__w64lt_tksa = $ff96
__w64lt_untlk = $ffab
__w64lt_acptr = $ffa5
__w64lt_chkin = $ffc6
__w64lt_chkout = $ffc9
__w64lt_chrin = $ffcf
__w64lt_chrout = $ffd2
__w64lt_close = $ffc3
__w64lt_open = $ffc0
__w64lt_setmsg = $ff90
__w64lt_setnam = $ffbd
__w64lt_setlfs = $ffba
__w64lt_clrchn = $ffcc
__w64lt_getin = $ffe4
__w64lt_load = $ffd5
__w64lt_save = $ffd8
__w64lt_image_openfile__image:
__w64lt_image_openfile = __w64lt_image_openfile__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_openfile = __w64lt_image_openfile
    lda __w64lt_fileopen
    beq __w64lt_image_open_ok__image
    rts
__w64lt_image_open_ok__image:
__w64lt_image_open_ok = __w64lt_image_open_ok__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_open_ok = __w64lt_image_open_ok
    stx __w64lt_destlo
    sty __w64lt_desthi
    inc __w64lt_fileopen
    lda __w64lt_usefastload
    bne __w64lt_image_fastopen__image
__w64lt_image_slowopen__image:
__w64lt_image_slowopen = __w64lt_image_slowopen__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_slowopen = __w64lt_image_slowopen
    tay
    jsr __w64lt_kernalon
__w64lt_image_slowopen_nameloop__image:
__w64lt_image_slowopen_nameloop = __w64lt_image_slowopen_nameloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_slowopen_nameloop = __w64lt_image_slowopen_nameloop
    iny
    lda (__w64lt_destlo),y
    bne __w64lt_image_slowopen_nameloop__image
    tya
    ldx __w64lt_destlo
    ldy __w64lt_desthi
    jsr __w64lt_setnam
    lda #$02
    ldy #$00
    jsr __w64lt_setlfsdevice
    jsr __w64lt_open
    ldx #$02
    jsr __w64lt_chkin
    jmp __w64lt_kernaloff
__w64lt_image_fastopen__image:
__w64lt_image_fastopen = __w64lt_image_fastopen__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastopen = __w64lt_image_fastopen
    jsr __w64lt_initfastload
    ldy #$00
__w64lt_image_fastload_sendouter__image:
__w64lt_image_fastload_sendouter = __w64lt_image_fastload_sendouter__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_sendouter = __w64lt_image_fastload_sendouter
    lda (__w64lt_destlo),y
    sta __w64lt_loadtempreg
    pha
    ldx #$08
__w64lt_image_fastload_sendinner__image:
__w64lt_image_fastload_sendinner = __w64lt_image_fastload_sendinner__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_sendinner = __w64lt_image_fastload_sendinner
    bit $dd00
    bpl __w64lt_image_send_wait__image
    bvs __w64lt_image_send_ready__image
__w64lt_image_send_wait__image:
__w64lt_image_send_wait = __w64lt_image_send_wait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    jsr __w64lt_wait
    bcc __w64lt_image_fastload_sendinner__image
    pla
    jmp __w64lt_abort
__w64lt_image_send_ready__image:
__w64lt_image_send_ready = __w64lt_image_send_ready__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lsr __w64lt_loadtempreg
    lda #$10
    ora $dd00
    bcc __w64lt_image_fastload_zerobit__image
    eor #$30
__w64lt_image_fastload_zerobit__image:
__w64lt_image_fastload_zerobit = __w64lt_image_fastload_zerobit__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_zerobit = __w64lt_image_fastload_zerobit
    sta $dd00
    lda #$c0
__w64lt_image_fastload_sendack__image:
__w64lt_image_fastload_sendack = __w64lt_image_fastload_sendack__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_sendack = __w64lt_image_fastload_sendack
    bit $dd00
    beq __w64lt_image_ack_ready__image
    jsr __w64lt_wait
    bcc __w64lt_image_fastload_sendack__image
    pla
    jmp __w64lt_abort
__w64lt_image_ack_ready__image:
__w64lt_image_ack_ready = __w64lt_image_ack_ready__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda #$ff-$30
    and $dd00
    sta $dd00
    dex
    bne __w64lt_image_fastload_sendinner__image
    iny
    pla
    bne __w64lt_image_fastload_sendouter__image
    sta $d07a
__w64lt_image_fastload_predelay__image:
__w64lt_image_fastload_predelay = __w64lt_image_fastload_predelay__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_predelay = __w64lt_image_fastload_predelay
    dex
    bne __w64lt_image_fastload_predelay__image
__w64lt_image_fastload_fillbuffer__image:
__w64lt_image_fastload_fillbuffer = __w64lt_image_fastload_fillbuffer__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_fillbuffer = __w64lt_image_fastload_fillbuffer
    ldx __w64lt_fileopen
    beq __w64lt_image_fileclosed__image
    pha
    sta $d07a
__w64lt_image_fastload_fbwait__image:
__w64lt_image_fastload_fbwait = __w64lt_image_fastload_fbwait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_fbwait = __w64lt_image_fastload_fbwait
    bit $dd00
    bvs __w64lt_image_fb_ready__image
    jsr __w64lt_wait
    bcc __w64lt_image_fastload_fbwait__image
    pla
    jmp __w64lt_abort
__w64lt_image_fb_ready__image:
__w64lt_image_fb_ready = __w64lt_image_fb_ready__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    pha
    pla
    pha
    pla
    nop
__w64lt_image_fastload_fillbufferloop__image:
__w64lt_image_fastload_fillbufferloop = __w64lt_image_fastload_fillbufferloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_fillbufferloop = __w64lt_image_fastload_fillbufferloop
    nop
    nop
    ldx #$08
__w64lt_image_fastload_bitloop__image:
__w64lt_image_fastload_bitloop = __w64lt_image_fastload_bitloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_bitloop = __w64lt_image_fastload_bitloop
    nop
    ; Four extra NOPs cover the drive's ATN cancellation checks on each bit.
    ; This is the actual IEC settling window, not an emulator-only shortcut.
    nop
    nop
    nop
    nop
    lda #$10
    eor $dd00
    sta $dd00
    asl
__w64lt_image_fastload_store__image:
__w64lt_image_fastload_store = __w64lt_image_fastload_store__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_store = __w64lt_image_fastload_store
    ror __w64lt_loadbuffer
    dex
    bne __w64lt_image_fastload_bitloop__image
    inc __w64lt_fastload_store+1
    bne __w64lt_image_fastload_fillbufferloop__image
__w64lt_image_fillbuffer_common__image:
__w64lt_image_fillbuffer_common = __w64lt_image_fillbuffer_common__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fillbuffer_common = __w64lt_image_fillbuffer_common
    lda #$02
    sta __w64lt_bufferstatus
    ldx #$ff
__w64lt_buffer_head__image:
__w64lt_buffer_head = __w64lt_buffer_head__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda __w64lt_loadbuffer
    bne __w64lt_image_fastload_fullbuffer__image
__w64lt_buffer_tail__image:
__w64lt_buffer_tail = __w64lt_buffer_tail__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    ldx __w64lt_loadbuffer+1
    bne __w64lt_image_fastload_noloadend__image
    stx __w64lt_fileopen
__w64lt_buffer_error__image:
__w64lt_buffer_error = __w64lt_buffer_error__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda __w64lt_loadbuffer+2
    sta __w64lt_fileclosed+1
__w64lt_image_fastload_noloadend__image:
__w64lt_image_fastload_noloadend = __w64lt_image_fastload_noloadend__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_noloadend = __w64lt_image_fastload_noloadend
__w64lt_image_fastload_fullbuffer__image:
__w64lt_image_fastload_fullbuffer = __w64lt_image_fastload_fullbuffer__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_fullbuffer = __w64lt_image_fastload_fullbuffer
    stx __w64lt_fastload_endcmp+1
    pla
    clc
    bcc __w64lt_image_getbyte_restx__image
__w64lt_image_fileclosed__image:
__w64lt_image_fileclosed = __w64lt_image_fileclosed__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fileclosed = __w64lt_image_fileclosed
    lda #$00
    sec
    bcs __w64lt_image_getbyte_restx__image
__w64lt_image_getbyte__image:
__w64lt_image_getbyte = __w64lt_image_getbyte__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_getbyte = __w64lt_image_getbyte
    stx __w64lt_getbyte_restx+1
__w64lt_image_getbyte_usefastload__image:
__w64lt_image_getbyte_usefastload = __w64lt_image_getbyte_usefastload__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_getbyte_usefastload = __w64lt_image_getbyte_usefastload
    lda #$00
    beq __w64lt_image_slowload_getbyte__image
__w64lt_image_fastload_getbyte__image:
__w64lt_image_fastload_getbyte = __w64lt_image_fastload_getbyte__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_getbyte = __w64lt_image_fastload_getbyte
    ldx __w64lt_bufferstatus
__w64lt_buffer_read__image:
__w64lt_buffer_read = __w64lt_buffer_read__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda __w64lt_loadbuffer,x
__w64lt_image_fastload_endcmp__image:
__w64lt_image_fastload_endcmp = __w64lt_image_fastload_endcmp__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_fastload_endcmp = __w64lt_image_fastload_endcmp
    cpx #$00
    bcs __w64lt_image_fastload_fillbuffer__image
    inc __w64lt_bufferstatus
__w64lt_image_getbyte_restx__image:
__w64lt_image_getbyte_restx = __w64lt_image_getbyte_restx__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_getbyte_restx = __w64lt_image_getbyte_restx
    ldx #$00
    rts
__w64lt_image_slowload_getbyte__image:
__w64lt_image_slowload_getbyte = __w64lt_image_slowload_getbyte__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_slowload_getbyte = __w64lt_image_slowload_getbyte
    lda __w64lt_fileopen
    beq __w64lt_image_fileclosed__image
    jsr __w64lt_kernalon
    jsr __w64lt_chrin
    ldx __w64lt_status
    bne __w64lt_image_slowload_eof__image
    jsr __w64lt_kernaloff
    clc
    bcc __w64lt_image_getbyte_restx__image
__w64lt_image_slowload_eof__image:
__w64lt_image_slowload_eof = __w64lt_image_slowload_eof__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_slowload_eof = __w64lt_image_slowload_eof
    pha
    txa
    and #$03
    sta __w64lt_fileclosed+1
    dec __w64lt_fileopen
    sty __w64lt_getbyte_resty+1
    jsr __w64lt_close_kernaloff
__w64lt_image_getbyte_resty__image:
__w64lt_image_getbyte_resty = __w64lt_image_getbyte_resty__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_getbyte_resty = __w64lt_image_getbyte_resty
    ldy #$00
    pla
    ldx __w64lt_fileclosed+1
    cpx #$01
    bcc __w64lt_image_getbyte_restx__image
    txa
    bcs __w64lt_image_getbyte_restx__image
__w64lt_image_setlfsdevice__image:
__w64lt_image_setlfsdevice = __w64lt_image_setlfsdevice__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_setlfsdevice = __w64lt_image_setlfsdevice
    ldx __w64lt_fa
    jmp __w64lt_setlfs
__w64lt_image_kernalon__image:
__w64lt_image_kernalon = __w64lt_image_kernalon__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_kernalon = __w64lt_image_kernalon
    ldx $01
    stx __w64lt_kernaloff+1
    ldx #$36
    stx $01
    rts
__w64lt_image_close_kernaloff__image:
__w64lt_image_close_kernaloff = __w64lt_image_close_kernaloff__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_close_kernaloff = __w64lt_image_close_kernaloff
    lda #$02
    jsr __w64lt_close
    jsr __w64lt_clrchn
__w64lt_image_kernaloff__image:
__w64lt_image_kernaloff = __w64lt_image_kernaloff__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_kernaloff = __w64lt_image_kernaloff
    ldx #$36
    stx $01
__w64lt_image_il_ok__image:
__w64lt_image_il_ok = __w64lt_image_il_ok__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_ok = __w64lt_image_il_ok
    rts
__w64lt_image_initfastload__image:
__w64lt_image_initfastload = __w64lt_image_initfastload__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_initfastload = __w64lt_image_initfastload
    lda __w64lt_usefastload
    beq __w64lt_image_il_ok__image
    lda __w64lt_fastloadstatus
    bne __w64lt_image_il_ok__image
    inc __w64lt_fastloadstatus
    lda #<__w64lt_drivecode
    ldx #>__w64lt_drivecode
    ldy #(__w64lt_drvend-__w64lt_drvstart+__w64lt_MW_LENGTH-1)/__w64lt_MW_LENGTH
__w64lt_image_ifl_begin__image:
__w64lt_image_ifl_begin = __w64lt_image_ifl_begin__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_begin = __w64lt_image_ifl_begin
    sta __w64lt_ifl_senddata+1
    stx __w64lt_ifl_senddata+2
    sty __w64lt_loadtempreg
    jsr __w64lt_kernalon
    lda #>__w64lt_drvstart
    sta __w64lt_ifl_mwstring+1
    ldy #$00
    sty __w64lt_ifl_mwstring+2
    beq __w64lt_image_ifl_nextpacket__image
__w64lt_image_ifl_sendmw__image:
__w64lt_image_ifl_sendmw = __w64lt_image_ifl_sendmw__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_sendmw = __w64lt_image_ifl_sendmw
    lda __w64lt_ifl_mwstring,x
    jsr __w64lt_ciout
    dex
    bpl __w64lt_image_ifl_sendmw__image
    ldx #__w64lt_MW_LENGTH
__w64lt_image_ifl_senddata__image:
__w64lt_image_ifl_senddata = __w64lt_image_ifl_senddata__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_senddata = __w64lt_image_ifl_senddata
    lda __w64lt_drivecode,y
    jsr __w64lt_ciout
    iny
    bne __w64lt_image_ifl_notover__image
    inc __w64lt_ifl_senddata+2
__w64lt_image_ifl_notover__image:
__w64lt_image_ifl_notover = __w64lt_image_ifl_notover__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_notover = __w64lt_image_ifl_notover
    inc __w64lt_ifl_mwstring+2
    bne __w64lt_image_ifl_notover2__image
    inc __w64lt_ifl_mwstring+1
__w64lt_image_ifl_notover2__image:
__w64lt_image_ifl_notover2 = __w64lt_image_ifl_notover2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_notover2 = __w64lt_image_ifl_notover2
    dex
    bne __w64lt_image_ifl_senddata__image
    jsr __w64lt_unlsn
__w64lt_image_ifl_nextpacket__image:
__w64lt_image_ifl_nextpacket = __w64lt_image_ifl_nextpacket__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_nextpacket = __w64lt_image_ifl_nextpacket
    lda __w64lt_fa
    jsr __w64lt_listen
    lda __w64lt_status
    and #$80
    bne __w64lt_image_ifl_error__image
    lda #$6f
    jsr __w64lt_second
    ldx #$05
    dec __w64lt_loadtempreg
    bpl __w64lt_image_ifl_sendmw__image
__w64lt_image_ifl_sendme__image:
__w64lt_image_ifl_sendme = __w64lt_image_ifl_sendme__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_sendme = __w64lt_image_ifl_sendme
    lda __w64lt_ifl_mestring-1,x
    jsr __w64lt_ciout
    dex
    bne __w64lt_image_ifl_sendme__image
    jsr __w64lt_unlsn
__w64lt_image_ifl_error__image:
__w64lt_image_ifl_error = __w64lt_image_ifl_error__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_error = __w64lt_image_ifl_error
    jmp __w64lt_kernaloff
__w64lt_image_drivecode__image:
__w64lt_image_drivecode = __w64lt_image_drivecode__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drivecode = __w64lt_image_drivecode
__w64lt_image_drvmain__image:
__w64lt_image_drvmain = __w64lt_image_drvmain__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drvmain = __w64lt_image_drvmain - __w64lt_image_drivecode + __w64lt_drvstart
    cli
    lda #$00
__w64lt_image_drv_1800ac0__image:
__w64lt_image_drv_1800ac0 = __w64lt_image_drv_1800ac0__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac0 = __w64lt_image_drv_1800ac0 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1800
    ldx #$00
__w64lt_image_drv_nameloop__image:
__w64lt_image_drv_nameloop = __w64lt_image_drv_nameloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_nameloop = __w64lt_image_drv_nameloop - __w64lt_image_drivecode + __w64lt_drvstart
    ldy #$08
__w64lt_image_drv_namebitloop__image:
__w64lt_image_drv_namebitloop = __w64lt_image_drv_namebitloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namebitloop = __w64lt_image_drv_namebitloop - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_1800ac1__image:
__w64lt_image_drv_1800ac1 = __w64lt_image_drv_1800ac1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac1 = __w64lt_image_drv_1800ac1 - __w64lt_image_drivecode + __w64lt_drvstart
    lda $1800
    bpl __w64lt_image_drv_noquit__image
    jmp __w64lt_drv_quit
__w64lt_image_drv_noquit__image:
__w64lt_image_drv_noquit = __w64lt_image_drv_noquit__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_noquit = __w64lt_image_drv_noquit - __w64lt_image_drivecode + __w64lt_drvstart
    and #$05
    beq __w64lt_image_drv_namebitloop__image
    lsr
    lda #$02
    bcc __w64lt_image_drv_namezero__image
    lda #$08
__w64lt_image_drv_namezero__image:
__w64lt_image_drv_namezero = __w64lt_image_drv_namezero__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namezero = __w64lt_image_drv_namezero - __w64lt_image_drivecode + __w64lt_drvstart
    ror __w64lt_drv_filename,x
__w64lt_image_drv_1800ac2__image:
__w64lt_image_drv_1800ac2 = __w64lt_image_drv_1800ac2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac2 = __w64lt_image_drv_1800ac2 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1800
__w64lt_image_drv_namewait__image:
__w64lt_image_drv_namewait = __w64lt_image_drv_namewait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namewait = __w64lt_image_drv_namewait - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_1800ac3__image:
__w64lt_image_drv_1800ac3 = __w64lt_image_drv_1800ac3__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac3 = __w64lt_image_drv_1800ac3 - __w64lt_image_drivecode + __w64lt_drvstart
    lda $1800
    bmi __w64lt_image_drv_quit__image
    and #$05
    cmp #$05
    beq __w64lt_image_drv_namewait__image
    lda #$00
__w64lt_image_drv_1800ac4__image:
__w64lt_image_drv_1800ac4 = __w64lt_image_drv_1800ac4__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac4 = __w64lt_image_drv_1800ac4 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1800
    dey
    bne __w64lt_image_drv_namebitloop__image
    sei
    inx
    lda __w64lt_drv_filename-1,x
    bne __w64lt_image_drv_nameloop__image
    lda #$08
__w64lt_image_drv_1800ac5__image:
__w64lt_image_drv_1800ac5 = __w64lt_image_drv_1800ac5__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac5 = __w64lt_image_drv_1800ac5 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1800
__w64lt_image_drv_dirtrk__image:
__w64lt_image_drv_dirtrk = __w64lt_image_drv_dirtrk__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_dirtrk = __w64lt_image_drv_dirtrk - __w64lt_image_drivecode + __w64lt_drvstart
    ldx $1000
__w64lt_image_drv_dirsct__image:
__w64lt_image_drv_dirsct = __w64lt_image_drv_dirsct__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_dirsct = __w64lt_image_drv_dirsct - __w64lt_image_drivecode + __w64lt_drvstart
    ldy $1000
__w64lt_image_drv_dirloop__image:
__w64lt_image_drv_dirloop = __w64lt_image_drv_dirloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_dirloop = __w64lt_image_drv_dirloop - __w64lt_image_drivecode + __w64lt_drvstart
    jsr __w64lt_drv_readsector
    bcs __w64lt_image_drv_readerror__image
    ldy #$02
__w64lt_image_drv_nextfile__image:
__w64lt_image_drv_nextfile = __w64lt_image_drv_nextfile__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_nextfile = __w64lt_image_drv_nextfile - __w64lt_image_drivecode + __w64lt_drvstart
    lda __w64lt_buf,y
    and #$83
    cmp #$82
    bne __w64lt_image_drv_notfound__image
    ldx #$03
    sty __w64lt_drv_namelda+1
    lda #$a0
    sta __w64lt_buf+19,y
__w64lt_image_drv_namecmploop__image:
__w64lt_image_drv_namecmploop = __w64lt_image_drv_namecmploop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namecmploop = __w64lt_image_drv_namecmploop - __w64lt_image_drivecode + __w64lt_drvstart
    lda __w64lt_drv_filename-3,x
    cmp #$2a
    beq __w64lt_image_drv_found__image
__w64lt_image_drv_namelda__image:
__w64lt_image_drv_namelda = __w64lt_image_drv_namelda__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namelda = __w64lt_image_drv_namelda - __w64lt_image_drivecode + __w64lt_drvstart
    lda __w64lt_buf,x
    cmp __w64lt_drv_filename-3,x
    bne __w64lt_image_drv_namedone__image
    inx
    bne __w64lt_image_drv_namecmploop__image
__w64lt_image_drv_namedone__image:
__w64lt_image_drv_namedone = __w64lt_image_drv_namedone__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_namedone = __w64lt_image_drv_namedone - __w64lt_image_drivecode + __w64lt_drvstart
    cmp #$a0
    bne __w64lt_image_drv_notfound__image
    lda __w64lt_drv_filename-3,x
    beq __w64lt_image_drv_found__image
__w64lt_image_drv_notfound__image:
__w64lt_image_drv_notfound = __w64lt_image_drv_notfound__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_notfound = __w64lt_image_drv_notfound - __w64lt_image_drivecode + __w64lt_drvstart
    tya
    clc
    adc #$20
    tay
    bcc __w64lt_image_drv_nextfile__image
    ldy __w64lt_buf+1
    ldx __w64lt_buf
    bne __w64lt_image_drv_dirloop__image
__w64lt_image_drv_filenotfound__image:
__w64lt_image_drv_filenotfound = __w64lt_image_drv_filenotfound__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_filenotfound = __w64lt_image_drv_filenotfound - __w64lt_image_drivecode + __w64lt_drvstart
    ldx #$02
    bne __w64lt_image_drv_loadend__image
__w64lt_image_drv_readerror__image:
__w64lt_image_drv_readerror = __w64lt_image_drv_readerror__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    ; Completion codes, not a wire-protocol change: missing filename differs
    ; from an exhausted sector job and drive-not-ready (job status $0f).
    ldx #$03
    cmp #$0f
    bne __w64lt_image_drv_loadend__image
    ldx #$04
__w64lt_image_drv_loadend__image:
__w64lt_image_drv_loadend = __w64lt_image_drv_loadend__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_loadend = __w64lt_image_drv_loadend - __w64lt_image_drivecode + __w64lt_drvstart
    stx __w64lt_buf+2
    lda #$00
    sta __w64lt_buf
    sta __w64lt_buf+1
    beq __w64lt_image_drv_sendblk__image
__w64lt_image_drv_quit__image:
__w64lt_image_drv_quit = __w64lt_image_drv_quit__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_quit = __w64lt_image_drv_quit - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_drivetype__image:
__w64lt_image_drv_drivetype = __w64lt_image_drv_drivetype__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_drivetype = __w64lt_image_drv_drivetype - __w64lt_image_drivecode + __w64lt_drvstart
    ldx #$00
    bne __w64lt_image_drv_quitnot1541__image
    lda #$1a
    sta $1802
    jmp __w64lt_initialize
__w64lt_image_drv_quitnot1541__image:
__w64lt_image_drv_quitnot1541 = __w64lt_image_drv_quitnot1541__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_quitnot1541 = __w64lt_image_drv_quitnot1541 - __w64lt_image_drivecode + __w64lt_drvstart
    rts
__w64lt_image_drv_found__image:
__w64lt_image_drv_found = __w64lt_image_drv_found__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_found = __w64lt_image_drv_found - __w64lt_image_drivecode + __w64lt_drvstart
    iny
__w64lt_image_drv_nextsect__image:
__w64lt_image_drv_nextsect = __w64lt_image_drv_nextsect__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_nextsect = __w64lt_image_drv_nextsect - __w64lt_image_drivecode + __w64lt_drvstart
    ldx __w64lt_buf,y
    beq __w64lt_image_drv_loadend__image
    lda __w64lt_buf+1,y
    tay
    jsr __w64lt_drv_readsector
    bcs __w64lt_image_drv_readerror__image
__w64lt_image_drv_sendblk__image:
__w64lt_image_drv_sendblk = __w64lt_image_drv_sendblk__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendblk = __w64lt_image_drv_sendblk - __w64lt_image_drivecode + __w64lt_drvstart
    lda #$04
    ldx #$00
__w64lt_image_drv_1800ac6__image:
__w64lt_image_drv_1800ac6 = __w64lt_image_drv_1800ac6__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac6 = __w64lt_image_drv_1800ac6 - __w64lt_image_drivecode + __w64lt_drvstart
    stx $1800
__w64lt_image_drv_sendloop__image:
__w64lt_image_drv_sendloop = __w64lt_image_drv_sendloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendloop = __w64lt_image_drv_sendloop - __w64lt_image_drivecode + __w64lt_drvstart
    ldx __w64lt_buf
__w64lt_image_drv_zpac1__image:
__w64lt_image_drv_zpac1 = __w64lt_image_drv_zpac1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_zpac1 = __w64lt_image_drv_zpac1 - __w64lt_image_drivecode + __w64lt_drvstart
    stx __w64lt_drvtemp
    tay
__w64lt_image_drv_sendloop_bitpair__image:
__w64lt_image_drv_sendloop_bitpair = __w64lt_image_drv_sendloop_bitpair__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendloop_bitpair = __w64lt_image_drv_sendloop_bitpair - __w64lt_image_drivecode + __w64lt_drvstart
    ldx #$00
__w64lt_image_drv_zpac2__image:
__w64lt_image_drv_zpac2 = __w64lt_image_drv_zpac2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_zpac2 = __w64lt_image_drv_zpac2 - __w64lt_image_drivecode + __w64lt_drvstart
    lsr __w64lt_drvtemp
    bcs __w64lt_image_drv_sendloop_wait1__image
    ldx #$02
__w64lt_image_drv_sendloop_wait1__image:
__w64lt_image_drv_sendloop_wait1 = __w64lt_image_drv_sendloop_wait1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendloop_wait1 = __w64lt_image_drv_sendloop_wait1 - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_1800ac7__image:
__w64lt_image_drv_1800ac7 = __w64lt_image_drv_1800ac7__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac7 = __w64lt_image_drv_1800ac7 - __w64lt_image_drivecode + __w64lt_drvstart
    bit $1800
    bmi __w64lt_image_drv_send_cancel__image
    bne __w64lt_image_drv_sendloop_wait1__image
__w64lt_image_drv_1800ac8__image:
__w64lt_image_drv_1800ac8 = __w64lt_image_drv_1800ac8__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac8 = __w64lt_image_drv_1800ac8 - __w64lt_image_drivecode + __w64lt_drvstart
    stx $1800
    ldx #$00
__w64lt_image_drv_zpac3__image:
__w64lt_image_drv_zpac3 = __w64lt_image_drv_zpac3__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_zpac3 = __w64lt_image_drv_zpac3 - __w64lt_image_drivecode + __w64lt_drvstart
    lsr __w64lt_drvtemp
    bcs __w64lt_image_drv_sendloop_wait2__image
    ldx #$02
__w64lt_image_drv_sendloop_wait2__image:
__w64lt_image_drv_sendloop_wait2 = __w64lt_image_drv_sendloop_wait2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendloop_wait2 = __w64lt_image_drv_sendloop_wait2 - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_1800ac9__image:
__w64lt_image_drv_1800ac9 = __w64lt_image_drv_1800ac9__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac9 = __w64lt_image_drv_1800ac9 - __w64lt_image_drivecode + __w64lt_drvstart
    bit $1800
    bmi __w64lt_image_drv_send_cancel__image
    beq __w64lt_image_drv_sendloop_wait2__image
__w64lt_image_drv_1800ac10__image:
__w64lt_image_drv_1800ac10 = __w64lt_image_drv_1800ac10__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac10 = __w64lt_image_drv_1800ac10 - __w64lt_image_drivecode + __w64lt_drvstart
    stx $1800
    dey
    bne __w64lt_image_drv_sendloop_bitpair__image
    inc __w64lt_drv_sendloop+1
    bne __w64lt_image_drv_sendloop__image
__w64lt_image_drv_sendloop_endwait__image:
__w64lt_image_drv_sendloop_endwait = __w64lt_image_drv_sendloop_endwait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_sendloop_endwait = __w64lt_image_drv_sendloop_endwait - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_drv_1800ac11__image:
__w64lt_image_drv_1800ac11 = __w64lt_image_drv_1800ac11__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac11 = __w64lt_image_drv_1800ac11 - __w64lt_image_drivecode + __w64lt_drvstart
    bit $1800
    bmi __w64lt_image_drv_send_cancel__image
    bne __w64lt_image_drv_sendloop_endwait__image
    asl
__w64lt_image_drv_1800ac12__image:
__w64lt_image_drv_1800ac12 = __w64lt_image_drv_1800ac12__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1800ac12 = __w64lt_image_drv_1800ac12 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1800
    lda __w64lt_buf
    ora __w64lt_buf+1
    bne __w64lt_image_drv_nextsect__image
    jmp __w64lt_drvmain
__w64lt_image_drv_send_cancel__image:
__w64lt_image_drv_send_cancel = __w64lt_image_drv_send_cancel__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    jmp __w64lt_drv_quit
__w64lt_image_drv_readsector__image:
__w64lt_image_drv_readsector = __w64lt_image_drv_readsector__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_readsector = __w64lt_image_drv_readsector - __w64lt_image_drivecode + __w64lt_drvstart
    jsr __w64lt_drv_led
__w64lt_image_drv_readtrk__image:
__w64lt_image_drv_readtrk = __w64lt_image_drv_readtrk__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_readtrk = __w64lt_image_drv_readtrk - __w64lt_image_drivecode + __w64lt_drvstart
    stx $1000
__w64lt_image_drv_readsct__image:
__w64lt_image_drv_readsct = __w64lt_image_drv_readsct__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_readsct = __w64lt_image_drv_readsct - __w64lt_image_drivecode + __w64lt_drvstart
    sty $1000
    lda #__w64lt_RETRIES
    sta __w64lt_drv_retry_count
__w64lt_image_drv_retry__image:
__w64lt_image_drv_retry = __w64lt_image_drv_retry__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_retry = __w64lt_image_drv_retry - __w64lt_image_drivecode + __w64lt_drvstart
    lda #$80
    ldx #1
__w64lt_image_drv_execjsr__image:
__w64lt_image_drv_execjsr = __w64lt_image_drv_execjsr__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_execjsr = __w64lt_image_drv_execjsr - __w64lt_image_drivecode + __w64lt_drvstart
    jsr __w64lt_drv_1541exec
    cmp #$02
    bcc __w64lt_image_drv_success__image
    dec __w64lt_drv_retry_count
    bne __w64lt_image_drv_retry__image
    pha
    jsr __w64lt_drv_led
    pla
    sec
    rts
__w64lt_image_drv_success__image:
__w64lt_image_drv_success = __w64lt_image_drv_success__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_success = __w64lt_image_drv_success - __w64lt_image_drivecode + __w64lt_drvstart
    sei
    clc
__w64lt_image_drv_led__image:
__w64lt_image_drv_led = __w64lt_image_drv_led__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_led = __w64lt_image_drv_led - __w64lt_image_drivecode + __w64lt_drvstart
    lda #$08
__w64lt_image_drv_ledac1__image:
__w64lt_image_drv_ledac1 = __w64lt_image_drv_ledac1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_ledac1 = __w64lt_image_drv_ledac1 - __w64lt_image_drivecode + __w64lt_drvstart
    eor $1c00
__w64lt_image_drv_ledac2__image:
__w64lt_image_drv_ledac2 = __w64lt_image_drv_ledac2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_ledac2 = __w64lt_image_drv_ledac2 - __w64lt_image_drivecode + __w64lt_drvstart
    sta $1c00
    rts
__w64lt_image_drv_1541exec__image:
__w64lt_image_drv_1541exec = __w64lt_image_drv_1541exec__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1541exec = __w64lt_image_drv_1541exec - __w64lt_image_drivecode + __w64lt_drvstart
    sta $01
    cli
__w64lt_image_drv_1541execwait__image:
__w64lt_image_drv_1541execwait = __w64lt_image_drv_1541execwait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1541execwait = __w64lt_image_drv_1541execwait - __w64lt_image_drivecode + __w64lt_drvstart
    lda $01
    bmi __w64lt_image_drv_1541execwait__image
    pha
    lda __w64lt_id
    sta __w64lt_iddrv0
    lda __w64lt_id+1
    sta __w64lt_iddrv0+1
    pla
    rts
__w64lt_image_drv_fdexec__image:
__w64lt_image_drv_fdexec = __w64lt_image_drv_fdexec__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_fdexec = __w64lt_image_drv_fdexec - __w64lt_image_drivecode + __w64lt_drvstart
    jsr $ff54
    lda $03
    rts
__w64lt_image_drv_1541dirtrk__image:
__w64lt_image_drv_1541dirtrk = __w64lt_image_drv_1541dirtrk__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1541dirtrk = __w64lt_image_drv_1541dirtrk - __w64lt_image_drivecode + __w64lt_drvstart
    .byte 18
__w64lt_image_drv_1541dirsct__image:
__w64lt_image_drv_1541dirsct = __w64lt_image_drv_1541dirsct__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1541dirsct = __w64lt_image_drv_1541dirsct - __w64lt_image_drivecode + __w64lt_drvstart
    .byte 1
__w64lt_image_drv_1581dirsct__image:
__w64lt_image_drv_1581dirsct = __w64lt_image_drv_1581dirsct__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_1581dirsct = __w64lt_image_drv_1581dirsct - __w64lt_image_drivecode + __w64lt_drvstart
    .byte 3
__w64lt_image_drv_filename__image:
__w64lt_image_drv_filename = __w64lt_image_drv_filename__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_filename = __w64lt_image_drv_filename - __w64lt_image_drivecode + __w64lt_drvstart
    .fill 17,0
__w64lt_image_drv_retry_count__image:
__w64lt_image_drv_retry_count = __w64lt_image_drv_retry_count__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drv_retry_count = __w64lt_image_drv_retry_count - __w64lt_image_drivecode + __w64lt_drvstart
    .byte 0
__w64lt_image_drvend__image:
__w64lt_image_drvend = __w64lt_image_drvend__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_drvend = __w64lt_image_drvend - __w64lt_image_drivecode + __w64lt_drvstart
__w64lt_image_ifl_mwstring__image:
__w64lt_image_ifl_mwstring = __w64lt_image_ifl_mwstring__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_mwstring = __w64lt_image_ifl_mwstring
    .byte __w64lt_MW_LENGTH,$00,$00,87,45,77
__w64lt_image_ifl_mestring__image:
__w64lt_image_ifl_mestring = __w64lt_image_ifl_mestring__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ifl_mestring = __w64lt_image_ifl_mestring
    .byte >__w64lt_drvstart, <__w64lt_drvstart, 69,45,77
__w64lt_image_usefastload__image:
__w64lt_image_usefastload = __w64lt_image_usefastload__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_usefastload = __w64lt_image_usefastload
    .byte 0
__w64lt_image_useserial__image:
__w64lt_image_useserial = __w64lt_image_useserial__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_useserial = __w64lt_image_useserial
    .byte 1
__w64lt_image_wait__image:
__w64lt_image_wait = __w64lt_image_wait__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_wait = __w64lt_image_wait
    pha
    lda __w64loader_abort_requested
    beq __w64lt_image_wait_clock__image
    pla
    sec
    rts
__w64lt_image_wait_clock__image:
__w64lt_image_wait_clock = __w64lt_image_wait_clock__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_wait_clock_read__image:
__w64lt_wait_clock_read = __w64lt_wait_clock_read__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda $ffff
    sec
    sbc __w64lt_wait_start
    cmp #3
    pla
    rts
__w64lt_image_wait_start__image:
__w64lt_image_wait_start = __w64lt_image_wait_start__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_wait_start = __w64lt_image_wait_start
    .byte 0
__w64lt_image_abort__image:
__w64lt_image_abort = __w64lt_image_abort__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_abort = __w64lt_image_abort
    lda #0
    sta __w64lt_fileopen
    sta __w64lt_fastloadstatus
    ; Release CLK/DATA and pulse ATN so the drive returns to DOS.
    lda $dd00
    and #$c7
    ora #8
    sta $dd00
    ldx #0
__w64lt_image_abort_delay__image:
__w64lt_image_abort_delay = __w64lt_image_abort_delay__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    dex
    bne __w64lt_image_abort_delay__image
    lda $dd00
    and #$f7
    sta $dd00
    lda #2
    sta __w64lt_fileclosed+1
    sec
    rts
__w64lt_runtime_image_end__image:
__w64lt_runtime_image_end = __w64lt_runtime_image_end__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS






; _web64_rt exact-width named argument window for web64_loader_init
_web64_loader_init__arg_window__image:
_web64_loader_init__arg_window = _web64_loader_init__arg_window__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

_web64_loader_init__arg_window_size = 5
_web64_loader_init__arg0 = _web64_loader_init__arg_device
_web64_loader_init__arg_device__width = 1
_web64_loader_init__arg_device__offset = 0
_web64_loader_init__arg_device__image:
_web64_loader_init__arg_device = _web64_loader_init__arg_device__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__web64_fn_web64_loader_init_param_device_0__image:
__web64_fn_web64_loader_init_param_device_0 = __web64_fn_web64_loader_init_param_device_0__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    .byte 0
_web64_loader_init__arg1 = _web64_loader_init__arg_sector
_web64_loader_init__arg_sector__width = 2
_web64_loader_init__arg_sector__offset = 1
_web64_loader_init__arg_sector__image:
_web64_loader_init__arg_sector = _web64_loader_init__arg_sector__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__web64_fn_web64_loader_init_param_sector_1__image:
__web64_fn_web64_loader_init_param_sector_1 = __web64_fn_web64_loader_init_param_sector_1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    .word 0
_web64_loader_init__arg2 = _web64_loader_init__arg_ticks
_web64_loader_init__arg_ticks__width = 2
_web64_loader_init__arg_ticks__offset = 3
_web64_loader_init__arg_ticks__image:
_web64_loader_init__arg_ticks = _web64_loader_init__arg_ticks__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__web64_fn_web64_loader_init_param_ticks_2__image:
__web64_fn_web64_loader_init_param_ticks_2 = __web64_fn_web64_loader_init_param_ticks_2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    .word 0
_web64_loader_init__image:
_web64_loader_init = _web64_loader_init__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    cld
    lda __w64loader_phase
    beq __w64loader_init_idle__image
    lda #15
    rts
__w64loader_init_idle__image:
__w64loader_init_idle = __w64loader_init_idle__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    ; A failed fresh initialization never leaves an older drive configuration
    ; apparently ready. Validate all caller-owned RAM before patching operands.
    lda #0
    sta __w64loader_ready
    sta __w64loader_configured
    sta __w64lt_usefastload
    sta __w64lt_getbyte_usefastload+1
    lda _web64_loader_init__arg_device
    cmp #8
    bcc __w64loader_init_invalid__image
    cmp #31
    bcs __w64loader_init_invalid__image
    lda _web64_loader_init__arg_sector
    bne __w64loader_init_invalid__image
    lda _web64_loader_init__arg_sector+1
    cmp #2
    bcc __w64loader_init_invalid__image
    cmp #$ff
    beq __w64loader_init_invalid__image
    cmp #$d0
    bcc __w64loader_init_sector_ok__image
    cmp #$e0
    bcc __w64loader_init_invalid__image
__w64loader_init_sector_ok__image:
__w64loader_init_sector_ok = __w64loader_init_sector_ok__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    cmp #>__w64loader_transport_begin
    bcc __w64loader_init_sector_owned__image
    cmp #>(__w64loader_transport_end-1)+1
    bcc __w64loader_init_invalid__image
__w64loader_init_sector_owned__image:
__w64loader_init_sector_owned = __w64loader_init_sector_owned__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda _web64_loader_init__arg_ticks+1
    cmp #2
    bcc __w64loader_init_invalid__image
    cmp _web64_loader_init__arg_sector+1
    beq __w64loader_init_invalid__image
    cmp #>__w64loader_transport_begin
    bcc __w64loader_init_clock_owned__image
    cmp #>(__w64loader_transport_end-1)+1
    bcc __w64loader_init_invalid__image
    jmp __w64loader_init_clock_owned
__w64loader_init_invalid__image:
__w64loader_init_invalid = __w64loader_init_invalid__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda #13
    sta __w64loader_status
    rts
__w64loader_init_clock_owned__image:
__w64loader_init_clock_owned = __w64loader_init_clock_owned__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    cmp #$d0
    bcc __w64loader_init_clock_ram__image
    cmp #$e0
    bcc __w64loader_init_invalid__image
__w64loader_init_clock_ram__image:
__w64loader_init_clock_ram = __w64loader_init_clock_ram__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda _web64_loader_init__arg_ticks
    clc
    adc #1
    tay
    lda _web64_loader_init__arg_ticks+1
    adc #0
    bcs __w64loader_init_invalid__image
    cmp _web64_loader_init__arg_sector+1
    beq __w64loader_init_invalid__image
    cmp #>__w64loader_transport_begin
    bcc __w64loader_init_clock_high_owned__image
    cmp #>(__w64loader_transport_end-1)+1
    bcc __w64loader_init_invalid__image
__w64loader_init_clock_high_owned__image:
__w64loader_init_clock_high_owned = __w64loader_init_clock_high_owned__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    cmp #$d0
    bcc __w64loader_init_clock_ok__image
    cmp #$e0
    bcc __w64loader_init_invalid__image
    cmp #$ff
    bne __w64loader_init_clock_ok__image
    cpy #$fa
    bcs __w64loader_init_invalid__image
__w64loader_init_clock_ok__image:
__w64loader_init_clock_ok = __w64loader_init_clock_ok__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    sta __w64lt_wait_clock_read+2
    sta __w64loader_sample_clock+2
    sty __w64lt_wait_clock_read+1
    sty __w64loader_sample_clock+1
    lda _web64_loader_init__arg_device
    sta __w64loader_device
    lda _web64_loader_init__arg_sector+1
    sta __w64loader_sector_page
    sta __w64lt_fastload_store+2
    sta __w64lt_buffer_head+2
    sta __w64lt_buffer_tail+2
    sta __w64lt_buffer_error+2
    sta __w64lt_buffer_read+2
    ; The caller supplies a monotonic 16-bit IRQ frame clock. Only its high
    ; byte is sampled by the preserved approximately 10–15 PAL second timeout.
    lda #0
    sta __w64loader_detected_type
    jsr __w64loader_rom_enter
    jsr __w64lt_initloader
    lda __w64loader_detected_type
    bne __w64loader_init_unsupported__image
    lda __w64lt_usefastload
    beq __w64loader_init_unavailable__image
    lda #1
    sta __w64loader_configured
    jsr __w64lt_initfastload
    jmp __w64loader_upload_result
__w64loader_init_unsupported__image:
__w64loader_init_unsupported = __w64loader_init_unsupported__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda #14
    bne __w64loader_init_return__image
__w64loader_init_unavailable__image:
__w64loader_init_unavailable = __w64loader_init_unavailable__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda #3
    bne __w64loader_init_return__image
_web64_loader_reinitialize_after_save__image:
_web64_loader_reinitialize_after_save = _web64_loader_reinitialize_after_save__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    cld
    lda __w64loader_phase
    beq __w64loader_reinit_idle__image
    lda #15
    rts
__w64loader_reinit_idle__image:
__w64loader_reinit_idle = __w64loader_reinit_idle__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda __w64loader_configured
    beq __w64loader_reinit_unconfigured__image
    lda #0
    sta __w64loader_ready
    sta __w64lt_fastloadstatus
    sta __w64lt_fileopen
    jsr __w64loader_rom_enter
    jsr __w64lt_initfastload
__w64loader_upload_result__image:
__w64loader_upload_result = __w64loader_upload_result__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda $90
    and #$c0
    bne __w64loader_init_unavailable__image
    lda #1
    sta __w64loader_ready
    lda #0
__w64loader_init_return__image:
__w64loader_init_return = __w64loader_init_return__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    sta __w64loader_status
    lda __w64loader_old_port
    sta $01
    lda __w64loader_old_messages
    sta $9d
    lda __w64loader_status
    rts
__w64loader_reinit_unconfigured__image:
__w64loader_reinit_unconfigured = __w64loader_reinit_unconfigured__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda #12
    sta __w64loader_status
    rts
_web64_loader_shutdown__image:
_web64_loader_shutdown = _web64_loader_shutdown__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda __w64loader_phase
    beq __w64loader_shutdown_idle__image
    lda #15
    rts
__w64loader_shutdown_idle__image:
__w64loader_shutdown_idle = __w64loader_shutdown_idle__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    jsr __w64lt_abort
    lda #0
    sta __w64loader_ready
    sta __w64loader_status
    rts
__w64loader_rom_enter__image:
__w64loader_rom_enter = __w64loader_rom_enter__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda $01
    sta __w64loader_old_port
    lda #$36
    sta $01
    lda $9d
    sta __w64loader_old_messages
    lda #0
    sta $9d
    sta __w64loader_abort_requested
    sta $90
    lda __w64loader_device
    sta $ba
    rts
__w64loader_sample_clock__image:
__w64loader_sample_clock = __w64loader_sample_clock__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    lda $ffff
    rts
__w64loader_ready__image:
__w64loader_ready = __w64loader_ready__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_configured__image:
__w64loader_configured = __w64loader_configured__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_detected_type__image:
__w64loader_detected_type = __w64loader_detected_type__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_device__image:
__w64loader_device = __w64loader_device__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_sector_page__image:
__w64loader_sector_page = __w64loader_sector_page__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_old_port__image:
__w64loader_old_port = __w64loader_old_port__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0
__w64loader_old_messages__image:
__w64loader_old_messages = __w64loader_old_messages__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS
 .byte 0


; Covert Bitops Loadersystem 2.29 / Lasse Oorni (MIT).
; One-bit, long-name configuration; see loader-licenses.md.
__w64lt_init_image__image:
__w64lt_init_image = __w64lt_init_image__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_image_initloader__image:
__w64lt_image_initloader = __w64lt_image_initloader__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_initloader = __w64lt_image_initloader
    sta $d07f
    lda #$00
    sta __w64lt_messages
    sta __w64lt_fastloadstatus
    sta __w64lt_fileopen
__w64lt_image_il_detectdrive__image:
__w64lt_image_il_detectdrive = __w64lt_image_il_detectdrive__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_detectdrive = __w64lt_image_il_detectdrive
    lda #$aa
    sta $a5
    lda #<__w64lt_il_drivecode
    ldx #>__w64lt_il_drivecode
    ldy #(__w64lt_il_driveend-__w64lt_il_drivecode+__w64lt_MW_LENGTH-1)/__w64lt_MW_LENGTH
    jsr __w64lt_ifl_begin
    lda __w64lt_status
    and #$80
    bne __w64lt_image_il_noserial__image
    ldx #$00
    ldy #$00
__w64lt_image_il_delay__image:
__w64lt_image_il_delay = __w64lt_image_il_delay__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_delay = __w64lt_image_il_delay
    inx
    bne __w64lt_image_il_delay__image
    iny
    bpl __w64lt_image_il_delay__image
    lda __w64lt_fa
    jsr __w64lt_listen
    lda #$6f
    jsr __w64lt_second
    ldx #$05
__w64lt_image_il_ddsendmr__image:
__w64lt_image_il_ddsendmr = __w64lt_image_il_ddsendmr__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_ddsendmr = __w64lt_image_il_ddsendmr
    lda __w64lt_il_mrstring,x
    jsr __w64lt_ciout
    dex
    bpl __w64lt_image_il_ddsendmr__image
    jsr __w64lt_unlsn
    lda __w64lt_fa
    jsr __w64lt_talk
    lda #$6f
    jsr __w64lt_tksa
    lda #$00
    jsr __w64lt_acptr
    pha
    jsr __w64lt_acptr
    tax
    jsr __w64lt_untlk
    pla
    cmp #$aa
    beq __w64lt_image_il_fastloadok__image
    lda $a5
    cmp #$aa
    bne __w64lt_image_il_nofastload__image
__w64lt_image_il_noserial__image:
__w64lt_image_il_noserial = __w64lt_image_il_noserial__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_noserial = __w64lt_image_il_noserial
    dec __w64lt_useserial
__w64lt_image_il_nofastload__image:
__w64lt_image_il_nofastload = __w64lt_image_il_nofastload__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_nofastload = __w64lt_image_il_nofastload
    rts
__w64lt_image_il_fastloadok__image:
__w64lt_image_il_fastloadok = __w64lt_image_il_fastloadok__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_fastloadok = __w64lt_image_il_fastloadok
    stx __w64loader_detected_type
    cpx #0
    beq __w64lt_image_il_supported__image
    rts
__w64lt_image_il_supported__image:
__w64lt_image_il_supported = __w64lt_image_il_supported__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

    sta __w64lt_usefastload
    sta __w64lt_getbyte_usefastload+1
    stx __w64lt_il_drivetype+1
    stx __w64lt_drv_drivetype+1-__w64lt_drvstart+__w64lt_drivecode
    ; Non-1541 families were rejected above; $1800 requires no patch table.
__w64lt_image_il_skippatch1800__image:
__w64lt_image_il_skippatch1800 = __w64lt_image_il_skippatch1800__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_skippatch1800 = __w64lt_image_il_skippatch1800
__w64lt_image_il_drivetype__image:
__w64lt_image_il_drivetype = __w64lt_image_il_drivetype__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_drivetype = __w64lt_image_il_drivetype
    ldx #$00
    lda __w64lt_il_dirtrklo,x
    sta __w64lt_drv_dirtrk+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_dirtrkhi,x
    sta __w64lt_drv_dirtrk+2-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_dirsctlo,x
    sta __w64lt_drv_dirsct+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_dirscthi,x
    sta __w64lt_drv_dirsct+2-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_execlo,x
    sta __w64lt_drv_execjsr+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_exechi,x
    sta __w64lt_drv_execjsr+2-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_jobtrklo,x
    sta __w64lt_drv_readtrk+1-__w64lt_drvstart+__w64lt_drivecode
    clc
    adc #$01
    sta __w64lt_drv_readsct+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_jobtrkhi,x
    sta __w64lt_drv_readtrk+2-__w64lt_drvstart+__w64lt_drivecode
    adc #$00
    sta __w64lt_drv_readsct+2-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_zp,x
    sta __w64lt_drv_zpac1+1-__w64lt_drvstart+__w64lt_drivecode
    sta __w64lt_drv_zpac2+1-__w64lt_drvstart+__w64lt_drivecode
    sta __w64lt_drv_zpac3+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_ledenabled,x
    sta __w64lt_drv_led-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_ledbit,x
    sta __w64lt_drv_led+1-__w64lt_drvstart+__w64lt_drivecode
    lda __w64lt_il_ledadrhi,x
    sta __w64lt_drv_ledac1+2-__w64lt_drvstart+__w64lt_drivecode
    sta __w64lt_drv_ledac2+2-__w64lt_drvstart+__w64lt_drivecode
    rts
__w64lt_image_il_drivecode__image:
__w64lt_image_il_drivecode = __w64lt_image_il_drivecode__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_drivecode = __w64lt_image_il_drivecode
    asl __w64lt_ild_return1
    lda $fea0
    ldx #3
__w64lt_image_ild_floop__image:
__w64lt_image_ild_floop = __w64lt_image_ild_floop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_floop = __w64lt_image_ild_floop - __w64lt_image_il_drivecode + __w64lt_drvstart
    cmp __w64lt_ild_family-1,x
    beq __w64lt_image_ild_ffound__image
    dex
    bne __w64lt_image_ild_floop__image
    beq __w64lt_image_ild_1541__image
__w64lt_image_ild_ffound__image:
__w64lt_image_ild_ffound = __w64lt_image_ild_ffound__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_ffound = __w64lt_image_ild_ffound - __w64lt_image_il_drivecode + __w64lt_drvstart
    lda __w64lt_ild_idloclo-1,x
    sta __w64lt_ild_idlda+1
    lda __w64lt_ild_idlochi-1,x
    sta __w64lt_ild_idlda+2
__w64lt_image_ild_idlda__image:
__w64lt_image_ild_idlda = __w64lt_image_ild_idlda__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_idlda = __w64lt_image_ild_idlda - __w64lt_image_il_drivecode + __w64lt_drvstart
    lda $fea4
    ldx #3
__w64lt_image_ild_idloop__image:
__w64lt_image_ild_idloop = __w64lt_image_ild_idloop__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_idloop = __w64lt_image_ild_idloop - __w64lt_image_il_drivecode + __w64lt_drvstart
    cmp __w64lt_ild_id-1,x
    beq __w64lt_image_ild_idfound__image
    dex
    bne __w64lt_image_ild_idloop__image
__w64lt_image_ild_1541__image:
__w64lt_image_ild_1541 = __w64lt_image_ild_1541__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_1541 = __w64lt_image_ild_1541 - __w64lt_image_il_drivecode + __w64lt_drvstart
__w64lt_image_ild_idfound__image:
__w64lt_image_ild_idfound = __w64lt_image_ild_idfound__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_idfound = __w64lt_image_ild_idfound - __w64lt_image_il_drivecode + __w64lt_drvstart
    stx __w64lt_ild_return2
    rts
__w64lt_image_ild_family__image:
__w64lt_image_ild_family = __w64lt_image_ild_family__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_family = __w64lt_image_ild_family - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte $43,$0d,$ff
__w64lt_image_ild_idloclo__image:
__w64lt_image_ild_idloclo = __w64lt_image_ild_idloclo__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_idloclo = __w64lt_image_ild_idloclo - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte $a4,$c6,$e9
__w64lt_image_ild_idlochi__image:
__w64lt_image_ild_idlochi = __w64lt_image_ild_idlochi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_idlochi = __w64lt_image_ild_idlochi - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte $fe,$e5,$a6
__w64lt_image_ild_id__image:
__w64lt_image_ild_id = __w64lt_image_ild_id__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_id = __w64lt_image_ild_id - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte 56,70,72
__w64lt_image_ild_return1__image:
__w64lt_image_ild_return1 = __w64lt_image_ild_return1__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_return1 = __w64lt_image_ild_return1 - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte $55
__w64lt_image_ild_return2__image:
__w64lt_image_ild_return2 = __w64lt_image_ild_return2__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_ild_return2 = __w64lt_image_ild_return2 - __w64lt_image_il_drivecode + __w64lt_drvstart
    .byte 0
__w64lt_image_il_driveend__image:
__w64lt_image_il_driveend = __w64lt_image_il_driveend__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_driveend = __w64lt_image_il_driveend
__w64lt_image_il_mrstring__image:
__w64lt_image_il_mrstring = __w64lt_image_il_mrstring__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_mrstring = __w64lt_image_il_mrstring
    .byte 2,>__w64lt_ild_return1,<__w64lt_ild_return1,82,45,77
__w64lt_image_il_dirtrklo__image:
__w64lt_image_il_dirtrklo = __w64lt_image_il_dirtrklo__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_dirtrklo = __w64lt_image_il_dirtrklo
    .byte <__w64lt_drv_1541dirtrk,<$022b,<$54,<$2ba7
__w64lt_image_il_dirtrkhi__image:
__w64lt_image_il_dirtrkhi = __w64lt_image_il_dirtrkhi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_dirtrkhi = __w64lt_image_il_dirtrkhi
    .byte >__w64lt_drv_1541dirtrk,>$022b,>$54,>$2ba7
__w64lt_image_il_dirsctlo__image:
__w64lt_image_il_dirsctlo = __w64lt_image_il_dirsctlo__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_dirsctlo = __w64lt_image_il_dirsctlo
    .byte <__w64lt_drv_1541dirsct,<__w64lt_drv_1581dirsct,<$56,<$2ba9
__w64lt_image_il_dirscthi__image:
__w64lt_image_il_dirscthi = __w64lt_image_il_dirscthi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_dirscthi = __w64lt_image_il_dirscthi
    .byte >__w64lt_drv_1541dirsct,>__w64lt_drv_1581dirsct,>$56,>$2ba9
__w64lt_image_il_execlo__image:
__w64lt_image_il_execlo = __w64lt_image_il_execlo__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_execlo = __w64lt_image_il_execlo
    .byte <__w64lt_drv_1541exec,<$ff54,<__w64lt_drv_fdexec,<$ff4e
__w64lt_image_il_exechi__image:
__w64lt_image_il_exechi = __w64lt_image_il_exechi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_exechi = __w64lt_image_il_exechi
    .byte >__w64lt_drv_1541exec,>$ff54,>__w64lt_drv_fdexec,>$ff4e
__w64lt_image_il_jobtrklo__image:
__w64lt_image_il_jobtrklo = __w64lt_image_il_jobtrklo__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_jobtrklo = __w64lt_image_il_jobtrklo
    .byte <$0008,<$000d,<$000d,<$2802
__w64lt_image_il_jobtrkhi__image:
__w64lt_image_il_jobtrkhi = __w64lt_image_il_jobtrkhi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_jobtrkhi = __w64lt_image_il_jobtrkhi
    .byte >$0008,>$000d,>$000d,>$2802
__w64lt_image_il_zp__image:
__w64lt_image_il_zp = __w64lt_image_il_zp__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_zp = __w64lt_image_il_zp
    .byte $06,$0b,$0b,$06
__w64lt_image_il_ledenabled__image:
__w64lt_image_il_ledenabled = __w64lt_image_il_ledenabled__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_ledenabled = __w64lt_image_il_ledenabled
    .byte $a9,$a9,$a9,$60
__w64lt_image_il_ledbit__image:
__w64lt_image_il_ledbit = __w64lt_image_il_ledbit__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_ledbit = __w64lt_image_il_ledbit
    .byte $08,$40,$40,$00
__w64lt_image_il_ledadrhi__image:
__w64lt_image_il_ledadrhi = __w64lt_image_il_ledadrhi__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS

__w64lt_il_ledadrhi = __w64lt_image_il_ledadrhi
    .byte $1c,$40,$40,$40
__w64lt_init_image_end__image:
__w64lt_init_image_end = __w64lt_init_image_end__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS





__w64loader_transport_end__image:
__w64loader_transport_end = __w64loader_transport_end__image - web64_loader_transport_image + WEB64_LOADER_TRANSPORT_ADDRESS


web64_loader_transport_image_end:
web64_loader_transport_image_size = web64_loader_transport_image_end - web64_loader_transport_image

web64/loader.h

#ifndef WEB64_LOADER_H
#define WEB64_LOADER_H
#include <stdint.h>
#define WEB64_LOADER_OK 0
#define WEB64_LOADER_NOT_FOUND 1
#define WEB64_LOADER_TRANSPORT 2
#define WEB64_LOADER_UNAVAILABLE 3
#define WEB64_LOADER_HEADER 4
#define WEB64_LOADER_INTEGRITY 5
#define WEB64_LOADER_PACKED_SIZE 6
#define WEB64_LOADER_UNPACKED_SIZE 7
#define WEB64_LOADER_RANGE 8
#define WEB64_LOADER_WORKSPACE 9
#define WEB64_LOADER_DECOMPRESSION 10
#define WEB64_LOADER_ABORTED 11
#define WEB64_LOADER_NOT_INITIALIZED 12
#define WEB64_LOADER_INVALID_ARGUMENT 13
#define WEB64_LOADER_UNSUPPORTED_DRIVE 14
#define WEB64_LOADER_BUSY 15
#define WEB64_LOADER_ALL_BLOCKS 255
typedef struct { const uint8_t *stage; uint16_t length; uint8_t *destination; uint16_t capacity; uint8_t *workspace; uint16_t workspace_capacity; uint8_t block; } web64_loader_packed_request;
typedef struct { const char *name; uint8_t name_length; uint8_t *stage; uint16_t stage_capacity; uint8_t *destination; uint16_t capacity; uint8_t *workspace; uint16_t workspace_capacity; uint8_t block; } web64_loader_request;
_web64_rt uint8_t web64_loader_load_raw(const web64_loader_request *request);
_web64_rt uint8_t web64_loader_load_packed(const web64_loader_request *request);
_web64_rt uint8_t web64_loader_unpack(const web64_loader_packed_request *request);
_web64_rt uint8_t web64_loader_init(uint8_t device, uint8_t *sector, volatile uint16_t *ticks);
_web64_rt uint8_t web64_loader_read(const char *name, uint8_t length, uint8_t *stage, uint16_t capacity);
uint8_t web64_loader_status(void);
void web64_loader_abort(void);
uint8_t web64_loader_shutdown(void);
uint8_t web64_loader_reinitialize_after_save(void);
uint16_t web64_loader_last_size(void);
uint16_t web64_loader_last_origin(void);
#endif

web64/loader.inc

WEB64_LOADER_OK = 0
WEB64_LOADER_NOT_FOUND = 1
WEB64_LOADER_TRANSPORT = 2
WEB64_LOADER_UNAVAILABLE = 3
WEB64_LOADER_HEADER = 4
WEB64_LOADER_INTEGRITY = 5
WEB64_LOADER_PACKED_SIZE = 6
WEB64_LOADER_UNPACKED_SIZE = 7
WEB64_LOADER_RANGE = 8
WEB64_LOADER_WORKSPACE = 9
WEB64_LOADER_DECOMPRESSION = 10
WEB64_LOADER_ABORTED = 11
WEB64_LOADER_NOT_INITIALIZED = 12
WEB64_LOADER_INVALID_ARGUMENT = 13
WEB64_LOADER_UNSUPPORTED_DRIVE = 14
WEB64_LOADER_BUSY = 15
WEB64_LOADER_ALL_BLOCKS = 255
WEB64_LOADER_PACKED_REQUEST_STAGE = 0
WEB64_LOADER_PACKED_REQUEST_LENGTH = 2
WEB64_LOADER_PACKED_REQUEST_DESTINATION = 4
WEB64_LOADER_PACKED_REQUEST_CAPACITY = 6
WEB64_LOADER_PACKED_REQUEST_WORKSPACE = 8
WEB64_LOADER_PACKED_REQUEST_WORKSPACE_CAPACITY = 10
WEB64_LOADER_PACKED_REQUEST_BLOCK = 12
WEB64_LOADER_PACKED_REQUEST_SIZE = 13
WEB64_LOADER_PACKED_REQUEST_ALL = 255
WEB64_LOADER_REQUEST_NAME = 0
WEB64_LOADER_REQUEST_NAME_LENGTH = 2
WEB64_LOADER_REQUEST_STAGE = 3
WEB64_LOADER_REQUEST_STAGE_CAPACITY = 5
WEB64_LOADER_REQUEST_DESTINATION = 7
WEB64_LOADER_REQUEST_CAPACITY = 9
WEB64_LOADER_REQUEST_WORKSPACE = 11
WEB64_LOADER_REQUEST_WORKSPACE_CAPACITY = 13
WEB64_LOADER_REQUEST_BLOCK = 15
WEB64_LOADER_REQUEST_SIZE = 16

; Web64 _web64_rt C/assembly call helpers for <web64/loader.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_LOADER_CALL_COUNT = 11
WEB64_RT_LOADER_WINDOW_CALL_COUNT = 5

; web64_loader_abort: parameterless entry _web64_loader_abort
.macro web64_rt_call_loader_abort
    jsr _web64_loader_abort
.endmacro

; web64_loader_init: 5-byte window; entry _web64_loader_init
.macro web64_rt_prepare_loader_init device, sector, ticks
    lda #device
    sta _web64_loader_init__arg_device
    lda #<sector
    sta _web64_loader_init__arg_sector
    lda #>sector
    sta _web64_loader_init__arg_sector+1
    lda #<ticks
    sta _web64_loader_init__arg_ticks
    lda #>ticks
    sta _web64_loader_init__arg_ticks+1
.endmacro

.macro web64_rt_call_loader_init device, sector, ticks
    web64_rt_prepare_loader_init device, sector, ticks
    jsr _web64_loader_init
.endmacro

; web64_loader_last_origin: parameterless entry _web64_loader_last_origin
.macro web64_rt_call_loader_last_origin
    jsr _web64_loader_last_origin
.endmacro

; web64_loader_last_size: parameterless entry _web64_loader_last_size
.macro web64_rt_call_loader_last_size
    jsr _web64_loader_last_size
.endmacro

; web64_loader_load_packed: 2-byte window; entry _web64_loader_load_packed
.macro web64_rt_prepare_loader_load_packed request
    lda #<request
    sta _web64_loader_load_packed__arg_request
    lda #>request
    sta _web64_loader_load_packed__arg_request+1
.endmacro

.macro web64_rt_call_loader_load_packed request
    web64_rt_prepare_loader_load_packed request
    jsr _web64_loader_load_packed
.endmacro

; web64_loader_load_raw: 2-byte window; entry _web64_loader_load_raw
.macro web64_rt_prepare_loader_load_raw request
    lda #<request
    sta _web64_loader_load_raw__arg_request
    lda #>request
    sta _web64_loader_load_raw__arg_request+1
.endmacro

.macro web64_rt_call_loader_load_raw request
    web64_rt_prepare_loader_load_raw request
    jsr _web64_loader_load_raw
.endmacro

; web64_loader_read: 7-byte window; entry _web64_loader_read
.macro web64_rt_prepare_loader_read name, length, stage, capacity
    lda #<name
    sta _web64_loader_read__arg_name
    lda #>name
    sta _web64_loader_read__arg_name+1
    lda #length
    sta _web64_loader_read__arg_length
    lda #<stage
    sta _web64_loader_read__arg_stage
    lda #>stage
    sta _web64_loader_read__arg_stage+1
    lda #<capacity
    sta _web64_loader_read__arg_capacity
    lda #>capacity
    sta _web64_loader_read__arg_capacity+1
.endmacro

.macro web64_rt_call_loader_read name, length, stage, capacity
    web64_rt_prepare_loader_read name, length, stage, capacity
    jsr _web64_loader_read
.endmacro

; web64_loader_reinitialize_after_save: parameterless entry _web64_loader_reinitialize_after_save
.macro web64_rt_call_loader_reinitialize_after_save
    jsr _web64_loader_reinitialize_after_save
.endmacro

; web64_loader_shutdown: parameterless entry _web64_loader_shutdown
.macro web64_rt_call_loader_shutdown
    jsr _web64_loader_shutdown
.endmacro

; web64_loader_status: parameterless entry _web64_loader_status
.macro web64_rt_call_loader_status
    jsr _web64_loader_status
.endmacro

; web64_loader_unpack: 2-byte window; entry _web64_loader_unpack
.macro web64_rt_prepare_loader_unpack request
    lda #<request
    sta _web64_loader_unpack__arg_request
    lda #>request
    sta _web64_loader_unpack__arg_request+1
.endmacro

.macro web64_rt_call_loader_unpack request
    web64_rt_prepare_loader_unpack request
    jsr _web64_loader_unpack
.endmacro

web64/motion.h

#ifndef WEB64_MOTION_H
#define WEB64_MOTION_H
#include <web64/game.h>
#define WEB64_MOTION_HIT_MIN_X 1
#define WEB64_MOTION_HIT_MAX_X 2
#define WEB64_MOTION_HIT_MIN_Y 4
#define WEB64_MOTION_HIT_MAX_Y 8
typedef struct { web64_pos_t x; web64_pos_t y; web64_vel_t vx; web64_vel_t vy; } Web64Body2D;
typedef struct { uint16_t acceleration; uint16_t braking; uint16_t maximum; uint16_t gravity; uint16_t terminal; } Web64MotionProfile;
_web64_rt int16_t web64_motion_axis(int16_t velocity, int8_t intent, uint16_t acceleration, uint16_t braking, uint16_t maximum);
_web64_rt int16_t web64_motion_steer_s16(int16_t velocity, int8_t intent, uint8_t acceleration, uint8_t braking, uint8_t reversal, uint8_t maximum);
_web64_rt void web64_motion_integrate(uint16_t *position, int16_t velocity);
_web64_rt uint8_t web64_motion_clamp(uint16_t *position, int16_t *velocity, uint16_t minimum, uint16_t maximum);
_web64_rt void web64_motion_wrap(uint16_t *position, uint16_t minimum, uint16_t maximum);
_web64_rt void web64_motion_integrate_s16(int16_t *position, int16_t velocity);
_web64_rt uint8_t web64_motion_clamp_s16(int16_t *position, int16_t *velocity, int16_t minimum, int16_t maximum);
_web64_rt void web64_motion_wrap_s16(int16_t *position, int16_t minimum, int16_t maximum);
#define web64_motion_apply_gravity(velocity, gravity, terminal) web64_motion_axis((velocity), 1, (gravity), 0, (terminal))
#define web64_motion_jump(velocity, impulse) ((velocity) = (web64_vel_t)(-(int16_t)(impulse)))
#define web64_motion_brake(velocity, braking) web64_motion_axis((velocity), 0, 0, (braking), 0x7fff)
#define web64_motion_platform(body, intent, profile) ((body)->vx = web64_motion_axis((body)->vx, (intent), (profile)->acceleration, (profile)->braking, (profile)->maximum), (body)->vy = web64_motion_apply_gravity((body)->vy, (profile)->gravity, (profile)->terminal), web64_motion_integrate(&(body)->x, (body)->vx), web64_motion_integrate(&(body)->y, (body)->vy))
#endif

web64/motion.inc

; Web64 _web64_rt C/assembly call helpers for <web64/motion.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_MOTION_CALL_COUNT = 8
WEB64_RT_MOTION_WINDOW_CALL_COUNT = 8

; web64_motion_axis: 9-byte window; entry _web64_motion_axis
.macro web64_rt_prepare_motion_axis velocity, intent, acceleration, braking, maximum
    lda #<velocity
    sta _web64_motion_axis__arg_velocity
    lda #>velocity
    sta _web64_motion_axis__arg_velocity+1
    lda #intent
    sta _web64_motion_axis__arg_intent
    lda #<acceleration
    sta _web64_motion_axis__arg_acceleration
    lda #>acceleration
    sta _web64_motion_axis__arg_acceleration+1
    lda #<braking
    sta _web64_motion_axis__arg_braking
    lda #>braking
    sta _web64_motion_axis__arg_braking+1
    lda #<maximum
    sta _web64_motion_axis__arg_maximum
    lda #>maximum
    sta _web64_motion_axis__arg_maximum+1
.endmacro

.macro web64_rt_call_motion_axis velocity, intent, acceleration, braking, maximum
    web64_rt_prepare_motion_axis velocity, intent, acceleration, braking, maximum
    jsr _web64_motion_axis
.endmacro

; web64_motion_clamp: 8-byte window; entry _web64_motion_clamp
.macro web64_rt_prepare_motion_clamp position, velocity, minimum, maximum
    lda #<position
    sta _web64_motion_clamp__arg_position
    lda #>position
    sta _web64_motion_clamp__arg_position+1
    lda #<velocity
    sta _web64_motion_clamp__arg_velocity
    lda #>velocity
    sta _web64_motion_clamp__arg_velocity+1
    lda #<minimum
    sta _web64_motion_clamp__arg_minimum
    lda #>minimum
    sta _web64_motion_clamp__arg_minimum+1
    lda #<maximum
    sta _web64_motion_clamp__arg_maximum
    lda #>maximum
    sta _web64_motion_clamp__arg_maximum+1
.endmacro

.macro web64_rt_call_motion_clamp position, velocity, minimum, maximum
    web64_rt_prepare_motion_clamp position, velocity, minimum, maximum
    jsr _web64_motion_clamp
.endmacro

; web64_motion_clamp_s16: 8-byte window; entry _web64_motion_clamp_s16
.macro web64_rt_prepare_motion_clamp_s16 position, velocity, minimum, maximum
    lda #<position
    sta _web64_motion_clamp_s16__arg_position
    lda #>position
    sta _web64_motion_clamp_s16__arg_position+1
    lda #<velocity
    sta _web64_motion_clamp_s16__arg_velocity
    lda #>velocity
    sta _web64_motion_clamp_s16__arg_velocity+1
    lda #<minimum
    sta _web64_motion_clamp_s16__arg_minimum
    lda #>minimum
    sta _web64_motion_clamp_s16__arg_minimum+1
    lda #<maximum
    sta _web64_motion_clamp_s16__arg_maximum
    lda #>maximum
    sta _web64_motion_clamp_s16__arg_maximum+1
.endmacro

.macro web64_rt_call_motion_clamp_s16 position, velocity, minimum, maximum
    web64_rt_prepare_motion_clamp_s16 position, velocity, minimum, maximum
    jsr _web64_motion_clamp_s16
.endmacro

; web64_motion_integrate: 4-byte window; entry _web64_motion_integrate
.macro web64_rt_prepare_motion_integrate position, velocity
    lda #<position
    sta _web64_motion_integrate__arg_position
    lda #>position
    sta _web64_motion_integrate__arg_position+1
    lda #<velocity
    sta _web64_motion_integrate__arg_velocity
    lda #>velocity
    sta _web64_motion_integrate__arg_velocity+1
.endmacro

.macro web64_rt_call_motion_integrate position, velocity
    web64_rt_prepare_motion_integrate position, velocity
    jsr _web64_motion_integrate
.endmacro

; web64_motion_integrate_s16: 4-byte window; entry _web64_motion_integrate_s16
.macro web64_rt_prepare_motion_integrate_s16 position, velocity
    lda #<position
    sta _web64_motion_integrate_s16__arg_position
    lda #>position
    sta _web64_motion_integrate_s16__arg_position+1
    lda #<velocity
    sta _web64_motion_integrate_s16__arg_velocity
    lda #>velocity
    sta _web64_motion_integrate_s16__arg_velocity+1
.endmacro

.macro web64_rt_call_motion_integrate_s16 position, velocity
    web64_rt_prepare_motion_integrate_s16 position, velocity
    jsr _web64_motion_integrate_s16
.endmacro

; web64_motion_steer_s16: 7-byte window; entry _web64_motion_steer_s16
.macro web64_rt_prepare_motion_steer_s16 velocity, intent, acceleration, braking, reversal, maximum
    lda #<velocity
    sta _web64_motion_steer_s16__arg_velocity
    lda #>velocity
    sta _web64_motion_steer_s16__arg_velocity+1
    lda #intent
    sta _web64_motion_steer_s16__arg_intent
    lda #acceleration
    sta _web64_motion_steer_s16__arg_acceleration
    lda #braking
    sta _web64_motion_steer_s16__arg_braking
    lda #reversal
    sta _web64_motion_steer_s16__arg_reversal
    lda #maximum
    sta _web64_motion_steer_s16__arg_maximum
.endmacro

.macro web64_rt_call_motion_steer_s16 velocity, intent, acceleration, braking, reversal, maximum
    web64_rt_prepare_motion_steer_s16 velocity, intent, acceleration, braking, reversal, maximum
    jsr _web64_motion_steer_s16
.endmacro

; web64_motion_wrap: 6-byte window; entry _web64_motion_wrap
.macro web64_rt_prepare_motion_wrap position, minimum, maximum
    lda #<position
    sta _web64_motion_wrap__arg_position
    lda #>position
    sta _web64_motion_wrap__arg_position+1
    lda #<minimum
    sta _web64_motion_wrap__arg_minimum
    lda #>minimum
    sta _web64_motion_wrap__arg_minimum+1
    lda #<maximum
    sta _web64_motion_wrap__arg_maximum
    lda #>maximum
    sta _web64_motion_wrap__arg_maximum+1
.endmacro

.macro web64_rt_call_motion_wrap position, minimum, maximum
    web64_rt_prepare_motion_wrap position, minimum, maximum
    jsr _web64_motion_wrap
.endmacro

; web64_motion_wrap_s16: 6-byte window; entry _web64_motion_wrap_s16
.macro web64_rt_prepare_motion_wrap_s16 position, minimum, maximum
    lda #<position
    sta _web64_motion_wrap_s16__arg_position
    lda #>position
    sta _web64_motion_wrap_s16__arg_position+1
    lda #<minimum
    sta _web64_motion_wrap_s16__arg_minimum
    lda #>minimum
    sta _web64_motion_wrap_s16__arg_minimum+1
    lda #<maximum
    sta _web64_motion_wrap_s16__arg_maximum
    lda #>maximum
    sta _web64_motion_wrap_s16__arg_maximum+1
.endmacro

.macro web64_rt_call_motion_wrap_s16 position, minimum, maximum
    web64_rt_prepare_motion_wrap_s16 position, minimum, maximum
    jsr _web64_motion_wrap_s16
.endmacro

web64/reu.h

#ifndef WEB64_REU_H
#define WEB64_REU_H
#include <stdint.h>
#define WEB64_REU_REG_STATUS 0xDF00U
#define WEB64_REU_REG_COMMAND 0xDF01U
#define WEB64_REU_REG_C64_ADDRESS_LO 0xDF02U
#define WEB64_REU_REG_C64_ADDRESS_HI 0xDF03U
#define WEB64_REU_REG_REU_ADDRESS_LO 0xDF04U
#define WEB64_REU_REG_REU_ADDRESS_MID 0xDF05U
#define WEB64_REU_REG_REU_ADDRESS_HI 0xDF06U
#define WEB64_REU_REG_LENGTH_LO 0xDF07U
#define WEB64_REU_REG_LENGTH_HI 0xDF08U
#define WEB64_REU_REG_IRQ_MASK 0xDF09U
#define WEB64_REU_REG_ADDRESS_CONTROL 0xDF0AU
#define WEB64_REU_OK 0
#define WEB64_REU_NOT_INITIALIZED 1
#define WEB64_REU_UNAVAILABLE 2
#define WEB64_REU_RANGE 3
#define WEB64_REU_BUFFER 4
#define WEB64_REU_BUSY 5
#define WEB64_REU_TRANSFER 6
#define WEB64_REU_MAX_BURST 256
typedef struct { uint8_t *buffer; uint32_t reuOffset; uint16_t length; } web64_reu_request;
typedef struct { uint16_t completed; } web64_reu_result;
_web64_rt uint8_t web64_reu_init(void);
_web64_rt uint8_t web64_reu_store(const web64_reu_request *request, web64_reu_result *result);
_web64_rt uint8_t web64_reu_fetch(const web64_reu_request *request, web64_reu_result *result);
#endif

web64/reu.inc

WEB64_REU_REG_STATUS = $DF00
WEB64_REU_REG_COMMAND = $DF01
WEB64_REU_REG_C64_ADDRESS_LO = $DF02
WEB64_REU_REG_C64_ADDRESS_HI = $DF03
WEB64_REU_REG_REU_ADDRESS_LO = $DF04
WEB64_REU_REG_REU_ADDRESS_MID = $DF05
WEB64_REU_REG_REU_ADDRESS_HI = $DF06
WEB64_REU_REG_LENGTH_LO = $DF07
WEB64_REU_REG_LENGTH_HI = $DF08
WEB64_REU_REG_IRQ_MASK = $DF09
WEB64_REU_REG_ADDRESS_CONTROL = $DF0A
WEB64_REU_OK = 0
WEB64_REU_NOT_INITIALIZED = 1
WEB64_REU_UNAVAILABLE = 2
WEB64_REU_RANGE = 3
WEB64_REU_BUFFER = 4
WEB64_REU_BUSY = 5
WEB64_REU_TRANSFER = 6
WEB64_REU_REQUEST_BUFFER = 0
WEB64_REU_REQUEST_REU_OFFSET = 2
WEB64_REU_REQUEST_LENGTH = 6
WEB64_REU_REQUEST_SIZE = 8
WEB64_REU_RESULT_COMPLETED = 0
WEB64_REU_RESULT_SIZE = 2
WEB64_REU_MAX_BURST = 256

; Web64 _web64_rt C/assembly call helpers for <web64/reu.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_REU_CALL_COUNT = 3
WEB64_RT_REU_WINDOW_CALL_COUNT = 3

; web64_reu_fetch: 4-byte window; entry _web64_reu_fetch
.macro web64_rt_prepare_reu_fetch request, result
    lda #<request
    sta _web64_reu_fetch__arg_request
    lda #>request
    sta _web64_reu_fetch__arg_request+1
    lda #<result
    sta _web64_reu_fetch__arg_result
    lda #>result
    sta _web64_reu_fetch__arg_result+1
.endmacro

.macro web64_rt_call_reu_fetch request, result
    web64_rt_prepare_reu_fetch request, result
    jsr _web64_reu_fetch
.endmacro

; web64_reu_init: 0-byte window; entry _web64_reu_init
.macro web64_rt_prepare_reu_init
.endmacro

.macro web64_rt_call_reu_init
    web64_rt_prepare_reu_init
    jsr _web64_reu_init
.endmacro

; web64_reu_store: 4-byte window; entry _web64_reu_store
.macro web64_rt_prepare_reu_store request, result
    lda #<request
    sta _web64_reu_store__arg_request
    lda #>request
    sta _web64_reu_store__arg_request+1
    lda #<result
    sta _web64_reu_store__arg_result
    lda #>result
    sta _web64_reu_store__arg_result+1
.endmacro

.macro web64_rt_call_reu_store request, result
    web64_rt_prepare_reu_store request, result
    jsr _web64_reu_store
.endmacro

web64/runtime.inc

; Web64 runtime _web64_rt ABI registry v8
; Including this file links no runtime code.
; Referencing an entry label from assembly exact-links that entry and its window.
; Each linked entry defines the named and positional symbols listed below.
; Populate the complete window before JSR; windows are mainline-only and non-reentrant.
WEB64_RT_REGISTRY_VERSION = 8
WEB64_RT_ABI_EXACT_WIDTH_NAMED_WINDOW_V1 = 1
WEB64_RT_ARGUMENT_WINDOW_COUNT = 166

; _web64_actor_activate: _web64_actor_activate__arg_window, 8 byte(s)
;   +0 active[2] -> _web64_actor_activate__arg_active / _web64_actor_activate__arg0 (0)
;   +2 active_ids[2] -> _web64_actor_activate__arg_active_ids / _web64_actor_activate__arg1 (1)
;   +4 active_count[2] -> _web64_actor_activate__arg_active_count / _web64_actor_activate__arg2 (2)
;   +6 capacity[1] -> _web64_actor_activate__arg_capacity / _web64_actor_activate__arg3 (3)
;   +7 actor[1] -> _web64_actor_activate__arg_actor / _web64_actor_activate__arg4 (4)
; _web64_actor_batch_animation_tick: _web64_actor_batch_animation_tick__arg_window, 6 byte(s)
;   +0 view[2] -> _web64_actor_batch_animation_tick__arg_view / _web64_actor_batch_animation_tick__arg0 (0)
;   +2 animation[2] -> _web64_actor_batch_animation_tick__arg_animation / _web64_actor_batch_animation_tick__arg1 (1)
;   +4 status[2] -> _web64_actor_batch_animation_tick__arg_status / _web64_actor_batch_animation_tick__arg2 (2)
; _web64_actor_batch_animation_tick_fast: _web64_actor_batch_animation_tick_fast__arg_window, 6 byte(s)
;   +0 view[2] -> _web64_actor_batch_animation_tick_fast__arg_view / _web64_actor_batch_animation_tick_fast__arg0 (0)
;   +2 animation[2] -> _web64_actor_batch_animation_tick_fast__arg_animation / _web64_actor_batch_animation_tick_fast__arg1 (1)
;   +4 status[2] -> _web64_actor_batch_animation_tick_fast__arg_status / _web64_actor_batch_animation_tick_fast__arg2 (2)
; _web64_actor_batch_build_commands: _web64_actor_batch_build_commands__arg_window, 10 byte(s)
;   +0 view[2] -> _web64_actor_batch_build_commands__arg_view / _web64_actor_batch_build_commands__arg0 (0)
;   +2 visible[2] -> _web64_actor_batch_build_commands__arg_visible / _web64_actor_batch_build_commands__arg1 (1)
;   +4 sprites[2] -> _web64_actor_batch_build_commands__arg_sprites / _web64_actor_batch_build_commands__arg2 (2)
;   +6 commands[2] -> _web64_actor_batch_build_commands__arg_commands / _web64_actor_batch_build_commands__arg3 (3)
;   +8 status[2] -> _web64_actor_batch_build_commands__arg_status / _web64_actor_batch_build_commands__arg4 (4)
; _web64_actor_batch_build_commands_fast: _web64_actor_batch_build_commands_fast__arg_window, 10 byte(s)
;   +0 view[2] -> _web64_actor_batch_build_commands_fast__arg_view / _web64_actor_batch_build_commands_fast__arg0 (0)
;   +2 visible[2] -> _web64_actor_batch_build_commands_fast__arg_visible / _web64_actor_batch_build_commands_fast__arg1 (1)
;   +4 sprites[2] -> _web64_actor_batch_build_commands_fast__arg_sprites / _web64_actor_batch_build_commands_fast__arg2 (2)
;   +6 commands[2] -> _web64_actor_batch_build_commands_fast__arg_commands / _web64_actor_batch_build_commands_fast__arg3 (3)
;   +8 status[2] -> _web64_actor_batch_build_commands_fast__arg_status / _web64_actor_batch_build_commands_fast__arg4 (4)
; _web64_actor_batch_cull: _web64_actor_batch_cull__arg_window, 8 byte(s)
;   +0 view[2] -> _web64_actor_batch_cull__arg_view / _web64_actor_batch_cull__arg0 (0)
;   +2 viewport[2] -> _web64_actor_batch_cull__arg_viewport / _web64_actor_batch_cull__arg1 (1)
;   +4 visible[2] -> _web64_actor_batch_cull__arg_visible / _web64_actor_batch_cull__arg2 (2)
;   +6 status[2] -> _web64_actor_batch_cull__arg_status / _web64_actor_batch_cull__arg3 (3)
; _web64_actor_batch_cull_fast: _web64_actor_batch_cull_fast__arg_window, 8 byte(s)
;   +0 view[2] -> _web64_actor_batch_cull_fast__arg_view / _web64_actor_batch_cull_fast__arg0 (0)
;   +2 viewport[2] -> _web64_actor_batch_cull_fast__arg_viewport / _web64_actor_batch_cull_fast__arg1 (1)
;   +4 visible[2] -> _web64_actor_batch_cull_fast__arg_visible / _web64_actor_batch_cull_fast__arg2 (2)
;   +6 status[2] -> _web64_actor_batch_cull_fast__arg_status / _web64_actor_batch_cull_fast__arg3 (3)
; _web64_actor_batch_integrate_x: _web64_actor_batch_integrate_x__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_x__arg_view / _web64_actor_batch_integrate_x__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_x__arg_status / _web64_actor_batch_integrate_x__arg1 (1)
; _web64_actor_batch_integrate_x_fast: _web64_actor_batch_integrate_x_fast__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_x_fast__arg_view / _web64_actor_batch_integrate_x_fast__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_x_fast__arg_status / _web64_actor_batch_integrate_x_fast__arg1 (1)
; _web64_actor_batch_integrate_xy: _web64_actor_batch_integrate_xy__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_xy__arg_view / _web64_actor_batch_integrate_xy__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_xy__arg_status / _web64_actor_batch_integrate_xy__arg1 (1)
; _web64_actor_batch_integrate_xy_fast: _web64_actor_batch_integrate_xy_fast__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_xy_fast__arg_view / _web64_actor_batch_integrate_xy_fast__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_xy_fast__arg_status / _web64_actor_batch_integrate_xy_fast__arg1 (1)
; _web64_actor_batch_integrate_y: _web64_actor_batch_integrate_y__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_y__arg_view / _web64_actor_batch_integrate_y__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_y__arg_status / _web64_actor_batch_integrate_y__arg1 (1)
; _web64_actor_batch_integrate_y_fast: _web64_actor_batch_integrate_y_fast__arg_window, 4 byte(s)
;   +0 view[2] -> _web64_actor_batch_integrate_y_fast__arg_view / _web64_actor_batch_integrate_y_fast__arg0 (0)
;   +2 status[2] -> _web64_actor_batch_integrate_y_fast__arg_status / _web64_actor_batch_integrate_y_fast__arg1 (1)
; _web64_actor_batch_pairs_x: _web64_actor_batch_pairs_x__arg_window, 8 byte(s)
;   +0 view[2] -> _web64_actor_batch_pairs_x__arg_view / _web64_actor_batch_pairs_x__arg0 (0)
;   +2 workspace[2] -> _web64_actor_batch_pairs_x__arg_workspace / _web64_actor_batch_pairs_x__arg1 (1)
;   +4 pairs[2] -> _web64_actor_batch_pairs_x__arg_pairs / _web64_actor_batch_pairs_x__arg2 (2)
;   +6 status[2] -> _web64_actor_batch_pairs_x__arg_status / _web64_actor_batch_pairs_x__arg3 (3)
; _web64_actor_batch_pairs_x_fast: _web64_actor_batch_pairs_x_fast__arg_window, 8 byte(s)
;   +0 view[2] -> _web64_actor_batch_pairs_x_fast__arg_view / _web64_actor_batch_pairs_x_fast__arg0 (0)
;   +2 workspace[2] -> _web64_actor_batch_pairs_x_fast__arg_workspace / _web64_actor_batch_pairs_x_fast__arg1 (1)
;   +4 pairs[2] -> _web64_actor_batch_pairs_x_fast__arg_pairs / _web64_actor_batch_pairs_x_fast__arg2 (2)
;   +6 status[2] -> _web64_actor_batch_pairs_x_fast__arg_status / _web64_actor_batch_pairs_x_fast__arg3 (3)
; _web64_actor_batch_run_mux: _web64_actor_batch_run_mux__arg_window, 2 byte(s)
;   +0 pipeline[2] -> _web64_actor_batch_run_mux__arg_pipeline / _web64_actor_batch_run_mux__arg0 (0)
; _web64_actor_batch_run_mux_fast: _web64_actor_batch_run_mux_fast__arg_window, 2 byte(s)
;   +0 pipeline[2] -> _web64_actor_batch_run_mux_fast__arg_pipeline / _web64_actor_batch_run_mux_fast__arg0 (0)
; _web64_actor_commands_render_direct: _web64_actor_commands_render_direct__arg_window, 7 byte(s)
;   +0 renderer[2] -> _web64_actor_commands_render_direct__arg_renderer / _web64_actor_commands_render_direct__arg0 (0)
;   +2 commands[2] -> _web64_actor_commands_render_direct__arg_commands / _web64_actor_commands_render_direct__arg1 (1)
;   +4 owned_slots[1] -> _web64_actor_commands_render_direct__arg_owned_slots / _web64_actor_commands_render_direct__arg2 (2)
;   +5 status[2] -> _web64_actor_commands_render_direct__arg_status / _web64_actor_commands_render_direct__arg3 (3)
; _web64_actor_commands_render_direct_fast: _web64_actor_commands_render_direct_fast__arg_window, 7 byte(s)
;   +0 renderer[2] -> _web64_actor_commands_render_direct_fast__arg_renderer / _web64_actor_commands_render_direct_fast__arg0 (0)
;   +2 commands[2] -> _web64_actor_commands_render_direct_fast__arg_commands / _web64_actor_commands_render_direct_fast__arg1 (1)
;   +4 owned_slots[1] -> _web64_actor_commands_render_direct_fast__arg_owned_slots / _web64_actor_commands_render_direct_fast__arg2 (2)
;   +5 status[2] -> _web64_actor_commands_render_direct_fast__arg_status / _web64_actor_commands_render_direct_fast__arg3 (3)
; _web64_actor_commands_submit_mux: _web64_actor_commands_submit_mux__arg_window, 6 byte(s)
;   +0 mux[2] -> _web64_actor_commands_submit_mux__arg_mux / _web64_actor_commands_submit_mux__arg0 (0)
;   +2 commands[2] -> _web64_actor_commands_submit_mux__arg_commands / _web64_actor_commands_submit_mux__arg1 (1)
;   +4 status[2] -> _web64_actor_commands_submit_mux__arg_status / _web64_actor_commands_submit_mux__arg2 (2)
; _web64_actor_commands_submit_mux_fast: _web64_actor_commands_submit_mux_fast__arg_window, 6 byte(s)
;   +0 mux[2] -> _web64_actor_commands_submit_mux_fast__arg_mux / _web64_actor_commands_submit_mux_fast__arg0 (0)
;   +2 commands[2] -> _web64_actor_commands_submit_mux_fast__arg_commands / _web64_actor_commands_submit_mux_fast__arg1 (1)
;   +4 status[2] -> _web64_actor_commands_submit_mux_fast__arg_status / _web64_actor_commands_submit_mux_fast__arg2 (2)
; _web64_actor_deactivate: _web64_actor_deactivate__arg_window, 7 byte(s)
;   +0 active[2] -> _web64_actor_deactivate__arg_active / _web64_actor_deactivate__arg0 (0)
;   +2 active_ids[2] -> _web64_actor_deactivate__arg_active_ids / _web64_actor_deactivate__arg1 (1)
;   +4 active_count[2] -> _web64_actor_deactivate__arg_active_count / _web64_actor_deactivate__arg2 (2)
;   +6 actor[1] -> _web64_actor_deactivate__arg_actor / _web64_actor_deactivate__arg3 (3)
; _web64_actor_sprite_bind_asset: _web64_actor_sprite_bind_asset__arg_window, 8 byte(s)
;   +0 sprites[2] -> _web64_actor_sprite_bind_asset__arg_sprites / _web64_actor_sprite_bind_asset__arg0 (0)
;   +2 actor[1] -> _web64_actor_sprite_bind_asset__arg_actor / _web64_actor_sprite_bind_asset__arg1 (1)
;   +3 asset[2] -> _web64_actor_sprite_bind_asset__arg_asset / _web64_actor_sprite_bind_asset__arg2 (2)
;   +5 pointer_base[1] -> _web64_actor_sprite_bind_asset__arg_pointer_base / _web64_actor_sprite_bind_asset__arg3 (3)
;   +6 flags[1] -> _web64_actor_sprite_bind_asset__arg_flags / _web64_actor_sprite_bind_asset__arg4 (4)
;   +7 priority[1] -> _web64_actor_sprite_bind_asset__arg_priority / _web64_actor_sprite_bind_asset__arg5 (5)
; _web64_actor_sprite_bind_asset_pair: _web64_actor_sprite_bind_asset_pair__arg_window, 7 byte(s)
;   +0 sprites[2] -> _web64_actor_sprite_bind_asset_pair__arg_sprites / _web64_actor_sprite_bind_asset_pair__arg0 (0)
;   +2 actor[1] -> _web64_actor_sprite_bind_asset_pair__arg_actor / _web64_actor_sprite_bind_asset_pair__arg1 (1)
;   +3 binding[2] -> _web64_actor_sprite_bind_asset_pair__arg_binding / _web64_actor_sprite_bind_asset_pair__arg2 (2)
;   +5 flags[1] -> _web64_actor_sprite_bind_asset_pair__arg_flags / _web64_actor_sprite_bind_asset_pair__arg3 (3)
;   +6 priority[1] -> _web64_actor_sprite_bind_asset_pair__arg_priority / _web64_actor_sprite_bind_asset_pair__arg4 (4)
; _web64_actor_sprite_bind_raw: _web64_actor_sprite_bind_raw__arg_window, 9 byte(s)
;   +0 sprites[2] -> _web64_actor_sprite_bind_raw__arg_sprites / _web64_actor_sprite_bind_raw__arg0 (0)
;   +2 actor[1] -> _web64_actor_sprite_bind_raw__arg_actor / _web64_actor_sprite_bind_raw__arg1 (1)
;   +3 pointer_base[1] -> _web64_actor_sprite_bind_raw__arg_pointer_base / _web64_actor_sprite_bind_raw__arg2 (2)
;   +4 frame_count[2] -> _web64_actor_sprite_bind_raw__arg_frame_count / _web64_actor_sprite_bind_raw__arg3 (3)
;   +6 color[1] -> _web64_actor_sprite_bind_raw__arg_color / _web64_actor_sprite_bind_raw__arg4 (4)
;   +7 flags[1] -> _web64_actor_sprite_bind_raw__arg_flags / _web64_actor_sprite_bind_raw__arg5 (5)
;   +8 priority[1] -> _web64_actor_sprite_bind_raw__arg_priority / _web64_actor_sprite_bind_raw__arg6 (6)
; _web64_actor_sprite_unbind: _web64_actor_sprite_unbind__arg_window, 3 byte(s)
;   +0 sprites[2] -> _web64_actor_sprite_unbind__arg_sprites / _web64_actor_sprite_unbind__arg0 (0)
;   +2 actor[1] -> _web64_actor_sprite_unbind__arg_actor / _web64_actor_sprite_unbind__arg1 (1)
; _web64_animation_init: _web64_animation_init__arg_window, 4 byte(s)
;   +0 player[2] -> _web64_animation_init__arg_player / _web64_animation_init__arg0 (0)
;   +2 bank[2] -> _web64_animation_init__arg_bank / _web64_animation_init__arg1 (1)
; _web64_animation_play: _web64_animation_play__arg_window, 4 byte(s)
;   +0 player[2] -> _web64_animation_play__arg_player / _web64_animation_play__arg0 (0)
;   +2 sequence[1] -> _web64_animation_play__arg_sequence / _web64_animation_play__arg1 (1)
;   +3 policy[1] -> _web64_animation_play__arg_policy / _web64_animation_play__arg2 (2)
; _web64_animation_queue: _web64_animation_queue__arg_window, 3 byte(s)
;   +0 player[2] -> _web64_animation_queue__arg_player / _web64_animation_queue__arg0 (0)
;   +2 sequence[1] -> _web64_animation_queue__arg_sequence / _web64_animation_queue__arg1 (1)
; _web64_animation_take_events: _web64_animation_take_events__arg_window, 2 byte(s)
;   +0 player[2] -> _web64_animation_take_events__arg_player / _web64_animation_take_events__arg0 (0)
; _web64_animation_tick: _web64_animation_tick__arg_window, 2 byte(s)
;   +0 player[2] -> _web64_animation_tick__arg_player / _web64_animation_tick__arg0 (0)
; _web64_asset_copy: _web64_asset_copy__arg_window, 6 byte(s)
;   +0 destination[2] -> _web64_asset_copy__arg_destination / _web64_asset_copy__arg0 (0)
;   +2 source[2] -> _web64_asset_copy__arg_source / _web64_asset_copy__arg1 (1)
;   +4 length[2] -> _web64_asset_copy__arg_length / _web64_asset_copy__arg2 (2)
; _web64_asset_copy_block: _web64_asset_copy_block__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_block__arg_destination / _web64_asset_copy_block__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_block__arg_asset / _web64_asset_copy_block__arg1 (1)
; _web64_asset_copy_blockset: _web64_asset_copy_blockset__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_blockset__arg_destination / _web64_asset_copy_blockset__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_blockset__arg_asset / _web64_asset_copy_blockset__arg1 (1)
; _web64_asset_copy_char: _web64_asset_copy_char__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_char__arg_destination / _web64_asset_copy_char__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_char__arg_asset / _web64_asset_copy_char__arg1 (1)
; _web64_asset_copy_charset: _web64_asset_copy_charset__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_charset__arg_destination / _web64_asset_copy_charset__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_charset__arg_asset / _web64_asset_copy_charset__arg1 (1)
; _web64_asset_copy_map_plane: _web64_asset_copy_map_plane__arg_window, 5 byte(s)
;   +0 destination[2] -> _web64_asset_copy_map_plane__arg_destination / _web64_asset_copy_map_plane__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_map_plane__arg_asset / _web64_asset_copy_map_plane__arg1 (1)
;   +4 plane[1] -> _web64_asset_copy_map_plane__arg_plane / _web64_asset_copy_map_plane__arg2 (2)
; _web64_asset_copy_sid_payload: _web64_asset_copy_sid_payload__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_sid_payload__arg_destination / _web64_asset_copy_sid_payload__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_sid_payload__arg_asset / _web64_asset_copy_sid_payload__arg1 (1)
; _web64_asset_copy_sprite: _web64_asset_copy_sprite__arg_window, 4 byte(s)
;   +0 destination[2] -> _web64_asset_copy_sprite__arg_destination / _web64_asset_copy_sprite__arg0 (0)
;   +2 asset[2] -> _web64_asset_copy_sprite__arg_asset / _web64_asset_copy_sprite__arg1 (1)
; _web64_asset_copy_sprite_pair: _web64_asset_copy_sprite_pair__arg_window, 6 byte(s)
;   +0 base_destination[2] -> _web64_asset_copy_sprite_pair__arg_base_destination / _web64_asset_copy_sprite_pair__arg0 (0)
;   +2 overlay_destination[2] -> _web64_asset_copy_sprite_pair__arg_overlay_destination / _web64_asset_copy_sprite_pair__arg1 (1)
;   +4 asset[2] -> _web64_asset_copy_sprite_pair__arg_asset / _web64_asset_copy_sprite_pair__arg2 (2)
; _web64_bitmap_activate: _web64_bitmap_activate__arg_window, 2 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_activate__arg_bitmap / _web64_bitmap_activate__arg0 (0)
; _web64_bitmap_clear: _web64_bitmap_clear__arg_window, 3 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_clear__arg_bitmap / _web64_bitmap_clear__arg0 (0)
;   +2 pixel[1] -> _web64_bitmap_clear__arg_pixel / _web64_bitmap_clear__arg1 (1)
; _web64_bitmap_configure: _web64_bitmap_configure__arg_window, 7 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_configure__arg_bitmap / _web64_bitmap_configure__arg0 (0)
;   +2 pixels[2] -> _web64_bitmap_configure__arg_pixels / _web64_bitmap_configure__arg1 (1)
;   +4 screen[2] -> _web64_bitmap_configure__arg_screen / _web64_bitmap_configure__arg2 (2)
;   +6 mode[1] -> _web64_bitmap_configure__arg_mode / _web64_bitmap_configure__arg3 (3)
; _web64_bitmap_ellipse: _web64_bitmap_ellipse__arg_window, 12 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_ellipse__arg_bitmap / _web64_bitmap_ellipse__arg0 (0)
;   +2 center_x[2] -> _web64_bitmap_ellipse__arg_center_x / _web64_bitmap_ellipse__arg1 (1)
;   +4 center_y[2] -> _web64_bitmap_ellipse__arg_center_y / _web64_bitmap_ellipse__arg2 (2)
;   +6 radius_x[2] -> _web64_bitmap_ellipse__arg_radius_x / _web64_bitmap_ellipse__arg3 (3)
;   +8 radius_y[2] -> _web64_bitmap_ellipse__arg_radius_y / _web64_bitmap_ellipse__arg4 (4)
;   +10 pixel[1] -> _web64_bitmap_ellipse__arg_pixel / _web64_bitmap_ellipse__arg5 (5)
;   +11 operation[1] -> _web64_bitmap_ellipse__arg_operation / _web64_bitmap_ellipse__arg6 (6)
; _web64_bitmap_ellipse_fast: _web64_bitmap_ellipse_fast__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_ellipse_fast__arg_bitmap / _web64_bitmap_ellipse_fast__arg0 (0)
;   +2 center_x[2] -> _web64_bitmap_ellipse_fast__arg_center_x / _web64_bitmap_ellipse_fast__arg1 (1)
;   +4 center_y[1] -> _web64_bitmap_ellipse_fast__arg_center_y / _web64_bitmap_ellipse_fast__arg2 (2)
;   +5 radius_x[2] -> _web64_bitmap_ellipse_fast__arg_radius_x / _web64_bitmap_ellipse_fast__arg3 (3)
;   +7 radius_y[1] -> _web64_bitmap_ellipse_fast__arg_radius_y / _web64_bitmap_ellipse_fast__arg4 (4)
;   +8 pixel[1] -> _web64_bitmap_ellipse_fast__arg_pixel / _web64_bitmap_ellipse_fast__arg5 (5)
;   +9 operation[1] -> _web64_bitmap_ellipse_fast__arg_operation / _web64_bitmap_ellipse_fast__arg6 (6)
; _web64_bitmap_fill_rect: _web64_bitmap_fill_rect__arg_window, 12 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_fill_rect__arg_bitmap / _web64_bitmap_fill_rect__arg0 (0)
;   +2 x[2] -> _web64_bitmap_fill_rect__arg_x / _web64_bitmap_fill_rect__arg1 (1)
;   +4 y[2] -> _web64_bitmap_fill_rect__arg_y / _web64_bitmap_fill_rect__arg2 (2)
;   +6 width[2] -> _web64_bitmap_fill_rect__arg_width / _web64_bitmap_fill_rect__arg3 (3)
;   +8 height[2] -> _web64_bitmap_fill_rect__arg_height / _web64_bitmap_fill_rect__arg4 (4)
;   +10 pixel[1] -> _web64_bitmap_fill_rect__arg_pixel / _web64_bitmap_fill_rect__arg5 (5)
;   +11 operation[1] -> _web64_bitmap_fill_rect__arg_operation / _web64_bitmap_fill_rect__arg6 (6)
; _web64_bitmap_fill_rect_fast: _web64_bitmap_fill_rect_fast__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_fill_rect_fast__arg_bitmap / _web64_bitmap_fill_rect_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_fill_rect_fast__arg_x / _web64_bitmap_fill_rect_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_fill_rect_fast__arg_y / _web64_bitmap_fill_rect_fast__arg2 (2)
;   +5 width[2] -> _web64_bitmap_fill_rect_fast__arg_width / _web64_bitmap_fill_rect_fast__arg3 (3)
;   +7 height[1] -> _web64_bitmap_fill_rect_fast__arg_height / _web64_bitmap_fill_rect_fast__arg4 (4)
;   +8 pixel[1] -> _web64_bitmap_fill_rect_fast__arg_pixel / _web64_bitmap_fill_rect_fast__arg5 (5)
;   +9 operation[1] -> _web64_bitmap_fill_rect_fast__arg_operation / _web64_bitmap_fill_rect_fast__arg6 (6)
; _web64_bitmap_flood_fill: _web64_bitmap_flood_fill__arg_window, 9 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_flood_fill__arg_bitmap / _web64_bitmap_flood_fill__arg0 (0)
;   +2 seed_x[2] -> _web64_bitmap_flood_fill__arg_seed_x / _web64_bitmap_flood_fill__arg1 (1)
;   +4 seed_y[2] -> _web64_bitmap_flood_fill__arg_seed_y / _web64_bitmap_flood_fill__arg2 (2)
;   +6 replacement[1] -> _web64_bitmap_flood_fill__arg_replacement / _web64_bitmap_flood_fill__arg3 (3)
;   +7 workspace[2] -> _web64_bitmap_flood_fill__arg_workspace / _web64_bitmap_flood_fill__arg4 (4)
; _web64_bitmap_flood_fill_fast: _web64_bitmap_flood_fill_fast__arg_window, 8 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_flood_fill_fast__arg_bitmap / _web64_bitmap_flood_fill_fast__arg0 (0)
;   +2 seed_x[2] -> _web64_bitmap_flood_fill_fast__arg_seed_x / _web64_bitmap_flood_fill_fast__arg1 (1)
;   +4 seed_y[1] -> _web64_bitmap_flood_fill_fast__arg_seed_y / _web64_bitmap_flood_fill_fast__arg2 (2)
;   +5 replacement[1] -> _web64_bitmap_flood_fill_fast__arg_replacement / _web64_bitmap_flood_fill_fast__arg3 (3)
;   +6 workspace[2] -> _web64_bitmap_flood_fill_fast__arg_workspace / _web64_bitmap_flood_fill_fast__arg4 (4)
; _web64_bitmap_get: _web64_bitmap_get__arg_window, 6 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_get__arg_bitmap / _web64_bitmap_get__arg0 (0)
;   +2 x[2] -> _web64_bitmap_get__arg_x / _web64_bitmap_get__arg1 (1)
;   +4 y[2] -> _web64_bitmap_get__arg_y / _web64_bitmap_get__arg2 (2)
; _web64_bitmap_get_fast: _web64_bitmap_get_fast__arg_window, 5 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_get_fast__arg_bitmap / _web64_bitmap_get_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_get_fast__arg_x / _web64_bitmap_get_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_get_fast__arg_y / _web64_bitmap_get_fast__arg2 (2)
; _web64_bitmap_hline: _web64_bitmap_hline__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_hline__arg_bitmap / _web64_bitmap_hline__arg0 (0)
;   +2 x[2] -> _web64_bitmap_hline__arg_x / _web64_bitmap_hline__arg1 (1)
;   +4 y[2] -> _web64_bitmap_hline__arg_y / _web64_bitmap_hline__arg2 (2)
;   +6 width[2] -> _web64_bitmap_hline__arg_width / _web64_bitmap_hline__arg3 (3)
;   +8 pixel[1] -> _web64_bitmap_hline__arg_pixel / _web64_bitmap_hline__arg4 (4)
;   +9 operation[1] -> _web64_bitmap_hline__arg_operation / _web64_bitmap_hline__arg5 (5)
; _web64_bitmap_hline_fast: _web64_bitmap_hline_fast__arg_window, 9 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_hline_fast__arg_bitmap / _web64_bitmap_hline_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_hline_fast__arg_x / _web64_bitmap_hline_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_hline_fast__arg_y / _web64_bitmap_hline_fast__arg2 (2)
;   +5 width[2] -> _web64_bitmap_hline_fast__arg_width / _web64_bitmap_hline_fast__arg3 (3)
;   +7 pixel[1] -> _web64_bitmap_hline_fast__arg_pixel / _web64_bitmap_hline_fast__arg4 (4)
;   +8 operation[1] -> _web64_bitmap_hline_fast__arg_operation / _web64_bitmap_hline_fast__arg5 (5)
; _web64_bitmap_init: _web64_bitmap_init__arg_window, 9 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_init__arg_bitmap / _web64_bitmap_init__arg0 (0)
;   +2 pixels[2] -> _web64_bitmap_init__arg_pixels / _web64_bitmap_init__arg1 (1)
;   +4 screen[2] -> _web64_bitmap_init__arg_screen / _web64_bitmap_init__arg2 (2)
;   +6 mode[1] -> _web64_bitmap_init__arg_mode / _web64_bitmap_init__arg3 (3)
;   +7 palette[2] -> _web64_bitmap_init__arg_palette / _web64_bitmap_init__arg4 (4)
; _web64_bitmap_line: _web64_bitmap_line__arg_window, 12 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_line__arg_bitmap / _web64_bitmap_line__arg0 (0)
;   +2 x0[2] -> _web64_bitmap_line__arg_x0 / _web64_bitmap_line__arg1 (1)
;   +4 y0[2] -> _web64_bitmap_line__arg_y0 / _web64_bitmap_line__arg2 (2)
;   +6 x1[2] -> _web64_bitmap_line__arg_x1 / _web64_bitmap_line__arg3 (3)
;   +8 y1[2] -> _web64_bitmap_line__arg_y1 / _web64_bitmap_line__arg4 (4)
;   +10 pixel[1] -> _web64_bitmap_line__arg_pixel / _web64_bitmap_line__arg5 (5)
;   +11 operation[1] -> _web64_bitmap_line__arg_operation / _web64_bitmap_line__arg6 (6)
; _web64_bitmap_line_fast: _web64_bitmap_line_fast__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_line_fast__arg_bitmap / _web64_bitmap_line_fast__arg0 (0)
;   +2 x0[2] -> _web64_bitmap_line_fast__arg_x0 / _web64_bitmap_line_fast__arg1 (1)
;   +4 y0[1] -> _web64_bitmap_line_fast__arg_y0 / _web64_bitmap_line_fast__arg2 (2)
;   +5 x1[2] -> _web64_bitmap_line_fast__arg_x1 / _web64_bitmap_line_fast__arg3 (3)
;   +7 y1[1] -> _web64_bitmap_line_fast__arg_y1 / _web64_bitmap_line_fast__arg4 (4)
;   +8 pixel[1] -> _web64_bitmap_line_fast__arg_pixel / _web64_bitmap_line_fast__arg5 (5)
;   +9 operation[1] -> _web64_bitmap_line_fast__arg_operation / _web64_bitmap_line_fast__arg6 (6)
; _web64_bitmap_load_map: _web64_bitmap_load_map__arg_window, 6 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_load_map__arg_bitmap / _web64_bitmap_load_map__arg0 (0)
;   +2 map[2] -> _web64_bitmap_load_map__arg_map / _web64_bitmap_load_map__arg1 (1)
;   +4 charset[2] -> _web64_bitmap_load_map__arg_charset / _web64_bitmap_load_map__arg2 (2)
; _web64_bitmap_palette_cell: _web64_bitmap_palette_cell__arg_window, 6 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_palette_cell__arg_bitmap / _web64_bitmap_palette_cell__arg0 (0)
;   +2 column[1] -> _web64_bitmap_palette_cell__arg_column / _web64_bitmap_palette_cell__arg1 (1)
;   +3 row[1] -> _web64_bitmap_palette_cell__arg_row / _web64_bitmap_palette_cell__arg2 (2)
;   +4 palette[2] -> _web64_bitmap_palette_cell__arg_palette / _web64_bitmap_palette_cell__arg3 (3)
; _web64_bitmap_palette_uniform: _web64_bitmap_palette_uniform__arg_window, 4 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_palette_uniform__arg_bitmap / _web64_bitmap_palette_uniform__arg0 (0)
;   +2 palette[2] -> _web64_bitmap_palette_uniform__arg_palette / _web64_bitmap_palette_uniform__arg1 (1)
; _web64_bitmap_plot: _web64_bitmap_plot__arg_window, 8 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_plot__arg_bitmap / _web64_bitmap_plot__arg0 (0)
;   +2 x[2] -> _web64_bitmap_plot__arg_x / _web64_bitmap_plot__arg1 (1)
;   +4 y[2] -> _web64_bitmap_plot__arg_y / _web64_bitmap_plot__arg2 (2)
;   +6 pixel[1] -> _web64_bitmap_plot__arg_pixel / _web64_bitmap_plot__arg3 (3)
;   +7 operation[1] -> _web64_bitmap_plot__arg_operation / _web64_bitmap_plot__arg4 (4)
; _web64_bitmap_plot_fast: _web64_bitmap_plot_fast__arg_window, 7 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_plot_fast__arg_bitmap / _web64_bitmap_plot_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_plot_fast__arg_x / _web64_bitmap_plot_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_plot_fast__arg_y / _web64_bitmap_plot_fast__arg2 (2)
;   +5 pixel[1] -> _web64_bitmap_plot_fast__arg_pixel / _web64_bitmap_plot_fast__arg3 (3)
;   +6 operation[1] -> _web64_bitmap_plot_fast__arg_operation / _web64_bitmap_plot_fast__arg4 (4)
; _web64_bitmap_rect: _web64_bitmap_rect__arg_window, 12 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_rect__arg_bitmap / _web64_bitmap_rect__arg0 (0)
;   +2 x[2] -> _web64_bitmap_rect__arg_x / _web64_bitmap_rect__arg1 (1)
;   +4 y[2] -> _web64_bitmap_rect__arg_y / _web64_bitmap_rect__arg2 (2)
;   +6 width[2] -> _web64_bitmap_rect__arg_width / _web64_bitmap_rect__arg3 (3)
;   +8 height[2] -> _web64_bitmap_rect__arg_height / _web64_bitmap_rect__arg4 (4)
;   +10 pixel[1] -> _web64_bitmap_rect__arg_pixel / _web64_bitmap_rect__arg5 (5)
;   +11 operation[1] -> _web64_bitmap_rect__arg_operation / _web64_bitmap_rect__arg6 (6)
; _web64_bitmap_rect_fast: _web64_bitmap_rect_fast__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_rect_fast__arg_bitmap / _web64_bitmap_rect_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_rect_fast__arg_x / _web64_bitmap_rect_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_rect_fast__arg_y / _web64_bitmap_rect_fast__arg2 (2)
;   +5 width[2] -> _web64_bitmap_rect_fast__arg_width / _web64_bitmap_rect_fast__arg3 (3)
;   +7 height[1] -> _web64_bitmap_rect_fast__arg_height / _web64_bitmap_rect_fast__arg4 (4)
;   +8 pixel[1] -> _web64_bitmap_rect_fast__arg_pixel / _web64_bitmap_rect_fast__arg5 (5)
;   +9 operation[1] -> _web64_bitmap_rect_fast__arg_operation / _web64_bitmap_rect_fast__arg6 (6)
; _web64_bitmap_vline: _web64_bitmap_vline__arg_window, 10 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_vline__arg_bitmap / _web64_bitmap_vline__arg0 (0)
;   +2 x[2] -> _web64_bitmap_vline__arg_x / _web64_bitmap_vline__arg1 (1)
;   +4 y[2] -> _web64_bitmap_vline__arg_y / _web64_bitmap_vline__arg2 (2)
;   +6 height[2] -> _web64_bitmap_vline__arg_height / _web64_bitmap_vline__arg3 (3)
;   +8 pixel[1] -> _web64_bitmap_vline__arg_pixel / _web64_bitmap_vline__arg4 (4)
;   +9 operation[1] -> _web64_bitmap_vline__arg_operation / _web64_bitmap_vline__arg5 (5)
; _web64_bitmap_vline_fast: _web64_bitmap_vline_fast__arg_window, 9 byte(s)
;   +0 bitmap[2] -> _web64_bitmap_vline_fast__arg_bitmap / _web64_bitmap_vline_fast__arg0 (0)
;   +2 x[2] -> _web64_bitmap_vline_fast__arg_x / _web64_bitmap_vline_fast__arg1 (1)
;   +4 y[1] -> _web64_bitmap_vline_fast__arg_y / _web64_bitmap_vline_fast__arg2 (2)
;   +5 height[2] -> _web64_bitmap_vline_fast__arg_height / _web64_bitmap_vline_fast__arg3 (3)
;   +7 pixel[1] -> _web64_bitmap_vline_fast__arg_pixel / _web64_bitmap_vline_fast__arg4 (4)
;   +8 operation[1] -> _web64_bitmap_vline_fast__arg_operation / _web64_bitmap_vline_fast__arg5 (5)
; _web64_cart_copy: _web64_cart_copy__arg_window, 2 byte(s)
;   +0 request[2] -> _web64_cart_copy__arg_request / _web64_cart_copy__arg0 (0)
; _web64_cart_read: _web64_cart_read__arg_window, 2 byte(s)
;   +0 request[2] -> _web64_cart_read__arg_request / _web64_cart_read__arg0 (0)
; _web64_cart_resource_copy: _web64_cart_resource_copy__arg_window, 4 byte(s)
;   +0 request[2] -> _web64_cart_resource_copy__arg_request / _web64_cart_resource_copy__arg0 (0)
;   +2 result[2] -> _web64_cart_resource_copy__arg_result / _web64_cart_resource_copy__arg1 (1)
; _web64_cart_resource_read: _web64_cart_resource_read__arg_window, 4 byte(s)
;   +0 request[2] -> _web64_cart_resource_read__arg_request / _web64_cart_resource_read__arg0 (0)
;   +2 result[2] -> _web64_cart_resource_read__arg_result / _web64_cart_resource_read__arg1 (1)
; _web64_cart_resources_init: _web64_cart_resources_init__arg_window, 0 byte(s)
; _web64_cart_select_bank: _web64_cart_select_bank__arg_window, 2 byte(s)
;   +0 profile[1] -> _web64_cart_select_bank__arg_profile / _web64_cart_select_bank__arg0 (0)
;   +1 bank[1] -> _web64_cart_select_bank__arg_bank / _web64_cart_select_bank__arg1 (1)
; _web64_cart_set_mode: _web64_cart_set_mode__arg_window, 2 byte(s)
;   +0 profile[1] -> _web64_cart_set_mode__arg_profile / _web64_cart_set_mode__arg0 (0)
;   +1 mode[1] -> _web64_cart_set_mode__arg_mode / _web64_cart_set_mode__arg1 (1)
; _web64_collision_aabb: _web64_collision_aabb__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_collision_aabb__arg_a / _web64_collision_aabb__arg0 (0)
;   +2 b[2] -> _web64_collision_aabb__arg_b / _web64_collision_aabb__arg1 (1)
; _web64_collision_event_push: _web64_collision_event_push__arg_window, 4 byte(s)
;   +0 queue[2] -> _web64_collision_event_push__arg_queue / _web64_collision_event_push__arg0 (0)
;   +2 event[2] -> _web64_collision_event_push__arg_event / _web64_collision_event_push__arg1 (1)
; _web64_collision_find_material_rect: _web64_collision_find_material_rect__arg_window, 8 byte(s)
;   +0 materials[2] -> _web64_collision_find_material_rect__arg_materials / _web64_collision_find_material_rect__arg0 (0)
;   +2 row_stride[1] -> _web64_collision_find_material_rect__arg_row_stride / _web64_collision_find_material_rect__arg1 (1)
;   +3 first_column[1] -> _web64_collision_find_material_rect__arg_first_column / _web64_collision_find_material_rect__arg2 (2)
;   +4 last_column[1] -> _web64_collision_find_material_rect__arg_last_column / _web64_collision_find_material_rect__arg3 (3)
;   +5 first_row[1] -> _web64_collision_find_material_rect__arg_first_row / _web64_collision_find_material_rect__arg4 (4)
;   +6 last_row[1] -> _web64_collision_find_material_rect__arg_last_row / _web64_collision_find_material_rect__arg5 (5)
;   +7 material[1] -> _web64_collision_find_material_rect__arg_material / _web64_collision_find_material_rect__arg6 (6)
; _web64_collision_map_write: _web64_collision_map_write__arg_window, 7 byte(s)
;   +0 plane[2] -> _web64_collision_map_write__arg_plane / _web64_collision_map_write__arg0 (0)
;   +2 row_stride[2] -> _web64_collision_map_write__arg_row_stride / _web64_collision_map_write__arg1 (1)
;   +4 column[1] -> _web64_collision_map_write__arg_column / _web64_collision_map_write__arg2 (2)
;   +5 row[1] -> _web64_collision_map_write__arg_row / _web64_collision_map_write__arg3 (3)
;   +6 value[1] -> _web64_collision_map_write__arg_value / _web64_collision_map_write__arg4 (4)
; _web64_collision_material_at: _web64_collision_material_at__arg_window, 6 byte(s)
;   +0 map[2] -> _web64_collision_material_at__arg_map / _web64_collision_material_at__arg0 (0)
;   +2 pixel_x[2] -> _web64_collision_material_at__arg_pixel_x / _web64_collision_material_at__arg1 (1)
;   +4 pixel_y[2] -> _web64_collision_material_at__arg_pixel_y / _web64_collision_material_at__arg2 (2)
; _web64_collision_material_flags: _web64_collision_material_flags__arg_window, 3 byte(s)
;   +0 map[2] -> _web64_collision_material_flags__arg_map / _web64_collision_material_flags__arg0 (0)
;   +2 material[1] -> _web64_collision_material_flags__arg_material / _web64_collision_material_flags__arg1 (1)
; _web64_collision_probe_edge: _web64_collision_probe_edge__arg_window, 9 byte(s)
;   +0 map[2] -> _web64_collision_probe_edge__arg_map / _web64_collision_probe_edge__arg0 (0)
;   +2 pixel_x[2] -> _web64_collision_probe_edge__arg_pixel_x / _web64_collision_probe_edge__arg1 (1)
;   +4 pixel_y0[2] -> _web64_collision_probe_edge__arg_pixel_y0 / _web64_collision_probe_edge__arg2 (2)
;   +6 pixel_y1[2] -> _web64_collision_probe_edge__arg_pixel_y1 / _web64_collision_probe_edge__arg3 (3)
;   +8 material_mask[1] -> _web64_collision_probe_edge__arg_material_mask / _web64_collision_probe_edge__arg4 (4)
; _web64_collision_probe_point: _web64_collision_probe_point__arg_window, 7 byte(s)
;   +0 map[2] -> _web64_collision_probe_point__arg_map / _web64_collision_probe_point__arg0 (0)
;   +2 pixel_x[2] -> _web64_collision_probe_point__arg_pixel_x / _web64_collision_probe_point__arg1 (1)
;   +4 pixel_y[2] -> _web64_collision_probe_point__arg_pixel_y / _web64_collision_probe_point__arg2 (2)
;   +6 material_mask[1] -> _web64_collision_probe_point__arg_material_mask / _web64_collision_probe_point__arg3 (3)
; _web64_collision_probe_span: _web64_collision_probe_span__arg_window, 9 byte(s)
;   +0 map[2] -> _web64_collision_probe_span__arg_map / _web64_collision_probe_span__arg0 (0)
;   +2 pixel_x0[2] -> _web64_collision_probe_span__arg_pixel_x0 / _web64_collision_probe_span__arg1 (1)
;   +4 pixel_x1[2] -> _web64_collision_probe_span__arg_pixel_x1 / _web64_collision_probe_span__arg2 (2)
;   +6 pixel_y[2] -> _web64_collision_probe_span__arg_pixel_y / _web64_collision_probe_span__arg3 (3)
;   +8 material_mask[1] -> _web64_collision_probe_span__arg_material_mask / _web64_collision_probe_span__arg4 (4)
; _web64_collision_sweep_x: _web64_collision_sweep_x__arg_window, 6 byte(s)
;   +0 map[2] -> _web64_collision_sweep_x__arg_map / _web64_collision_sweep_x__arg0 (0)
;   +2 box[2] -> _web64_collision_sweep_x__arg_box / _web64_collision_sweep_x__arg1 (1)
;   +4 sweep[2] -> _web64_collision_sweep_x__arg_sweep / _web64_collision_sweep_x__arg2 (2)
; _web64_collision_sweep_y: _web64_collision_sweep_y__arg_window, 6 byte(s)
;   +0 map[2] -> _web64_collision_sweep_y__arg_map / _web64_collision_sweep_y__arg0 (0)
;   +2 box[2] -> _web64_collision_sweep_y__arg_box / _web64_collision_sweep_y__arg1 (1)
;   +4 sweep[2] -> _web64_collision_sweep_y__arg_sweep / _web64_collision_sweep_y__arg2 (2)
; _web64_cos8: _web64_cos8__arg_window, 1 byte(s)
;   +0 angle[1] -> _web64_cos8__arg_angle / _web64_cos8__arg0 (0)
; _web64_disk_load: _web64_disk_load__arg_window, 6 byte(s)
;   +0 name[2] -> _web64_disk_load__arg_name / _web64_disk_load__arg0 (0)
;   +2 length[1] -> _web64_disk_load__arg_length / _web64_disk_load__arg1 (1)
;   +3 device[1] -> _web64_disk_load__arg_device / _web64_disk_load__arg2 (2)
;   +4 address[2] -> _web64_disk_load__arg_address / _web64_disk_load__arg3 (3)
; _web64_disk_request: _web64_disk_request__arg_window, 1 byte(s)
;   +0 disk_index[1] -> _web64_disk_request__arg_disk_index / _web64_disk_request__arg0 (0)
; _web64_disk_require: _web64_disk_require__arg_window, 4 byte(s)
;   +0 marker_name[2] -> _web64_disk_require__arg_marker_name / _web64_disk_require__arg0 (0)
;   +2 marker_length[1] -> _web64_disk_require__arg_marker_length / _web64_disk_require__arg1 (1)
;   +3 device[1] -> _web64_disk_require__arg_device / _web64_disk_require__arg2 (2)
; _web64_disk_save: _web64_disk_save__arg_window, 8 byte(s)
;   +0 name[2] -> _web64_disk_save__arg_name / _web64_disk_save__arg0 (0)
;   +2 length[1] -> _web64_disk_save__arg_length / _web64_disk_save__arg1 (1)
;   +3 device[1] -> _web64_disk_save__arg_device / _web64_disk_save__arg2 (2)
;   +4 start_address[2] -> _web64_disk_save__arg_start_address / _web64_disk_save__arg3 (3)
;   +6 end_address[2] -> _web64_disk_save__arg_end_address / _web64_disk_save__arg4 (4)
; _web64_file_close: _web64_file_close__arg_window, 1 byte(s)
;   +0 logical_file[1] -> _web64_file_close__arg_logical_file / _web64_file_close__arg0 (0)
; _web64_file_open: _web64_file_open__arg_window, 6 byte(s)
;   +0 name[2] -> _web64_file_open__arg_name / _web64_file_open__arg0 (0)
;   +2 length[1] -> _web64_file_open__arg_length / _web64_file_open__arg1 (1)
;   +3 logical_file[1] -> _web64_file_open__arg_logical_file / _web64_file_open__arg2 (2)
;   +4 device[1] -> _web64_file_open__arg_device / _web64_file_open__arg3 (3)
;   +5 secondary[1] -> _web64_file_open__arg_secondary / _web64_file_open__arg4 (4)
; _web64_file_read: _web64_file_read__arg_window, 3 byte(s)
;   +0 logical_file[1] -> _web64_file_read__arg_logical_file / _web64_file_read__arg0 (0)
;   +1 destination[2] -> _web64_file_read__arg_destination / _web64_file_read__arg1 (1)
; _web64_file_write: _web64_file_write__arg_window, 2 byte(s)
;   +0 logical_file[1] -> _web64_file_write__arg_logical_file / _web64_file_write__arg0 (0)
;   +1 value[1] -> _web64_file_write__arg_value / _web64_file_write__arg1 (1)
; _web64_fix8_abs: _web64_fix8_abs__arg_window, 2 byte(s)
;   +0 value[2] -> _web64_fix8_abs__arg_value / _web64_fix8_abs__arg0 (0)
; _web64_fix8_add_sat: _web64_fix8_add_sat__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_add_sat__arg_a / _web64_fix8_add_sat__arg0 (0)
;   +2 b[2] -> _web64_fix8_add_sat__arg_b / _web64_fix8_add_sat__arg1 (1)
; _web64_fix8_clamp: _web64_fix8_clamp__arg_window, 6 byte(s)
;   +0 value[2] -> _web64_fix8_clamp__arg_value / _web64_fix8_clamp__arg0 (0)
;   +2 min_value[2] -> _web64_fix8_clamp__arg_min_value / _web64_fix8_clamp__arg1 (1)
;   +4 max_value[2] -> _web64_fix8_clamp__arg_max_value / _web64_fix8_clamp__arg2 (2)
; _web64_fix8_div: _web64_fix8_div__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_div__arg_a / _web64_fix8_div__arg0 (0)
;   +2 b[2] -> _web64_fix8_div__arg_b / _web64_fix8_div__arg1 (1)
; _web64_fix8_lerp: _web64_fix8_lerp__arg_window, 5 byte(s)
;   +0 a[2] -> _web64_fix8_lerp__arg_a / _web64_fix8_lerp__arg0 (0)
;   +2 b[2] -> _web64_fix8_lerp__arg_b / _web64_fix8_lerp__arg1 (1)
;   +4 amount[1] -> _web64_fix8_lerp__arg_amount / _web64_fix8_lerp__arg2 (2)
; _web64_fix8_max: _web64_fix8_max__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_max__arg_a / _web64_fix8_max__arg0 (0)
;   +2 b[2] -> _web64_fix8_max__arg_b / _web64_fix8_max__arg1 (1)
; _web64_fix8_min: _web64_fix8_min__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_min__arg_a / _web64_fix8_min__arg0 (0)
;   +2 b[2] -> _web64_fix8_min__arg_b / _web64_fix8_min__arg1 (1)
; _web64_fix8_mul: _web64_fix8_mul__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_mul__arg_a / _web64_fix8_mul__arg0 (0)
;   +2 b[2] -> _web64_fix8_mul__arg_b / _web64_fix8_mul__arg1 (1)
; _web64_fix8_mul_round: _web64_fix8_mul_round__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_mul_round__arg_a / _web64_fix8_mul_round__arg0 (0)
;   +2 b[2] -> _web64_fix8_mul_round__arg_b / _web64_fix8_mul_round__arg1 (1)
; _web64_fix8_sub_sat: _web64_fix8_sub_sat__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_fix8_sub_sat__arg_a / _web64_fix8_sub_sat__arg0 (0)
;   +2 b[2] -> _web64_fix8_sub_sat__arg_b / _web64_fix8_sub_sat__arg1 (1)
; _web64_fixvec2_add: _web64_fixvec2_add__arg_window, 6 byte(s)
;   +0 out[2] -> _web64_fixvec2_add__arg_out / _web64_fixvec2_add__arg0 (0)
;   +2 a[2] -> _web64_fixvec2_add__arg_a / _web64_fixvec2_add__arg1 (1)
;   +4 b[2] -> _web64_fixvec2_add__arg_b / _web64_fixvec2_add__arg2 (2)
; _web64_fixvec2_scale: _web64_fixvec2_scale__arg_window, 6 byte(s)
;   +0 out[2] -> _web64_fixvec2_scale__arg_out / _web64_fixvec2_scale__arg0 (0)
;   +2 value[2] -> _web64_fixvec2_scale__arg_value / _web64_fixvec2_scale__arg1 (1)
;   +4 scale[2] -> _web64_fixvec2_scale__arg_scale / _web64_fixvec2_scale__arg2 (2)
; _web64_fixvec2_sub: _web64_fixvec2_sub__arg_window, 6 byte(s)
;   +0 out[2] -> _web64_fixvec2_sub__arg_out / _web64_fixvec2_sub__arg0 (0)
;   +2 a[2] -> _web64_fixvec2_sub__arg_a / _web64_fixvec2_sub__arg1 (1)
;   +4 b[2] -> _web64_fixvec2_sub__arg_b / _web64_fixvec2_sub__arg2 (2)
; _web64_loader_init: _web64_loader_init__arg_window, 5 byte(s)
;   +0 device[1] -> _web64_loader_init__arg_device / _web64_loader_init__arg0 (0)
;   +1 sector[2] -> _web64_loader_init__arg_sector / _web64_loader_init__arg1 (1)
;   +3 ticks[2] -> _web64_loader_init__arg_ticks / _web64_loader_init__arg2 (2)
; _web64_loader_load_packed: _web64_loader_load_packed__arg_window, 2 byte(s)
;   +0 request[2] -> _web64_loader_load_packed__arg_request / _web64_loader_load_packed__arg0 (0)
; _web64_loader_load_raw: _web64_loader_load_raw__arg_window, 2 byte(s)
;   +0 request[2] -> _web64_loader_load_raw__arg_request / _web64_loader_load_raw__arg0 (0)
; _web64_loader_read: _web64_loader_read__arg_window, 7 byte(s)
;   +0 name[2] -> _web64_loader_read__arg_name / _web64_loader_read__arg0 (0)
;   +2 length[1] -> _web64_loader_read__arg_length / _web64_loader_read__arg1 (1)
;   +3 stage[2] -> _web64_loader_read__arg_stage / _web64_loader_read__arg2 (2)
;   +5 capacity[2] -> _web64_loader_read__arg_capacity / _web64_loader_read__arg3 (3)
; _web64_loader_unpack: _web64_loader_unpack__arg_window, 2 byte(s)
;   +0 request[2] -> _web64_loader_unpack__arg_request / _web64_loader_unpack__arg0 (0)
; _web64_motion_axis: _web64_motion_axis__arg_window, 9 byte(s)
;   +0 velocity[2] -> _web64_motion_axis__arg_velocity / _web64_motion_axis__arg0 (0)
;   +2 intent[1] -> _web64_motion_axis__arg_intent / _web64_motion_axis__arg1 (1)
;   +3 acceleration[2] -> _web64_motion_axis__arg_acceleration / _web64_motion_axis__arg2 (2)
;   +5 braking[2] -> _web64_motion_axis__arg_braking / _web64_motion_axis__arg3 (3)
;   +7 maximum[2] -> _web64_motion_axis__arg_maximum / _web64_motion_axis__arg4 (4)
; _web64_motion_clamp: _web64_motion_clamp__arg_window, 8 byte(s)
;   +0 position[2] -> _web64_motion_clamp__arg_position / _web64_motion_clamp__arg0 (0)
;   +2 velocity[2] -> _web64_motion_clamp__arg_velocity / _web64_motion_clamp__arg1 (1)
;   +4 minimum[2] -> _web64_motion_clamp__arg_minimum / _web64_motion_clamp__arg2 (2)
;   +6 maximum[2] -> _web64_motion_clamp__arg_maximum / _web64_motion_clamp__arg3 (3)
; _web64_motion_clamp_s16: _web64_motion_clamp_s16__arg_window, 8 byte(s)
;   +0 position[2] -> _web64_motion_clamp_s16__arg_position / _web64_motion_clamp_s16__arg0 (0)
;   +2 velocity[2] -> _web64_motion_clamp_s16__arg_velocity / _web64_motion_clamp_s16__arg1 (1)
;   +4 minimum[2] -> _web64_motion_clamp_s16__arg_minimum / _web64_motion_clamp_s16__arg2 (2)
;   +6 maximum[2] -> _web64_motion_clamp_s16__arg_maximum / _web64_motion_clamp_s16__arg3 (3)
; _web64_motion_integrate: _web64_motion_integrate__arg_window, 4 byte(s)
;   +0 position[2] -> _web64_motion_integrate__arg_position / _web64_motion_integrate__arg0 (0)
;   +2 velocity[2] -> _web64_motion_integrate__arg_velocity / _web64_motion_integrate__arg1 (1)
; _web64_motion_integrate_s16: _web64_motion_integrate_s16__arg_window, 4 byte(s)
;   +0 position[2] -> _web64_motion_integrate_s16__arg_position / _web64_motion_integrate_s16__arg0 (0)
;   +2 velocity[2] -> _web64_motion_integrate_s16__arg_velocity / _web64_motion_integrate_s16__arg1 (1)
; _web64_motion_steer_s16: _web64_motion_steer_s16__arg_window, 7 byte(s)
;   +0 velocity[2] -> _web64_motion_steer_s16__arg_velocity / _web64_motion_steer_s16__arg0 (0)
;   +2 intent[1] -> _web64_motion_steer_s16__arg_intent / _web64_motion_steer_s16__arg1 (1)
;   +3 acceleration[1] -> _web64_motion_steer_s16__arg_acceleration / _web64_motion_steer_s16__arg2 (2)
;   +4 braking[1] -> _web64_motion_steer_s16__arg_braking / _web64_motion_steer_s16__arg3 (3)
;   +5 reversal[1] -> _web64_motion_steer_s16__arg_reversal / _web64_motion_steer_s16__arg4 (4)
;   +6 maximum[1] -> _web64_motion_steer_s16__arg_maximum / _web64_motion_steer_s16__arg5 (5)
; _web64_motion_wrap: _web64_motion_wrap__arg_window, 6 byte(s)
;   +0 position[2] -> _web64_motion_wrap__arg_position / _web64_motion_wrap__arg0 (0)
;   +2 minimum[2] -> _web64_motion_wrap__arg_minimum / _web64_motion_wrap__arg1 (1)
;   +4 maximum[2] -> _web64_motion_wrap__arg_maximum / _web64_motion_wrap__arg2 (2)
; _web64_motion_wrap_s16: _web64_motion_wrap_s16__arg_window, 6 byte(s)
;   +0 position[2] -> _web64_motion_wrap_s16__arg_position / _web64_motion_wrap_s16__arg0 (0)
;   +2 minimum[2] -> _web64_motion_wrap_s16__arg_minimum / _web64_motion_wrap_s16__arg1 (1)
;   +4 maximum[2] -> _web64_motion_wrap_s16__arg_maximum / _web64_motion_wrap_s16__arg2 (2)
; _web64_motion2d_integrate: _web64_motion2d_integrate__arg_window, 2 byte(s)
;   +0 motion[2] -> _web64_motion2d_integrate__arg_motion / _web64_motion2d_integrate__arg0 (0)
; _web64_reu_fetch: _web64_reu_fetch__arg_window, 4 byte(s)
;   +0 request[2] -> _web64_reu_fetch__arg_request / _web64_reu_fetch__arg0 (0)
;   +2 result[2] -> _web64_reu_fetch__arg_result / _web64_reu_fetch__arg1 (1)
; _web64_reu_init: _web64_reu_init__arg_window, 0 byte(s)
; _web64_reu_store: _web64_reu_store__arg_window, 4 byte(s)
;   +0 request[2] -> _web64_reu_store__arg_request / _web64_reu_store__arg0 (0)
;   +2 result[2] -> _web64_reu_store__arg_result / _web64_reu_store__arg1 (1)
; _web64_sin8: _web64_sin8__arg_window, 1 byte(s)
;   +0 angle[1] -> _web64_sin8__arg_angle / _web64_sin8__arg0 (0)
; _web64_sprite_apply_overlay_palette: _web64_sprite_apply_overlay_palette__arg_window, 2 byte(s)
;   +0 asset[2] -> _web64_sprite_apply_overlay_palette__arg_asset / _web64_sprite_apply_overlay_palette__arg0 (0)
; _web64_sprite_mux_activate: _web64_sprite_mux_activate__arg_window, 2 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_activate__arg_mux / _web64_sprite_mux_activate__arg0 (0)
; _web64_sprite_mux_begin_frame: _web64_sprite_mux_begin_frame__arg_window, 2 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_begin_frame__arg_mux / _web64_sprite_mux_begin_frame__arg0 (0)
; _web64_sprite_mux_commit: _web64_sprite_mux_commit__arg_window, 2 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_commit__arg_mux / _web64_sprite_mux_commit__arg0 (0)
; _web64_sprite_mux_deactivate: _web64_sprite_mux_deactivate__arg_window, 2 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_deactivate__arg_mux / _web64_sprite_mux_deactivate__arg0 (0)
; _web64_sprite_mux_init: _web64_sprite_mux_init__arg_window, 13 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_init__arg_mux / _web64_sprite_mux_init__arg0 (0)
;   +2 buffer_a[2] -> _web64_sprite_mux_init__arg_buffer_a / _web64_sprite_mux_init__arg1 (1)
;   +4 buffer_b[2] -> _web64_sprite_mux_init__arg_buffer_b / _web64_sprite_mux_init__arg2 (2)
;   +6 capacity[1] -> _web64_sprite_mux_init__arg_capacity / _web64_sprite_mux_init__arg3 (3)
;   +7 pointer_table[2] -> _web64_sprite_mux_init__arg_pointer_table / _web64_sprite_mux_init__arg4 (4)
;   +9 owned_slots[1] -> _web64_sprite_mux_init__arg_owned_slots / _web64_sprite_mux_init__arg5 (5)
;   +10 multicolor_1[1] -> _web64_sprite_mux_init__arg_multicolor_1 / _web64_sprite_mux_init__arg6 (6)
;   +11 multicolor_2[1] -> _web64_sprite_mux_init__arg_multicolor_2 / _web64_sprite_mux_init__arg7 (7)
;   +12 video_standard[1] -> _web64_sprite_mux_init__arg_video_standard / _web64_sprite_mux_init__arg8 (8)
; _web64_sprite_mux_submit: _web64_sprite_mux_submit__arg_window, 9 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_submit__arg_mux / _web64_sprite_mux_submit__arg0 (0)
;   +2 x[2] -> _web64_sprite_mux_submit__arg_x / _web64_sprite_mux_submit__arg1 (1)
;   +4 y[1] -> _web64_sprite_mux_submit__arg_y / _web64_sprite_mux_submit__arg2 (2)
;   +5 pointer[1] -> _web64_sprite_mux_submit__arg_pointer / _web64_sprite_mux_submit__arg3 (3)
;   +6 color[1] -> _web64_sprite_mux_submit__arg_color / _web64_sprite_mux_submit__arg4 (4)
;   +7 flags[1] -> _web64_sprite_mux_submit__arg_flags / _web64_sprite_mux_submit__arg5 (5)
;   +8 priority[1] -> _web64_sprite_mux_submit__arg_priority / _web64_sprite_mux_submit__arg6 (6)
; _web64_sprite_mux_submit_asset_pair: _web64_sprite_mux_submit_asset_pair__arg_window, 11 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_submit_asset_pair__arg_mux / _web64_sprite_mux_submit_asset_pair__arg0 (0)
;   +2 binding[2] -> _web64_sprite_mux_submit_asset_pair__arg_binding / _web64_sprite_mux_submit_asset_pair__arg1 (1)
;   +4 x[2] -> _web64_sprite_mux_submit_asset_pair__arg_x / _web64_sprite_mux_submit_asset_pair__arg2 (2)
;   +6 y[1] -> _web64_sprite_mux_submit_asset_pair__arg_y / _web64_sprite_mux_submit_asset_pair__arg3 (3)
;   +7 base_frame[1] -> _web64_sprite_mux_submit_asset_pair__arg_base_frame / _web64_sprite_mux_submit_asset_pair__arg4 (4)
;   +8 overlay_frame[1] -> _web64_sprite_mux_submit_asset_pair__arg_overlay_frame / _web64_sprite_mux_submit_asset_pair__arg5 (5)
;   +9 flags[1] -> _web64_sprite_mux_submit_asset_pair__arg_flags / _web64_sprite_mux_submit_asset_pair__arg6 (6)
;   +10 priority[1] -> _web64_sprite_mux_submit_asset_pair__arg_priority / _web64_sprite_mux_submit_asset_pair__arg7 (7)
; _web64_sprite_mux_submit_pair: _web64_sprite_mux_submit_pair__arg_window, 11 byte(s)
;   +0 mux[2] -> _web64_sprite_mux_submit_pair__arg_mux / _web64_sprite_mux_submit_pair__arg0 (0)
;   +2 x[2] -> _web64_sprite_mux_submit_pair__arg_x / _web64_sprite_mux_submit_pair__arg1 (1)
;   +4 y[1] -> _web64_sprite_mux_submit_pair__arg_y / _web64_sprite_mux_submit_pair__arg2 (2)
;   +5 base_pointer[1] -> _web64_sprite_mux_submit_pair__arg_base_pointer / _web64_sprite_mux_submit_pair__arg3 (3)
;   +6 overlay_pointer[1] -> _web64_sprite_mux_submit_pair__arg_overlay_pointer / _web64_sprite_mux_submit_pair__arg4 (4)
;   +7 base_color[1] -> _web64_sprite_mux_submit_pair__arg_base_color / _web64_sprite_mux_submit_pair__arg5 (5)
;   +8 overlay_color[1] -> _web64_sprite_mux_submit_pair__arg_overlay_color / _web64_sprite_mux_submit_pair__arg6 (6)
;   +9 flags[1] -> _web64_sprite_mux_submit_pair__arg_flags / _web64_sprite_mux_submit_pair__arg7 (7)
;   +10 priority[1] -> _web64_sprite_mux_submit_pair__arg_priority / _web64_sprite_mux_submit_pair__arg8 (8)
; _web64_sprite_render: _web64_sprite_render__arg_window, 9 byte(s)
;   +0 renderer[2] -> _web64_sprite_render__arg_renderer / _web64_sprite_render__arg0 (0)
;   +2 slot[1] -> _web64_sprite_render__arg_slot / _web64_sprite_render__arg1 (1)
;   +3 x[2] -> _web64_sprite_render__arg_x / _web64_sprite_render__arg2 (2)
;   +5 y[1] -> _web64_sprite_render__arg_y / _web64_sprite_render__arg3 (3)
;   +6 frame[1] -> _web64_sprite_render__arg_frame / _web64_sprite_render__arg4 (4)
;   +7 color[1] -> _web64_sprite_render__arg_color / _web64_sprite_render__arg5 (5)
;   +8 flags[1] -> _web64_sprite_render__arg_flags / _web64_sprite_render__arg6 (6)
; _web64_sprite_render_asset_pair: _web64_sprite_render_asset_pair__arg_window, 12 byte(s)
;   +0 renderer[2] -> _web64_sprite_render_asset_pair__arg_renderer / _web64_sprite_render_asset_pair__arg0 (0)
;   +2 binding[2] -> _web64_sprite_render_asset_pair__arg_binding / _web64_sprite_render_asset_pair__arg1 (1)
;   +4 base_slot[1] -> _web64_sprite_render_asset_pair__arg_base_slot / _web64_sprite_render_asset_pair__arg2 (2)
;   +5 overlay_slot[1] -> _web64_sprite_render_asset_pair__arg_overlay_slot / _web64_sprite_render_asset_pair__arg3 (3)
;   +6 x[2] -> _web64_sprite_render_asset_pair__arg_x / _web64_sprite_render_asset_pair__arg4 (4)
;   +8 y[1] -> _web64_sprite_render_asset_pair__arg_y / _web64_sprite_render_asset_pair__arg5 (5)
;   +9 base_frame[1] -> _web64_sprite_render_asset_pair__arg_base_frame / _web64_sprite_render_asset_pair__arg6 (6)
;   +10 overlay_frame[1] -> _web64_sprite_render_asset_pair__arg_overlay_frame / _web64_sprite_render_asset_pair__arg7 (7)
;   +11 flags[1] -> _web64_sprite_render_asset_pair__arg_flags / _web64_sprite_render_asset_pair__arg8 (8)
; _web64_sprite_render_attachment: _web64_sprite_render_attachment__arg_window, 18 byte(s)
;   +0 renderer[2] -> _web64_sprite_render_attachment__arg_renderer / _web64_sprite_render_attachment__arg0 (0)
;   +2 base_slot[1] -> _web64_sprite_render_attachment__arg_base_slot / _web64_sprite_render_attachment__arg1 (1)
;   +3 overlay_slot[1] -> _web64_sprite_render_attachment__arg_overlay_slot / _web64_sprite_render_attachment__arg2 (2)
;   +4 world_x[2] -> _web64_sprite_render_attachment__arg_world_x / _web64_sprite_render_attachment__arg3 (3)
;   +6 world_y[2] -> _web64_sprite_render_attachment__arg_world_y / _web64_sprite_render_attachment__arg4 (4)
;   +8 camera[2] -> _web64_sprite_render_attachment__arg_camera / _web64_sprite_render_attachment__arg5 (5)
;   +10 offset_x[1] -> _web64_sprite_render_attachment__arg_offset_x / _web64_sprite_render_attachment__arg6 (6)
;   +11 offset_y[1] -> _web64_sprite_render_attachment__arg_offset_y / _web64_sprite_render_attachment__arg7 (7)
;   +12 base_frame[1] -> _web64_sprite_render_attachment__arg_base_frame / _web64_sprite_render_attachment__arg8 (8)
;   +13 overlay_frame[1] -> _web64_sprite_render_attachment__arg_overlay_frame / _web64_sprite_render_attachment__arg9 (9)
;   +14 base_color[1] -> _web64_sprite_render_attachment__arg_base_color / _web64_sprite_render_attachment__arg10 (10)
;   +15 overlay_color[1] -> _web64_sprite_render_attachment__arg_overlay_color / _web64_sprite_render_attachment__arg11 (11)
;   +16 base_flags[1] -> _web64_sprite_render_attachment__arg_base_flags / _web64_sprite_render_attachment__arg12 (12)
;   +17 overlay_flags[1] -> _web64_sprite_render_attachment__arg_overlay_flags / _web64_sprite_render_attachment__arg13 (13)
; _web64_sprite_render_camera: _web64_sprite_render_camera__arg_window, 12 byte(s)
;   +0 renderer[2] -> _web64_sprite_render_camera__arg_renderer / _web64_sprite_render_camera__arg0 (0)
;   +2 slot[1] -> _web64_sprite_render_camera__arg_slot / _web64_sprite_render_camera__arg1 (1)
;   +3 world_x[2] -> _web64_sprite_render_camera__arg_world_x / _web64_sprite_render_camera__arg2 (2)
;   +5 world_y[2] -> _web64_sprite_render_camera__arg_world_y / _web64_sprite_render_camera__arg3 (3)
;   +7 camera[2] -> _web64_sprite_render_camera__arg_camera / _web64_sprite_render_camera__arg4 (4)
;   +9 frame[1] -> _web64_sprite_render_camera__arg_frame / _web64_sprite_render_camera__arg5 (5)
;   +10 color[1] -> _web64_sprite_render_camera__arg_color / _web64_sprite_render_camera__arg6 (6)
;   +11 flags[1] -> _web64_sprite_render_camera__arg_flags / _web64_sprite_render_camera__arg7 (7)
; _web64_sprite_render_overlay: _web64_sprite_render_overlay__arg_window, 12 byte(s)
;   +0 renderer[2] -> _web64_sprite_render_overlay__arg_renderer / _web64_sprite_render_overlay__arg0 (0)
;   +2 base_slot[1] -> _web64_sprite_render_overlay__arg_base_slot / _web64_sprite_render_overlay__arg1 (1)
;   +3 overlay_slot[1] -> _web64_sprite_render_overlay__arg_overlay_slot / _web64_sprite_render_overlay__arg2 (2)
;   +4 x[2] -> _web64_sprite_render_overlay__arg_x / _web64_sprite_render_overlay__arg3 (3)
;   +6 y[1] -> _web64_sprite_render_overlay__arg_y / _web64_sprite_render_overlay__arg4 (4)
;   +7 base_frame[1] -> _web64_sprite_render_overlay__arg_base_frame / _web64_sprite_render_overlay__arg5 (5)
;   +8 overlay_frame[1] -> _web64_sprite_render_overlay__arg_overlay_frame / _web64_sprite_render_overlay__arg6 (6)
;   +9 base_color[1] -> _web64_sprite_render_overlay__arg_base_color / _web64_sprite_render_overlay__arg7 (7)
;   +10 overlay_color[1] -> _web64_sprite_render_overlay__arg_overlay_color / _web64_sprite_render_overlay__arg8 (8)
;   +11 flags[1] -> _web64_sprite_render_overlay__arg_flags / _web64_sprite_render_overlay__arg9 (9)
; _web64_sprite_renderer_init: _web64_sprite_renderer_init__arg_window, 4 byte(s)
;   +0 renderer[2] -> _web64_sprite_renderer_init__arg_renderer / _web64_sprite_renderer_init__arg0 (0)
;   +2 pointer_base[2] -> _web64_sprite_renderer_init__arg_pointer_base / _web64_sprite_renderer_init__arg1 (1)
; _web64_trajectory_init: _web64_trajectory_init__arg_window, 10 byte(s)
;   +0 state[2] -> _web64_trajectory_init__arg_state / _web64_trajectory_init__arg0 (0)
;   +2 pattern[2] -> _web64_trajectory_init__arg_pattern / _web64_trajectory_init__arg1 (1)
;   +4 x[2] -> _web64_trajectory_init__arg_x / _web64_trajectory_init__arg2 (2)
;   +6 y[2] -> _web64_trajectory_init__arg_y / _web64_trajectory_init__arg3 (3)
;   +8 options[2] -> _web64_trajectory_init__arg_options / _web64_trajectory_init__arg4 (4)
; _web64_trajectory_init_fast: _web64_trajectory_init_fast__arg_window, 10 byte(s)
;   +0 state[2] -> _web64_trajectory_init_fast__arg_state / _web64_trajectory_init_fast__arg0 (0)
;   +2 pattern[2] -> _web64_trajectory_init_fast__arg_pattern / _web64_trajectory_init_fast__arg1 (1)
;   +4 x[2] -> _web64_trajectory_init_fast__arg_x / _web64_trajectory_init_fast__arg2 (2)
;   +6 y[2] -> _web64_trajectory_init_fast__arg_y / _web64_trajectory_init_fast__arg3 (3)
;   +8 options[2] -> _web64_trajectory_init_fast__arg_options / _web64_trajectory_init_fast__arg4 (4)
; _web64_trajectory_step: _web64_trajectory_step__arg_window, 2 byte(s)
;   +0 state[2] -> _web64_trajectory_step__arg_state / _web64_trajectory_step__arg0 (0)
; _web64_trajectory_step_batch: _web64_trajectory_step_batch__arg_window, 5 byte(s)
;   +0 states[2] -> _web64_trajectory_step_batch__arg_states / _web64_trajectory_step_batch__arg0 (0)
;   +2 count[1] -> _web64_trajectory_step_batch__arg_count / _web64_trajectory_step_batch__arg1 (1)
;   +3 events[2] -> _web64_trajectory_step_batch__arg_events / _web64_trajectory_step_batch__arg2 (2)
; _web64_trajectory_step_batch_fast: _web64_trajectory_step_batch_fast__arg_window, 5 byte(s)
;   +0 states[2] -> _web64_trajectory_step_batch_fast__arg_states / _web64_trajectory_step_batch_fast__arg0 (0)
;   +2 count[1] -> _web64_trajectory_step_batch_fast__arg_count / _web64_trajectory_step_batch_fast__arg1 (1)
;   +3 events[2] -> _web64_trajectory_step_batch_fast__arg_events / _web64_trajectory_step_batch_fast__arg2 (2)
; _web64_trajectory_step_fast: _web64_trajectory_step_fast__arg_window, 2 byte(s)
;   +0 state[2] -> _web64_trajectory_step_fast__arg_state / _web64_trajectory_step_fast__arg0 (0)
; _web64_trajectory_validate: _web64_trajectory_validate__arg_window, 2 byte(s)
;   +0 pattern[2] -> _web64_trajectory_validate__arg_pattern / _web64_trajectory_validate__arg0 (0)
; _web64_ufix8_div: _web64_ufix8_div__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_ufix8_div__arg_a / _web64_ufix8_div__arg0 (0)
;   +2 b[2] -> _web64_ufix8_div__arg_b / _web64_ufix8_div__arg1 (1)
; _web64_ufix8_mul: _web64_ufix8_mul__arg_window, 4 byte(s)
;   +0 a[2] -> _web64_ufix8_mul__arg_a / _web64_ufix8_mul__arg0 (0)
;   +2 b[2] -> _web64_ufix8_mul__arg_b / _web64_ufix8_mul__arg1 (1)
; _web64_world_apply_video_mode: _web64_world_apply_video_mode__arg_window, 2 byte(s)
;   +0 flags[1] -> _web64_world_apply_video_mode__arg_flags / _web64_world_apply_video_mode__arg0 (0)
;   +1 memory_setup[1] -> _web64_world_apply_video_mode__arg_memory_setup / _web64_world_apply_video_mode__arg1 (1)
; _web64_world_camera_sync_x: _web64_world_camera_sync_x__arg_window, 4 byte(s)
;   +0 camera[2] -> _web64_world_camera_sync_x__arg_camera / _web64_world_camera_sync_x__arg0 (0)
;   +2 subpixel_position[2] -> _web64_world_camera_sync_x__arg_subpixel_position / _web64_world_camera_sync_x__arg1 (1)
; _web64_world_camera_sync_y: _web64_world_camera_sync_y__arg_window, 4 byte(s)
;   +0 camera[2] -> _web64_world_camera_sync_y__arg_camera / _web64_world_camera_sync_y__arg0 (0)
;   +2 subpixel_position[2] -> _web64_world_camera_sync_y__arg_subpixel_position / _web64_world_camera_sync_y__arg1 (1)
; _web64_world_copy_asset: _web64_world_copy_asset__arg_window, 6 byte(s)
;   +0 destination[2] -> _web64_world_copy_asset__arg_destination / _web64_world_copy_asset__arg0 (0)
;   +2 source[2] -> _web64_world_copy_asset__arg_source / _web64_world_copy_asset__arg1 (1)
;   +4 length[2] -> _web64_world_copy_asset__arg_length / _web64_world_copy_asset__arg2 (2)
; _web64_world_draw_block2_view: _web64_world_draw_block2_view__arg_window, 15 byte(s)
;   +0 map[2] -> _web64_world_draw_block2_view__arg_map / _web64_world_draw_block2_view__arg0 (0)
;   +2 blocks[2] -> _web64_world_draw_block2_view__arg_blocks / _web64_world_draw_block2_view__arg1 (1)
;   +4 block_colors[2] -> _web64_world_draw_block2_view__arg_block_colors / _web64_world_draw_block2_view__arg2 (2)
;   +6 screen[2] -> _web64_world_draw_block2_view__arg_screen / _web64_world_draw_block2_view__arg3 (3)
;   +8 color_ram[2] -> _web64_world_draw_block2_view__arg_color_ram / _web64_world_draw_block2_view__arg4 (4)
;   +10 width[1] -> _web64_world_draw_block2_view__arg_width / _web64_world_draw_block2_view__arg5 (5)
;   +11 height[1] -> _web64_world_draw_block2_view__arg_height / _web64_world_draw_block2_view__arg6 (6)
;   +12 row_stride[1] -> _web64_world_draw_block2_view__arg_row_stride / _web64_world_draw_block2_view__arg7 (7)
;   +13 color_mode[1] -> _web64_world_draw_block2_view__arg_color_mode / _web64_world_draw_block2_view__arg8 (8)
;   +14 region_color[1] -> _web64_world_draw_block2_view__arg_region_color / _web64_world_draw_block2_view__arg9 (9)
; _web64_world_draw_block2_view_screen: _web64_world_draw_block2_view_screen__arg_window, 9 byte(s)
;   +0 map[2] -> _web64_world_draw_block2_view_screen__arg_map / _web64_world_draw_block2_view_screen__arg0 (0)
;   +2 blocks[2] -> _web64_world_draw_block2_view_screen__arg_blocks / _web64_world_draw_block2_view_screen__arg1 (1)
;   +4 screen[2] -> _web64_world_draw_block2_view_screen__arg_screen / _web64_world_draw_block2_view_screen__arg2 (2)
;   +6 width[1] -> _web64_world_draw_block2_view_screen__arg_width / _web64_world_draw_block2_view_screen__arg3 (3)
;   +7 height[1] -> _web64_world_draw_block2_view_screen__arg_height / _web64_world_draw_block2_view_screen__arg4 (4)
;   +8 row_stride[1] -> _web64_world_draw_block2_view_screen__arg_row_stride / _web64_world_draw_block2_view_screen__arg5 (5)
; _web64_world_draw_char_view: _web64_world_draw_char_view__arg_window, 13 byte(s)
;   +0 cells[2] -> _web64_world_draw_char_view__arg_cells / _web64_world_draw_char_view__arg0 (0)
;   +2 colors[2] -> _web64_world_draw_char_view__arg_colors / _web64_world_draw_char_view__arg1 (1)
;   +4 screen[2] -> _web64_world_draw_char_view__arg_screen / _web64_world_draw_char_view__arg2 (2)
;   +6 color_ram[2] -> _web64_world_draw_char_view__arg_color_ram / _web64_world_draw_char_view__arg3 (3)
;   +8 width[1] -> _web64_world_draw_char_view__arg_width / _web64_world_draw_char_view__arg4 (4)
;   +9 height[1] -> _web64_world_draw_char_view__arg_height / _web64_world_draw_char_view__arg5 (5)
;   +10 row_stride[1] -> _web64_world_draw_char_view__arg_row_stride / _web64_world_draw_char_view__arg6 (6)
;   +11 color_mode[1] -> _web64_world_draw_char_view__arg_color_mode / _web64_world_draw_char_view__arg7 (7)
;   +12 region_color[1] -> _web64_world_draw_char_view__arg_region_color / _web64_world_draw_char_view__arg8 (8)
; _web64_world_draw_char_view_screen: _web64_world_draw_char_view_screen__arg_window, 7 byte(s)
;   +0 cells[2] -> _web64_world_draw_char_view_screen__arg_cells / _web64_world_draw_char_view_screen__arg0 (0)
;   +2 screen[2] -> _web64_world_draw_char_view_screen__arg_screen / _web64_world_draw_char_view_screen__arg1 (1)
;   +4 width[1] -> _web64_world_draw_char_view_screen__arg_width / _web64_world_draw_char_view_screen__arg2 (2)
;   +5 height[1] -> _web64_world_draw_char_view_screen__arg_height / _web64_world_draw_char_view_screen__arg3 (3)
;   +6 row_stride[1] -> _web64_world_draw_char_view_screen__arg_row_stride / _web64_world_draw_char_view_screen__arg4 (4)
; _web64_world_mutate_cell: _web64_world_mutate_cell__arg_window, 20 byte(s)
;   +0 cells[2] -> _web64_world_mutate_cell__arg_cells / _web64_world_mutate_cell__arg0 (0)
;   +2 colors[2] -> _web64_world_mutate_cell__arg_colors / _web64_world_mutate_cell__arg1 (1)
;   +4 materials[2] -> _web64_world_mutate_cell__arg_materials / _web64_world_mutate_cell__arg2 (2)
;   +6 screen[2] -> _web64_world_mutate_cell__arg_screen / _web64_world_mutate_cell__arg3 (3)
;   +8 color_ram[2] -> _web64_world_mutate_cell__arg_color_ram / _web64_world_mutate_cell__arg4 (4)
;   +10 camera[2] -> _web64_world_mutate_cell__arg_camera / _web64_world_mutate_cell__arg5 (5)
;   +12 column[1] -> _web64_world_mutate_cell__arg_column / _web64_world_mutate_cell__arg6 (6)
;   +13 row[1] -> _web64_world_mutate_cell__arg_row / _web64_world_mutate_cell__arg7 (7)
;   +14 value[1] -> _web64_world_mutate_cell__arg_value / _web64_world_mutate_cell__arg8 (8)
;   +15 color[1] -> _web64_world_mutate_cell__arg_color / _web64_world_mutate_cell__arg9 (9)
;   +16 material[1] -> _web64_world_mutate_cell__arg_material / _web64_world_mutate_cell__arg10 (10)
;   +17 row_stride[1] -> _web64_world_mutate_cell__arg_row_stride / _web64_world_mutate_cell__arg11 (11)
;   +18 screen_stride[1] -> _web64_world_mutate_cell__arg_screen_stride / _web64_world_mutate_cell__arg12 (12)
;   +19 color_mode[1] -> _web64_world_mutate_cell__arg_color_mode / _web64_world_mutate_cell__arg13 (13)
; _web64_world_scroll_x: _web64_world_scroll_x__arg_window, 6 byte(s)
;   +0 camera[2] -> _web64_world_scroll_x__arg_camera / _web64_world_scroll_x__arg0 (0)
;   +2 delta_pixels[1] -> _web64_world_scroll_x__arg_delta_pixels / _web64_world_scroll_x__arg1 (1)
;   +3 max_cell_x[2] -> _web64_world_scroll_x__arg_max_cell_x / _web64_world_scroll_x__arg2 (2)
;   +5 flags[1] -> _web64_world_scroll_x__arg_flags / _web64_world_scroll_x__arg3 (3)
; _web64_world_scroll_y: _web64_world_scroll_y__arg_window, 6 byte(s)
;   +0 camera[2] -> _web64_world_scroll_y__arg_camera / _web64_world_scroll_y__arg0 (0)
;   +2 delta_pixels[1] -> _web64_world_scroll_y__arg_delta_pixels / _web64_world_scroll_y__arg1 (1)
;   +3 max_cell_y[2] -> _web64_world_scroll_y__arg_max_cell_y / _web64_world_scroll_y__arg2 (2)
;   +5 flags[1] -> _web64_world_scroll_y__arg_flags / _web64_world_scroll_y__arg3 (3)
; _web64_world_shift_down: _web64_world_shift_down__arg_window, 6 byte(s)
;   +0 screen[2] -> _web64_world_shift_down__arg_screen / _web64_world_shift_down__arg0 (0)
;   +2 color_ram[2] -> _web64_world_shift_down__arg_color_ram / _web64_world_shift_down__arg1 (1)
;   +4 height[1] -> _web64_world_shift_down__arg_height / _web64_world_shift_down__arg2 (2)
;   +5 color_mode[1] -> _web64_world_shift_down__arg_color_mode / _web64_world_shift_down__arg3 (3)
; _web64_world_shift_left: _web64_world_shift_left__arg_window, 6 byte(s)
;   +0 screen[2] -> _web64_world_shift_left__arg_screen / _web64_world_shift_left__arg0 (0)
;   +2 color_ram[2] -> _web64_world_shift_left__arg_color_ram / _web64_world_shift_left__arg1 (1)
;   +4 height[1] -> _web64_world_shift_left__arg_height / _web64_world_shift_left__arg2 (2)
;   +5 color_mode[1] -> _web64_world_shift_left__arg_color_mode / _web64_world_shift_left__arg3 (3)
; _web64_world_shift_right: _web64_world_shift_right__arg_window, 6 byte(s)
;   +0 screen[2] -> _web64_world_shift_right__arg_screen / _web64_world_shift_right__arg0 (0)
;   +2 color_ram[2] -> _web64_world_shift_right__arg_color_ram / _web64_world_shift_right__arg1 (1)
;   +4 height[1] -> _web64_world_shift_right__arg_height / _web64_world_shift_right__arg2 (2)
;   +5 color_mode[1] -> _web64_world_shift_right__arg_color_mode / _web64_world_shift_right__arg3 (3)
; _web64_world_shift_up: _web64_world_shift_up__arg_window, 6 byte(s)
;   +0 screen[2] -> _web64_world_shift_up__arg_screen / _web64_world_shift_up__arg0 (0)
;   +2 color_ram[2] -> _web64_world_shift_up__arg_color_ram / _web64_world_shift_up__arg1 (1)
;   +4 height[1] -> _web64_world_shift_up__arg_height / _web64_world_shift_up__arg2 (2)
;   +5 color_mode[1] -> _web64_world_shift_up__arg_color_mode / _web64_world_shift_up__arg3 (3)
; _web64_world_stream_column: _web64_world_stream_column__arg_window, 15 byte(s)
;   +0 cells[2] -> _web64_world_stream_column__arg_cells / _web64_world_stream_column__arg0 (0)
;   +2 colors[2] -> _web64_world_stream_column__arg_colors / _web64_world_stream_column__arg1 (1)
;   +4 screen[2] -> _web64_world_stream_column__arg_screen / _web64_world_stream_column__arg2 (2)
;   +6 color_ram[2] -> _web64_world_stream_column__arg_color_ram / _web64_world_stream_column__arg3 (3)
;   +8 source_column[1] -> _web64_world_stream_column__arg_source_column / _web64_world_stream_column__arg4 (4)
;   +9 dest_column[1] -> _web64_world_stream_column__arg_dest_column / _web64_world_stream_column__arg5 (5)
;   +10 height[1] -> _web64_world_stream_column__arg_height / _web64_world_stream_column__arg6 (6)
;   +11 row_stride[1] -> _web64_world_stream_column__arg_row_stride / _web64_world_stream_column__arg7 (7)
;   +12 screen_stride[1] -> _web64_world_stream_column__arg_screen_stride / _web64_world_stream_column__arg8 (8)
;   +13 color_mode[1] -> _web64_world_stream_column__arg_color_mode / _web64_world_stream_column__arg9 (9)
;   +14 region_color[1] -> _web64_world_stream_column__arg_region_color / _web64_world_stream_column__arg10 (10)
; _web64_world_stream_column_screen: _web64_world_stream_column_screen__arg_window, 9 byte(s)
;   +0 cells[2] -> _web64_world_stream_column_screen__arg_cells / _web64_world_stream_column_screen__arg0 (0)
;   +2 screen[2] -> _web64_world_stream_column_screen__arg_screen / _web64_world_stream_column_screen__arg1 (1)
;   +4 source_column[1] -> _web64_world_stream_column_screen__arg_source_column / _web64_world_stream_column_screen__arg2 (2)
;   +5 dest_column[1] -> _web64_world_stream_column_screen__arg_dest_column / _web64_world_stream_column_screen__arg3 (3)
;   +6 height[1] -> _web64_world_stream_column_screen__arg_height / _web64_world_stream_column_screen__arg4 (4)
;   +7 row_stride[1] -> _web64_world_stream_column_screen__arg_row_stride / _web64_world_stream_column_screen__arg5 (5)
;   +8 screen_stride[1] -> _web64_world_stream_column_screen__arg_screen_stride / _web64_world_stream_column_screen__arg6 (6)
; _web64_world_stream_row: _web64_world_stream_row__arg_window, 15 byte(s)
;   +0 cells[2] -> _web64_world_stream_row__arg_cells / _web64_world_stream_row__arg0 (0)
;   +2 colors[2] -> _web64_world_stream_row__arg_colors / _web64_world_stream_row__arg1 (1)
;   +4 screen[2] -> _web64_world_stream_row__arg_screen / _web64_world_stream_row__arg2 (2)
;   +6 color_ram[2] -> _web64_world_stream_row__arg_color_ram / _web64_world_stream_row__arg3 (3)
;   +8 source_row[1] -> _web64_world_stream_row__arg_source_row / _web64_world_stream_row__arg4 (4)
;   +9 dest_row[1] -> _web64_world_stream_row__arg_dest_row / _web64_world_stream_row__arg5 (5)
;   +10 width[1] -> _web64_world_stream_row__arg_width / _web64_world_stream_row__arg6 (6)
;   +11 row_stride[1] -> _web64_world_stream_row__arg_row_stride / _web64_world_stream_row__arg7 (7)
;   +12 screen_stride[1] -> _web64_world_stream_row__arg_screen_stride / _web64_world_stream_row__arg8 (8)
;   +13 color_mode[1] -> _web64_world_stream_row__arg_color_mode / _web64_world_stream_row__arg9 (9)
;   +14 region_color[1] -> _web64_world_stream_row__arg_region_color / _web64_world_stream_row__arg10 (10)
; _web64_world_stream_row_screen: _web64_world_stream_row_screen__arg_window, 9 byte(s)
;   +0 cells[2] -> _web64_world_stream_row_screen__arg_cells / _web64_world_stream_row_screen__arg0 (0)
;   +2 screen[2] -> _web64_world_stream_row_screen__arg_screen / _web64_world_stream_row_screen__arg1 (1)
;   +4 source_row[1] -> _web64_world_stream_row_screen__arg_source_row / _web64_world_stream_row_screen__arg2 (2)
;   +5 dest_row[1] -> _web64_world_stream_row_screen__arg_dest_row / _web64_world_stream_row_screen__arg3 (3)
;   +6 width[1] -> _web64_world_stream_row_screen__arg_width / _web64_world_stream_row_screen__arg4 (4)
;   +7 row_stride[1] -> _web64_world_stream_row_screen__arg_row_stride / _web64_world_stream_row_screen__arg5 (5)
;   +8 screen_stride[1] -> _web64_world_stream_row_screen__arg_screen_stride / _web64_world_stream_row_screen__arg6 (6)

web64/sprite-mux.h

#ifndef WEB64_SPRITE_MUX_H
#define WEB64_SPRITE_MUX_H
#include <web64/sprite-runtime.h>
#define WEB64_SPRITE_MUX_VIDEO_PAL 1
#define WEB64_SPRITE_MUX_VIDEO_NTSC 2
#define WEB64_SPRITE_MUX_OK 0
#define WEB64_SPRITE_MUX_BUSY 1
#define WEB64_SPRITE_MUX_CAPACITY 2
#define WEB64_SPRITE_MUX_INVALID_FRAME 4
#define WEB64_SPRITE_MUX_PALETTE_MISMATCH 8
#define WEB64_SPRITE_MUX_UNSCHEDULABLE 16
#define WEB64_SPRITE_MUX_UNSUPPORTED_STANDARD 32
#define WEB64_SPRITE_MUX_ACTIVE 64
#define WEB64_SPRITE_MUX_INVALID_ARGUMENT 128
#define WEB64_SPRITE_MUX_ENTRY_PAIR 1
#define WEB64_SPRITE_MUX_PAL_LINE_CYCLES 63
#define WEB64_SPRITE_MUX_IRQ_FIXED_CYCLES 300
#define WEB64_SPRITE_MUX_IRQ_LAYER_CYCLES 48
#define WEB64_SPRITE_MUX_SAFETY_CYCLES 63
#define WEB64_SPRITE_MUX_SINGLE_SERVICE_LINES 7
#define WEB64_SPRITE_MUX_PAIR_SERVICE_LINES 8
typedef struct { uint8_t accepted_entries; uint8_t dropped_entries; uint8_t accepted_layers; uint8_t dropped_layers; uint8_t reasons; uint8_t capacity; uint8_t submitted_entries; uint8_t pending; } Web64SpriteMuxStatus;
typedef struct { uint16_t x; uint8_t y; uint8_t base_pointer; uint8_t overlay_pointer; uint8_t base_color; uint8_t overlay_color; uint8_t flags; uint8_t priority; uint8_t submission_order; uint8_t layers; uint8_t base_slot; uint8_t overlay_slot; uint16_t event_line; uint16_t end_line; uint8_t accepted; uint8_t vic_x_high; uint8_t vic_expand_x; uint8_t vic_expand_y; uint8_t vic_priority; uint8_t vic_multicolor; uint8_t vic_visible; } Web64SpriteMuxEntry;
typedef struct { Web64SpriteMuxEntry *buffer_a; Web64SpriteMuxEntry *buffer_b; Web64SpriteMuxEntry *build_buffer; Web64SpriteMuxEntry *active_buffer; Web64SpriteMuxEntry *pending_buffer; uint16_t pointer_table; uint8_t capacity; uint8_t owned_slots; uint8_t multicolor_1; uint8_t multicolor_2; uint8_t video_standard; uint8_t build_count; uint8_t build_layers; uint8_t pending_count; uint8_t active_count; uint8_t pending; uint8_t activated; uint8_t active_index; uint8_t layout_count; Web64SpriteMuxStatus status; uint16_t slot_end[8]; uint8_t slot_used; uint8_t layout_generation; uint8_t buffer_a_generation; uint8_t buffer_b_generation; uint8_t layout_layers; uint8_t stable_identity_x_low; } Web64SpriteMultiplexer;
#define WEB64_SPRITE_MUX_STORAGE(name, capacity) Web64SpriteMultiplexer name; Web64SpriteMuxEntry name##_buffer_a[capacity]; Web64SpriteMuxEntry name##_buffer_b[capacity]
_web64_rt uint8_t web64_sprite_mux_init(Web64SpriteMultiplexer *mux, Web64SpriteMuxEntry *buffer_a, Web64SpriteMuxEntry *buffer_b, uint8_t capacity, uint16_t pointer_table, uint8_t owned_slots, uint8_t multicolor_1, uint8_t multicolor_2, uint8_t video_standard);
_web64_rt uint8_t web64_sprite_mux_activate(Web64SpriteMultiplexer *mux);
_web64_rt void web64_sprite_mux_deactivate(Web64SpriteMultiplexer *mux);
_web64_rt uint8_t web64_sprite_mux_begin_frame(Web64SpriteMultiplexer *mux);
_web64_rt uint8_t web64_sprite_mux_submit(Web64SpriteMultiplexer *mux, uint16_t x, uint8_t y, uint8_t pointer, uint8_t color, uint8_t flags, uint8_t priority);
_web64_rt uint8_t web64_sprite_mux_submit_pair(Web64SpriteMultiplexer *mux, uint16_t x, uint8_t y, uint8_t base_pointer, uint8_t overlay_pointer, uint8_t base_color, uint8_t overlay_color, uint8_t flags, uint8_t priority);
_web64_rt uint8_t web64_sprite_mux_submit_asset_pair(Web64SpriteMultiplexer *mux, const Web64SpriteOverlayBinding *binding, uint16_t x, uint8_t y, uint8_t base_frame, uint8_t overlay_frame, uint8_t flags, uint8_t priority);
_web64_rt uint8_t web64_sprite_mux_commit(Web64SpriteMultiplexer *mux);
void web64_sprite_mux_irq_service(void);
void web64_sprite_mux_irq_service_fast(void);
#endif

web64/sprite-mux.inc

; Web64 _web64_rt C/assembly call helpers for <web64/sprite-mux.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_SPRITE_MUX_CALL_COUNT = 10
WEB64_RT_SPRITE_MUX_WINDOW_CALL_COUNT = 8

; web64_sprite_mux_activate: 2-byte window; entry _web64_sprite_mux_activate
.macro web64_rt_prepare_sprite_mux_activate mux
    lda #<mux
    sta _web64_sprite_mux_activate__arg_mux
    lda #>mux
    sta _web64_sprite_mux_activate__arg_mux+1
.endmacro

.macro web64_rt_call_sprite_mux_activate mux
    web64_rt_prepare_sprite_mux_activate mux
    jsr _web64_sprite_mux_activate
.endmacro

; web64_sprite_mux_begin_frame: 2-byte window; entry _web64_sprite_mux_begin_frame
.macro web64_rt_prepare_sprite_mux_begin_frame mux
    lda #<mux
    sta _web64_sprite_mux_begin_frame__arg_mux
    lda #>mux
    sta _web64_sprite_mux_begin_frame__arg_mux+1
.endmacro

.macro web64_rt_call_sprite_mux_begin_frame mux
    web64_rt_prepare_sprite_mux_begin_frame mux
    jsr _web64_sprite_mux_begin_frame
.endmacro

; web64_sprite_mux_commit: 2-byte window; entry _web64_sprite_mux_commit
.macro web64_rt_prepare_sprite_mux_commit mux
    lda #<mux
    sta _web64_sprite_mux_commit__arg_mux
    lda #>mux
    sta _web64_sprite_mux_commit__arg_mux+1
.endmacro

.macro web64_rt_call_sprite_mux_commit mux
    web64_rt_prepare_sprite_mux_commit mux
    jsr _web64_sprite_mux_commit
.endmacro

; web64_sprite_mux_deactivate: 2-byte window; entry _web64_sprite_mux_deactivate
.macro web64_rt_prepare_sprite_mux_deactivate mux
    lda #<mux
    sta _web64_sprite_mux_deactivate__arg_mux
    lda #>mux
    sta _web64_sprite_mux_deactivate__arg_mux+1
.endmacro

.macro web64_rt_call_sprite_mux_deactivate mux
    web64_rt_prepare_sprite_mux_deactivate mux
    jsr _web64_sprite_mux_deactivate
.endmacro

; web64_sprite_mux_init: 13-byte window; entry _web64_sprite_mux_init
.macro web64_rt_prepare_sprite_mux_init mux, buffer_a, buffer_b, capacity, pointer_table, owned_slots, multicolor_1, multicolor_2, video_standard
    lda #<mux
    sta _web64_sprite_mux_init__arg_mux
    lda #>mux
    sta _web64_sprite_mux_init__arg_mux+1
    lda #<buffer_a
    sta _web64_sprite_mux_init__arg_buffer_a
    lda #>buffer_a
    sta _web64_sprite_mux_init__arg_buffer_a+1
    lda #<buffer_b
    sta _web64_sprite_mux_init__arg_buffer_b
    lda #>buffer_b
    sta _web64_sprite_mux_init__arg_buffer_b+1
    lda #capacity
    sta _web64_sprite_mux_init__arg_capacity
    lda #<pointer_table
    sta _web64_sprite_mux_init__arg_pointer_table
    lda #>pointer_table
    sta _web64_sprite_mux_init__arg_pointer_table+1
    lda #owned_slots
    sta _web64_sprite_mux_init__arg_owned_slots
    lda #multicolor_1
    sta _web64_sprite_mux_init__arg_multicolor_1
    lda #multicolor_2
    sta _web64_sprite_mux_init__arg_multicolor_2
    lda #video_standard
    sta _web64_sprite_mux_init__arg_video_standard
.endmacro

.macro web64_rt_call_sprite_mux_init mux, buffer_a, buffer_b, capacity, pointer_table, owned_slots, multicolor_1, multicolor_2, video_standard
    web64_rt_prepare_sprite_mux_init mux, buffer_a, buffer_b, capacity, pointer_table, owned_slots, multicolor_1, multicolor_2, video_standard
    jsr _web64_sprite_mux_init
.endmacro

; web64_sprite_mux_irq_service: parameterless entry _web64_sprite_mux_irq_service
.macro web64_rt_call_sprite_mux_irq_service
    jsr _web64_sprite_mux_irq_service
.endmacro

; web64_sprite_mux_irq_service_fast: parameterless entry _web64_sprite_mux_irq_service_fast
.macro web64_rt_call_sprite_mux_irq_service_fast
    jsr _web64_sprite_mux_irq_service_fast
.endmacro

; web64_sprite_mux_submit: 9-byte window; entry _web64_sprite_mux_submit
.macro web64_rt_prepare_sprite_mux_submit mux, x, y, pointer, color, flags, priority
    lda #<mux
    sta _web64_sprite_mux_submit__arg_mux
    lda #>mux
    sta _web64_sprite_mux_submit__arg_mux+1
    lda #<x
    sta _web64_sprite_mux_submit__arg_x
    lda #>x
    sta _web64_sprite_mux_submit__arg_x+1
    lda #y
    sta _web64_sprite_mux_submit__arg_y
    lda #pointer
    sta _web64_sprite_mux_submit__arg_pointer
    lda #color
    sta _web64_sprite_mux_submit__arg_color
    lda #flags
    sta _web64_sprite_mux_submit__arg_flags
    lda #priority
    sta _web64_sprite_mux_submit__arg_priority
.endmacro

.macro web64_rt_call_sprite_mux_submit mux, x, y, pointer, color, flags, priority
    web64_rt_prepare_sprite_mux_submit mux, x, y, pointer, color, flags, priority
    jsr _web64_sprite_mux_submit
.endmacro

; web64_sprite_mux_submit_asset_pair: 11-byte window; entry _web64_sprite_mux_submit_asset_pair
.macro web64_rt_prepare_sprite_mux_submit_asset_pair mux, binding, x, y, base_frame, overlay_frame, flags, priority
    lda #<mux
    sta _web64_sprite_mux_submit_asset_pair__arg_mux
    lda #>mux
    sta _web64_sprite_mux_submit_asset_pair__arg_mux+1
    lda #<binding
    sta _web64_sprite_mux_submit_asset_pair__arg_binding
    lda #>binding
    sta _web64_sprite_mux_submit_asset_pair__arg_binding+1
    lda #<x
    sta _web64_sprite_mux_submit_asset_pair__arg_x
    lda #>x
    sta _web64_sprite_mux_submit_asset_pair__arg_x+1
    lda #y
    sta _web64_sprite_mux_submit_asset_pair__arg_y
    lda #base_frame
    sta _web64_sprite_mux_submit_asset_pair__arg_base_frame
    lda #overlay_frame
    sta _web64_sprite_mux_submit_asset_pair__arg_overlay_frame
    lda #flags
    sta _web64_sprite_mux_submit_asset_pair__arg_flags
    lda #priority
    sta _web64_sprite_mux_submit_asset_pair__arg_priority
.endmacro

.macro web64_rt_call_sprite_mux_submit_asset_pair mux, binding, x, y, base_frame, overlay_frame, flags, priority
    web64_rt_prepare_sprite_mux_submit_asset_pair mux, binding, x, y, base_frame, overlay_frame, flags, priority
    jsr _web64_sprite_mux_submit_asset_pair
.endmacro

; web64_sprite_mux_submit_pair: 11-byte window; entry _web64_sprite_mux_submit_pair
.macro web64_rt_prepare_sprite_mux_submit_pair mux, x, y, base_pointer, overlay_pointer, base_color, overlay_color, flags, priority
    lda #<mux
    sta _web64_sprite_mux_submit_pair__arg_mux
    lda #>mux
    sta _web64_sprite_mux_submit_pair__arg_mux+1
    lda #<x
    sta _web64_sprite_mux_submit_pair__arg_x
    lda #>x
    sta _web64_sprite_mux_submit_pair__arg_x+1
    lda #y
    sta _web64_sprite_mux_submit_pair__arg_y
    lda #base_pointer
    sta _web64_sprite_mux_submit_pair__arg_base_pointer
    lda #overlay_pointer
    sta _web64_sprite_mux_submit_pair__arg_overlay_pointer
    lda #base_color
    sta _web64_sprite_mux_submit_pair__arg_base_color
    lda #overlay_color
    sta _web64_sprite_mux_submit_pair__arg_overlay_color
    lda #flags
    sta _web64_sprite_mux_submit_pair__arg_flags
    lda #priority
    sta _web64_sprite_mux_submit_pair__arg_priority
.endmacro

.macro web64_rt_call_sprite_mux_submit_pair mux, x, y, base_pointer, overlay_pointer, base_color, overlay_color, flags, priority
    web64_rt_prepare_sprite_mux_submit_pair mux, x, y, base_pointer, overlay_pointer, base_color, overlay_color, flags, priority
    jsr _web64_sprite_mux_submit_pair
.endmacro

web64/sprite-runtime.h

#ifndef WEB64_SPRITE_RUNTIME_H
#define WEB64_SPRITE_RUNTIME_H
#include <web64/game.h>
#define WEB64_SPRITE_VISIBLE 1
#define WEB64_SPRITE_MULTICOLOR 2
#define WEB64_SPRITE_EXPAND_X 4
#define WEB64_SPRITE_EXPAND_Y 8
#define WEB64_SPRITE_BEHIND 16
typedef struct { uint16_t x; uint8_t y; uint8_t frame; uint8_t color; uint8_t flags; } Web64SpriteState;
typedef struct { Web64SpriteState slots[8]; uint8_t valid_mask; uint8_t pointer_base_lo; uint8_t pointer_base_hi; } Web64SpriteRenderer;
typedef struct { int16_t x; int16_t y; } Web64Camera;
typedef struct { Web64AssetRef asset; uint8_t base_pointer; uint8_t overlay_pointer; } Web64SpriteOverlayBinding;
_web64_rt void web64_sprite_renderer_init(Web64SpriteRenderer *renderer, uint16_t pointer_base);
_web64_rt uint8_t web64_sprite_render(Web64SpriteRenderer *renderer, uint8_t slot, uint16_t x, uint8_t y, uint8_t frame, uint8_t color, uint8_t flags);
_web64_rt uint8_t web64_sprite_render_camera(Web64SpriteRenderer *renderer, uint8_t slot, uint16_t world_x, uint16_t world_y, Web64Camera *camera, uint8_t frame, uint8_t color, uint8_t flags);
_web64_rt uint8_t web64_sprite_render_overlay(Web64SpriteRenderer *renderer, uint8_t base_slot, uint8_t overlay_slot, uint16_t x, uint8_t y, uint8_t base_frame, uint8_t overlay_frame, uint8_t base_color, uint8_t overlay_color, uint8_t flags);
_web64_rt uint8_t web64_sprite_apply_overlay_palette(const Web64SpriteOverlayAsset *asset);
_web64_rt uint8_t web64_sprite_render_asset_pair(Web64SpriteRenderer *renderer, const Web64SpriteOverlayBinding *binding, uint8_t base_slot, uint8_t overlay_slot, uint16_t x, uint8_t y, uint8_t base_frame, uint8_t overlay_frame, uint8_t flags);
_web64_rt uint8_t web64_sprite_render_attachment(Web64SpriteRenderer *renderer, uint8_t base_slot, uint8_t overlay_slot, uint16_t world_x, uint16_t world_y, Web64Camera *camera, int8_t offset_x, int8_t offset_y, uint8_t base_frame, uint8_t overlay_frame, uint8_t base_color, uint8_t overlay_color, uint8_t base_flags, uint8_t overlay_flags);
#endif

web64/sprite-runtime.inc

; Web64 _web64_rt C/assembly call helpers for <web64/sprite-runtime.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_SPRITE_RUNTIME_CALL_COUNT = 7
WEB64_RT_SPRITE_RUNTIME_WINDOW_CALL_COUNT = 7

; web64_sprite_apply_overlay_palette: 2-byte window; entry _web64_sprite_apply_overlay_palette
.macro web64_rt_prepare_sprite_apply_overlay_palette asset
    lda #<asset
    sta _web64_sprite_apply_overlay_palette__arg_asset
    lda #>asset
    sta _web64_sprite_apply_overlay_palette__arg_asset+1
.endmacro

.macro web64_rt_call_sprite_apply_overlay_palette asset
    web64_rt_prepare_sprite_apply_overlay_palette asset
    jsr _web64_sprite_apply_overlay_palette
.endmacro

; web64_sprite_render: 9-byte window; entry _web64_sprite_render
.macro web64_rt_prepare_sprite_render renderer, slot, x, y, frame, color, flags
    lda #<renderer
    sta _web64_sprite_render__arg_renderer
    lda #>renderer
    sta _web64_sprite_render__arg_renderer+1
    lda #slot
    sta _web64_sprite_render__arg_slot
    lda #<x
    sta _web64_sprite_render__arg_x
    lda #>x
    sta _web64_sprite_render__arg_x+1
    lda #y
    sta _web64_sprite_render__arg_y
    lda #frame
    sta _web64_sprite_render__arg_frame
    lda #color
    sta _web64_sprite_render__arg_color
    lda #flags
    sta _web64_sprite_render__arg_flags
.endmacro

.macro web64_rt_call_sprite_render renderer, slot, x, y, frame, color, flags
    web64_rt_prepare_sprite_render renderer, slot, x, y, frame, color, flags
    jsr _web64_sprite_render
.endmacro

; web64_sprite_render_asset_pair: 12-byte window; entry _web64_sprite_render_asset_pair
.macro web64_rt_prepare_sprite_render_asset_pair renderer, binding, base_slot, overlay_slot, x, y, base_frame, overlay_frame, flags
    lda #<renderer
    sta _web64_sprite_render_asset_pair__arg_renderer
    lda #>renderer
    sta _web64_sprite_render_asset_pair__arg_renderer+1
    lda #<binding
    sta _web64_sprite_render_asset_pair__arg_binding
    lda #>binding
    sta _web64_sprite_render_asset_pair__arg_binding+1
    lda #base_slot
    sta _web64_sprite_render_asset_pair__arg_base_slot
    lda #overlay_slot
    sta _web64_sprite_render_asset_pair__arg_overlay_slot
    lda #<x
    sta _web64_sprite_render_asset_pair__arg_x
    lda #>x
    sta _web64_sprite_render_asset_pair__arg_x+1
    lda #y
    sta _web64_sprite_render_asset_pair__arg_y
    lda #base_frame
    sta _web64_sprite_render_asset_pair__arg_base_frame
    lda #overlay_frame
    sta _web64_sprite_render_asset_pair__arg_overlay_frame
    lda #flags
    sta _web64_sprite_render_asset_pair__arg_flags
.endmacro

.macro web64_rt_call_sprite_render_asset_pair renderer, binding, base_slot, overlay_slot, x, y, base_frame, overlay_frame, flags
    web64_rt_prepare_sprite_render_asset_pair renderer, binding, base_slot, overlay_slot, x, y, base_frame, overlay_frame, flags
    jsr _web64_sprite_render_asset_pair
.endmacro

; web64_sprite_render_attachment: 18-byte window; entry _web64_sprite_render_attachment
.macro web64_rt_prepare_sprite_render_attachment renderer, base_slot, overlay_slot, world_x, world_y, camera, offset_x, offset_y, base_frame, overlay_frame, base_color, overlay_color, base_flags, overlay_flags
    lda #<renderer
    sta _web64_sprite_render_attachment__arg_renderer
    lda #>renderer
    sta _web64_sprite_render_attachment__arg_renderer+1
    lda #base_slot
    sta _web64_sprite_render_attachment__arg_base_slot
    lda #overlay_slot
    sta _web64_sprite_render_attachment__arg_overlay_slot
    lda #<world_x
    sta _web64_sprite_render_attachment__arg_world_x
    lda #>world_x
    sta _web64_sprite_render_attachment__arg_world_x+1
    lda #<world_y
    sta _web64_sprite_render_attachment__arg_world_y
    lda #>world_y
    sta _web64_sprite_render_attachment__arg_world_y+1
    lda #<camera
    sta _web64_sprite_render_attachment__arg_camera
    lda #>camera
    sta _web64_sprite_render_attachment__arg_camera+1
    lda #offset_x
    sta _web64_sprite_render_attachment__arg_offset_x
    lda #offset_y
    sta _web64_sprite_render_attachment__arg_offset_y
    lda #base_frame
    sta _web64_sprite_render_attachment__arg_base_frame
    lda #overlay_frame
    sta _web64_sprite_render_attachment__arg_overlay_frame
    lda #base_color
    sta _web64_sprite_render_attachment__arg_base_color
    lda #overlay_color
    sta _web64_sprite_render_attachment__arg_overlay_color
    lda #base_flags
    sta _web64_sprite_render_attachment__arg_base_flags
    lda #overlay_flags
    sta _web64_sprite_render_attachment__arg_overlay_flags
.endmacro

.macro web64_rt_call_sprite_render_attachment renderer, base_slot, overlay_slot, world_x, world_y, camera, offset_x, offset_y, base_frame, overlay_frame, base_color, overlay_color, base_flags, overlay_flags
    web64_rt_prepare_sprite_render_attachment renderer, base_slot, overlay_slot, world_x, world_y, camera, offset_x, offset_y, base_frame, overlay_frame, base_color, overlay_color, base_flags, overlay_flags
    jsr _web64_sprite_render_attachment
.endmacro

; web64_sprite_render_camera: 12-byte window; entry _web64_sprite_render_camera
.macro web64_rt_prepare_sprite_render_camera renderer, slot, world_x, world_y, camera, frame, color, flags
    lda #<renderer
    sta _web64_sprite_render_camera__arg_renderer
    lda #>renderer
    sta _web64_sprite_render_camera__arg_renderer+1
    lda #slot
    sta _web64_sprite_render_camera__arg_slot
    lda #<world_x
    sta _web64_sprite_render_camera__arg_world_x
    lda #>world_x
    sta _web64_sprite_render_camera__arg_world_x+1
    lda #<world_y
    sta _web64_sprite_render_camera__arg_world_y
    lda #>world_y
    sta _web64_sprite_render_camera__arg_world_y+1
    lda #<camera
    sta _web64_sprite_render_camera__arg_camera
    lda #>camera
    sta _web64_sprite_render_camera__arg_camera+1
    lda #frame
    sta _web64_sprite_render_camera__arg_frame
    lda #color
    sta _web64_sprite_render_camera__arg_color
    lda #flags
    sta _web64_sprite_render_camera__arg_flags
.endmacro

.macro web64_rt_call_sprite_render_camera renderer, slot, world_x, world_y, camera, frame, color, flags
    web64_rt_prepare_sprite_render_camera renderer, slot, world_x, world_y, camera, frame, color, flags
    jsr _web64_sprite_render_camera
.endmacro

; web64_sprite_render_overlay: 12-byte window; entry _web64_sprite_render_overlay
.macro web64_rt_prepare_sprite_render_overlay renderer, base_slot, overlay_slot, x, y, base_frame, overlay_frame, base_color, overlay_color, flags
    lda #<renderer
    sta _web64_sprite_render_overlay__arg_renderer
    lda #>renderer
    sta _web64_sprite_render_overlay__arg_renderer+1
    lda #base_slot
    sta _web64_sprite_render_overlay__arg_base_slot
    lda #overlay_slot
    sta _web64_sprite_render_overlay__arg_overlay_slot
    lda #<x
    sta _web64_sprite_render_overlay__arg_x
    lda #>x
    sta _web64_sprite_render_overlay__arg_x+1
    lda #y
    sta _web64_sprite_render_overlay__arg_y
    lda #base_frame
    sta _web64_sprite_render_overlay__arg_base_frame
    lda #overlay_frame
    sta _web64_sprite_render_overlay__arg_overlay_frame
    lda #base_color
    sta _web64_sprite_render_overlay__arg_base_color
    lda #overlay_color
    sta _web64_sprite_render_overlay__arg_overlay_color
    lda #flags
    sta _web64_sprite_render_overlay__arg_flags
.endmacro

.macro web64_rt_call_sprite_render_overlay renderer, base_slot, overlay_slot, x, y, base_frame, overlay_frame, base_color, overlay_color, flags
    web64_rt_prepare_sprite_render_overlay renderer, base_slot, overlay_slot, x, y, base_frame, overlay_frame, base_color, overlay_color, flags
    jsr _web64_sprite_render_overlay
.endmacro

; web64_sprite_renderer_init: 4-byte window; entry _web64_sprite_renderer_init
.macro web64_rt_prepare_sprite_renderer_init renderer, pointer_base
    lda #<renderer
    sta _web64_sprite_renderer_init__arg_renderer
    lda #>renderer
    sta _web64_sprite_renderer_init__arg_renderer+1
    lda #<pointer_base
    sta _web64_sprite_renderer_init__arg_pointer_base
    lda #>pointer_base
    sta _web64_sprite_renderer_init__arg_pointer_base+1
.endmacro

.macro web64_rt_call_sprite_renderer_init renderer, pointer_base
    web64_rt_prepare_sprite_renderer_init renderer, pointer_base
    jsr _web64_sprite_renderer_init
.endmacro

web64/trajectory.h

#ifndef WEB64_TRAJECTORY_H
#define WEB64_TRAJECTORY_H
#include <stdint.h>
#include <web64/game.h>
#define WEB64_TRAJECTORY_ABI_VERSION 1
#define WEB64_TRAJECTORY_MAX_SEGMENTS 1024
#define WEB64_TRAJECTORY_BATCH_MAX_STATES 255
#define WEB64_TRAJECTORY_CONTROL_INDEX_MASK 1023
#define WEB64_TRAJECTORY_NEGATE_X 1024
#define WEB64_TRAJECTORY_NEGATE_Y 2048
#define WEB64_TRAJECTORY_LOOP 4096
#define WEB64_TRAJECTORY_PING_PONG 8192
#define WEB64_TRAJECTORY_REVERSE 16384
#define WEB64_TRAJECTORY_COMPLETE 32768
#define WEB64_TRAJECTORY_OPTIONS_MASK 31744
#define WEB64_TRAJECTORY_CORRECTION_X_NEGATIVE 1
#define WEB64_TRAJECTORY_CORRECTION_Y_NEGATIVE 2
#define WEB64_TRAJECTORY_OK 0
#define WEB64_TRAJECTORY_EVENT_SEGMENT 1
#define WEB64_TRAJECTORY_EVENT_LOOP 2
#define WEB64_TRAJECTORY_EVENT_DIRECTION 4
#define WEB64_TRAJECTORY_EVENT_COMPLETE 8
#define WEB64_TRAJECTORY_INVALID_ARGUMENT 16
#define WEB64_TRAJECTORY_INVALID_PATTERN 32
#define WEB64_TRAJECTORY_INVALID_DURATION 64
#define WEB64_TRAJECTORY_INVALID_STATE 128
#define WEB64_TRAJECTORY_SEGMENT_DELTA_X 0
#define WEB64_TRAJECTORY_SEGMENT_DELTA_Y 1
#define WEB64_TRAJECTORY_SEGMENT_DURATION 2
#define WEB64_TRAJECTORY_SEGMENT_SIZE 3
#define WEB64_TRAJECTORY_PATTERN_SEGMENTS 0
#define WEB64_TRAJECTORY_PATTERN_COUNT 2
#define WEB64_TRAJECTORY_PATTERN_SIZE 4
#define WEB64_TRAJECTORY_STATE_PATTERN 0
#define WEB64_TRAJECTORY_STATE_X 2
#define WEB64_TRAJECTORY_STATE_Y 4
#define WEB64_TRAJECTORY_STATE_STEP_X 6
#define WEB64_TRAJECTORY_STATE_STEP_Y 8
#define WEB64_TRAJECTORY_STATE_CONTROL 10
#define WEB64_TRAJECTORY_STATE_DURATION 12
#define WEB64_TRAJECTORY_STATE_FRAMES_REMAINING 13
#define WEB64_TRAJECTORY_STATE_REMAINDER_X 14
#define WEB64_TRAJECTORY_STATE_REMAINDER_Y 15
#define WEB64_TRAJECTORY_STATE_ERROR_X 16
#define WEB64_TRAJECTORY_STATE_ERROR_Y 17
#define WEB64_TRAJECTORY_STATE_CORRECTION 18
#define WEB64_TRAJECTORY_STATE_SIZE 19
typedef struct { char delta_x; char delta_y; uint8_t duration; } Web64TrajectorySegment;
typedef struct { Web64TrajectorySegment *segments; uint16_t count; } Web64TrajectoryPattern;
typedef struct { Web64TrajectoryPattern *pattern; web64_pos_t x; web64_pos_t y; int16_t step_x; int16_t step_y; uint16_t control; uint8_t duration; uint8_t frames_remaining; uint8_t remainder_x; uint8_t remainder_y; uint8_t error_x; uint8_t error_y; uint8_t correction; } Web64TrajectoryState;
/* Patterns and state are caller-owned and remain directly readable/writable from C or assembly. */
/* These transparent adapters copy only the public Q12.4 result; they link no runtime and trigger no downstream phase. */
#define WEB64_TRAJECTORY_APPLY_BODY(state, body) (body).x = (state).x; (body).y = (state).y
#define WEB64_TRAJECTORY_APPLY_POSITION(state, x_positions, y_positions, index) (x_positions)[(index)] = (state).x; (y_positions)[(index)] = (state).y
/* Checked calls validate before mutation. Fast calls require a previously validated immutable pattern and valid state. */
_web64_rt uint8_t web64_trajectory_validate(const Web64TrajectoryPattern *pattern);
_web64_rt uint8_t web64_trajectory_init(Web64TrajectoryState *state, const Web64TrajectoryPattern *pattern, uint16_t x, uint16_t y, uint16_t options);
_web64_rt uint8_t web64_trajectory_init_fast(Web64TrajectoryState *state, const Web64TrajectoryPattern *pattern, uint16_t x, uint16_t y, uint16_t options);
_web64_rt uint8_t web64_trajectory_step(Web64TrajectoryState *state);
_web64_rt uint8_t web64_trajectory_step_fast(Web64TrajectoryState *state);
/* Batch calls preserve input order and write one event byte per state. Checked batch preflights non-null, non-wrapping, non-overlapping state/event spans before mutation. The fast entry requires those valid spans plus contiguous lockstep states sharing one pattern/index/phase and traversal mode; X/Y negation may differ. */
_web64_rt uint8_t web64_trajectory_step_batch(Web64TrajectoryState *states, uint8_t count, uint8_t *events);
_web64_rt uint8_t web64_trajectory_step_batch_fast(Web64TrajectoryState *states, uint8_t count, uint8_t *events);
#endif

web64/trajectory.inc

; Web64 trajectory public ABI v1
; Caller-owned data; Q12.4 positions; signed pixel deltas; duration is frames.
; Mainline-only, non-reentrant runtime. A/X/Y/flags and $fb-$fe are caller-save.
; Linked _web64_rt entries publish exact-width named argument windows beside their entries.
; This family include is self-contained; runtime.inc remains an optional whole-registry catalog.
; The macros below expand to ordinary instructions/data and add no hidden runtime or storage.
WEB64_TRAJECTORY_ABI_VERSION = 1
WEB64_TRAJECTORY_MAX_SEGMENTS = 1024
WEB64_TRAJECTORY_BATCH_MAX_STATES = 255
WEB64_TRAJECTORY_CONTROL_INDEX_MASK = 1023
WEB64_TRAJECTORY_NEGATE_X = 1024
WEB64_TRAJECTORY_NEGATE_Y = 2048
WEB64_TRAJECTORY_LOOP = 4096
WEB64_TRAJECTORY_PING_PONG = 8192
WEB64_TRAJECTORY_REVERSE = 16384
WEB64_TRAJECTORY_COMPLETE = 32768
WEB64_TRAJECTORY_OPTIONS_MASK = 31744
WEB64_TRAJECTORY_CORRECTION_X_NEGATIVE = 1
WEB64_TRAJECTORY_CORRECTION_Y_NEGATIVE = 2
WEB64_TRAJECTORY_OK = 0
WEB64_TRAJECTORY_EVENT_SEGMENT = 1
WEB64_TRAJECTORY_EVENT_LOOP = 2
WEB64_TRAJECTORY_EVENT_DIRECTION = 4
WEB64_TRAJECTORY_EVENT_COMPLETE = 8
WEB64_TRAJECTORY_INVALID_ARGUMENT = 16
WEB64_TRAJECTORY_INVALID_PATTERN = 32
WEB64_TRAJECTORY_INVALID_DURATION = 64
WEB64_TRAJECTORY_INVALID_STATE = 128
WEB64_TRAJECTORY_SEGMENT_DELTA_X = 0
WEB64_TRAJECTORY_SEGMENT_DELTA_Y = 1
WEB64_TRAJECTORY_SEGMENT_DURATION = 2
WEB64_TRAJECTORY_SEGMENT_SIZE = 3
WEB64_TRAJECTORY_PATTERN_SEGMENTS = 0
WEB64_TRAJECTORY_PATTERN_COUNT = 2
WEB64_TRAJECTORY_PATTERN_SIZE = 4
WEB64_TRAJECTORY_STATE_PATTERN = 0
WEB64_TRAJECTORY_STATE_X = 2
WEB64_TRAJECTORY_STATE_Y = 4
WEB64_TRAJECTORY_STATE_STEP_X = 6
WEB64_TRAJECTORY_STATE_STEP_Y = 8
WEB64_TRAJECTORY_STATE_CONTROL = 10
WEB64_TRAJECTORY_STATE_DURATION = 12
WEB64_TRAJECTORY_STATE_FRAMES_REMAINING = 13
WEB64_TRAJECTORY_STATE_REMAINDER_X = 14
WEB64_TRAJECTORY_STATE_REMAINDER_Y = 15
WEB64_TRAJECTORY_STATE_ERROR_X = 16
WEB64_TRAJECTORY_STATE_ERROR_Y = 17
WEB64_TRAJECTORY_STATE_CORRECTION = 18
WEB64_TRAJECTORY_STATE_SIZE = 19

; Immediate argument helpers. No second include is required for the prepare/call macros.
; These setup helpers clobber A only. Runtime call macros retain the entry clobber contract above.
.macro web64_trajectory_arg_u8 destination, value
    lda #value
    sta destination
.endmacro

.macro web64_trajectory_arg_u16 destination, value
    lda #<value
    sta destination
    lda #>value
    sta destination+1
.endmacro

; Setup-only forms are intended for hot loops that reuse a prepared argument window.
.macro web64_trajectory_prepare_validate pattern
    web64_trajectory_arg_u16 _web64_trajectory_validate__arg_pattern, pattern
.endmacro

.macro web64_trajectory_prepare_init state, pattern, x, y, options
    web64_trajectory_arg_u16 _web64_trajectory_init__arg_state, state
    web64_trajectory_arg_u16 _web64_trajectory_init__arg_pattern, pattern
    web64_trajectory_arg_u16 _web64_trajectory_init__arg_x, x
    web64_trajectory_arg_u16 _web64_trajectory_init__arg_y, y
    web64_trajectory_arg_u16 _web64_trajectory_init__arg_options, options
.endmacro

.macro web64_trajectory_prepare_init_fast state, pattern, x, y, options
    web64_trajectory_arg_u16 _web64_trajectory_init_fast__arg_state, state
    web64_trajectory_arg_u16 _web64_trajectory_init_fast__arg_pattern, pattern
    web64_trajectory_arg_u16 _web64_trajectory_init_fast__arg_x, x
    web64_trajectory_arg_u16 _web64_trajectory_init_fast__arg_y, y
    web64_trajectory_arg_u16 _web64_trajectory_init_fast__arg_options, options
.endmacro

.macro web64_trajectory_prepare_step state
    web64_trajectory_arg_u16 _web64_trajectory_step__arg_state, state
.endmacro

.macro web64_trajectory_prepare_step_fast state
    web64_trajectory_arg_u16 _web64_trajectory_step_fast__arg_state, state
.endmacro

.macro web64_trajectory_prepare_step_batch states, count, events
    web64_trajectory_arg_u16 _web64_trajectory_step_batch__arg_states, states
    web64_trajectory_arg_u8 _web64_trajectory_step_batch__arg_count, count
    web64_trajectory_arg_u16 _web64_trajectory_step_batch__arg_events, events
.endmacro

.macro web64_trajectory_prepare_step_batch_fast states, count, events
    web64_trajectory_arg_u16 _web64_trajectory_step_batch_fast__arg_states, states
    web64_trajectory_arg_u8 _web64_trajectory_step_batch_fast__arg_count, count
    web64_trajectory_arg_u16 _web64_trajectory_step_batch_fast__arg_events, events
.endmacro

; Complete convenience calls set every argument and then invoke the public entry.
.macro web64_trajectory_call_validate pattern
    web64_trajectory_prepare_validate pattern
    jsr _web64_trajectory_validate
.endmacro

.macro web64_trajectory_call_init state, pattern, x, y, options
    web64_trajectory_prepare_init state, pattern, x, y, options
    jsr _web64_trajectory_init
.endmacro

.macro web64_trajectory_call_init_fast state, pattern, x, y, options
    web64_trajectory_prepare_init_fast state, pattern, x, y, options
    jsr _web64_trajectory_init_fast
.endmacro

.macro web64_trajectory_call_step state
    web64_trajectory_prepare_step state
    jsr _web64_trajectory_step
.endmacro

.macro web64_trajectory_call_step_fast state
    web64_trajectory_prepare_step_fast state
    jsr _web64_trajectory_step_fast
.endmacro

.macro web64_trajectory_call_step_batch states, count, events
    web64_trajectory_prepare_step_batch states, count, events
    jsr _web64_trajectory_step_batch
.endmacro

.macro web64_trajectory_call_step_batch_fast states, count, events
    web64_trajectory_prepare_step_batch_fast states, count, events
    jsr _web64_trajectory_step_batch_fast
.endmacro

; Public descriptor/storage helpers. They emit exactly the packed ABI bytes shown above.
.macro web64_trajectory_emit_segment delta_x, delta_y, duration
    .byte delta_x, delta_y, duration
.endmacro

.macro web64_trajectory_emit_pattern segments, count
    .word segments
    .word count
.endmacro

.macro web64_trajectory_reserve_states count
    .fill count * WEB64_TRAJECTORY_STATE_SIZE, 0
.endmacro

.macro web64_trajectory_reserve_events count
    .fill count, 0
.endmacro

; Copy one public Q12.4 state position into two caller-owned 16-bit destinations.
.macro web64_trajectory_copy_position state, x_destination, y_destination
    lda state+WEB64_TRAJECTORY_STATE_X
    sta x_destination
    lda state+WEB64_TRAJECTORY_STATE_X+1
    sta x_destination+1
    lda state+WEB64_TRAJECTORY_STATE_Y
    sta y_destination
    lda state+WEB64_TRAJECTORY_STATE_Y+1
    sta y_destination+1
.endmacro

; Web64 _web64_rt C/assembly call helpers for <web64/trajectory.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_TRAJECTORY_CALL_COUNT = 7
WEB64_RT_TRAJECTORY_WINDOW_CALL_COUNT = 7

; web64_trajectory_init: 10-byte window; entry _web64_trajectory_init
.macro web64_rt_prepare_trajectory_init state, pattern, x, y, options
    lda #<state
    sta _web64_trajectory_init__arg_state
    lda #>state
    sta _web64_trajectory_init__arg_state+1
    lda #<pattern
    sta _web64_trajectory_init__arg_pattern
    lda #>pattern
    sta _web64_trajectory_init__arg_pattern+1
    lda #<x
    sta _web64_trajectory_init__arg_x
    lda #>x
    sta _web64_trajectory_init__arg_x+1
    lda #<y
    sta _web64_trajectory_init__arg_y
    lda #>y
    sta _web64_trajectory_init__arg_y+1
    lda #<options
    sta _web64_trajectory_init__arg_options
    lda #>options
    sta _web64_trajectory_init__arg_options+1
.endmacro

.macro web64_rt_call_trajectory_init state, pattern, x, y, options
    web64_rt_prepare_trajectory_init state, pattern, x, y, options
    jsr _web64_trajectory_init
.endmacro

; web64_trajectory_init_fast: 10-byte window; entry _web64_trajectory_init_fast
.macro web64_rt_prepare_trajectory_init_fast state, pattern, x, y, options
    lda #<state
    sta _web64_trajectory_init_fast__arg_state
    lda #>state
    sta _web64_trajectory_init_fast__arg_state+1
    lda #<pattern
    sta _web64_trajectory_init_fast__arg_pattern
    lda #>pattern
    sta _web64_trajectory_init_fast__arg_pattern+1
    lda #<x
    sta _web64_trajectory_init_fast__arg_x
    lda #>x
    sta _web64_trajectory_init_fast__arg_x+1
    lda #<y
    sta _web64_trajectory_init_fast__arg_y
    lda #>y
    sta _web64_trajectory_init_fast__arg_y+1
    lda #<options
    sta _web64_trajectory_init_fast__arg_options
    lda #>options
    sta _web64_trajectory_init_fast__arg_options+1
.endmacro

.macro web64_rt_call_trajectory_init_fast state, pattern, x, y, options
    web64_rt_prepare_trajectory_init_fast state, pattern, x, y, options
    jsr _web64_trajectory_init_fast
.endmacro

; web64_trajectory_step: 2-byte window; entry _web64_trajectory_step
.macro web64_rt_prepare_trajectory_step state
    lda #<state
    sta _web64_trajectory_step__arg_state
    lda #>state
    sta _web64_trajectory_step__arg_state+1
.endmacro

.macro web64_rt_call_trajectory_step state
    web64_rt_prepare_trajectory_step state
    jsr _web64_trajectory_step
.endmacro

; web64_trajectory_step_batch: 5-byte window; entry _web64_trajectory_step_batch
.macro web64_rt_prepare_trajectory_step_batch states, count, events
    lda #<states
    sta _web64_trajectory_step_batch__arg_states
    lda #>states
    sta _web64_trajectory_step_batch__arg_states+1
    lda #count
    sta _web64_trajectory_step_batch__arg_count
    lda #<events
    sta _web64_trajectory_step_batch__arg_events
    lda #>events
    sta _web64_trajectory_step_batch__arg_events+1
.endmacro

.macro web64_rt_call_trajectory_step_batch states, count, events
    web64_rt_prepare_trajectory_step_batch states, count, events
    jsr _web64_trajectory_step_batch
.endmacro

; web64_trajectory_step_batch_fast: 5-byte window; entry _web64_trajectory_step_batch_fast
.macro web64_rt_prepare_trajectory_step_batch_fast states, count, events
    lda #<states
    sta _web64_trajectory_step_batch_fast__arg_states
    lda #>states
    sta _web64_trajectory_step_batch_fast__arg_states+1
    lda #count
    sta _web64_trajectory_step_batch_fast__arg_count
    lda #<events
    sta _web64_trajectory_step_batch_fast__arg_events
    lda #>events
    sta _web64_trajectory_step_batch_fast__arg_events+1
.endmacro

.macro web64_rt_call_trajectory_step_batch_fast states, count, events
    web64_rt_prepare_trajectory_step_batch_fast states, count, events
    jsr _web64_trajectory_step_batch_fast
.endmacro

; web64_trajectory_step_fast: 2-byte window; entry _web64_trajectory_step_fast
.macro web64_rt_prepare_trajectory_step_fast state
    lda #<state
    sta _web64_trajectory_step_fast__arg_state
    lda #>state
    sta _web64_trajectory_step_fast__arg_state+1
.endmacro

.macro web64_rt_call_trajectory_step_fast state
    web64_rt_prepare_trajectory_step_fast state
    jsr _web64_trajectory_step_fast
.endmacro

; web64_trajectory_validate: 2-byte window; entry _web64_trajectory_validate
.macro web64_rt_prepare_trajectory_validate pattern
    lda #<pattern
    sta _web64_trajectory_validate__arg_pattern
    lda #>pattern
    sta _web64_trajectory_validate__arg_pattern+1
.endmacro

.macro web64_rt_call_trajectory_validate pattern
    web64_rt_prepare_trajectory_validate pattern
    jsr _web64_trajectory_validate
.endmacro

web64/world.h

#ifndef WEB64_WORLD_H
#define WEB64_WORLD_H
#include <stdint.h>
#include <web64/game.h>
#define WEB64_WORLD_MODE_MULTICOLOR 1
#define WEB64_WORLD_CAMERA_WRAP 1
#define WEB64_WORLD_CAMERA_CLAMP 2
#define WEB64_WORLD_COLOR_REGION 0
#define WEB64_WORLD_COLOR_PER_CELL 1
#define WEB64_WORLD_COLOR_NONE 2
#define WEB64_WORLD_BOUNDARY_LEFT 1
#define WEB64_WORLD_BOUNDARY_RIGHT 2
#define WEB64_WORLD_BOUNDARY_UP 4
#define WEB64_WORLD_BOUNDARY_DOWN 8
#define WEB64_WORLD_SCREEN_COLUMNS 40
#define WEB64_WORLD_SCREEN_ROWS 25
typedef struct { uint16_t x; uint16_t y; uint8_t fine_x; uint8_t fine_y; uint8_t flags; } Web64WorldCamera;
typedef struct { uint16_t cells; uint16_t colors; uint16_t materials; uint16_t blocks; uint16_t screen; uint16_t color_ram; uint16_t row_stride; uint8_t width; uint8_t height; uint8_t cell_width; uint8_t cell_height; uint8_t color_mode; uint8_t region_color; uint8_t flags; } Web64WorldView;
typedef struct { uint8_t column; uint8_t row; uint8_t width; uint8_t height; } Web64WorldRect;
_web64_rt void web64_world_apply_video_mode(uint8_t flags, uint8_t memory_setup);
/* Compatibility wrapper retained from Web64 1.7; prefer web64_asset_copy(). */
_web64_rt void web64_world_copy_asset(uint8_t *destination, const uint8_t *source, uint16_t length);
_web64_rt uint8_t web64_world_draw_char_view(uint8_t *cells, uint8_t *colors, uint8_t *screen, uint8_t *color_ram, uint8_t width, uint8_t height, uint8_t row_stride, uint8_t color_mode, uint8_t region_color);
_web64_rt uint8_t web64_world_draw_block2_view(uint8_t *map, uint8_t *blocks, uint8_t *block_colors, uint8_t *screen, uint8_t *color_ram, uint8_t width, uint8_t height, uint8_t row_stride, uint8_t color_mode, uint8_t region_color);
_web64_rt uint8_t web64_world_draw_char_view_screen(uint8_t *cells, uint8_t *screen, uint8_t width, uint8_t height, uint8_t row_stride);
_web64_rt uint8_t web64_world_draw_block2_view_screen(uint8_t *map, uint8_t *blocks, uint8_t *screen, uint8_t width, uint8_t height, uint8_t row_stride);
_web64_rt uint8_t web64_world_stream_column(uint8_t *cells, uint8_t *colors, uint8_t *screen, uint8_t *color_ram, uint8_t source_column, uint8_t dest_column, uint8_t height, uint8_t row_stride, uint8_t screen_stride, uint8_t color_mode, uint8_t region_color);
_web64_rt uint8_t web64_world_stream_row(uint8_t *cells, uint8_t *colors, uint8_t *screen, uint8_t *color_ram, uint8_t source_row, uint8_t dest_row, uint8_t width, uint8_t row_stride, uint8_t screen_stride, uint8_t color_mode, uint8_t region_color);
_web64_rt uint8_t web64_world_stream_column_screen(uint8_t *cells, uint8_t *screen, uint8_t source_column, uint8_t dest_column, uint8_t height, uint8_t row_stride, uint8_t screen_stride);
_web64_rt uint8_t web64_world_stream_row_screen(uint8_t *cells, uint8_t *screen, uint8_t source_row, uint8_t dest_row, uint8_t width, uint8_t row_stride, uint8_t screen_stride);
/* Camera math only: the application owns rendering and frame synchronization. */
/* Boundary bits report direction, not a crossing count; split render steps so each call crosses at most one cell. */
_web64_rt uint8_t web64_world_scroll_x(Web64WorldCamera *camera, int8_t delta_pixels, uint16_t max_cell_x, uint8_t flags);
_web64_rt uint8_t web64_world_scroll_y(Web64WorldCamera *camera, int8_t delta_pixels, uint16_t max_cell_y, uint8_t flags);
/* Synchronize directly from Motion Q12.4 position; clamp or wrap the Motion position before calling. */
_web64_rt uint8_t web64_world_camera_sync_x(Web64WorldCamera *camera, uint16_t subpixel_position);
_web64_rt uint8_t web64_world_camera_sync_y(Web64WorldCamera *camera, uint16_t subpixel_position);
/* Offscreen-page primitives only. Never pass the screen currently selected by VIC-II. */
_web64_rt void web64_world_shift_left(uint8_t *screen, uint8_t *color_ram, uint8_t height, uint8_t color_mode);
_web64_rt void web64_world_shift_right(uint8_t *screen, uint8_t *color_ram, uint8_t height, uint8_t color_mode);
_web64_rt void web64_world_shift_up(uint8_t *screen, uint8_t *color_ram, uint8_t height, uint8_t color_mode);
_web64_rt void web64_world_shift_down(uint8_t *screen, uint8_t *color_ram, uint8_t height, uint8_t color_mode);
_web64_rt uint8_t web64_world_mutate_cell(uint8_t *cells, uint8_t *colors, uint8_t *materials, uint8_t *screen, uint8_t *color_ram, Web64WorldCamera *camera, uint8_t column, uint8_t row, uint8_t value, uint8_t color, uint8_t material, uint8_t row_stride, uint8_t screen_stride, uint8_t color_mode);
#define web64_world_shift_left_screen(screen, height) web64_world_shift_left((screen), 0, (height), WEB64_WORLD_COLOR_NONE)
#define web64_world_shift_right_screen(screen, height) web64_world_shift_right((screen), 0, (height), WEB64_WORLD_COLOR_NONE)
#define web64_world_shift_up_screen(screen, height) web64_world_shift_up((screen), 0, (height), WEB64_WORLD_COLOR_NONE)
#define web64_world_shift_down_screen(screen, height) web64_world_shift_down((screen), 0, (height), WEB64_WORLD_COLOR_NONE)
#define web64_world_mutate_cell_screen(cells, screen, camera, column, row, value, row_stride, screen_stride) web64_world_mutate_cell((cells), 0, 0, (screen), 0, (camera), (column), (row), (value), 0, 0, (row_stride), (screen_stride), WEB64_WORLD_COLOR_NONE)
#define WEB64_WORLD_PIXEL_TO_CELL(pixel) ((uint16_t)(pixel) >> 3)
#define WEB64_WORLD_PIXEL_FINE(pixel) ((uint8_t)(pixel) & 7)
#define WEB64_WORLD_SUBPIXEL_TO_PIXEL(position) ((uint16_t)(position) >> WEB64_SUBPIXEL_BITS)
#define WEB64_WORLD_SUBPIXEL_TO_CELL(position) (WEB64_WORLD_SUBPIXEL_TO_PIXEL(position) >> 3)
#define WEB64_WORLD_SUBPIXEL_FINE(position) (WEB64_WORLD_SUBPIXEL_TO_PIXEL(position) & 7)
#define web64_world_camera_vic_fine_x(camera) (7 - ((camera)->fine_x & 7))
#define web64_world_camera_vic_fine_y(camera) (7 - ((camera)->fine_y & 7))
#define web64_world_camera_pixel_x(camera) (((camera)->x << 3) + (camera)->fine_x)
#define web64_world_camera_pixel_y(camera) (((camera)->y << 3) + (camera)->fine_y)
#endif

web64/world.inc

; Web64 _web64_rt C/assembly call helpers for <web64/world.h>
; Generated from native runtime registry v8; do not hand-edit.
; Arguments are immediate assembly expressions. Pass C globals with their emitted labels.
; Prepare helpers write the complete exact-width window and clobber A only.
; Call helpers prepare the window, JSR the public entry, and inherit its clobber/return contract.
; Helpers allocate no storage. Including this file, or leaving a helper unused, links zero runtime bytes.
WEB64_RT_WORLD_CALL_COUNT = 19
WEB64_RT_WORLD_WINDOW_CALL_COUNT = 19

; web64_world_apply_video_mode: 2-byte window; entry _web64_world_apply_video_mode
.macro web64_rt_prepare_world_apply_video_mode flags, memory_setup
    lda #flags
    sta _web64_world_apply_video_mode__arg_flags
    lda #memory_setup
    sta _web64_world_apply_video_mode__arg_memory_setup
.endmacro

.macro web64_rt_call_world_apply_video_mode flags, memory_setup
    web64_rt_prepare_world_apply_video_mode flags, memory_setup
    jsr _web64_world_apply_video_mode
.endmacro

; web64_world_camera_sync_x: 4-byte window; entry _web64_world_camera_sync_x
.macro web64_rt_prepare_world_camera_sync_x camera, subpixel_position
    lda #<camera
    sta _web64_world_camera_sync_x__arg_camera
    lda #>camera
    sta _web64_world_camera_sync_x__arg_camera+1
    lda #<subpixel_position
    sta _web64_world_camera_sync_x__arg_subpixel_position
    lda #>subpixel_position
    sta _web64_world_camera_sync_x__arg_subpixel_position+1
.endmacro

.macro web64_rt_call_world_camera_sync_x camera, subpixel_position
    web64_rt_prepare_world_camera_sync_x camera, subpixel_position
    jsr _web64_world_camera_sync_x
.endmacro

; web64_world_camera_sync_y: 4-byte window; entry _web64_world_camera_sync_y
.macro web64_rt_prepare_world_camera_sync_y camera, subpixel_position
    lda #<camera
    sta _web64_world_camera_sync_y__arg_camera
    lda #>camera
    sta _web64_world_camera_sync_y__arg_camera+1
    lda #<subpixel_position
    sta _web64_world_camera_sync_y__arg_subpixel_position
    lda #>subpixel_position
    sta _web64_world_camera_sync_y__arg_subpixel_position+1
.endmacro

.macro web64_rt_call_world_camera_sync_y camera, subpixel_position
    web64_rt_prepare_world_camera_sync_y camera, subpixel_position
    jsr _web64_world_camera_sync_y
.endmacro

; web64_world_copy_asset: 6-byte window; entry _web64_world_copy_asset
.macro web64_rt_prepare_world_copy_asset destination, source, length
    lda #<destination
    sta _web64_world_copy_asset__arg_destination
    lda #>destination
    sta _web64_world_copy_asset__arg_destination+1
    lda #<source
    sta _web64_world_copy_asset__arg_source
    lda #>source
    sta _web64_world_copy_asset__arg_source+1
    lda #<length
    sta _web64_world_copy_asset__arg_length
    lda #>length
    sta _web64_world_copy_asset__arg_length+1
.endmacro

.macro web64_rt_call_world_copy_asset destination, source, length
    web64_rt_prepare_world_copy_asset destination, source, length
    jsr _web64_world_copy_asset
.endmacro

; web64_world_draw_block2_view: 15-byte window; entry _web64_world_draw_block2_view
.macro web64_rt_prepare_world_draw_block2_view map, blocks, block_colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    lda #<map
    sta _web64_world_draw_block2_view__arg_map
    lda #>map
    sta _web64_world_draw_block2_view__arg_map+1
    lda #<blocks
    sta _web64_world_draw_block2_view__arg_blocks
    lda #>blocks
    sta _web64_world_draw_block2_view__arg_blocks+1
    lda #<block_colors
    sta _web64_world_draw_block2_view__arg_block_colors
    lda #>block_colors
    sta _web64_world_draw_block2_view__arg_block_colors+1
    lda #<screen
    sta _web64_world_draw_block2_view__arg_screen
    lda #>screen
    sta _web64_world_draw_block2_view__arg_screen+1
    lda #<color_ram
    sta _web64_world_draw_block2_view__arg_color_ram
    lda #>color_ram
    sta _web64_world_draw_block2_view__arg_color_ram+1
    lda #width
    sta _web64_world_draw_block2_view__arg_width
    lda #height
    sta _web64_world_draw_block2_view__arg_height
    lda #row_stride
    sta _web64_world_draw_block2_view__arg_row_stride
    lda #color_mode
    sta _web64_world_draw_block2_view__arg_color_mode
    lda #region_color
    sta _web64_world_draw_block2_view__arg_region_color
.endmacro

.macro web64_rt_call_world_draw_block2_view map, blocks, block_colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    web64_rt_prepare_world_draw_block2_view map, blocks, block_colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    jsr _web64_world_draw_block2_view
.endmacro

; web64_world_draw_block2_view_screen: 9-byte window; entry _web64_world_draw_block2_view_screen
.macro web64_rt_prepare_world_draw_block2_view_screen map, blocks, screen, width, height, row_stride
    lda #<map
    sta _web64_world_draw_block2_view_screen__arg_map
    lda #>map
    sta _web64_world_draw_block2_view_screen__arg_map+1
    lda #<blocks
    sta _web64_world_draw_block2_view_screen__arg_blocks
    lda #>blocks
    sta _web64_world_draw_block2_view_screen__arg_blocks+1
    lda #<screen
    sta _web64_world_draw_block2_view_screen__arg_screen
    lda #>screen
    sta _web64_world_draw_block2_view_screen__arg_screen+1
    lda #width
    sta _web64_world_draw_block2_view_screen__arg_width
    lda #height
    sta _web64_world_draw_block2_view_screen__arg_height
    lda #row_stride
    sta _web64_world_draw_block2_view_screen__arg_row_stride
.endmacro

.macro web64_rt_call_world_draw_block2_view_screen map, blocks, screen, width, height, row_stride
    web64_rt_prepare_world_draw_block2_view_screen map, blocks, screen, width, height, row_stride
    jsr _web64_world_draw_block2_view_screen
.endmacro

; web64_world_draw_char_view: 13-byte window; entry _web64_world_draw_char_view
.macro web64_rt_prepare_world_draw_char_view cells, colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    lda #<cells
    sta _web64_world_draw_char_view__arg_cells
    lda #>cells
    sta _web64_world_draw_char_view__arg_cells+1
    lda #<colors
    sta _web64_world_draw_char_view__arg_colors
    lda #>colors
    sta _web64_world_draw_char_view__arg_colors+1
    lda #<screen
    sta _web64_world_draw_char_view__arg_screen
    lda #>screen
    sta _web64_world_draw_char_view__arg_screen+1
    lda #<color_ram
    sta _web64_world_draw_char_view__arg_color_ram
    lda #>color_ram
    sta _web64_world_draw_char_view__arg_color_ram+1
    lda #width
    sta _web64_world_draw_char_view__arg_width
    lda #height
    sta _web64_world_draw_char_view__arg_height
    lda #row_stride
    sta _web64_world_draw_char_view__arg_row_stride
    lda #color_mode
    sta _web64_world_draw_char_view__arg_color_mode
    lda #region_color
    sta _web64_world_draw_char_view__arg_region_color
.endmacro

.macro web64_rt_call_world_draw_char_view cells, colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    web64_rt_prepare_world_draw_char_view cells, colors, screen, color_ram, width, height, row_stride, color_mode, region_color
    jsr _web64_world_draw_char_view
.endmacro

; web64_world_draw_char_view_screen: 7-byte window; entry _web64_world_draw_char_view_screen
.macro web64_rt_prepare_world_draw_char_view_screen cells, screen, width, height, row_stride
    lda #<cells
    sta _web64_world_draw_char_view_screen__arg_cells
    lda #>cells
    sta _web64_world_draw_char_view_screen__arg_cells+1
    lda #<screen
    sta _web64_world_draw_char_view_screen__arg_screen
    lda #>screen
    sta _web64_world_draw_char_view_screen__arg_screen+1
    lda #width
    sta _web64_world_draw_char_view_screen__arg_width
    lda #height
    sta _web64_world_draw_char_view_screen__arg_height
    lda #row_stride
    sta _web64_world_draw_char_view_screen__arg_row_stride
.endmacro

.macro web64_rt_call_world_draw_char_view_screen cells, screen, width, height, row_stride
    web64_rt_prepare_world_draw_char_view_screen cells, screen, width, height, row_stride
    jsr _web64_world_draw_char_view_screen
.endmacro

; web64_world_mutate_cell: 20-byte window; entry _web64_world_mutate_cell
.macro web64_rt_prepare_world_mutate_cell cells, colors, materials, screen, color_ram, camera, column, row, value, color, material, row_stride, screen_stride, color_mode
    lda #<cells
    sta _web64_world_mutate_cell__arg_cells
    lda #>cells
    sta _web64_world_mutate_cell__arg_cells+1
    lda #<colors
    sta _web64_world_mutate_cell__arg_colors
    lda #>colors
    sta _web64_world_mutate_cell__arg_colors+1
    lda #<materials
    sta _web64_world_mutate_cell__arg_materials
    lda #>materials
    sta _web64_world_mutate_cell__arg_materials+1
    lda #<screen
    sta _web64_world_mutate_cell__arg_screen
    lda #>screen
    sta _web64_world_mutate_cell__arg_screen+1
    lda #<color_ram
    sta _web64_world_mutate_cell__arg_color_ram
    lda #>color_ram
    sta _web64_world_mutate_cell__arg_color_ram+1
    lda #<camera
    sta _web64_world_mutate_cell__arg_camera
    lda #>camera
    sta _web64_world_mutate_cell__arg_camera+1
    lda #column
    sta _web64_world_mutate_cell__arg_column
    lda #row
    sta _web64_world_mutate_cell__arg_row
    lda #value
    sta _web64_world_mutate_cell__arg_value
    lda #color
    sta _web64_world_mutate_cell__arg_color
    lda #material
    sta _web64_world_mutate_cell__arg_material
    lda #row_stride
    sta _web64_world_mutate_cell__arg_row_stride
    lda #screen_stride
    sta _web64_world_mutate_cell__arg_screen_stride
    lda #color_mode
    sta _web64_world_mutate_cell__arg_color_mode
.endmacro

.macro web64_rt_call_world_mutate_cell cells, colors, materials, screen, color_ram, camera, column, row, value, color, material, row_stride, screen_stride, color_mode
    web64_rt_prepare_world_mutate_cell cells, colors, materials, screen, color_ram, camera, column, row, value, color, material, row_stride, screen_stride, color_mode
    jsr _web64_world_mutate_cell
.endmacro

; web64_world_scroll_x: 6-byte window; entry _web64_world_scroll_x
.macro web64_rt_prepare_world_scroll_x camera, delta_pixels, max_cell_x, flags
    lda #<camera
    sta _web64_world_scroll_x__arg_camera
    lda #>camera
    sta _web64_world_scroll_x__arg_camera+1
    lda #delta_pixels
    sta _web64_world_scroll_x__arg_delta_pixels
    lda #<max_cell_x
    sta _web64_world_scroll_x__arg_max_cell_x
    lda #>max_cell_x
    sta _web64_world_scroll_x__arg_max_cell_x+1
    lda #flags
    sta _web64_world_scroll_x__arg_flags
.endmacro

.macro web64_rt_call_world_scroll_x camera, delta_pixels, max_cell_x, flags
    web64_rt_prepare_world_scroll_x camera, delta_pixels, max_cell_x, flags
    jsr _web64_world_scroll_x
.endmacro

; web64_world_scroll_y: 6-byte window; entry _web64_world_scroll_y
.macro web64_rt_prepare_world_scroll_y camera, delta_pixels, max_cell_y, flags
    lda #<camera
    sta _web64_world_scroll_y__arg_camera
    lda #>camera
    sta _web64_world_scroll_y__arg_camera+1
    lda #delta_pixels
    sta _web64_world_scroll_y__arg_delta_pixels
    lda #<max_cell_y
    sta _web64_world_scroll_y__arg_max_cell_y
    lda #>max_cell_y
    sta _web64_world_scroll_y__arg_max_cell_y+1
    lda #flags
    sta _web64_world_scroll_y__arg_flags
.endmacro

.macro web64_rt_call_world_scroll_y camera, delta_pixels, max_cell_y, flags
    web64_rt_prepare_world_scroll_y camera, delta_pixels, max_cell_y, flags
    jsr _web64_world_scroll_y
.endmacro

; web64_world_shift_down: 6-byte window; entry _web64_world_shift_down
.macro web64_rt_prepare_world_shift_down screen, color_ram, height, color_mode
    lda #<screen
    sta _web64_world_shift_down__arg_screen
    lda #>screen
    sta _web64_world_shift_down__arg_screen+1
    lda #<color_ram
    sta _web64_world_shift_down__arg_color_ram
    lda #>color_ram
    sta _web64_world_shift_down__arg_color_ram+1
    lda #height
    sta _web64_world_shift_down__arg_height
    lda #color_mode
    sta _web64_world_shift_down__arg_color_mode
.endmacro

.macro web64_rt_call_world_shift_down screen, color_ram, height, color_mode
    web64_rt_prepare_world_shift_down screen, color_ram, height, color_mode
    jsr _web64_world_shift_down
.endmacro

; web64_world_shift_left: 6-byte window; entry _web64_world_shift_left
.macro web64_rt_prepare_world_shift_left screen, color_ram, height, color_mode
    lda #<screen
    sta _web64_world_shift_left__arg_screen
    lda #>screen
    sta _web64_world_shift_left__arg_screen+1
    lda #<color_ram
    sta _web64_world_shift_left__arg_color_ram
    lda #>color_ram
    sta _web64_world_shift_left__arg_color_ram+1
    lda #height
    sta _web64_world_shift_left__arg_height
    lda #color_mode
    sta _web64_world_shift_left__arg_color_mode
.endmacro

.macro web64_rt_call_world_shift_left screen, color_ram, height, color_mode
    web64_rt_prepare_world_shift_left screen, color_ram, height, color_mode
    jsr _web64_world_shift_left
.endmacro

; web64_world_shift_right: 6-byte window; entry _web64_world_shift_right
.macro web64_rt_prepare_world_shift_right screen, color_ram, height, color_mode
    lda #<screen
    sta _web64_world_shift_right__arg_screen
    lda #>screen
    sta _web64_world_shift_right__arg_screen+1
    lda #<color_ram
    sta _web64_world_shift_right__arg_color_ram
    lda #>color_ram
    sta _web64_world_shift_right__arg_color_ram+1
    lda #height
    sta _web64_world_shift_right__arg_height
    lda #color_mode
    sta _web64_world_shift_right__arg_color_mode
.endmacro

.macro web64_rt_call_world_shift_right screen, color_ram, height, color_mode
    web64_rt_prepare_world_shift_right screen, color_ram, height, color_mode
    jsr _web64_world_shift_right
.endmacro

; web64_world_shift_up: 6-byte window; entry _web64_world_shift_up
.macro web64_rt_prepare_world_shift_up screen, color_ram, height, color_mode
    lda #<screen
    sta _web64_world_shift_up__arg_screen
    lda #>screen
    sta _web64_world_shift_up__arg_screen+1
    lda #<color_ram
    sta _web64_world_shift_up__arg_color_ram
    lda #>color_ram
    sta _web64_world_shift_up__arg_color_ram+1
    lda #height
    sta _web64_world_shift_up__arg_height
    lda #color_mode
    sta _web64_world_shift_up__arg_color_mode
.endmacro

.macro web64_rt_call_world_shift_up screen, color_ram, height, color_mode
    web64_rt_prepare_world_shift_up screen, color_ram, height, color_mode
    jsr _web64_world_shift_up
.endmacro

; web64_world_stream_column: 15-byte window; entry _web64_world_stream_column
.macro web64_rt_prepare_world_stream_column cells, colors, screen, color_ram, source_column, dest_column, height, row_stride, screen_stride, color_mode, region_color
    lda #<cells
    sta _web64_world_stream_column__arg_cells
    lda #>cells
    sta _web64_world_stream_column__arg_cells+1
    lda #<colors
    sta _web64_world_stream_column__arg_colors
    lda #>colors
    sta _web64_world_stream_column__arg_colors+1
    lda #<screen
    sta _web64_world_stream_column__arg_screen
    lda #>screen
    sta _web64_world_stream_column__arg_screen+1
    lda #<color_ram
    sta _web64_world_stream_column__arg_color_ram
    lda #>color_ram
    sta _web64_world_stream_column__arg_color_ram+1
    lda #source_column
    sta _web64_world_stream_column__arg_source_column
    lda #dest_column
    sta _web64_world_stream_column__arg_dest_column
    lda #height
    sta _web64_world_stream_column__arg_height
    lda #row_stride
    sta _web64_world_stream_column__arg_row_stride
    lda #screen_stride
    sta _web64_world_stream_column__arg_screen_stride
    lda #color_mode
    sta _web64_world_stream_column__arg_color_mode
    lda #region_color
    sta _web64_world_stream_column__arg_region_color
.endmacro

.macro web64_rt_call_world_stream_column cells, colors, screen, color_ram, source_column, dest_column, height, row_stride, screen_stride, color_mode, region_color
    web64_rt_prepare_world_stream_column cells, colors, screen, color_ram, source_column, dest_column, height, row_stride, screen_stride, color_mode, region_color
    jsr _web64_world_stream_column
.endmacro

; web64_world_stream_column_screen: 9-byte window; entry _web64_world_stream_column_screen
.macro web64_rt_prepare_world_stream_column_screen cells, screen, source_column, dest_column, height, row_stride, screen_stride
    lda #<cells
    sta _web64_world_stream_column_screen__arg_cells
    lda #>cells
    sta _web64_world_stream_column_screen__arg_cells+1
    lda #<screen
    sta _web64_world_stream_column_screen__arg_screen
    lda #>screen
    sta _web64_world_stream_column_screen__arg_screen+1
    lda #source_column
    sta _web64_world_stream_column_screen__arg_source_column
    lda #dest_column
    sta _web64_world_stream_column_screen__arg_dest_column
    lda #height
    sta _web64_world_stream_column_screen__arg_height
    lda #row_stride
    sta _web64_world_stream_column_screen__arg_row_stride
    lda #screen_stride
    sta _web64_world_stream_column_screen__arg_screen_stride
.endmacro

.macro web64_rt_call_world_stream_column_screen cells, screen, source_column, dest_column, height, row_stride, screen_stride
    web64_rt_prepare_world_stream_column_screen cells, screen, source_column, dest_column, height, row_stride, screen_stride
    jsr _web64_world_stream_column_screen
.endmacro

; web64_world_stream_row: 15-byte window; entry _web64_world_stream_row
.macro web64_rt_prepare_world_stream_row cells, colors, screen, color_ram, source_row, dest_row, width, row_stride, screen_stride, color_mode, region_color
    lda #<cells
    sta _web64_world_stream_row__arg_cells
    lda #>cells
    sta _web64_world_stream_row__arg_cells+1
    lda #<colors
    sta _web64_world_stream_row__arg_colors
    lda #>colors
    sta _web64_world_stream_row__arg_colors+1
    lda #<screen
    sta _web64_world_stream_row__arg_screen
    lda #>screen
    sta _web64_world_stream_row__arg_screen+1
    lda #<color_ram
    sta _web64_world_stream_row__arg_color_ram
    lda #>color_ram
    sta _web64_world_stream_row__arg_color_ram+1
    lda #source_row
    sta _web64_world_stream_row__arg_source_row
    lda #dest_row
    sta _web64_world_stream_row__arg_dest_row
    lda #width
    sta _web64_world_stream_row__arg_width
    lda #row_stride
    sta _web64_world_stream_row__arg_row_stride
    lda #screen_stride
    sta _web64_world_stream_row__arg_screen_stride
    lda #color_mode
    sta _web64_world_stream_row__arg_color_mode
    lda #region_color
    sta _web64_world_stream_row__arg_region_color
.endmacro

.macro web64_rt_call_world_stream_row cells, colors, screen, color_ram, source_row, dest_row, width, row_stride, screen_stride, color_mode, region_color
    web64_rt_prepare_world_stream_row cells, colors, screen, color_ram, source_row, dest_row, width, row_stride, screen_stride, color_mode, region_color
    jsr _web64_world_stream_row
.endmacro

; web64_world_stream_row_screen: 9-byte window; entry _web64_world_stream_row_screen
.macro web64_rt_prepare_world_stream_row_screen cells, screen, source_row, dest_row, width, row_stride, screen_stride
    lda #<cells
    sta _web64_world_stream_row_screen__arg_cells
    lda #>cells
    sta _web64_world_stream_row_screen__arg_cells+1
    lda #<screen
    sta _web64_world_stream_row_screen__arg_screen
    lda #>screen
    sta _web64_world_stream_row_screen__arg_screen+1
    lda #source_row
    sta _web64_world_stream_row_screen__arg_source_row
    lda #dest_row
    sta _web64_world_stream_row_screen__arg_dest_row
    lda #width
    sta _web64_world_stream_row_screen__arg_width
    lda #row_stride
    sta _web64_world_stream_row_screen__arg_row_stride
    lda #screen_stride
    sta _web64_world_stream_row_screen__arg_screen_stride
.endmacro

.macro web64_rt_call_world_stream_row_screen cells, screen, source_row, dest_row, width, row_stride, screen_stride
    web64_rt_prepare_world_stream_row_screen cells, screen, source_row, dest_row, width, row_stride, screen_stride
    jsr _web64_world_stream_row_screen
.endmacro