
NOTE! integers are in big endian format.



WLA GB-Z80/Z80/6502/65C02/6510/65816/HuC6280/SPC-700 object file format "WLAM"


bytes   description

header:

  4     format information,
        "WLAM" - WLA GB-Z80/Z80/6502/65C02/6510/65816/HuC6280/SPC-700 object file version 14 (05-Feb-2016)
  1     empty fill
  1     misc bits (bit 0 - sms checksum (1 == compute)
                   bit 1 - snes rom mode (0 == lorom, 1 == hirom)
                   bit 2 - snes banking indicator (1 == use snes rom banking)
                   bit 3 - snes rom speed indicator (0 == 200ns, 1 == 120ns)
                   bit 4 - gb checksum (1 == compute)
                   bit 5 - gb complement check (1 == compute)
		   bit 6 - snes checksum (1 == compute)
                   bit 7 - 65816 indicator (1 == 65816))
  1     more bits (bit 0 - smc (1 == add smc rom header)
                   bit 1 - snes sram size, lower bit
                   bit 2 - snes sram size, higher bit
		   bit 3 - sms tag (1 == inject))

rom bank map:

  4     number of rom banks (int)
  1     entry types (0 = general bank size follows, 1 = bank size list follows)
  4     general bank size (int)
  ...
  4     bank size (int)
  ...

memory map:

  1     number of entries (1-255)
  ...
  4     slot address (int)
  4     slot size (int)
  ...

source file name list:

  4     number of source file names (int)
  ...
  n     source file name (0 terminated)
  1     id
  ...

exported definitions:

  4     number of definitions (int)
  ...
  n     definition label (terminated with 0 (value definition) or 1 (calculation definition))
  8     value or index of the pending calculation (double)
  ...

labels, symbols and breakpoints:

  4     number of entries (int)
  ...
  n     name (0 terminated if a label, 1 if a symbol, 2 if a breakpoint)
  1     slot number (0-255)
  1     file id
  4     section (0 = no section, 1+ = section id) (int)
  4     relative address (int)
  4     line number (int)
  4     bank number (int)
  ...

outside references:

  4     number of references (int)
  ...
  n     label (0 terminated)
  1     type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
              4 = relative 16-bit)
  1     file id
  1     slot number (0-255)
  4     section (0 = no section, 1+ = section id) (int)
  4     line number (int)
  4     relative address (int)
  4     bank number (int)
  ...

pending calculations:

  4     number of pending calculations (int)
  ...
  4     id (int)
  1     result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit)
        if bit 7 ~ 1, then the label references are relative, else absolute
  4     section (0 = no section, 1+ = section id) (int)
  1     file id
  1     number of stack items
  1     position (0 = definition, 1 = elsewhere)
  1     slot number (0-255)
  4     relative address (int)
  4     line number (int)
  4     bank number (int)
  ...
  1     type (0 = value, 1 = operator, 2 = string, 3 = deleted, 4 = stack)
  1     sign (0 = positive, 1 = negative)
  8     value (double) OR
  n     string (0 terminated)
  ...
  ...

data area (loops to the end of the file):

  ...
  1     type (0 = data block, 1 = section)
  ...

data block:

  4     address (int)
  4     number of bytes n (int)
  n     data

section:

  n     name (terminated with 0 (free), 1 (forced), 2 (overwrite), 3 (header),
                              4 (semifree), 5 (absolute), 6 (ram),
                              7 (superfree) or 8 (semisubfree))
  n     namespace (terminated with 0)
  4     section id (int)
  1     slot number (0-255)
  1     file id
  4     relative address (int)
  4     bank number (int)
  4     size (int)
  4     alignment (int)
  n     data
  1     list file information (0 == no, 1 == yes)
  n     list file information block (if present)



WLA-GB/Z80/6502/65C02/6510/65816/HuC6280/SPC-700 library file format "WLAX"


bytes   description

header:

  4     format information,
        "WLAX" - WLA-GB/Z80/6502/65C02/6510/65816/HuC6280/SPC-700 library file version 12 (05-Feb-2016)

source file name list:

  4     number of source file names (int)
  ...
  n     source file name (0 terminated)
  1     id
  ...

exported definitions:

  4     number of definitions (int)
  ...
  n     definition label (terminated with 0 (value definition) or 1 (calculation definition))
  8     value or index of the pending calculation (double)
  ...

labels, symbols and breakpoints:

  4     number of entries (int)
  ...
  n     name (0 terminated if a label, 1 if a symbol, 2 if a breakpoint)
  4     section (1+ = section id) (int)
  1     file id
  4     line number (int)
  4     relative address (int)
  ...

outside references:

  4     number of references (int)
  ...
  n     label (0 terminated)
  1     type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
              4 = relative 16-bit)
  4     section (1+ = section id) (int)
  1     file id
  4     line number (int)
  4     relative address (int)
  ...

pending calculations:

  4     number of pending calculations (int)
  ...
  4     id (int)
  1     result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit)
        if bit 7 ~ 1, then the label references are relative, else absolute
  4     section (1+ = section id) (int)
  1     file id
  1     number of stack items
  1     position (0 = definition, 1 = elsewhere)
  4     relative address (int)
  4     line number (int)
  ...
  1     type (0 = value, 1 = operator, 2 = string, 3 = deleted, 4 = stack)
  1     sign (0 = positive, 1 = negative)
  8     value (double) OR
  n     string (0 terminated)
  ...
  ...

sections:

  ...
  n     name (terminated with 0 (for free) or 7 (for superfree))
  n     namespace (terminated with 0)
  4     section id (int)
  1     file id
  4     number of bytes (int)
  4     alignment (int)
  n     data
  1     list file information (0 == no, 1 == yes)
  n     list file information block (if present)
  ...




* list file information block:

bytes   description

  4     number of items
  ...
  1     command ('f' == file name, 'k' == new line)
  4     data 0 (int)
  4     data 1 (present only if command == 'k') (int)
  ...
