#+STARTUP: overview

* Tube registers

| Host Addr | Read              | R Note | Write           | W Note |
|-----------+-------------------+--------+-----------------+--------|
| fee0      | A1 F1 P V M J I Q |        | S T P V M K I Q |        |
| fee1      | FIFO 1 p2h data   |        | FIFO 1 h2p data | 6      |
| fee2      | A2 F2 1 1 1 1 1 1 |        | -               |        |
| fee3      | FIFO 2 p2h data   |        | FIFO 2 h2p data |        |
| fee4      | A3 F3 1 1 1 1 1 1 |        | -               |        |
| fee5      | FIFO 3 p2h data   | 2      | FIFO 3 h2p data | 7      |
| fee6      | A4 F4 1 1 1 1 1 1 |        | -               |        |
| fee7      | FIFO 4 p2h data   | 4      | FIFO 4 h2p data | 9      |

| Par Addr | Read              | R Note | Write          | W Note |
|----------+-------------------+--------+----------------+--------|
| fef8     | A1 F1 P V M J I Q | 1      | -              |        |
| fef9     | FIFO1 h2p data    |        | FIFO1 p2h data |        |
| fefa     | A2 F2 1 1 1 1 1 1 |        | -              |        |
| fefb     | FIFO2 h2p data    |        | FIFO2 p2h data |        |
| fefc     | A3 F3 1 1 1 1 1 1 |        | -              |        |
| fefd     | FIFO3 h2p data    |  3     | FIFO3 p2h data |        |
| fefe     | A4 F4 1 1 1 1 1 1 |        | -              |        |
| feff     | FIFO4 h2p data    |  5     | FIFO4 p2h data |  10    |

HIRQ: Q=1, R4 p2h data available

PIRQ: I=1, R1 h2p data available
      J=1, R4 h2p data available

These two cases must be tracked independently, as the two status can
be reset independently.

PNMI: M=1, V=0, 1+ byte in R3 h2p
      M=1, V=1, 2 bytes in R3 h2p
      M=1, 0 bytes in R3 p2h

** TODO 1. Will clear PIRQ if register 1 was the source
** TODO 2. May activate PNMI depending on M and V flags
** TODO 3. May clear PNMI (see description of interrupt operation)
** TODO 4. Will clear HIRQ if it was active
** TODO 5. Will clear PIRQ if register 4 was the source
** TODO 6. Will activate PIRQ if I = 1
** TODO 7. May activate PNMI depending on M and V flags
** TODO 8. May clear PNMI
** TODO 9. Will activate PIRQ is J = 1
** TODO 10. Will activate HIRQ if Q = 1
* ADC registers

| nCS | nRD | nWR | (Access) | A1 | A0 | (Addr) | Mode         | Internal Function | Data I/O terminals     |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   1 |   - |   - | -        |  - |  - |        | Not selected |                   | High impedance         |
|   0 |   1 |   1 | -        |  - |  - |        | Not selected |                   | High impedance         |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   1 |   0 | write    |  0 |  0 |      0 | Write mode   | A/D start         | Input status           |
|     |     |     |          |    |    |        |              |                   | D1;D0 = MPX address    |
|     |     |     |          |    |    |        |              |                   | D2 = flag              |
|     |     |     |          |    |    |        |              |                   | D3 = 10-bit I/O if set |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   1 |   0 | write    |  0 |  1 |      1 | Not selected |                   | High impedance         |
|   0 |   1 |   0 | write    |  1 |  0 |      2 | Not selected |                   | High impedance         |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   1 |   0 | write    |  1 |  1 |      3 | Test mode    | Test status       |                        |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   0 |   1 | read     |  0 |  0 |      0 | Read mode    | Internal status   | D1;D0 = MPX            |
|     |     |     |          |    |    |        |              |                   | D2 = flag              |
|     |     |     |          |    |    |        |              |                   | D3 = 8/10              |
|     |     |     |          |    |    |        |              |                   | D5;D4 = MSBs           |
|     |     |     |          |    |    |        |              |                   | D6 = BUSY              |
|     |     |     |          |    |    |        |              |                   | D7 = ~EOC              |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   0 |   1 | read     |  0 |  1 |      1 | Read mode    | High data byte    |                        |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|
|   0 |   0 |   1 | read     |  1 |  0 |      2 | Read mode    | Low data byte     |                        |
|   0 |   0 |   1 | read     |  1 |  1 |      3 | Read mode    | Low data byte     |                        |
|-----+-----+-----+----------+----+----+--------+--------------+-------------------+------------------------|

* BeebThreadTimelineState

#+begin_src c++
  struct BeebThreadTimelineState {
      BeebThreadTimelineMode mode;  // y = ts.timeline_mode
      CycleCount begin_cycles;      // y } cycle range for event list...
      CycleCount end_cycles;        // y } ...see BeebThread::ThreadMain
      CycleCount current_cycles;    // = ts.num_executed_cycles
      size_t num_events;            // y needs tracking...
      size_t num_beeb_state_events; // y = ts.timeline_event_lists.size()
      bool can_record;              // y mode-dependent; see BeebThread::ThreadMain
      uint32_t clone_impediments;   // y see BeebThread::ThreadMain
  };
#+end_src

* Dock Fix Fallout

** DONE LEDs popup
CLOSED: [2023-12-19 Tue 23:58]
** DONE Messages popup
CLOSED: [2023-12-19 Tue 23:59]
** DONE ~ImGuiConsumePressedKeycode~
CLOSED: [2024-01-06 Sat 17:47]
** DONE Demo window
CLOSED: [2023-12-20 Wed 00:01]
** DONE Stored drawlists window
CLOSED: [2023-12-20 Wed 00:01]
** DONE Metrics window
CLOSED: [2023-12-20 Wed 00:01]
** DONE Beeb display size+borders
CLOSED: [2023-12-19 Tue 18:23]
** DONE Glitch when toggling texture filtering
CLOSED: [2023-12-19 Tue 19:28]

* test_AVFoundation

Convert video to .jpg files:

: ffmpeg -i "../IMG_1145.MOV" -q:v 2 %06d.jpg

Convert video to .wav file:

: ffmpeg -i "../IMG_1145.MOV" -f wav -vn test.wav

Command line options for test_AVFoundation:

#+begin_example
  --verbose -o /tmp/xyz.mov /Users/tom/tmp/video_test/frames
#+end_example

* Submodule notes

Where a submodule tracks a GitHub repo that's a fork, GitHub mostly
tracks the right source of the fork. Use the URL of the forked repo
(as shown on its GitHub repo page) as the ~upstream~ remote.

Because of the way submodules work, it's basically impossible to
remove one once it's been added, in case some historical revision
still uses it. So not all of them are actually used by the head
revision, but... hopefully... if you were to check out every single
revision of the repo, you'd find that every one was used at at least
one point.

Other submodule-specific notes:

** ~imgui~

This is a fork of the upstream repo, docking branch.

(For a long while it did track somebody else's fork
(https://github.com/Flix01/imgui/), which included some docking UI
functionality, but this appears to have been abandoned.

** ~SDL~

Unused submodule.

Fork of old mirror of SDL, plus a patch for rendering API-agnostic
triangle drawing. See https://github.com/libsdl-org/SDL/issues/772

SDL then moved to GitHub, and its official repo turned out not to be
mergeable with this one.

** ~SDL_official~ (https://github.com/tom-seddon/SDL-1)

Fork of the official SDL repo.

* Turbo disc (RIP)

After 1770 sets DRQ, wait for CPU to read/write data register. Once
read/written, wait for CPU to execute next RTI. Then go to the next
byte straight away. Also: reduce settle and seek times. (Don't omit
the inter-sector delay, as Watford DDFS needs it.)

This involved a bunch of code in a bunch of places, and ended up a
special case, being a runtime toggle (that affected reproducibility)
rather than part of the BeebConfig. And I never tested it enough to
promote it.

It could return, but probably won't... there are better ways of
providing fast file access, that b2 should probably support instead -
BeebLink (etc.), B-em's VDFS (etc.), (if you want ADFS) some kind of
hard disc emulation, and so on.

* Debugger paging override syntax

When providing an address, by default the debugger accesses whichever
byte of memory is paged in at the time. If you access address 8003,
for example, you could get any one of 16 paged ROMs, or (on B+/Master)
some of the extra RAM, depending on the value of ROMSEL.

If you want to refer to a particular byte, unambiguously, you can use
the paging override syntax. This consists of a prefix, specifying
which bits of paged memory are paged in, then a ~.~, then the address.
For example, ~5.8003~, to refer to address 8003 in ROM bank 5.

The available prefixes are as follows:

- ~0~, ~1~, ~2~, ~3~, ~4~, ~5~, ~6~, ~7~, ~8~, ~9~, ~a~, ~b~, ~c~, ~d~, ~e~, ~f~,  - the given ROM bank
- ~n~ - ANDY (Master), extra 12K RAM (B+)
- ~m~, ~s~ - main RAM or shadow RAM
- ~h~ - HAZEL (Master)
- ~i~ - I/O area (only useful on Master)
- ~o~ - OS

prefix precedence? overlapping areas??

** B

| Address   | What                                                                         |
|-----------+------------------------------------------------------------------------------|
| 0000-7fff | always main RAM                                                              |
| 8000-bfff | current paged ROM as per ROMSEL, or ~0123456789abcdef~ for specific ROM bank |
| c000-fbff | always OS                                                                    |
| fc00-feff | I/O area, or ~o~ for OS (not terribly useful)                                |
| ff00-ffff | always OS                                                                    |

** B+

| Address   | What                                                                                                             |
|-----------+------------------------------------------------------------------------------------------------------------------|
| 0000-2fff | always main RAM                                                                                                  |
| 3000-7fff | shadow/main RAM as per bit 7 of ACCON, or ~m~ for main RAM, or ~s~ for shadow RAM                                |
| 8000-afff | current paged ROM/extra RAM as per ROMSEL, or ~0123456789abcdef~ for specific ROM bank, or ~n~ for 12K extra RAM |
| b000-bfff | current paged ROM as per ROMSEL, or ~0123456789abcdef~ for specific ROM bank                                     |
| c000-fbff | always OS                                                                                                        |
| fc00-feff | I/O area, or ~o~ for OS (not terribly useful)                                                                    |
| ff00-ffff | always OS                                                                                                        |

Notes:

- ~n~ is for aNdy, which is what the RAM at 8000 is called on the Master

** Master

| Address   | What                                                                                               |
|-----------+----------------------------------------------------------------------------------------------------|
| 0000-2fff | always main RAM                                                                                    |
| 3000-7fff | shadow/main RAM as per bit 2 of ACCCON, or ~m~ for main RAM, or ~s~ for shadow RAM                 |
| 8000-8fff | current paged ROM/ANDY as per ROMSEL, or ~0123456789abcdef~ for specific ROM bank, or ~n~ for ANDY |
| 9000-bfff | current paged ROM as per ROMSEL, or ~0123456789abcdef~ for specific ROM bank                       |
| c000-dfff | OS or HAZEL as per bit 3 of ACCCON, or ~o~ for OS, or ~h~ for HAZEL                                |
| e000-fbff | always OS                                                                                          |
| fc00-feff | OS or I/O area as per bit 6 of ACCCON, or ~i~ for I/O, or ~o~ for OS                               |
| ff00-ffff | always OS                                                                                          |

* agh

#+begin_example
1948227  m`$4438: dec $fe65 [i`$fe65]      A=01 X=04 Y=00 S=fd P=Nvdizc (D=fe)
1948227  read $ce from $4438
1948228  CPU state before: tfn=T0_All t0fn=T0_RMW_ABS
1948228  CPU state after: tfn=T1_RMW_ABS ifn=DEC, abus=$4439, dbus=$ce
1948228  read $65 from $4439
1948229  CPU state before: tfn=T1_RMW_ABS ifn=DEC
1948229  CPU state after: tfn=T2_RMW_ABS ifn=DEC, abus=$443a, dbus=$65
1948229  read $fe from $443a
1948229  UserVIA - T1 timeout
1948230  CPU state before: tfn=T2_RMW_ABS ifn=DEC
1948230  CPU state after: tfn=T3_RMW_ABS ifn=DEC, abus=$fe65, dbus=$fe
1948230  Stretch #1
1948230  UserVIA - T1 IRQ. Continuous=false PB7=false
1948231  read $ff from $fe65
1948231  UserVIA - T1 reload: T1=$0004 (4)
1948232  CPU state before: tfn=T3_RMW_ABS ifn=DEC
1948232  CPU state after: tfn=T4_RMW_ABS ifn=DEC, abus=$fe65, dbus=$ff
1948232  Stretch #1
1948233  write $ff to $fe65
1948233  UserVIA - T1C-H write acknowledges T1 (IFR=$00)
1948233  UserVIA - T1 reload: T1=$ff04 (65284)
1948234  CPU state before: tfn=T4_RMW_ABS ifn=DEC
1948234  CPU state after: tfn=T5_RMW_ABS ifn=DEC, abus=$fe65, dbus=$fe

1948234  Checked for interrupts <---- this should happen just before the previous write!

1948234  Stretch #1
1948235  write $fe to $fe65
1948235  UserVIA - T1C-H write acknowledges T1 (IFR=$00)
1948235  UserVIA - T1 reload: T1=$fe04 (65028)
1948236  CPU state before: tfn=T5_RMW_ABS ifn=DEC
1948236  CPU state after: tfn=T0_All t0fn=?, abus=$443b, dbus=$fe
1948236  m`$443b: lda $1001 [m`$1001]      A=00 X=04 Y=00 S=fd P=nvdiZc (D=00)
1948236  read $ad from $443b
#+end_example

* Emacs setup

~.dir-locals.el~:

#+begin_example
((nil . ((compile-command . "cd ~/b2/ && make tom_emacs"))))
#+end_example

* config versioning notes

Tag each default config with a feature name, a string

When saving: save off features seen in all configs

When loading: any default configs with an unseen feature are added to
the list. And the cycle repeats.

Configs predating the feature mechanism - i.e., the stock B/B+/M128
set - are marked by having an empty feature name., They never get
re-added.

* notes about why stuff is in one of ~BBCMicro~ or ~BeebThread~ rather than the other 

Saved states/rewind/timeline/etc. is supposed to be at heart managed
by copying ~BBCMicro~ objects. So anything that affects
reproducibility has to be part of that. Hence pasting state being in
~BBCMicro~.

But ~BBCMicro~ should also have no more functionality in it than
necessary, so which is why the trace stuff is just start/stop on the
BBCMicro class and then a pile of junk in BeebThread to handle the
various start and stop conditions.

Would be nice to get the instruction/write callbacks out of BBCMicro
too, since in theory the BeebThread could do that bit. But having them
there does mean they can be easily stripped out of the templated
Update functions via ~if constexpr~, meaning no overhead when not
updating.

Could maybe template the BeebThread update function, along similar
lines? The stretch flag complicates that a bit, though.

* Compact EEPROM stuff

f`$82d9: - print "Options reset"

bra resetCMOSRAM:

H     2475011  f`$8279: bra  $82bb               00 00 00 ff nvdIZc (01)

powerOnReset:

H     2463066  f`$8264: ldx  #$ff                00 ff 0f ff NvdIzc (ff)

#+begin_example
605	.8264					powerOnReset:
607	.8264	a2 ff		ldx #$ff	                ldx #$ff
608	.8266	20 3a 9f	jsr $9f3a	                jsr i2cReadEEPROMByte
609	.8269	b0 10		bcs $827b	                bcs checkForNVRAMReset

C=0, so branch not taken. Read succeeded, at least.

Y=$00

610	.826b	98		tya		                tya

A=$00

611	.826c	29 7f		and #$7f	                and #$7f

A=$00

615	.826e	c9 30		cmp #$30	                cmp #$30

Nope...

617	.8270	f0 09		beq $827b	                beq checkForNVRAMReset

It is done.

618	.8272	a2 00		ldx #$00	                ldx #0
619	.8274	a0 00		ldy #$00	                ldy #0
620	.8276	20 09 9f	jsr $9f09	                jsr L9E99
621	.8279	80 40		bra $82bb	                bra resetCMOSRAM
#+end_example

* Olivetti PC 128 S

Default CMOS:

#+begin_example
  [0]	0 '\0'	unsigned char
  [1]	254 'þ'	unsigned char
  [2]	0 '\0'	unsigned char
  [3]	235 'ë'	unsigned char
  [4]	0 '\0'	unsigned char
  [5]	237 'í'	unsigned char
  [6]	255 'ÿ'	unsigned char
  [7]	255 'ÿ'	unsigned char
  [8]	0 '\0'	unsigned char
  [9]	0 '\0'	unsigned char
  [10]	249 'ù'	unsigned char
  [11]	227 'ã'	unsigned char
  [12]	32 ' '	unsigned char
  [13]	8 '\b'	unsigned char
  [14]	10 '\n'	unsigned char
  [15]	44 ','	unsigned char
  [16]	128 '€'	unsigned char
  [17]	0 '\0'	unsigned char
  [18]	3 '\x3'	unsigned char
  [19]	4 '\x4'	unsigned char
  [20]	0 '\0'	unsigned char
  [21]	0 '\0'	unsigned char
  [22]	0 '\0'	unsigned char
  [23]	0 '\0'	unsigned char
  [24]	0 '\0'	unsigned char
  [25]	0 '\0'	unsigned char
  [26]	0 '\0'	unsigned char
  [27]	0 '\0'	unsigned char
  [28]	0 '\0'	unsigned char
  [29]	0 '\0'	unsigned char
  [30]	0 '\0'	unsigned char
  [31]	0 '\0'	unsigned char
  [32]	0 '\0'	unsigned char
  [33]	0 '\0'	unsigned char
  [34]	0 '\0'	unsigned char
  [35]	0 '\0'	unsigned char
  [36]	0 '\0'	unsigned char
  [37]	0 '\0'	unsigned char
  [38]	0 '\0'	unsigned char
  [39]	0 '\0'	unsigned char
  [40]	0 '\0'	unsigned char
  [41]	0 '\0'	unsigned char
  [42]	0 '\0'	unsigned char
  [43]	0 '\0'	unsigned char
  [44]	0 '\0'	unsigned char
  [45]	0 '\0'	unsigned char
  [46]	0 '\0'	unsigned char
  [47]	0 '\0'	unsigned char
  [48]	0 '\0'	unsigned char
  [49]	0 '\0'	unsigned char
  [50]	0 '\0'	unsigned char
  [51]	0 '\0'	unsigned char
  [52]	0 '\0'	unsigned char
  [53]	0 '\0'	unsigned char
  [54]	0 '\0'	unsigned char
  [55]	0 '\0'	unsigned char
  [56]	0 '\0'	unsigned char
  [57]	0 '\0'	unsigned char
  [58]	0 '\0'	unsigned char
  [59]	0 '\0'	unsigned char
  [60]	0 '\0'	unsigned char
  [61]	0 '\0'	unsigned char
  [62]	0 '\0'	unsigned char
  [63]	0 '\0'	unsigned char
  [64]	0 '\0'	unsigned char
  [65]	0 '\0'	unsigned char
  [66]	0 '\0'	unsigned char
  [67]	0 '\0'	unsigned char
  [68]	0 '\0'	unsigned char
  [69]	0 '\0'	unsigned char
  [70]	0 '\0'	unsigned char
  [71]	0 '\0'	unsigned char
  [72]	0 '\0'	unsigned char
  [73]	0 '\0'	unsigned char
  [74]	0 '\0'	unsigned char
  [75]	0 '\0'	unsigned char
  [76]	0 '\0'	unsigned char
  [77]	0 '\0'	unsigned char
  [78]	0 '\0'	unsigned char
  [79]	0 '\0'	unsigned char
  [80]	0 '\0'	unsigned char
  [81]	0 '\0'	unsigned char
  [82]	0 '\0'	unsigned char
  [83]	0 '\0'	unsigned char
  [84]	0 '\0'	unsigned char
  [85]	0 '\0'	unsigned char
  [86]	0 '\0'	unsigned char
  [87]	0 '\0'	unsigned char
  [88]	0 '\0'	unsigned char
  [89]	0 '\0'	unsigned char
  [90]	0 '\0'	unsigned char
  [91]	0 '\0'	unsigned char
  [92]	0 '\0'	unsigned char
  [93]	0 '\0'	unsigned char
  [94]	0 '\0'	unsigned char
  [95]	0 '\0'	unsigned char
  [96]	0 '\0'	unsigned char
  [97]	0 '\0'	unsigned char
  [98]	0 '\0'	unsigned char
  [99]	0 '\0'	unsigned char
  [100]	0 '\0'	unsigned char
  [101]	0 '\0'	unsigned char
  [102]	0 '\0'	unsigned char
  [103]	0 '\0'	unsigned char
  [104]	0 '\0'	unsigned char
  [105]	0 '\0'	unsigned char
  [106]	0 '\0'	unsigned char
  [107]	0 '\0'	unsigned char
  [108]	0 '\0'	unsigned char
  [109]	0 '\0'	unsigned char
  [110]	0 '\0'	unsigned char
  [111]	0 '\0'	unsigned char
  [112]	0 '\0'	unsigned char
  [113]	0 '\0'	unsigned char
  [114]	0 '\0'	unsigned char
  [115]	0 '\0'	unsigned char
  [116]	0 '\0'	unsigned char
  [117]	0 '\0'	unsigned char
  [118]	0 '\0'	unsigned char
  [119]	0 '\0'	unsigned char
  [120]	0 '\0'	unsigned char
  [121]	0 '\0'	unsigned char
  [122]	0 '\0'	unsigned char
  [123]	0 '\0'	unsigned char
  [124]	0 '\0'	unsigned char
  [125]	0 '\0'	unsigned char
  [126]	0 '\0'	unsigned char
  [127]	50 '2'	unsigned char
#+end_example

* Breakpoint bug

address_debug_flags=0x0000017971e2d28a
addr_flags=0x0000017971e3bc38



* b2 UEF save state extra stuff

** Memory chunks

May as well reuse the BeebEm memory state and sideways ROM chunks,
though it might be nice to tidy up the shadow RAM while doing it.
Maybe just save all 32 KB of shadow RAM and skip the separate
private/FS RAM chunks?

** 6502 stuff

Cycle count for each 6502 is unnecessary, as there's a global one for
the entire system. Include that as part of some global system state
chunk that also holds machine type.

For saving 6502 state, it must be possible to save it on any cycle
boundary (pretty much) - the entire state will have to be saved. Can't
cheat by trying to put the 6502 to a known point, because it'll only
end up with the same issue as issue #2 for BeebEm compat...

The only complicated bit here is the tfn/ifn pointers, but
=g_named_ifns= and =g_name_tfns= to the rescue (hopefully). I'm not
certain there are no holes in the table, though - could this be
detected statically? Accesses to it are not really
performance-sensitive. (Answer: looks like it'd be possible to do at
least something, but a bit hard to guarantee the tables are set up
properly. Would be easier if it were C++. For now, can advance the
system cycle by cycle until all have known names, and flag any problem
cases.)

** VIA stuff

b2 will need to save more stuff than there's room for in the
BeebEm-format chunk.

** Sound stuff

The BeebEm stuff might be good?

** Video stuff

The 

* b2/BeebEm UEF save state compat stuff

Limitations if saving BeebEm-compatible state:

1. Can't save during 1770 operation, as the b2 internal state doesn't
   map to the BeebEm FDCCommand stuff. Probably no bad thing

2. Can't reliably save with second processor, as it may not be
   possible to advance tho emulation to a point where both CPUs are
   about to fetch an instruction

3. Have to fake the FDC DLL name

4. NMILock ain't a thing so it'll probably have to be saved as 0

5. Might not work anyway...!

Loading BeebEm-compatible states should be easy enough, probably.
Restrictions:

1. Note unsupported hardware (Master ET, 8271, Z80, Music 5000, etc.)

2. Can't load if 1770 active


* BeebEm UEF chunks

Current BeebEm UEF version is major 0, minor 14.

| # (hex) | Func                      | Notes                                      |
|---------+---------------------------+--------------------------------------------|
|    0460 | Save6502UEF               |                                            |
|    0461 | SaveMemUEF                | ROMSEL+ACCCON. 3=IntegraB                  |
|    0462 | SaveMemUEF                | Main memory: 32 KB                         |
|    0463 | SaveMemUEF                | Shadow RAM                                 |
|    0464 | SaveMemUEF                | Private RAM/ANDY                           |
|    0465 | SaveMemUEF                | FS RAM/HAZEL                               |
|    0466 | SaveMemUEF                | Sideways RAM                               |
|    0467 | SaveVIAUEF                | Saved twice. Flag in chunk indicates which |
|    0468 | SaveVideoUEF              |                                            |
|    046a | BeebWin::SaveEmuUEF       |                                            |
|    046b | SaveSoundUEF              |                                            |
|    046c | BeebWin::SaveBeebEmID     |                                            |
|    046e | Save8271UEF               | *Not yet supported*                        |
|    046f | Save1770UEF               | *Going to be painful*                      |
|    0470 | SaveTubeUEF               |                                            |
|    0471 | Save65C02UEF              |                                            |
|    0472 | Save65C02MemUEF           |                                            |
|    0473 | SaveSerialUEF             | *Not yet supported*                        |
|    0474 | SaveMusic5000UEF          | *Out of scope*                             |
|    0475 | SaveMemUEF                | ROM bank                                   |
|    0478 | SaveZ80UEF                | *Out of scope*                             |
|    0479 | CArm::SaveState           | *Out of scope*                             |
|    047C | SaveMemUEF                | PAL ROM bank                               |
|    047a | SprowCoPro::SaveState     | *Out of scope*                             |
|    047b | Master512CoPro::SaveState | *Out of scope*                             |

** 0460 6502 State

| Size | What        | Notes |
|------+-------------+-------|
|    2 | PC          |       |
|    1 | A           |       |
|    1 | X           |       |
|    1 | Y           |       |
|    1 | S           |       |
|    1 | P           |       |
|    4 | TotalCycles |       |
|    1 | intStatus   |       |
|    1 | NMIStatus   |       |
|    0 | NMILock     |       |
|    2 | 0           | ?     |

- ~intStatus~ is a bitfield. (See ~IRQ_Nums~ (6502core.h) for the bit
  indexes.) If any are set, initiate IRQ
- ~NMIStatus~ is a bitfield. (See ~NMI_Nums" (6502core.h) for the bit
  indexes.)
- ~NMILock~ is there to handle the edge-triggering. It's set if an NMI
  is initiated, then reset once the RTI occurs

** 0461 Memory Control State

*** Integra B

| Size | What                   |
|------+------------------------|
|    1 | ROMSEL+MemSel+PrvEn    |
|    1 | ShEn+Prvs8+Prvs4+Prvs1 |
|    1 | HiAdd                  |

*** B+

| Size | What          |
|------+---------------|
|    1 | ROMSEL+MemSel |
|    1 | Sh_Display    |

*** Master

| Size | What   |
|------+--------|
|    1 | ROMSEL |
|    1 | ACCCON |

** 0462 Main RAM

|  Size | What     |
|-------+----------|
| 32768 | Main RAM |

** 0463 Shadow RAM

*** Integra B

|  Size | What                |
|-------+---------------------|
| 20480 | shadow RAM contents |

*** B+

|  Size | What                |
|-------+---------------------|
| 32768 | shadow RAM contents |

In this mode, shadow RAM contents below $3000 are ignored.

*** Master

|  Size | What                | Notes |
|-------+---------------------+-------|
|     2 | 0                   | Why?  |
| 32768 | shadow RAM contents |       |

In this mode, shadow RAM contents below $3000 are ignored.

** 0464 Private RAM

*** Integra B

|  Size | What        |
|-------+-------------|
| 12288 | private RAM |

*** B+

|  Size | What        | Notes |
|-------+-------------+-------|
| 12288 | private RAM | ANDY  |

There is no overlap with the contents of chunk 0463; the corresponding
region of chunk 0463 is simply ignored.

*** Master

| Size | What        | Notes |
|------+-------------+-------|
| 4096 | private RAM | ANDY  |

There is no overlap with the contents of chunk 0463; the corresponding
region of chunk 0463 is simply ignored.

** 0465 Filing System RAM

*** Master

| Size | What   | Notes |
|------+--------+-------|
| 8192 | FS RAM | HAZEL |

There is no overlap with the contents of chunk 0463; the corresponding
region of chunk 0463 is simply ignored.

** 0466 Sideways RAM

|  Size | What          |
|-------+---------------|
| 16384 | Bank contents |
|     1 | Bank index    |

** 0467 VIA

| Size | What      | Notes                                   |
|------+-----------+-----------------------------------------|
|    1 | ident     | 0=System VIA, 1=User VIA                |
|    1 | ORB       |                                         |
|    1 | IRB       |                                         |
|    1 | ORA       |                                         |
|    1 | IRB       |                                         |
|    1 | DDRB      |                                         |
|    1 | DDRA      |                                         |
|    2 | T1C       | 2 MHz value/2                           |
|    2 | T1L       |                                         |
|    2 | T2C       | 2 MHz value/2                           |
|    2 | T1L       |                                         |
|    1 | ACR       |                                         |
|    1 | PCR       |                                         |
|    1 | IFR       |                                         |
|    1 | IER       |                                         |
|    1 | t1hasshot |                                         |
|    1 | t2hasshot |                                         |
|    1 | extra     | IC32 state if System VIA; 0 if User VIA |
|      |           |                                         |

** 0468 Video

| Size | What                               | Notes                          | Ver  |
|------+------------------------------------+--------------------------------+------|
|    1 | H Total                            |                                |      |
|    1 | H Displayed                        |                                |      |
|    1 | H Sync Pos                         |                                |      |
|    1 | Sync Width                         |                                |      |
|    1 | V Total                            |                                |      |
|    1 | V Total Adjust                     |                                |      |
|    1 | V Displayed                        |                                |      |
|    1 | V Sync Pos                         |                                |      |
|    1 | Interlace & Delay                  |                                |      |
|    1 | Scan Lines/Char                    |                                |      |
|    1 | Cursor Start                       |                                |      |
|    1 | Cursor End                         |                                |      |
|    1 | Screen Start MSB                   |                                |      |
|    1 | Screen Start LSB                   |                                |      |
|    1 | Cursor MSB                         |                                |      |
|    1 | Cursor LSB                         |                                |      |
|    1 | Light Pen MSB                      |                                |      |
|    1 | Light Pen LSB                      |                                |      |
|    1 | ULA Control Register               |                                |      |
|   16 | Palette                            | Actual colour values are saved |      |
|    2 | ActualScreenWidth                  |                                |      |
|    4 | ScreenAdjust                       |                                |      |
|    1 | CRTC Control Reg                   |                                |      |
|    1 | Teletext Style                     | 1 or 2                         |      |
|    4 | VideoState Addr                    |                                | >=13 |
|    4 | VideoState StartAddr               |                                | >=13 |
|    4 | VideoState PixmapLine              |                                | >=13 |
|    4 | VideoState PreviousFirstPixmapLine |                                | >=13 |
|    4 | VideoState CharLine                |                                | >=13 |
|    4 | VideoState InCharLineUp            |                                | >=13 |
|    4 | VideoState VSyncState              |                                | >=13 |
|    1 | VideoState IsNewTVFrame            |                                | >=13 |
|    1 | VideoState InterlaceFrame          |                                | >=13 |
|    1 | VideoState DoCA1Int                |                                | >=13 |
|    4 | ova                                |                                | >=13 |
|    4 | ovn                                |                                | >=13 |
|    4 | CursorFieldCount                   |                                | >=13 |
|    1 | CursorOnState                      |                                | >=13 |
|    4 | CurY                               |                                | >=13 |
|    4 | Mode7FlashTrigger                  |                                | >=13 |
|    1 | Mode7lashOn                        |                                | >=13 |
|    4 | VideoTriggerCount-TotalCycles      |                                | >=13 |

** 046A Emulator Specifics

|   Size | What         | Notes                                                                       | Min Ver |
|--------+--------------+-----------------------------------------------------------------------------+---------|
|      1 | Machine Type | 0=B; 1=B+Integra B; 2=B+; 3=M128; 4=ET                                      |         |
|      1 | Native FDC   | set if 8271 rather than FDC DLL??                                           |         |
|      1 | Tube Type    | 0=None; 1=65c02; 2=M512; 3=Acorn Z80; 4=Torch Z80; 5=Acorn ARM; 6=Sprow ARM |         |
|      2 | Key Mapping  | Key mapping type                                                            | >=11    |
|    256 | Key Map Path |                                                                             | <14     |
| String | Key Map Path |                                                                             | >=14    |
|      1 | 0            |                                                                             |         |

Key mapping types are:

- IDM_USERKYBDMAPPING :: 40060
- IDM_DEFAULTKYBDMAPPING :: 40034
- IDM_LOGICALKYBDMAPPING :: 40035

The Key Map Path is set if Key Mapping is IDM_USERKYBDMAPPING.

** 046B Sound

| Size | What                  | Notes                          |
|------+-----------------------+--------------------------------|
|    2 | Tone 2 Freq           |                                |
|    2 | Tone 1 Freq           |                                |
|    2 | Tone 0 Freq           |                                |
|    1 | Channel 3 Attenuation |                                |
|    1 | Channel 2 Attenuation |                                |
|    1 | Channel 1 Attenuation |                                |
|    1 | Noise register value  |                                |
|    1 | Channel 0 Attenuation |                                |
|    1 | Last channel set      | Used for handling the 2nd byte |
|    2 | GenIndex[0]           |                                |
|    2 | GenIndex[1]           |                                |
|    2 | GenIndex[2]           |                                |
|    2 | GenIndex[3]           |                                |

~GenIndex~ entries increment once per update and are used to decide
when to flip the polarity of the output.

** 046C BeebEm Id

Used to indicate this is a BeebEm save state UEF file.

| Size | What          |
|------+---------------|
|    6 | "BeebEm"      |
|    8 | 0 bytes       |
|    1 | Major version |
|    1 | Minor version |

Versions come from https://github.com/stardot/beebem-windows/blob/master/Src/Version.h

** 046E 8271

(Not relevant for b2)

** 046F 1770

|     Size | What          | Notes                                            |
|----------+---------------+--------------------------------------------------|
|      2*1 | Drive Type    | 0=SSD 1=DSD 2=ADFS 3=IMG 4=DOS 5=FSD             |
| 2*string | Drive File    |                                                  |
|        1 | Status        | status register                                  |
|        1 | Data          | data register                                    |
|        1 | Track         | actual track head is on??                        |
|        1 | ATrack        | value returned when track register read          |
|        1 | Sector        | sector register                                  |
|        1 | HeadDir       | step direction - true: track+=1, false: track-=1 |
|        1 | FDCCommand    | see below...                                     |
|        1 | LoadingCycles | spinup counter                                   |
|      2*4 | SpinDown      |                                                  |
|        1 | UpdateTrack   |                                                  |
|        1 | MultiSect     |                                                  |
|        1 | StepRate      |                                                  |
|        1 | SpinUp        |                                                  |
|        1 | Verify        |                                                  |
|      2*1 | LightsOn      |                                                  |
|        4 | ByteCount     |                                                  |
|        4 | 0             | unused                                           |
|        1 | ExtControl    |                                                  |
|        1 | CurrentDrive  |                                                  |
|      2*4 | HeadPos       | offset in current disk file                      |
|      2*1 | CurrentHead   |                                                  |
|      2*4 | DiscStep      |                                                  |
|      2*4 | DiscStrt      |                                                  |
|      2*1 | MaxSects      |                                                  |
|      2*4 | DefStart      |                                                  |
|      2*4 | Trklen        |                                                  |
|      2*1 | DWriteable    |                                                  |
|      2*1 | DiskDensity   |                                                  |
|        1 | RotSect       |                                                  |
|   string | FDCDLL        |                                                  |

=FDCCommand= is the state in BeebEm's internal 1770 state machine,
which is probably going to be a bit painful to map to anything in b2
(or vice versa). So perhaps it'll be safest just to insist on the 1770
being idle when saving or loading a BeebEm-compatible state. I think
an FDCCommand of 0 indicatse that the 1770 is waiting for a command.

FDCDLL probably easiest handled by checking the file name part, which
needs to be one of:

- `Acorn1770.dll` :: Acorn 1770
- `OpusDDOS.dll` :: Opus 1770
- `Watford.dll` :: Watford DDB2

** 0470 Tube ULA State

| Size | What          | Notes                                                          |
|------+---------------+----------------------------------------------------------------|
|    1 | R1 Status     | Holds the PVMKIQ bits                                          |
|   24 | R1 P->H Data  |                                                                |
|    1 | R1 P->H Index |                                                                |
|    1 | R1 H Status   | Holds the full/available bits (same applies to all H/P status) |
|    1 | R1 H->P Data  |                                                                |
|    1 | R1 P Status   |                                                                |
|    1 | R2 P->H Data  |                                                                |
|    1 | R2 H Status   |                                                                |
|    1 | R2 H->P Data  |                                                                |
|    1 | R2 P Status   |                                                                |
|    2 | R3 P->H Data  |                                                                |
|    1 | R3 P->H Index |                                                                |
|    1 | R3 H Status   |                                                                |
|    2 | R3 H->P Data  |                                                                |
|    1 | R3 H->P Index |                                                                |
|    1 | R3 P Status   |                                                                |
|    1 | R4 P->H Data  |                                                                |
|    1 | R4 H Status   |                                                                |
|    1 | R4 H->P Data  |                                                                |
|    1 | R4 P Status   |                                                                |

** 0471 65c02 Second Processor State

| Size | What            | Notes |
|------+-----------------+-------|
|    2 | PC              |       |
|    1 | A               |       |
|    1 | X               |       |
|    1 | Y               |       |
|    1 | S               |       |
|    1 | P               |       |
|    4 | TotalTubeCycles |       |
|    1 | TubeintStatus   |       |
|    1 | TubeNMIStatus   |       |
|    1 | TubeNMILock     |       |
|    2 | 0               | ?     |

Boot mode is not handled. BeebEm copies the second processor ROM into
memory before starting execution.

** 0472 65c02 Second Processor Memory

|  Size | What | Notes |
|-------+------+-------|
| 65536 | RAM  |       |

** 0475 Sideways ROM

|  Size | What          | Notes              |
|-------+---------------+--------------------|
|     1 | Bank index    |                    |
|     1 | 0             | indicates ROM bank |
| 16384 | Bank contents |                    |

* bp cycle counts

-		hits	0x0000016d73723638 {hit_recent={n=42490100 } hit_prev={n=42489926 } }	BBCMicro::DebugState::BreakpointHits *
+		hit_recent	{n=42490100 }	CycleCount
+		hit_prev	{n=42489926 }	CycleCount

* PAL ROM mappers

MAME link: https://github.com/mamedev/mame/blob/master/src/devices/bus/bbc/rom/pal.cpp

MAME BBC roms.xml: https://github.com/mamedev/mame/blob/master/hash/bbc_rom.xml

Large ROMs thread: https://stardot.org.uk/forums/viewtopic.php?t=14384

IntegraB V2: https://stardot.org.uk/forums/viewtopic.php?t=19392

** Interword

- Mask :: 3fe0
- Offset 0060, 3fc0 :: bank = 0
- Offset 0040, 3fa0, 3fe0 :: bank = 1

| What        | f | e | d | c | b | a | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
| Mask 3fe0   |   |   | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |   |   |   |   |   |
| Offset 0060 |   |   |   |   |   |   |   |   |   | 1 | 1 |   |   |   |   |   |
| Offset 3fc0 |   |   | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |   |   |   |   |   |   |
| Offset 0040 |   |   |   |   |   |   |   |   |   | 1 |   |   |   |   |   |   |
| Offset 3fa0 |   |   | 1 | 1 | 1 | 1 | 1 | 1 | 1 |   | 1 |   |   |   |   |   |
| Offset 3fe0 |   |   | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |   |   |   |   |   |

9 bits, 512 bytes

** Increase big pages to 128 KB's-worth per bank?

But the Watford ones have a fixed 8 KB at the bottom. So now the big
page addresses are no longer fixed.

# There would then be 32 big pages per bank, laid out as follows.

# | MBank | Big page | Address |
# |-------+----------+---------|
# | w     |       +0 | 8000    |
# | w     |       +1 | 9000    |
# | w     |       +2 | a000    |
# | w     |       +3 | b000    |
# | x     |       +4 | 8000    |
# | x     |       +5 | 9000    |
# | x     |       +6 | a000    |
# | x     |       +7 | b000    |
# | y     |       +8 | 8000    |
# | y     |       +9 | 9000    |
# | y     |      +10 | a000    |
# | y     |      +11 | b000    |
# | z     |      +12 | 8000    |
# | z     |      +13 | 9000    |
# | z     |      +14 | a000    |
# | z     |      +15 | b000    |
# | W     |      +16 | 8000    |
# | W     |      +17 | 9000    |
# | W     |      +18 | a000    |
# | W     |      +19 | b000    |
# | X     |      +20 | 8000    |
# | X     |      +21 | 9000    |
# | X     |      +22 | a000    |
# | X     |      +23 | b000    |
# | Y     |      +24 | 8000    |
# | Y     |      +25 | 9000    |
# | Y     |      +26 | a000    |
# | Y     |      +27 | b000    |
# | Z     |      +28 | 8000    |
# | Z     |      +29 | 9000    |
# | Z     |      +30 | a000    |
# | Z     |      +31 | b000    |

# Then for the various mapper types (names as per MAME):

# | Name     | w | x | y | z | W | X | Y | Z |
# |----------+---+---+---+---+---+---+---+---|
# | CCIWORD  | 1 | 1 |   |   |   |   |   |   |
# | CCIBASE  | 1 | 1 | 1 | 1 |   |   |   |   |
# | CCISPELL | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
# | PALQST   | 1 | 1 | 1 | 1 |   |   | 1 | 1 |

** Dynamic big pages

Base requirements:

- 32 KB RAM (B/B+/Master)
- 12 KB ANDY (B+)
- 4 KB ANDY (Master)
- 8 KB HAZEL (Master)
- 20 KB Shadow RAM (Master)
- <N> KB paged ROMs
- 16 KB MOS
- 64 KB parasite
- 2 KB parasite ROM

*** B

8 main RAM
4 OS ROM
...plus ROMs

*** B+

8 main RAM
3 ANDY
5 shadow RAM
4 OS ROM
...plus ROMs

*** Master/Compact

8 main RAM
1 ANDY
2 HAZEL
5 shadow RAM
4 OS ROM
...plus ROMs

*** 2nd processor

16 RAM
1 ROM

*** Other notes

=PARASITE_BIG_PAGE_INDEX= is used in update function to check for
breakpoints.

=MOS_BIG_PAGE_INDEX= is used in debugger code when showing the paging
setup.

** Status <2024-07-05 Fri>

Big page tables should be set up correctly. Regardless of mapper type,
the big page index is bank*32+region*4+bigpage.

ReadOnlyBigPage structs should be set up correctly. There's a new
function, =GetROMOffset=, that handles the details.

Mapper port access should work... maybe... there's a new =if
constexpr= inside =BBCMicro::Update=. This calls =UpdatePaging= to
sort out a new big page arrangement. No need to worry about switching
update function: that's impossible in this case. Access to mapper IO
can only change the paging. Code needs to access ROMSEL to switch to a
different update function due to switching to a different mapper, and
that's now handled with an additional =UpdateCPUDataBusFn= call in
=BBCMicro::WriteROMSEL=.

=UpdateCPUDataBusFn= has been updated to take the mapper type into
account.

TODOs

*** DONE don't allow writeable slot unless 16 KB
CLOSED: [2024-07-06 Sat 21:55]

etc., etc. - make sure the UI makes this clear

*** DONE NUM_BIG_PAGES is now a LOT
CLOSED: [2024-07-06 Sat 21:54]

Go through anywhere it's used to size arrays, and eliminate anything
that's now far too large.

Conclusion: probably going to leave this. Major offenders are:

- BBCMicro :: not a big deal, as there's only one of these per running
  emulator

- BBCMicro::DebugState :: this is now a slightly monstrous 2 MBytes
  plus, but, ditto. 

- BreakpointsDebugWindow :: another singleton

4 MBytes just ain't that much these days...

*** DONE NUM_UPDATE_MFNS is now a LOT
CLOSED: [2024-07-06 Sat 21:54]

Ditto.

Conclusion: ditto, but the sizeof BBCMicro::UpdateMFnsData is realy a
bit ridiculous!

Use a std::map or similar for this instead? It would only need
re-examining when the update mfn actually changes.

Or what about a remap table, so only the unique functions need to be
counted. This could be built up at runtime by scanning the update_mfns
table.

*** DONE Use GetROMBankCode where appropriate
CLOSED: [2024-07-06 Sat 21:56]

Remove all the occurrences of "%x" for this purpose.

* NUM_UPDATE_MFNS reduction (from 65536)

Current update flags, set a:

| Field                | # options |
|----------------------+-----------|
| IsMaster128          |         2 |
| HasBeebLink          |         2 |
| Hacks                |         2 |
| Debug                |         2 |
| Trace                |         2 |
| Parasite             |         2 |
| ParasiteSpecial      |         2 |
| DebugStepParasite    |         2 |
| DebugStepHost        |         2 |
| Parasite3MHzExternal |         2 |
| ParallelPrinter      |         2 |
| IsMasterCompact      |         2 |
| ROMType              |        16 |

#+begin_src lisp-interaction
  ;; a
  (* 2 2 2 2 2 2 2 2 2 2 2 2 16)
  65536

  ;; b
  (* 3 2 2 2 2 3 2 2 2 2 8)		
  18432

  ;; c
  (* 3 2 2 2 2 5 2 2 2 8)
  15360
#+end_src

But the actual set of options is more like this (set b):

| Field             | # options | Notes                |
|-------------------+-----------+----------------------|
| Type              |         3 | B/B+; M128; MCompact |
| BeebLink          |         2 |                      |
| Hacks             |         2 |                      |
| Debug             |         2 |                      |
| Trace             |         2 |                      |
| ParasiteType      |         3 | None; 3 MHz; 4 MHz   |
| ParasiteSpecial   |         2 |                      |
| DebugStepParasite |         2 |                      |
| DebugStepHost     |         2 |                      |
| ParallelPrinter   |         2 |                      |
| ROMType           |         8 |                      |

Other possibilities: merge parasite special into parasite type. 5. Set
c.

But, ultimately, this is only reducing the size of the tables. The
number of actual routines will necessarily remain the same. So does it
actually matter?

A 512 KB table (that's 90% unused) is kind of dumb, but for a modern
PC it's basically irrelevant.

* Mouse notes

~300 IRQs/sec for my Quest Mouse.

* Submodule upstreams

Origin is upstream already:

| Submodule            | Upstream                                        |
|----------------------+-------------------------------------------------+
| 6502Timing           | https://github.com/dp111/6502Timing             |
| Font-Awesome         | https://github.com/FortAwesome/Font-Awesome     |
| IconFontCppHeaders   | https://github.com/juliettef/IconFontCppHeaders |
| SDL_GameControllerDB | https://github.com/gabomdq/SDL_GameControllerDB |
| miniz                | https://github.com/richgel999/miniz             |
| rcedit               | https://github.com/electron/rcedit              |
| sanitizers-cmake     | https://github.com/arsenm/sanitizers-cmake      |
| stb                  | https://github.com/nothings/stb                 |
| 6502-tests           | https://github.com/tom-seddon/6502-tests        |
| beeb                 | https://github.com/tom-seddon/beeb              |
| shellcmd.py          | https://github.com/tom-seddon/shellcmd.py       |
|                      |                                                 |

Origin is my fork and upstream is elsewhere:

| submodule       | Upstream                                   | Origin                                        |
|-----------------+--------------------------------------------+-----------------------------------------------|
| Remotery        | https://github.com/Celtoys/Remotery        | https://github.com/tom-seddon/Remotery        |
| SDL_official    | https://github.com/libsdl-org/SDL          | https://github.com/tom-seddon/SDL-1           |
| curl            | https://github.com/curl/curl               | https://github.com/tom-seddon/curl            |
| http-parser     | https://github.com/nodejs/http-parser      | https://github.com/tom-seddon/http-parser     |
| imgui           | https://github.com/ocornut/imgui           | https://github.com/tom-seddon/imgui           |
| imgui_club      | https://github.com/tom-seddon/imgui_club   | https://github.com/tom-seddon/imgui_club      |
| libuv           | https://github.com/libuv/libuv             | https://github.com/tom-seddon/libuv           |
| macdylibbundler | https://github.com/auriamg/macdylibbundler | https://github.com/tom-seddon/macdylibbundler |
| perfect6502     | https://github.com/mist64/perfect6502      | https://github.com/tom-seddon/perfect6502     |
| rapidjson       | https://github.com/Tencent/rapidjson       | https://github.com/tom-seddon/rapidjson       |
| relacy          | https://github.com/dvyukov/relacy          | https://github.com/tom-seddon/relacy          |
| salieri         | https://github.com/nemequ/salieri          | https://github.com/tom-seddon/salieri         |
| visual6502      | https://github.com/trebonian/visual6502    | https://github.com/tom-seddon/visual6502      |

Upstream updates no longer relevant, as HEAD doesn't use this library
any more:

| Submodule | Origin                            |
|-----------+-----------------------------------|
| SDL       | https://github.com/tom-seddon/SDL |
| noc       | https://github.com/tom-seddon/noc |

* BBCMicro_Update.cpp build times
** VS2019

Modify =BBCMicro_Update= file, do =Project Only= > =Build= on beeb_lib
project.

Original: 3 runs: 1'09", 1'09", 1'08"

Split manually into 2 groups: 0'45", 0'44", 0'44"

Add configurable =BBCMICRO_NUM_UPDATE_GROUPS=:

- 1 group: 1'09"
- 2 groups: 0'47"
- 4 groups: 0'38", 0'38", 0'37"

i7-4890HQ (4C 8T)

** gcc

Modify =BBCMicro_Update= file, and do =time ninja
./src/beeb/libbeeb_lib.a= from the build folder.

- 1 group: 649.84s user 17.65s system 100% cpu 11:03.00 total
- 2 groups: 725.01s user 17.84s system 195% cpu 6:20.81 total
- 4 groups: 808.46s user 21.31s system 282% cpu 4:53.27 total

VirtualBox, 3 cores

** Xcode

Modify =BBCMicro_Update= file, select =beeb_lib= as the target in
Xcode, build from Xcode.

- 1 group: 139.4 sec
- 2 groups: 86.8 sec
- 4 groups: 80.1 sec

i7-5557U (2C 4T)

* More build times

** Initial

| Scenario                | Debug        | Release      |
|-------------------------+--------------+--------------|
| Rebuild all             | 2 min 51 sec | 5 min 37 sec |
| Touch BBCMicro.h, build | 1 min 11 sec |              |

** Include less stuff in test_standard.cpp

| Scenario                | Debug        | Release      |
|-------------------------+--------------+--------------|
| Rebuild all             | 2 min 35 sec | 5 min 35 sec |
| Touch BBCMicro.h, build | 1 min 5 sec  |              |

** Tidy up shared headers a bit

Rebuild all

debug: 2 min 29 sec

Release: 5 min 30 sec

* ffmpeg7

For MacPorts, need this before =make init_xcode=:

: export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/local/libexec/ffmpeg7/lib/pkgconfig

Component major version by ffmpeg major version:

| lib        | Define                    | ffmpeg4 | ...5 | ...6 | ...7 |
|------------+---------------------------+---------+------+------+------|
| avcodec    | LIBAVCODEC_VERSION_MAJOR  |      58 |   59 |   60 |   61 |
| avformat   | LIBAVFORMAT_VERSION_MAJOR |      58 |   59 |   60 |   61 |
| avutil     | LIBAVUTIL_VERSION_MAJOR   |      56 |   57 |   58 |   59 |
| swresample |                           |       3 |      |      |    5 |
| swscale    |                           |       5 |      |      |    8 |

** Version changes

AVCodec::ch_layouts - introduced in FFmpeg6, LIBAVCODEC_VERSION_MAJOR>=60

*** No member named 'codec' in 'AVStream'

Changed in ffmpeg5.

Use =codecpar= instead.

*** No member named 'channels' in 'AVCodecContext'

Changed in ffmpeg6.

I _think_ this is covered by the nb_channels field in the new
AVChannelLayout struct...

*** No member named 'channel_layout' in 'AVFrame'; No member named 'channel_layout' in 'AVCodecContext'

Changed in ffmpeg6.

Use ch_layout instead.

: * Copying an AVChannelLayout via assigning is forbidden,
: * av_channel_layout_copy() must be used instead (and its return value should
: * be checked)

int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src);

Regarding =AV_CH_LAYOUT_MONO= and so on, there is
=AV_CHANNEL_LAYOUT_STEREO= (etc.), macros that expand to struct
literals. So this can be used to create fodder for the copy function.

#+begin_src c++
  const AVChannelLayout LAYOUT_MONO=AV_CHANNEL_LAYOUT_MONO;
  const AVChannelLayout LAYOUT_STEREO=AV_CHANNEL_LAYOUT_STEREO;
  TEST_AV(av_channel_layout_copy(&ac_context->ch_layout,wav_fmt->nChannels==1?&LAYOUT_MONO:&LAYOUT_STEREO));
#+end_src

(The naming is annoyingly wonky.)

*** Undefined 'av_get_channel_layout_string'
*** No member named 'channel_layouts' in 'AVCodec'

FFmpeg5:

 * @deprecated use av_channel_layout_describe()


** ffmpeg7 properties

*** Audio codecs

012v 4xm 8bps a64multi a64multi5 aasc agm aic alias_pix alias_pix amv
amv anm ansi apng apng arbc argo asv1 asv1 asv2 asv2 aura aura2 av1
avrn avrp avrp avs avui avui bethsoftvid bfi binkvideo bintext
bitpacked bitpacked bmp bmp bmv_video brender_pix c93 camstudio
camtasia cavs cdgraphics cdtoons cdxl cfhd cfhd cinepak cinepak
clearvideo cljr cljr cllc cpia cri cyuv dds dfa dirac dnxhd dnxhd dpx
dpx dsicinvideo dvvideo dvvideo dxa dxtory dxv dxv eacmv eamad eatgq
eatgv eatqi escape124 escape130 exr exr ffv1 ffv1 ffvhuff ffvhuff fic
fits fits flashsv flashsv flashsv2 flashsv2 flic flv flv fmvc fraps
frwu g2m gdv gem gif gif h261 h261 h263 h263 h263i h263p h263p h264
h264_videotoolbox hap hdr hdr hevc hevc_videotoolbox hnm4video hq_hqa
hqx huffyuv huffyuv hymt idcinvideo idf iff imm4 imm5 indeo2 indeo3
indeo4 indeo5 interplayvideo ipu jpeg2000 jpeg2000 jpegls jpegls jv
kgv1 kmvc lagarith lead libaom-av1 libaom-av1 libdav1d libopenjpeg
librsvg libsvtav1 libtheora libvpx libvpx libvpx-vp9 libvpx-vp9
libwebp libwebp_anim libx264 libx264rgb libx265 libxvid ljpeg loco
lscr m101 magicyuv magicyuv mdec media100 mimic mjpeg mjpeg mjpegb
mmvideo mobiclip motionpixels mpeg1video mpeg1video mpeg2video
mpeg2video mpeg4 mpeg4 mpegvideo msa1 mscc msmpeg4 msmpeg4 msmpeg4v1
msmpeg4v2 msmpeg4v2 msp2 msrle msrle mss1 mss2 msvideo1 msvideo1 mszh
mts2 mv30 mvc1 mvc2 mvdv mvha mwsc mxpeg notchlc nuv paf_video pam pam
pbm pbm pcx pcx pdv pfm pfm pgm pgm pgmyuv pgmyuv pgx phm phm photocd
pictor pixlet png png ppm ppm prores prores prores_aw prores_ks
prores_videotoolbox prosumer psd ptx qdraw qoi qoi qpeg qtrle qtrle
r10k r10k r210 r210 rasc rawvideo rawvideo rl2 roqvideo roqvideo rpza
rpza rscc rtv1 rv10 rv10 rv20 rv20 rv30 rv40 sanm scpr screenpresso
sga sgi sgi sgirle sheervideo simbiosis_imx smackvid smc smc smvjpeg
snow snow sp5x speedhq speedhq srgc sunrast sunrast svq1 svq1 svq3
targa targa targa_y216 tdsc theora thp tiertexseqvideo tiff tiff tmv
truemotion1 truemotion2 truemotion2rt tscc2 txd ultimotion utvideo
utvideo v210 v210 v210x v308 v308 v408 v408 v410 v410 vb vble vbn vbn
vc1 vc1image vc2 vcr1 vmdvideo vmix vmnc vnull vnull vp3 vp4 vp5 vp6
vp6a vp6f vp7 vp8 vp9 vqavideo vqc vvc wbmp wbmp wcmv webp wmv1 wmv1
wmv2 wmv2 wmv3 wmv3image wnv1 wrapped_avframe wrapped_avframe xan_wc3
xan_wc4 xbin xbm xbm xface xface xl xpm xwd xwd y41p y41p ylc yop yuv4
yuv4 zerocodec zlib zlib zmbv zmbv

*** Video codecs

8svx_exp 8svx_fib aac aac aac_at aac_at aac_fixed aac_latm ac3 ac3
ac3_at ac3_fixed ac3_fixed acelp.kelvin adpcm_4xm adpcm_adx adpcm_adx
adpcm_afc adpcm_agm adpcm_aica adpcm_argo adpcm_argo adpcm_ct
adpcm_dtk adpcm_ea adpcm_ea_maxis_xa adpcm_ea_r1 adpcm_ea_r2
adpcm_ea_r3 adpcm_ea_xas adpcm_ima_acorn adpcm_ima_alp adpcm_ima_alp
adpcm_ima_amv adpcm_ima_amv adpcm_ima_apc adpcm_ima_apm adpcm_ima_apm
adpcm_ima_cunning adpcm_ima_dat4 adpcm_ima_dk3 adpcm_ima_dk4
adpcm_ima_ea_eacs adpcm_ima_ea_sead adpcm_ima_iss adpcm_ima_moflex
adpcm_ima_mtf adpcm_ima_oki adpcm_ima_qt adpcm_ima_qt adpcm_ima_qt_at
adpcm_ima_rad adpcm_ima_smjpeg adpcm_ima_ssi adpcm_ima_ssi
adpcm_ima_wav adpcm_ima_wav adpcm_ima_ws adpcm_ima_ws adpcm_ms
adpcm_ms adpcm_mtaf adpcm_psx adpcm_sbpro_2 adpcm_sbpro_3
adpcm_sbpro_4 adpcm_swf adpcm_swf adpcm_thp adpcm_thp_le adpcm_vima
adpcm_xa adpcm_xmd adpcm_yamaha adpcm_yamaha adpcm_zork alac alac
alac_at alac_at als amr_nb_at amrnb amrwb anull anull apac ape aptx
aptx aptx_hd aptx_hd atrac1 atrac3 atrac3al atrac3plus atrac3plusal
atrac9 binkaudio_dct binkaudio_rdft bmv_audio bonk cbd2_dpcm
comfortnoise comfortnoise cook dca dca derf_dpcm dfpwm dfpwm dolby_e
dsd_lsbf dsd_lsbf_planar dsd_msbf dsd_msbf_planar dsicinaudio dss_sp
dst dvaudio eac3 eac3 eac3_at evrc fastaudio flac flac ftr g722 g722
g723_1 g723_1 g726 g726 g726le g726le g729 gremlin_dpcm gsm gsm_ms
gsm_ms_at hca hcom iac ilbc ilbc_at ilbc_at imc interplay_dpcm
interplayacm libmp3lame libopus libopus libspeex libspeex libvorbis
libvorbis mace3 mace6 metasound misc4 mlp mlp mp1 mp1_at mp1float mp2
mp2 mp2_at mp2fixed mp2float mp3 mp3_at mp3adu mp3adufloat mp3float
mp3on4 mp3on4float mpc7 mpc8 msnsiren nellymoser nellymoser on2avc
opus opus osq paf_audio pcm_alaw pcm_alaw pcm_alaw_at pcm_alaw_at
pcm_bluray pcm_bluray pcm_dvd pcm_dvd pcm_f16le pcm_f24le pcm_f32be
pcm_f32be pcm_f32le pcm_f32le pcm_f64be pcm_f64be pcm_f64le pcm_f64le
pcm_lxf pcm_mulaw pcm_mulaw pcm_mulaw_at pcm_mulaw_at pcm_s16be
pcm_s16be pcm_s16be_planar pcm_s16be_planar pcm_s16le pcm_s16le
pcm_s16le_planar pcm_s16le_planar pcm_s24be pcm_s24be pcm_s24daud
pcm_s24daud pcm_s24le pcm_s24le pcm_s24le_planar pcm_s24le_planar
pcm_s32be pcm_s32be pcm_s32le pcm_s32le pcm_s32le_planar
pcm_s32le_planar pcm_s64be pcm_s64be pcm_s64le pcm_s64le pcm_s8 pcm_s8
pcm_s8_planar pcm_s8_planar pcm_sga pcm_u16be pcm_u16be pcm_u16le
pcm_u16le pcm_u24be pcm_u24be pcm_u24le pcm_u24le pcm_u32be pcm_u32be
pcm_u32le pcm_u32le pcm_u8 pcm_u8 pcm_vidc pcm_vidc qcelp qdm2 qdm2_at
qdmc qdmc_at qoa ralf real_144 real_144 real_288 rka roq_dpcm roq_dpcm
s302m s302m sbc sbc sdx2_dpcm shorten sipr siren smackaud sol_dpcm
sonic sonic sonicls speex tak truehd truehd truespeech tta tta twinvq
vmdaudio vorbis vorbis wady_dpcm wavarc wavesynth wavpack wavpack
wmalossless wmapro wmav1 wmav1 wmav2 wmav2 wmavoice ws_snd1 xan_dpcm
xma1 xma2

*** Formats

| name                    | long_name                                                   | mime_type                                 | acodec           | vcodec          | scodec   | flags  | extensions                                                                                                                                                                     |
|-------------------------+-------------------------------------------------------------+-------------------------------------------+------------------+-----------------+----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| a64                     | a64 - video for Commodore 64                                | (null)                                    | (none)           | a64multi        | (none)   | (none) | a64, A64                                                                                                                                                                       |
| ac3                     | raw AC-3                                                    | audio/x-ac3                               | ac3              | (none)          | (none)   | (none) | ac3                                                                                                                                                                            |
| ac4                     | raw AC-4                                                    | audio/ac4                                 | (none)           | (none)          | (none)   | (none) | ac4                                                                                                                                                                            |
| adts                    | ADTS AAC (Advanced Audio Coding)                            | audio/aac                                 | aac              | (none)          | (none)   | (none) | aac,adts                                                                                                                                                                       |
| adx                     | CRI ADX                                                     | (null)                                    | adpcm_adx        | (none)          | (none)   | (none) | adx                                                                                                                                                                            |
| aea                     | MD STUDIO audio                                             | (null)                                    | atrac1           | (none)          | (none)   | (none) | aea                                                                                                                                                                            |
| aiff                    | Audio IFF                                                   | audio/aiff                                | pcm_s16be        | png             | (none)   | (none) | aif,aiff,afc,aifc                                                                                                                                                              |
| alp                     | LEGO Racers ALP                                             | (null)                                    | adpcm_ima_alp    | (none)          | (none)   | (none) | tun,pcm                                                                                                                                                                        |
| amr                     | 3GPP AMR                                                    | audio/amr                                 | amrnb            | (none)          | (none)   | (none) | amr                                                                                                                                                                            |
| amv                     | AMV                                                         | video/amv                                 | adpcm_ima_amv    | amv             | (none)   | (none) | amv                                                                                                                                                                            |
| apm                     | Ubisoft Rayman 2 APM                                        | (null)                                    | adpcm_ima_apm    | (none)          | (none)   | (none) | apm                                                                                                                                                                            |
| apng                    | Animated Portable Network Graphics                          | image/png                                 | (none)           | apng            | (none)   | (none) | apng                                                                                                                                                                           |
| aptx                    | raw aptX (Audio Processing Technology for Bluetooth)        | (null)                                    | aptx             | (none)          | (none)   | (none) | aptx                                                                                                                                                                           |
| aptx_hd                 | raw aptX HD (Audio Processing Technology for Bluetooth)     | (null)                                    | aptx_hd          | (none)          | (none)   | (none) | aptxhd                                                                                                                                                                         |
| argo_asf                | Argonaut Games ASF                                          | (null)                                    | adpcm_argo       | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| argo_cvg                | Argonaut Games CVG                                          | (null)                                    | adpcm_psx        | (none)          | (none)   | (none) | cvg                                                                                                                                                                            |
| asf                     | ASF (Advanced / Active Streaming Format)                    | video/x-ms-asf                            | wmav2            | msmpeg4         | (none)   | (none) | asf,wmv,wma                                                                                                                                                                    |
| ass                     | SSA (SubStation Alpha) subtitle                             | text/x-ass                                | (none)           | (none)          | ssa      | (none) | ass,ssa                                                                                                                                                                        |
| ast                     | AST (Audio Stream)                                          | (null)                                    | pcm_s16be_planar | (none)          | (none)   | (none) | ast                                                                                                                                                                            |
| asf_stream              | ASF (Advanced / Active Streaming Format)                    | video/x-ms-asf                            | wmav2            | msmpeg4         | (none)   | (none) | asf,wmv,wma                                                                                                                                                                    |
| au                      | Sun AU                                                      | audio/basic                               | pcm_s16be        | (none)          | (none)   | (none) | au                                                                                                                                                                             |
| avi                     | AVI (Audio Video Interleaved)                               | video/x-msvideo                           | libmp3lame       | mpeg4           | (none)   | (none) | avi                                                                                                                                                                            |
| avif                    | AVIF                                                        | image/avif                                | (none)           | libaom-av1      | (none)   | (none) | avif                                                                                                                                                                           |
| avm2                    | SWF (ShockWave Flash) (AVM2)                                | application/x-shockwave-flash             | libmp3lame       | flv             | (none)   | (none) | (null)                                                                                                                                                                         |
| avs2                    | raw AVS2-P2/IEEE1857.4 video                                | (null)                                    | (none)           | (none)          | (none)   | (none) | avs,avs2                                                                                                                                                                       |
| avs3                    | AVS3-P2/IEEE1857.10                                         | (null)                                    | (none)           | (none)          | (none)   | (none) | avs3                                                                                                                                                                           |
| bit                     | G.729 BIT file format                                       | audio/bit                                 | g729             | (none)          | (none)   | (none) | bit                                                                                                                                                                            |
| caf                     | Apple CAF (Core Audio Format)                               | audio/x-caf                               | pcm_s16be        | (none)          | (none)   | (none) | caf                                                                                                                                                                            |
| cavsvideo               | raw Chinese AVS (Audio Video Standard) video                | (null)                                    | (none)           | cavs            | (none)   | (none) | cavs                                                                                                                                                                           |
| codec2                  | codec2 .c2 muxer                                            | (null)                                    | (none)           | (none)          | (none)   | (none) | c2                                                                                                                                                                             |
| codec2raw               | raw codec2 muxer                                            | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| crc                     | CRC testing                                                 | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| dash                    | DASH Muxer                                                  | (null)                                    | aac              | libx264         | (none)   | (none) | mpd                                                                                                                                                                            |
| data                    | raw data                                                    | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| daud                    | D-Cinema audio                                              | (null)                                    | pcm_s24daud      | (none)          | (none)   | (none) | 302                                                                                                                                                                            |
| dfpwm                   | raw DFPWM1a                                                 | (null)                                    | dfpwm            | (none)          | (none)   | (none) | dfpwm                                                                                                                                                                          |
| dirac                   | raw Dirac                                                   | (null)                                    | (none)           | vc2             | (none)   | (none) | drc,vc2                                                                                                                                                                        |
| dnxhd                   | raw DNxHD (SMPTE VC-3)                                      | (null)                                    | (none)           | dnxhd           | (none)   | (none) | dnxhd,dnxhr                                                                                                                                                                    |
| dts                     | raw DTS                                                     | audio/x-dca                               | dca              | (none)          | (none)   | (none) | dts                                                                                                                                                                            |
| dv                      | DV (Digital Video)                                          | (null)                                    | pcm_s16le        | dvvideo         | (none)   | (none) | dv                                                                                                                                                                             |
| eac3                    | raw E-AC-3                                                  | audio/x-eac3                              | eac3             | (none)          | (none)   | (none) | eac3,ec3                                                                                                                                                                       |
| evc                     | raw EVC video                                               | (null)                                    | (none)           | (none)          | (none)   | (none) | evc                                                                                                                                                                            |
| f4v                     | F4V Adobe Flash Video                                       | application/f4v                           | aac              | libx264         | (none)   | (none) | f4v                                                                                                                                                                            |
| ffmetadata              | FFmpeg metadata in text                                     | (null)                                    | (none)           | (none)          | (none)   | (none) | ffmeta                                                                                                                                                                         |
| fifo                    | FIFO queue pseudo-muxer                                     | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| filmstrip               | Adobe Filmstrip                                             | (null)                                    | (none)           | rawvideo        | (none)   | (none) | flm                                                                                                                                                                            |
| fits                    | Flexible Image Transport System                             | (null)                                    | (none)           | fits            | (none)   | (none) | fits                                                                                                                                                                           |
| flac                    | raw FLAC                                                    | audio/x-flac                              | flac             | png             | (none)   | (none) | flac                                                                                                                                                                           |
| flv                     | FLV (Flash Video)                                           | video/x-flv                               | libmp3lame       | flv             | (none)   | (none) | flv                                                                                                                                                                            |
| framecrc                | framecrc testing                                            | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| framehash               | Per-frame hash testing                                      | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| framemd5                | Per-frame MD5 testing                                       | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| g722                    | raw G.722                                                   | audio/G722                                | g722             | (none)          | (none)   | (none) | g722                                                                                                                                                                           |
| g723_1                  | raw G.723.1                                                 | audio/g723                                | g723_1           | (none)          | (none)   | (none) | tco,rco                                                                                                                                                                        |
| g726                    | raw big-endian G.726 ("left-justified")                     | (null)                                    | g726             | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| g726le                  | raw little-endian G.726 ("right-justified")                 | (null)                                    | g726le           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| gif                     | CompuServe Graphics Interchange Format (GIF)                | image/gif                                 | (none)           | gif             | (none)   | (none) | gif                                                                                                                                                                            |
| gsm                     | raw GSM                                                     | audio/x-gsm                               | gsm              | (none)          | (none)   | (none) | gsm                                                                                                                                                                            |
| gxf                     | GXF (General eXchange Format)                               | (null)                                    | pcm_s16le        | mpeg2video      | (none)   | (none) | gxf                                                                                                                                                                            |
| h261                    | raw H.261                                                   | video/x-h261                              | (none)           | h261            | (none)   | (none) | h261                                                                                                                                                                           |
| h263                    | raw H.263                                                   | video/x-h263                              | (none)           | h263            | (none)   | (none) | h263                                                                                                                                                                           |
| h264                    | raw H.264 video                                             | (null)                                    | (none)           | libx264         | (none)   | (none) | h264,264                                                                                                                                                                       |
| hash                    | Hash testing                                                | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| hds                     | HDS Muxer                                                   | (null)                                    | aac              | libx264         | (none)   | (none) | (null)                                                                                                                                                                         |
| hevc                    | raw HEVC video                                              | (null)                                    | (none)           | libx265         | (none)   | (none) | hevc,h265,265                                                                                                                                                                  |
| hls                     | Apple HTTP Live Streaming                                   | (null)                                    | aac              | libx264         | webvtt   | (none) | m3u8                                                                                                                                                                           |
| iamf                    | Raw Immersive Audio Model and Formats                       | (null)                                    | opus             | (none)          | (none)   | (none) | iamf                                                                                                                                                                           |
| ico                     | Microsoft Windows ICO                                       | image/vnd.microsoft.icon                  | (none)           | bmp             | (none)   | (none) | ico                                                                                                                                                                            |
| ilbc                    | iLBC storage                                                | audio/iLBC                                | ilbc_at          | (none)          | (none)   | (none) | lbc                                                                                                                                                                            |
| image2                  | image2 sequence                                             | (null)                                    | (none)           | mjpeg           | (none)   | (none) | bmp,dpx,exr,jls,jpeg,jpg,jxl,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,phm,png,ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,im24,sunras,vbn,xbm,xface,pix,y,avif,qoi,hdr,wbmp |
| image2pipe              | piped image2 sequence                                       | (null)                                    | (none)           | mjpeg           | (none)   | (none) | (null)                                                                                                                                                                         |
| ipod                    | iPod H.264 MP4 (MPEG-4 Part 14)                             | video/mp4                                 | aac              | libx264         | (none)   | (none) | m4v,m4a,m4b                                                                                                                                                                    |
| ircam                   | Berkeley/IRCAM/CARL Sound Format                            | (null)                                    | pcm_s16le        | (none)          | (none)   | (none) | sf,ircam                                                                                                                                                                       |
| ismv                    | ISMV/ISMA (Smooth Streaming)                                | video/mp4                                 | aac              | libx264         | (none)   | (none) | ismv,isma                                                                                                                                                                      |
| ivf                     | On2 IVF                                                     | (null)                                    | (none)           | libvpx          | (none)   | (none) | ivf                                                                                                                                                                            |
| jacosub                 | JACOsub subtitle format                                     | text/x-jacosub                            | (none)           | (none)          | jacosub  | (none) | jss,js                                                                                                                                                                         |
| kvag                    | Simon & Schuster Interactive VAG                            | (null)                                    | adpcm_ima_ssi    | (none)          | (none)   | (none) | vag                                                                                                                                                                            |
| latm                    | LOAS/LATM                                                   | audio/MP4A-LATM                           | aac              | (none)          | (none)   | (none) | latm,loas                                                                                                                                                                      |
| lrc                     | LRC lyrics                                                  | (null)                                    | (none)           | (none)          | srt      | (none) | lrc                                                                                                                                                                            |
| m4v                     | raw MPEG-4 video                                            | (null)                                    | (none)           | mpeg4           | (none)   | (none) | m4v                                                                                                                                                                            |
| md5                     | MD5 testing                                                 | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| matroska                | Matroska                                                    | video/x-matroska                          | vorbis           | libx264         | ssa      | (none) | mkv                                                                                                                                                                            |
| matroska                | Matroska Audio                                              | audio/x-matroska                          | vorbis           | (none)          | (none)   | (none) | mka                                                                                                                                                                            |
| microdvd                | MicroDVD subtitle format                                    | text/x-microdvd                           | (none)           | (none)          | microdvd | (none) | sub                                                                                                                                                                            |
| mjpeg                   | raw MJPEG video                                             | video/x-mjpeg                             | (none)           | mjpeg           | (none)   | (none) | mjpg,mjpeg                                                                                                                                                                     |
| mlp                     | raw MLP                                                     | (null)                                    | mlp              | (none)          | (none)   | (none) | mlp                                                                                                                                                                            |
| mmf                     | Yamaha SMAF                                                 | application/vnd.smaf                      | adpcm_yamaha     | (none)          | (none)   | (none) | mmf                                                                                                                                                                            |
| mov                     | QuickTime / MOV                                             | (null)                                    | aac              | libx264         | (none)   | (none) | mov                                                                                                                                                                            |
| mp2                     | MP2 (MPEG audio layer 2)                                    | audio/mpeg                                | mp2              | (none)          | (none)   | (none) | mp2,m2a,mpa                                                                                                                                                                    |
| mp3                     | MP3 (MPEG audio layer 3)                                    | audio/mpeg                                | libmp3lame       | png             | (none)   | (none) | mp3                                                                                                                                                                            |
| mp4                     | MP4 (MPEG-4 Part 14)                                        | video/mp4                                 | aac              | libx264         | (none)   | (none) | mp4                                                                                                                                                                            |
| mpeg                    | MPEG-1 Systems / MPEG program stream                        | video/mpeg                                | mp2              | mpeg1video      | (none)   | (none) | mpg,mpeg                                                                                                                                                                       |
| vcd                     | MPEG-1 Systems / MPEG program stream (VCD)                  | video/mpeg                                | mp2              | mpeg1video      | (none)   | (none) | (null)                                                                                                                                                                         |
| mpeg1video              | raw MPEG-1 video                                            | video/mpeg                                | (none)           | mpeg1video      | (none)   | (none) | mpg,mpeg,m1v                                                                                                                                                                   |
| dvd                     | MPEG-2 PS (DVD VOB)                                         | video/mpeg                                | mp2              | mpeg2video      | (none)   | (none) | dvd                                                                                                                                                                            |
| svcd                    | MPEG-2 PS (SVCD)                                            | video/mpeg                                | mp2              | mpeg2video      | (none)   | (none) | vob                                                                                                                                                                            |
| mpeg2video              | raw MPEG-2 video                                            | (null)                                    | (none)           | mpeg2video      | (none)   | (none) | m2v                                                                                                                                                                            |
| vob                     | MPEG-2 PS (VOB)                                             | video/mpeg                                | mp2              | mpeg2video      | (none)   | (none) | vob                                                                                                                                                                            |
| mpegts                  | MPEG-TS (MPEG-2 Transport Stream)                           | video/MP2T                                | mp2              | mpeg2video      | (none)   | (none) | ts,m2t,m2ts,mts                                                                                                                                                                |
| mpjpeg                  | MIME multipart JPEG                                         | multipart/x-mixed-replace;boundary=ffmpeg | (none)           | mjpeg           | (none)   | (none) | mjpg                                                                                                                                                                           |
| mxf                     | MXF (Material eXchange Format)                              | application/mxf                           | pcm_s16le        | mpeg2video      | (none)   | (none) | mxf                                                                                                                                                                            |
| mxf_d10                 | MXF (Material eXchange Format) D-10 Mapping                 | application/mxf                           | pcm_s16le        | mpeg2video      | (none)   | (none) | (null)                                                                                                                                                                         |
| mxf_opatom              | MXF (Material eXchange Format) Operational Pattern Atom     | application/mxf                           | pcm_s16le        | dnxhd           | (none)   | (none) | mxf                                                                                                                                                                            |
| null                    | raw null video                                              | (null)                                    | pcm_s16le        | wrapped_avframe | (none)   | (none) | (null)                                                                                                                                                                         |
| nut                     | NUT                                                         | video/x-nut                               | vorbis           | mpeg4           | (none)   | (none) | nut                                                                                                                                                                            |
| obu                     | AV1 low overhead OBU                                        | (null)                                    | (none)           | libaom-av1      | (none)   | (none) | obu                                                                                                                                                                            |
| oga                     | Ogg Audio                                                   | audio/ogg                                 | flac             | (none)          | (none)   | (none) | oga                                                                                                                                                                            |
| ogg                     | Ogg                                                         | application/ogg                           | vorbis           | libtheora       | (none)   | (none) | ogg                                                                                                                                                                            |
| ogv                     | Ogg Video                                                   | video/ogg                                 | vorbis           | libtheora       | (none)   | (none) | ogv                                                                                                                                                                            |
| oma                     | Sony OpenMG audio                                           | audio/x-oma                               | atrac3           | (none)          | (none)   | (none) | oma                                                                                                                                                                            |
| opus                    | Ogg Opus                                                    | audio/ogg                                 | opus             | (none)          | (none)   | (none) | opus                                                                                                                                                                           |
| alaw                    | PCM A-law                                                   | (null)                                    | pcm_alaw         | (none)          | (none)   | (none) | al                                                                                                                                                                             |
| mulaw                   | PCM mu-law                                                  | (null)                                    | pcm_mulaw        | (none)          | (none)   | (none) | ul                                                                                                                                                                             |
| vidc                    | PCM Archimedes VIDC                                         | (null)                                    | pcm_vidc         | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| f64be                   | PCM 64-bit floating-point big-endian                        | (null)                                    | pcm_f64be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| f64le                   | PCM 64-bit floating-point little-endian                     | (null)                                    | pcm_f64le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| f32be                   | PCM 32-bit floating-point big-endian                        | (null)                                    | pcm_f32be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| f32le                   | PCM 32-bit floating-point little-endian                     | (null)                                    | pcm_f32le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s32be                   | PCM signed 32-bit big-endian                                | (null)                                    | pcm_s32be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s32le                   | PCM signed 32-bit little-endian                             | (null)                                    | pcm_s32le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s24be                   | PCM signed 24-bit big-endian                                | (null)                                    | pcm_s24be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s24le                   | PCM signed 24-bit little-endian                             | (null)                                    | pcm_s24le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s16be                   | PCM signed 16-bit big-endian                                | (null)                                    | pcm_s16be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| s16le                   | PCM signed 16-bit little-endian                             | (null)                                    | pcm_s16le        | (none)          | (none)   | (none) | sw                                                                                                                                                                             |
| s8                      | PCM signed 8-bit                                            | (null)                                    | pcm_s8           | (none)          | (none)   | (none) | sb                                                                                                                                                                             |
| u32be                   | PCM unsigned 32-bit big-endian                              | (null)                                    | pcm_u32be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| u32le                   | PCM unsigned 32-bit little-endian                           | (null)                                    | pcm_u32le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| u24be                   | PCM unsigned 24-bit big-endian                              | (null)                                    | pcm_u24be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| u24le                   | PCM unsigned 24-bit little-endian                           | (null)                                    | pcm_u24le        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| u16be                   | PCM unsigned 16-bit big-endian                              | (null)                                    | pcm_u16be        | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| u16le                   | PCM unsigned 16-bit little-endian                           | (null)                                    | pcm_u16le        | (none)          | (none)   | (none) | uw                                                                                                                                                                             |
| u8                      | PCM unsigned 8-bit                                          | (null)                                    | pcm_u8           | (none)          | (none)   | (none) | ub                                                                                                                                                                             |
| psp                     | PSP MP4 (MPEG-4 Part 14)                                    | (null)                                    | aac              | libx264         | (none)   | (none) | mp4,psp                                                                                                                                                                        |
| rawvideo                | raw video                                                   | (null)                                    | (none)           | rawvideo        | (none)   | (none) | yuv,rgb                                                                                                                                                                        |
| rcwt                    | RCWT (Raw Captions With Time)                               | (null)                                    | (none)           | (none)          | cc_dec   | (none) | bin                                                                                                                                                                            |
| rm                      | RealMedia                                                   | application/vnd.rn-realmedia              | ac3              | rv10            | (none)   | (none) | rm,ra                                                                                                                                                                          |
| roq                     | raw id RoQ                                                  | (null)                                    | roq_dpcm         | roqvideo        | (none)   | (none) | roq                                                                                                                                                                            |
| rso                     | Lego Mindstorms RSO                                         | (null)                                    | pcm_u8           | (none)          | (none)   | (none) | rso                                                                                                                                                                            |
| rtp                     | RTP output                                                  | (null)                                    | pcm_mulaw        | mpeg4           | (none)   | (none) | (null)                                                                                                                                                                         |
| rtp_mpegts              | RTP/mpegts output format                                    | (null)                                    | aac              | mpeg4           | (none)   | (none) | (null)                                                                                                                                                                         |
| rtsp                    | RTSP output                                                 | (null)                                    | aac              | mpeg4           | (none)   | (none) | (null)                                                                                                                                                                         |
| sap                     | SAP output                                                  | (null)                                    | aac              | mpeg4           | (none)   | (none) | (null)                                                                                                                                                                         |
| sbc                     | raw SBC                                                     | audio/x-sbc                               | sbc              | (none)          | (none)   | (none) | sbc,msbc                                                                                                                                                                       |
| scc                     | Scenarist Closed Captions                                   | (null)                                    | (none)           | (none)          | cc_dec   | (none) | scc                                                                                                                                                                            |
| film_cpk                | Sega FILM / CPK                                             | (null)                                    | pcm_s16be_planar | cinepak         | (none)   | (none) | cpk                                                                                                                                                                            |
| segment                 | segment                                                     | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| stream_segment,ssegment | streaming segment muxer                                     | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| smjpeg                  | Loki SDL MJPEG                                              | (null)                                    | pcm_s16le        | mjpeg           | (none)   | (none) | (null)                                                                                                                                                                         |
| smoothstreaming         | Smooth Streaming Muxer                                      | (null)                                    | aac              | libx264         | (none)   | (none) | (null)                                                                                                                                                                         |
| sox                     | SoX (Sound eXchange) native                                 | (null)                                    | pcm_s32le        | (none)          | (none)   | (none) | sox                                                                                                                                                                            |
| spx                     | Ogg Speex                                                   | audio/ogg                                 | libspeex         | (none)          | (none)   | (none) | spx                                                                                                                                                                            |
| spdif                   | IEC 61937 (used on S/PDIF - IEC958)                         | (null)                                    | ac3              | (none)          | (none)   | (none) | spdif                                                                                                                                                                          |
| srt                     | SubRip subtitle                                             | application/x-subrip                      | (none)           | (none)          | srt      | (none) | srt                                                                                                                                                                            |
| streamhash              | Per-stream hash testing                                     | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| sup                     | raw HDMV Presentation Graphic Stream subtitles              | application/x-pgs                         | (none)           | (none)          | pgssub   | (none) | sup                                                                                                                                                                            |
| swf                     | SWF (ShockWave Flash)                                       | application/x-shockwave-flash             | libmp3lame       | flv             | (none)   | (none) | swf                                                                                                                                                                            |
| tee                     | Multiple muxer tee                                          | (null)                                    | (none)           | (none)          | (none)   | (none) | (null)                                                                                                                                                                         |
| 3g2                     | 3GP2 (3GPP2 file format)                                    | (null)                                    | amrnb            | h263            | (none)   | (none) | 3g2                                                                                                                                                                            |
| 3gp                     | 3GP (3GPP file format)                                      | (null)                                    | amrnb            | h263            | (none)   | (none) | 3gp                                                                                                                                                                            |
| mkvtimestamp_v2         | extract pts as timecode v2 format, as defined by mkvtoolnix | (null)                                    | (none)           | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| truehd                  | raw TrueHD                                                  | (null)                                    | truehd           | (none)          | (none)   | (none) | thd                                                                                                                                                                            |
| tta                     | TTA (True Audio)                                            | audio/x-tta                               | tta              | (none)          | (none)   | (none) | tta                                                                                                                                                                            |
| ttml                    | TTML subtitle                                               | text/ttml                                 | (none)           | (none)          | ttml     | (none) | ttml                                                                                                                                                                           |
| uncodedframecrc         | uncoded framecrc testing                                    | (null)                                    | pcm_s16le        | rawvideo        | (none)   | (none) | (null)                                                                                                                                                                         |
| vc1                     | raw VC-1 video                                              | (null)                                    | (none)           | vc1             | (none)   | (none) | vc1                                                                                                                                                                            |
| vc1test                 | VC-1 test bitstream                                         | (null)                                    | (none)           | wmv3            | (none)   | (none) | rcv                                                                                                                                                                            |
| voc                     | Creative Voice                                              | audio/x-voc                               | pcm_s16le        | (none)          | (none)   | (none) | voc                                                                                                                                                                            |
| vvc                     | raw H.266/VVC video                                         | (null)                                    | (none)           | vvc             | (none)   | (none) | vvc,h266,266                                                                                                                                                                   |
| w64                     | Sony Wave64                                                 | (null)                                    | pcm_s16le        | (none)          | (none)   | (none) | w64                                                                                                                                                                            |
| wav                     | WAV / WAVE (Waveform Audio)                                 | audio/x-wav                               | pcm_s16le        | (none)          | (none)   | (none) | wav                                                                                                                                                                            |
| webm                    | WebM                                                        | video/webm                                | opus             | libvpx-vp9      | webvtt   | (none) | webm                                                                                                                                                                           |
| webm_dash_manifest      | WebM DASH Manifest                                          | application/xml                           | (none)           | (none)          | (none)   | (none) | xml                                                                                                                                                                            |
| webm_chunk              | WebM Chunk Muxer                                            | video/webm                                | (none)           | (none)          | (none)   | (none) | chk                                                                                                                                                                            |
| webp                    | WebP                                                        | (null)                                    | (none)           | libwebp_anim    | (none)   | (none) | webp                                                                                                                                                                           |
| webvtt                  | WebVTT subtitle                                             | text/vtt                                  | (none)           | (none)          | webvtt   | (none) | vtt                                                                                                                                                                            |
| wsaud                   | Westwood Studios audio                                      | (null)                                    | adpcm_ima_ws     | (none)          | (none)   | (none) | aud                                                                                                                                                                            |
| wtv                     | Windows Television (WTV)                                    | (null)                                    | ac3              | mpeg2video      | (none)   | (none) | wtv                                                                                                                                                                            |
| wv                      | raw WavPack                                                 | audio/x-wavpack                           | wavpack          | (none)          | (none)   | (none) | wv                                                                                                                                                                             |
| yuv4mpegpipe            | YUV4MPEG pipe                                               | (null)                                    | (none)           | wrapped_avframe | (none)   | (none) | y4m                                                                                                                                                                            |

* Disk seek noises

| Sample            | Duration (ms) | Step rate (ms) |
|-------------------+---------------+----------------|
| 35_seek_2ms.wav   |            83 |              2 |
| 35_seek_6ms.wav   |           251 |              6 |
| 35_seek_12ms.wav  |           300 |             12 |
| 35_seek_20ms.wav  |           500 |             20 |
| 35_step_1_1.wav   |            77 |             30 |
| 525_seek_2ms.wav  |            60 |              2 |
| 525_seek_6ms.wav  |           167 |              6 |
| 525_seek_12ms.wav |           257 |             12 |
| 525_seek_20ms.wav |           340 |             20 |
| 525_step_1_1.wav  |            74 |             30 |

* beeb_lib test types

Separate EXE for each one is no fun! It'd be nice to rationalise this
somehow.

** Kevin Edwards

Parameters:

1. File containing minimized Kevin Edwards protection routine
2. Text (possibly >1 line) for pasting in at BASIC prompt

All dealt with by shared function: =TestKevinEwards=

** Standard

Parameters:

1. File to load
2. BBC Micro type

All dealt with by shared function: =RunStandardTest=

** Teletest

Parameters:

1. Teletext image file to load
2. .png file to compare it to

All dealt with by shared function: =RunStandardTest=

** dp111 6502Timing

Parameters:

1. BBC Micro type
2. .ssd file to run =6502tim= from

** Hoglet Tube test

Parameters:

1. BBC Micro type
2. File to load and address to load it to
3. Pre-test command to paste
4. Post-test command to paste
5. =*CONFIGURE NOTUBE= or =*CONFIGURE EXTUBE=

All dealt with by shared function: =TestTube=

* New Tests

** Before

Build folder = 11.3 GB

Test run times:

- Debug :: 138.637
- RelWithDebInfo :: 63.994
- Final :: 48.121

** After (1st pass)

Build folder = 2.9 GB

Test run times:

- Debug :: 66.374
- RelWithDebInfo :: 34.846
- Final :: 34.972

** After (2nd pass)

=Total Test Time= times:

- Debug :: 67.76
- RelWithDebInfo :: 32.62
- Final :: 31.47


* Hard disk stuff

** adsb bits

Some info here: http://www.adsb.co.uk/bbc/winchester/

Addresses:

| Controller | Address | Read   | Write           |
|------------+---------+--------+-----------------|
|          0 | fc40    | data   | data            |
|          0 | fc41    | status | -               |
|          0 | fc42    | -      | select          |
|          0 | fc43    |        | interrupt latch |
|------------+---------+--------+-----------------|
|          1 | fc44    | data   | data            |
|          1 | fc45    | status | -               |
|          1 | fc46    | -      | select          |
|          1 | fc47    |        | interrupt latch |

#+begin_quote
IC5 (74LS254), IC6 (74LS138) and IC7 (74LS138) perform the address
line buffering and decoding. S1 provides a link selectable setting for
controller 0 or controller 1 (base address FC40 or FC44). The output
of the address decoder provides eight lines (active low), four for
read and four for write (shown for controller 0 on the diagram).

IC1 (74LS245) buffers the data bus continuously, IC2 (73LS373) is used
to latch data that is written to the controller. Writer data is
inverted by IC13/14 when enabled by the I/O control signal from the
controller card. IC13/14 (7438) are open collector output devices that
drive the SASI data port (pins 2 to 16).

Data is read from the controller card, inverted and buffered by IC3
(74LS240). Controller status is inverted by individual Schmitt
inverters in IC15 (7414) and latched and bufferedf by IC4 (74LS373).
Acknowledge (ACK) signals are provided automatically after a Request
from the controller when a read or write to the data port is peformed.
Select (SEL) is driven automatically by the Busy (BSY) status from the
controller.

An unusual interrupt generating arrangement is also incorporated, a
set reset flip flop, IC12, is set every time a Request (REQ) is
received from the controller, and is cleared when a "1" is written to
bit of the interrupt latch, half of IC10. At certain times this system
interrupts the CPU (via the IRQ line). The precise operation of this
interrupt system is not known, if it is omitted from the host adapter
then all OSFILE (load/save) operations work correctly, but writes in
random access mode (OPENUP, *SLPOO) fail and leave the controller hung
in a selected state, we can only presume that it forms a hardware
"bodge" to fix a software problem...
#+end_quote

** BeebEm formats

.dsc - 22 byte geometry file

| Offset | What |
|--------+------|
|      0 |      |
|      1 |      |
|      2 |      |
|      3 |      |
|      4 |      |
|      5 |      |
|      6 |      |
|      7 |      |
|      8 |      |
|      9 |      |
|     10 |      |
|     11 |      |
|     12 |      |
|     13 |      |
|     14 |      |
|     15 |      |
|     16 |      |
|     17 |      |
|     18 |      |
|     19 |      |
|     20 |      |
|     21 |      |

.dat - actual disk data

Some notes about this stuff:
http://www.cowsarenotpurple.co.uk/bbccomputer/native/adfs.html

* release.py bork

Works: 9f41cdeca4c6d91ffe8662145496d68967efdef6
Not works: e825ff1654b8181292c6ef2f07f072e860c21693

* Unify ROM mappers 

The BBCMicro::Update code maps accesses to specific regions to a new
mapper region to set. (The actual behaviour of the mapper region is
handled elsewhere.)

Masks:

| Type     | Mask 0x | Mask 0b             |
|----------+---------+---------------------|
| CCIWORD  |  0xffe0 | 1111 1111 1110 0000 |
| CCIBASE  |  0xffe0 | 1111 1111 1110 0000 |
| CCISPELL |  0xffe0 | 1011 1111 1110 0000 |
| PALQST   |  0xffe0 | 1111 1111 1110 0000 |
| PALWAP   |  0xffe0 | 1111 1111 1110 0000 |
| PALTED   |  0xffe0 | 1111 1111 1110 0000 |
| ABEP     |  0xfffc | 1111 1111 1111 1100 |
| ABE      |  0xfffc | 1111 1111 1111 1100 |

ROM areas:

- 0x8000 - 1000 xxxx xxxx xxxx
- 0x9000 - 1001 xxxx xxxx xxxx
- 0xa000 - 1010 xxxx xxxx xxxx
- 0xb000 - 1011 xxxx xxxx xxxx

So, ROM address mask is 10xx xxxx xxxx xxxx

Hit regions:

CCIWORD:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| 8060    | 1000 0000 011x xxxx |      0 |
| bfc0    | 1011 1111 110x xxxx |      0 |
| 8040    | 1000 0000 010x xxxx |      1 |
| bfa0    | 1011 1111 101x xxxx |      1 |
| bfe0    | 1011 1111 111x xxxx |      1 |

CCIBASE:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| bf80    | 1011 1111 100x xxxx |      0 |
| bfa0    | 1011 1111 101x xxxx |      1 |
| bfc0    | 1011 1111 110x xxxx |      2 |
| bfe0    | 1011 1111 111x xxxx |      3 |

CCISPELL:

Note conditional banking though - regions 1-7 can only be selected
when region 0 is active.

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| bfe0    | 1011 1111 111x xxxx |      0 |
| bfc0    | 1011 1111 110x xxxx |      1 |
| bfa0    | 1011 1111 101x xxxx |      2 |
| bf80    | 1011 1111 100x xxxx |      3 |
| bf60    | 1011 1111 011x xxxx |      4 |
| bf40    | 1011 1111 010x xxxx |      5 |
| bf20    | 1011 1111 001x xxxx |      6 |
| bf00    | 1011 1111 000x xxxx |      7 |

PALQST:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
|    8820 | 1000 1000 001x xxxx |      2 |
|    91e0 | 1001 0001 111x xxxx |      1 |
|    92c0 | 1001 0010 110x xxxx |      3 |
|    9340 | 1001 0011 010x xxxx |      0 |

PALWAP:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| 9f00    | 1001 1111 000x xxxx |      0 |
| 9f20    | 1001 1111 001x xxxx |      1 |
| 9f40    | 1001 1111 010x xxxx |      2 |
| 9f60    | 1001 1111 011x xxxx |      3 |
| 9f80    | 1001 1111 100x xxxx |      4 |
| 9fa0    | 1001 1111 101x xxxx |      5 |
| 9fc0    | 1001 1111 110x xxxx |      6 |
| 9fe0    | 1001 1111 111x xxxx |      7 |

PALTED:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| 9f80    | 1001 1111 100x xxxx |      0 |
| 9fa0    | 1001 1111 101x xxxx |      1 |
| 9fc0    | 1001 1111 110x xxxx |      2 |
| 9fe0    | 1001 1111 111x xxxx |      3 |

ABEP/ABE:

| Addr 0x | Addr 0b             | Region |
|---------+---------------------+--------|
| bff8    | 1011 1111 1111 10xx |      1 |
| bffc    | 1011 1111 1111 11xx |      0 |

Logic is identical for ABEP but banks swapped.

Trilogy:

| Addr 0x   | Addr 0b             | Region |
|-----------+---------------------+--------|
| bff8/bffc | 1011 1111 1111 1x00 |      0 |
| bff9/bffd | 1011 1111 1111 1x01 |      1 |
| bffa/bffe | 1011 1111 1111 1x10 |      2 |
| bffb/bfff | 1011 1111 1111 1x11 |      3 |

* Instant Mini Office II

https://github.com/mamedev/mame/blob/81284c68caf803c81989b2e55a9b6434b892ab96/src/devices/bus/bbc/rom/pal.cpp#L312

#+begin_src c
  uint8_t bbc_palmo2_device::read(offs_t offset)
  {
      if (!machine().side_effects_disabled())
      {
          /* switching zones for Instant Mini Office 2 */
          switch (offset & 0x3ff0)
          {
          case 0x2000: m_bank = offset & 0x0f; break;
          }
      }

      return get_rom_base()[(offset & 0x3fff) | (m_bank << 13)];
  }
#+end_src

Note: the ROMs are numbered in reverse order of offset!

#+begin_src nxml
  <software name="moffice2">
  	<description>Instant Mini Office II</description>
  	<year>1986</year>
  	<publisher>Database Software</publisher>
  	<part name="rom1" interface="bbc_rom">
  		<feature name="slot" value="palmo2" />
  		<dataarea name="rom" size="131072">
  			<rom name="MiniOfficeII-1.rom" size="32768" crc="5e0f6853" sha1="3deef1b1680c9a1449009b11899bf5ab360f89ef" offset="0x18000"/>
  			<rom name="MiniOfficeII-2.rom" size="32768" crc="afb646cc" sha1="d7ead85e32930b0f35ad87d3a825f48896abc8e1" offset="0x10000"/>
  			<rom name="MiniOfficeII-3.rom" size="32768" crc="e8a1cbd8" sha1="9e31542d2099c98605032c175c196f3ea073de5f" offset="0x08000"/>
  			<rom name="MiniOfficeII-4.rom" size="32768" crc="d041fe31" sha1="cd0297096009c71ebb00709cfb32a6c56e7eea8b" offset="0x00000"/>
  		</dataarea>
  	</part>
  </software>
#+end_src

1<<13==0x2000

Odd arrangement:

| Region | Addr | Offset |
|--------+------+--------|
| 0 (A)  | 8xxx |  +0xxx |
| 0 (A)  | 9xxx |  +1xxx |
| 0 (A)  | axxx |  +2xxx |
| 0 (A)  | bxxx |  +3xxx |
|--------+------+--------|
| 1 (B)  | 8xxx |  +2xxx |
| 1 (B)  | 9xxx |  +3xxx |
| 1 (B)  | axxx |  +2xxx |
| 1 (B)  | bxxx |  +3xxx |
|--------+------+--------|
| 2 (C)  | 8xxx |  +4xxx |
| 2 (C)  | 9xxx |  +5xxx |
| 2 (C)  | axxx |  +6xxx |
| 2 (C)  | bxxx |  +7xxx |
|--------+------+--------|
| 3 (D)  | 8xxx |  +6xxx |
| 3 (D)  | 9xxx |  +7xxx |
| 3 (D)  | axxx |  +6xxx |
| 3 (D)  | bxxx |  +7xxx |
|--------+------+--------|
| 4 (E)  | 8xxx |  +8xxx |
| 4 (E)  | 9xxx |  +9xxx |
| 4 (E)  | axxx |  +axxx |
| 4 (E)  | bxxx |  +bxxx |
|--------+------+--------|
| 5 (F)  | 8xxx |  +axxx |
| 5 (F)  | 9xxx |  +bxxx |
| 5 (F)  | axxx |  +axxx |
| 5 (F)  | bxxx |  +bxxx |
|--------+------+--------|
| 6 (G)  | 8xxx |  +cxxx |
| 6 (G)  | 9xxx |  +dxxx |
| 6 (G)  | axxx |  +exxx |
| 6 (G)  | bxxx |  +fxxx |
|--------+------+--------|
| 7 (H)  | 8xxx |  +exxx |
| 7 (H)  | 9xxx |  +fxxx |
| 7 (H)  | axxx |  +exxx |
| 7 (H)  | bxxx |  +fxxx |
|--------+------+--------|
| 8 (I)  | 8xxx | +10xxx |
| 8 (I)  | 9xxx | +11xxx |
| 8 (I)  | axxx | +12xxx |
| 8 (I)  | bxxx | +13xxx |
|--------+------+--------|
| 9 (J)  | 8xxx | +12xxx |
| 9 (J)  | 9xxx | +13xxx |
| 9 (J)  | axxx | +12xxx |
| 9 (J)  | bxxx | +13xxx |
|--------+------+--------|
| 10 (K) | 8xxx | +14xxx |
| 10 (K) | 9xxx | +15xxx |
| 10 (K) | axxx | +16xxx |
| 10 (K) | bxxx | +17xxx |
|--------+------+--------|
| 11 (L) | 8xxx | +16xxx |
| 11 (L) | 9xxx | +17xxx |
| 11 (L) | axxx | +16xxx |
| 11 (L) | bxxx | +17xxx |
|--------+------+--------|
| 12 (M) | 8xxx | +18xxx |
| 12 (M) | 9xxx | +19xxx |
| 12 (M) | axxx | +1axxx |
| 12 (M) | bxxx | +1bxxx |
|--------+------+--------|
| 13 (N) | 8xxx | +1axxx |
| 13 (N) | 9xxx | +1bxxx |
| 13 (N) | axxx | +1axxx |
| 13 (N) | bxxx | +1bxxx |
|--------+------+--------|
| 14 (O) | 8xxx | +1cxxx |
| 14 (O) | 9xxx | +1dxxx |
| 14 (O) | axxx | +1exxx |
| 14 (O) | bxxx | +1fxxx |
|--------+------+--------|
| 15 (P) | 8xxx | +1exxx |
| 15 (P) | 9xxx | +1fxxx |
| 15 (P) | axxx | +1exxx |
| 15 (P) | bxxx | +1fxxx |

* Windows 10 user switch hang

https://github.com/tom-seddon/b2/issues/143

** Example case

Displays in array after switching user then back:

: [0]	unique_ptr {id=1 hmonitor=0x000000000f6f08a9 {unused=??? } data=0x0000016599412e40 ...}	std::unique_ptr<VBlankMonitorWindows::Display,std::default_delete<VBlankMonitorWindows::Display>>
: [1]	unique_ptr {id=2 hmonitor=0x0000000002c20581 {unused=??? } data=0x000001659941ba70 ...}	std::unique_ptr<VBlankMonitorWindows::Display,std::default_delete<VBlankMonitorWindows::Display>>
: [2]	unique_ptr {id=3 hmonitor=0x00000000024d07c9 {unused=??? } data=0x000001659941fcc0 ...}	std::unique_ptr<VBlankMonitorWindows::Display,std::default_delete<VBlankMonitorWindows::Display>>

This stuff all seems to work, and the vblank messages keep coming.

But then:

: HMONITOR hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
: hmonitor	0x000000000f0f0005 {unused=??? }	HMONITOR__ *

Not a known HMONITOR!

There's no [[https://learn.microsoft.com/en-us/windows/win32/gdi/wm-displaychange][WM_DISPLAYCHANGE]] message to indicate this has happened.

There's no [[https://learn.microsoft.com/en-us/windows/win32/devio/wm-devicechange][WM_DEVICECHANGE]]...

* b2.json schema

In slightly bogus C++ terms...

- =T *= means optional. Might be null.

- =union= is more like TypeScript's =|= - it'll be one of the given
  types. Unnamed union members are always valid

- =Flags<T>= is a bitfield. See the referenced enum

#+begin_src c++
  struct b2 {
      Globals globals;
      map<string,RecentPaths> recent_paths;
      vector<NewKeymap> new_keymaps;
      map<string/*window name*/,map<string/*command name*/,vector<Shortcut>>> shortcuts;
      Windows windows;
      Trace trace;
      BeebLink beeblink;

      // The formats of these two are the same.
      //
      // If configs is present, that is used. The default configs are
      // force added first and anything in configs overrides them.
      //
      // Otherwise, new_configs is used. Everything in there is loaded,
      // and then the default configs are added afterwards, based on the
      // feature flags seen.
      vector<Config> configs;
      vector<Config> new_configs;
      Joysticks joysticks;
  };

  struct Globals {
      bool vsync;
      Flags<BeebConfigFeatureFlag> feature_flags;
  };

  struct RecentPaths {
      vector<string> paths;
  };

  struct NewKeymap {
      string name;
      bool keysyms;
      bool prefer_shortcuts;
      map<string,NewKeymapKey> keys;
  };

  union NewKeymapKey {
      string;//name
      int;//number;
      vector<NewKeymapKeySym>;//sym;
  };

  struct NewKeymapKeySym {
      bool Shift;
      string keycode;
  };

  struct Shortcut {
      bool Shift,Ctrl,Alt;
      string keycode;
  };

  struct Windows {
      string window_placement;
      vector<string> popups;
      string keymap;
      float bbc_volume,disc_volume;
      bool filter_bbc;
      bool correct_aspect_ratio;
      bool screenshot_filtery
      bool screenshot_correct_aspect_ratioy
      bool screenshot_last_vsyncy
      bool full_screeny
      bool prefer_shortcutsy
      bool auto_scaley

      float manual_scale;
      bool power_on_tone;
      bool interlace;
      LEDsPopupMode leds_popup_mode;
      int gui_font_size;
      UTF8ConvertMode text_utf8_convert_mode;
      bool text_handle_delete;
      UTF8ConvertMode "printer_utf8_convert_mode;
      bool printer_handle_delete;
      bool capture_mouse_on_click;
      bool hide_cursor_when_unfocused;
      string config;/*must be one of the keys of new_configs*/
  };

  struct Trace {
      Flags<BBCMicroTraceFlag> flags;
      Flags<TraceOutputFlags> output_flags;
      TraceUIStartCondition start;
      TraceUIStopCondition stop;
      bool unlimited;
      uint64_t start_instruction_address;
      uint64_t start_write_address;
      uint64_t stop_write_address;
      uint64_t stop_num_cycles;
      bool auto_save;
      string auto_save_path;
  #if SYSTEM_WINDOWS
      bool unix_line_endings;
  #endif
  };

  struct Beeblink {
      vector<string> urls;
  };

  struct Config {
      string name;
      ROM *os;
      OSROMType os_rom_type;
      BBCMicroTypeID type;
      string disc_interface;
      ROM *roms[16];
      bool ext_mem;
      bool beeblink;
      bool adji;
      unsigned adji_dip_switches;
      bool mouse;
      BBCMicroParasiteType parasite_type;
      ROM *parasite_os;
      BeebConfigNVRAMType nvram_type;
      string nvram;
  };

  struct ROM {
      bool writeable;
      union {
          StandardROMEnum standard_rom;
          struct {
              string file_name;
              ROMType type;
          };
      };
  };

  struct Joysticks {
      vector<string> device_names;
      bool swap_joysticks_when_shared;
  };
#+end_src

* libcurl vs llhttp

Both have a =BUILD_STATIC_LIBS= CMake option...

The first option encountered with the given name wins. This is kind of
exactly what you want, but there's the possibility of problems when
multiple packages use the same option names. Not an issue in this case
but probably worth filing a bug over.

Noticed this because llhttp stopped building properly after upgrading
libcurl. Something about the exact way that these 2 libraries make
decisions based on options and variables.

* Video NuLA tests

** some output

test_beeb help output:

#+begin_example
  Options:

    --help            display help
    -t TEST, --test=TEST
                      run test(s) matching TEST, a case-insensitive string
    -T TEST, --test-regexp=TEST
                      run test(s) matching TEST, a case-insensitive regular expression
    -l, --list        list all test names
    --infer-wanted-images
                      wanted images may not exist if one doesn't, assume the got image is the right one, and copy it to the wanted image path
    --wip             include WIP tests that aren't finished or passing yet
#+end_example

Test list (including WIP):

- dp111.6502timing
- dp111.6502timing1M
- dp111.65C12timing
- dp111.65C12timing1M
- kevin_edwards.Alien8
- kevin_edwards.Jetman
- kevin_edwards.Nightsh
- standard.TIMINGS
- standard.VIA.AC1
- standard.VIA.AC2
- standard.VIA.AC3
- standard.VIA.AC4
- standard.VIA.AC5
- standard.VIA.AC6
- standard.VIA.AC7
- standard.VIA.C1
- standard.VIA.C2
- standard.VIA.C3
- standard.VIA.C4
- standard.VIA.I1
- standard.VIA.I2
- standard.VIA.PB2
- standard.VIA.PB6
- standard.VIA.PB7
- standard.VIA.T11
- standard.VIA.T21
- standard.VIA.T22
- standard.VPOLL
- standard.VTIMEOU
- standard.VTIMERS
- teletext.ENGTEST
- teletext.RED
- teletext.TELETST
- tube.itu_prst
- tube.xtu_prst
- tube.xtu_r124
- tube.xtu_r3
- video_nula.blank1.N.3-BLANK-1.M0.N00
- video_nula.blank1.N.3-BLANK-1.M0.N01
- video_nula.blank1.N.3-BLANK-1.M0.N02
- video_nula.blank1.N.3-BLANK-1.M0.N03
- video_nula.blank1.N.3-BLANK-1.M0.N04
- video_nula.blank1.N.3-BLANK-1.M0.N05
- video_nula.blank1.N.3-BLANK-1.M0.N06
- video_nula.blank1.N.3-BLANK-1.M0.N07
- video_nula.blank1.N.3-BLANK-1.M0.N08
- video_nula.blank1.N.3-BLANK-1.M0.N09
- video_nula.blank1.N.3-BLANK-1.M0.N10
- video_nula.blank1.N.3-BLANK-1.M0.N11
- video_nula.blank1.N.3-BLANK-1.M0.N12
- video_nula.blank1.N.3-BLANK-1.M0.N13
- video_nula.blank1.N.3-BLANK-1.M0.N14
- video_nula.blank1.N.3-BLANK-1.M0.N15
- video_nula.blank1.N.3-BLANK-1.M1.N00
- video_nula.blank1.N.3-BLANK-1.M1.N01
- video_nula.blank1.N.3-BLANK-1.M1.N02
- video_nula.blank1.N.3-BLANK-1.M1.N03
- video_nula.blank1.N.3-BLANK-1.M1.N04
- video_nula.blank1.N.3-BLANK-1.M1.N05
- video_nula.blank1.N.3-BLANK-1.M1.N06
- video_nula.blank1.N.3-BLANK-1.M1.N07
- video_nula.blank1.N.3-BLANK-1.M1.N08
- video_nula.blank1.N.3-BLANK-1.M1.N09
- video_nula.blank1.N.3-BLANK-1.M1.N10
- video_nula.blank1.N.3-BLANK-1.M1.N11
- video_nula.blank1.N.3-BLANK-1.M1.N12
- video_nula.blank1.N.3-BLANK-1.M1.N13
- video_nula.blank1.N.3-BLANK-1.M1.N14
- video_nula.blank1.N.3-BLANK-1.M1.N15
- video_nula.blank1.N.3-BLANK-1.M2.N00
- video_nula.blank1.N.3-BLANK-1.M2.N01
- video_nula.blank1.N.3-BLANK-1.M2.N02
- video_nula.blank1.N.3-BLANK-1.M2.N03
- video_nula.blank1.N.3-BLANK-1.M2.N04
- video_nula.blank1.N.3-BLANK-1.M2.N05
- video_nula.blank1.N.3-BLANK-1.M2.N06
- video_nula.blank1.N.3-BLANK-1.M2.N07
- video_nula.blank1.N.3-BLANK-1.M2.N08
- video_nula.blank1.N.3-BLANK-1.M2.N09
- video_nula.blank1.N.3-BLANK-1.M2.N10
- video_nula.blank1.N.3-BLANK-1.M2.N11
- video_nula.blank1.N.3-BLANK-1.M2.N12
- video_nula.blank1.N.3-BLANK-1.M2.N13
- video_nula.blank1.N.3-BLANK-1.M2.N14
- video_nula.blank1.N.3-BLANK-1.M2.N15
- video_nula.blank1.N.3-BLANK-1.M3.N00
- video_nula.blank1.N.3-BLANK-1.M3.N01
- video_nula.blank1.N.3-BLANK-1.M3.N02
- video_nula.blank1.N.3-BLANK-1.M3.N03
- video_nula.blank1.N.3-BLANK-1.M3.N04
- video_nula.blank1.N.3-BLANK-1.M3.N05
- video_nula.blank1.N.3-BLANK-1.M3.N06
- video_nula.blank1.N.3-BLANK-1.M3.N07
- video_nula.blank1.N.3-BLANK-1.M3.N08
- video_nula.blank1.N.3-BLANK-1.M3.N09
- video_nula.blank1.N.3-BLANK-1.M3.N10
- video_nula.blank1.N.3-BLANK-1.M3.N11
- video_nula.blank1.N.3-BLANK-1.M3.N12
- video_nula.blank1.N.3-BLANK-1.M3.N13
- video_nula.blank1.N.3-BLANK-1.M3.N14
- video_nula.blank1.N.3-BLANK-1.M3.N15
- video_nula.blank1.N.3-BLANK-1.M4.N00
- video_nula.blank1.N.3-BLANK-1.M4.N01
- video_nula.blank1.N.3-BLANK-1.M4.N02
- video_nula.blank1.N.3-BLANK-1.M4.N03
- video_nula.blank1.N.3-BLANK-1.M4.N04
- video_nula.blank1.N.3-BLANK-1.M4.N05
- video_nula.blank1.N.3-BLANK-1.M4.N06
- video_nula.blank1.N.3-BLANK-1.M4.N07
- video_nula.blank1.N.3-BLANK-1.M4.N08
- video_nula.blank1.N.3-BLANK-1.M4.N09
- video_nula.blank1.N.3-BLANK-1.M4.N10
- video_nula.blank1.N.3-BLANK-1.M4.N11
- video_nula.blank1.N.3-BLANK-1.M4.N12
- video_nula.blank1.N.3-BLANK-1.M4.N13
- video_nula.blank1.N.3-BLANK-1.M4.N14
- video_nula.blank1.N.3-BLANK-1.M4.N15
- video_nula.blank1.N.3-BLANK-1.M5.N00
- video_nula.blank1.N.3-BLANK-1.M5.N01
- video_nula.blank1.N.3-BLANK-1.M5.N02
- video_nula.blank1.N.3-BLANK-1.M5.N03
- video_nula.blank1.N.3-BLANK-1.M5.N04
- video_nula.blank1.N.3-BLANK-1.M5.N05
- video_nula.blank1.N.3-BLANK-1.M5.N06
- video_nula.blank1.N.3-BLANK-1.M5.N07
- video_nula.blank1.N.3-BLANK-1.M5.N08
- video_nula.blank1.N.3-BLANK-1.M5.N09
- video_nula.blank1.N.3-BLANK-1.M5.N10
- video_nula.blank1.N.3-BLANK-1.M5.N11
- video_nula.blank1.N.3-BLANK-1.M5.N12
- video_nula.blank1.N.3-BLANK-1.M5.N13
- video_nula.blank1.N.3-BLANK-1.M5.N14
- video_nula.blank1.N.3-BLANK-1.M5.N15
- video_nula.blank1.N.3-BLANK-1.M6.N00
- video_nula.blank1.N.3-BLANK-1.M6.N01
- video_nula.blank1.N.3-BLANK-1.M6.N02
- video_nula.blank1.N.3-BLANK-1.M6.N03
- video_nula.blank1.N.3-BLANK-1.M6.N04
- video_nula.blank1.N.3-BLANK-1.M6.N05
- video_nula.blank1.N.3-BLANK-1.M6.N06
- video_nula.blank1.N.3-BLANK-1.M6.N07
- video_nula.blank1.N.3-BLANK-1.M6.N08
- video_nula.blank1.N.3-BLANK-1.M6.N09
- video_nula.blank1.N.3-BLANK-1.M6.N10
- video_nula.blank1.N.3-BLANK-1.M6.N11
- video_nula.blank1.N.3-BLANK-1.M6.N12
- video_nula.blank1.N.3-BLANK-1.M6.N13
- video_nula.blank1.N.3-BLANK-1.M6.N14
- video_nula.blank1.N.3-BLANK-1.M6.N15
- video_nula.blank1.N.3-BLANK-1.M7.N00
- video_nula.blank1.N.3-BLANK-1.M7.N01
- video_nula.blank1.N.3-BLANK-1.M7.N02
- video_nula.blank1.N.3-BLANK-1.M7.N03
- video_nula.blank1.N.3-BLANK-1.M7.N04
- video_nula.blank1.N.3-BLANK-1.M7.N05
- video_nula.blank1.N.3-BLANK-1.M7.N06
- video_nula.blank1.N.3-BLANK-1.M7.N07
- video_nula.blank1.N.3-BLANK-1.M7.N08
- video_nula.blank1.N.3-BLANK-1.M7.N09
- video_nula.blank1.N.3-BLANK-1.M7.N10
- video_nula.blank1.N.3-BLANK-1.M7.N11
- video_nula.blank1.N.3-BLANK-1.M7.N12
- video_nula.blank1.N.3-BLANK-1.M7.N13
- video_nula.blank1.N.3-BLANK-1.M7.N14
- video_nula.blank1.N.3-BLANK-1.M7.N15
- video_nula.blank1.N.3-BLANK-1.M8.N00
- video_nula.blank1.N.3-BLANK-1.M8.N01
- video_nula.blank1.N.3-BLANK-1.M8.N02
- video_nula.blank1.N.3-BLANK-1.M8.N03
- video_nula.blank1.N.3-BLANK-1.M8.N04
- video_nula.blank1.N.3-BLANK-1.M8.N05
- video_nula.blank1.N.3-BLANK-1.M8.N06
- video_nula.blank1.N.3-BLANK-1.M8.N07
- video_nula.blank1.N.3-BLANK-1.M8.N08
- video_nula.blank1.N.3-BLANK-1.M8.N09
- video_nula.blank1.N.3-BLANK-1.M8.N10
- video_nula.blank1.N.3-BLANK-1.M8.N11
- video_nula.blank1.N.3-BLANK-1.M8.N12
- video_nula.blank1.N.3-BLANK-1.M8.N13
- video_nula.blank1.N.3-BLANK-1.M8.N14
- video_nula.blank1.N.3-BLANK-1.M8.N15
- video_nula.scroll1.N.2-SCROLL-1.M0.O00
- video_nula.scroll1.N.2-SCROLL-1.M0.O01
- video_nula.scroll1.N.2-SCROLL-1.M0.O02
- video_nula.scroll1.N.2-SCROLL-1.M0.O03
- video_nula.scroll1.N.2-SCROLL-1.M0.O04
- video_nula.scroll1.N.2-SCROLL-1.M0.O05
- video_nula.scroll1.N.2-SCROLL-1.M0.O06
- video_nula.scroll1.N.2-SCROLL-1.M0.O07
- video_nula.scroll1.N.2-SCROLL-1.M0.O08
- video_nula.scroll1.N.2-SCROLL-1.M0.O09
- video_nula.scroll1.N.2-SCROLL-1.M0.O10
- video_nula.scroll1.N.2-SCROLL-1.M0.O11
- video_nula.scroll1.N.2-SCROLL-1.M0.O12
- video_nula.scroll1.N.2-SCROLL-1.M0.O13
- video_nula.scroll1.N.2-SCROLL-1.M0.O14
- video_nula.scroll1.N.2-SCROLL-1.M0.O15
- video_nula.scroll1.N.2-SCROLL-1.M1.O00
- video_nula.scroll1.N.2-SCROLL-1.M1.O01
- video_nula.scroll1.N.2-SCROLL-1.M1.O02
- video_nula.scroll1.N.2-SCROLL-1.M1.O03
- video_nula.scroll1.N.2-SCROLL-1.M1.O04
- video_nula.scroll1.N.2-SCROLL-1.M1.O05
- video_nula.scroll1.N.2-SCROLL-1.M1.O06
- video_nula.scroll1.N.2-SCROLL-1.M1.O07
- video_nula.scroll1.N.2-SCROLL-1.M1.O08
- video_nula.scroll1.N.2-SCROLL-1.M1.O09
- video_nula.scroll1.N.2-SCROLL-1.M1.O10
- video_nula.scroll1.N.2-SCROLL-1.M1.O11
- video_nula.scroll1.N.2-SCROLL-1.M1.O12
- video_nula.scroll1.N.2-SCROLL-1.M1.O13
- video_nula.scroll1.N.2-SCROLL-1.M1.O14
- video_nula.scroll1.N.2-SCROLL-1.M1.O15
- video_nula.scroll1.N.2-SCROLL-1.M2.O00
- video_nula.scroll1.N.2-SCROLL-1.M2.O01
- video_nula.scroll1.N.2-SCROLL-1.M2.O02
- video_nula.scroll1.N.2-SCROLL-1.M2.O03
- video_nula.scroll1.N.2-SCROLL-1.M2.O04
- video_nula.scroll1.N.2-SCROLL-1.M2.O05
- video_nula.scroll1.N.2-SCROLL-1.M2.O06
- video_nula.scroll1.N.2-SCROLL-1.M2.O07
- video_nula.scroll1.N.2-SCROLL-1.M2.O08
- video_nula.scroll1.N.2-SCROLL-1.M2.O09
- video_nula.scroll1.N.2-SCROLL-1.M2.O10
- video_nula.scroll1.N.2-SCROLL-1.M2.O11
- video_nula.scroll1.N.2-SCROLL-1.M2.O12
- video_nula.scroll1.N.2-SCROLL-1.M2.O13
- video_nula.scroll1.N.2-SCROLL-1.M2.O14
- video_nula.scroll1.N.2-SCROLL-1.M2.O15
- video_nula.scroll1.N.2-SCROLL-1.M3.O00
- video_nula.scroll1.N.2-SCROLL-1.M3.O01
- video_nula.scroll1.N.2-SCROLL-1.M3.O02
- video_nula.scroll1.N.2-SCROLL-1.M3.O03
- video_nula.scroll1.N.2-SCROLL-1.M3.O04
- video_nula.scroll1.N.2-SCROLL-1.M3.O05
- video_nula.scroll1.N.2-SCROLL-1.M3.O06
- video_nula.scroll1.N.2-SCROLL-1.M3.O07
- video_nula.scroll1.N.2-SCROLL-1.M3.O08
- video_nula.scroll1.N.2-SCROLL-1.M3.O09
- video_nula.scroll1.N.2-SCROLL-1.M3.O10
- video_nula.scroll1.N.2-SCROLL-1.M3.O11
- video_nula.scroll1.N.2-SCROLL-1.M3.O12
- video_nula.scroll1.N.2-SCROLL-1.M3.O13
- video_nula.scroll1.N.2-SCROLL-1.M3.O14
- video_nula.scroll1.N.2-SCROLL-1.M3.O15
- video_nula.scroll1.N.2-SCROLL-1.M4.O00
- video_nula.scroll1.N.2-SCROLL-1.M4.O01
- video_nula.scroll1.N.2-SCROLL-1.M4.O02
- video_nula.scroll1.N.2-SCROLL-1.M4.O03
- video_nula.scroll1.N.2-SCROLL-1.M4.O04
- video_nula.scroll1.N.2-SCROLL-1.M4.O05
- video_nula.scroll1.N.2-SCROLL-1.M4.O06
- video_nula.scroll1.N.2-SCROLL-1.M4.O07
- video_nula.scroll1.N.2-SCROLL-1.M4.O08
- video_nula.scroll1.N.2-SCROLL-1.M4.O09
- video_nula.scroll1.N.2-SCROLL-1.M4.O10
- video_nula.scroll1.N.2-SCROLL-1.M4.O11
- video_nula.scroll1.N.2-SCROLL-1.M4.O12
- video_nula.scroll1.N.2-SCROLL-1.M4.O13
- video_nula.scroll1.N.2-SCROLL-1.M4.O14
- video_nula.scroll1.N.2-SCROLL-1.M4.O15
- video_nula.scroll1.N.2-SCROLL-1.M5.O00
- video_nula.scroll1.N.2-SCROLL-1.M5.O01
- video_nula.scroll1.N.2-SCROLL-1.M5.O02
- video_nula.scroll1.N.2-SCROLL-1.M5.O03
- video_nula.scroll1.N.2-SCROLL-1.M5.O04
- video_nula.scroll1.N.2-SCROLL-1.M5.O05
- video_nula.scroll1.N.2-SCROLL-1.M5.O06
- video_nula.scroll1.N.2-SCROLL-1.M5.O07
- video_nula.scroll1.N.2-SCROLL-1.M5.O08
- video_nula.scroll1.N.2-SCROLL-1.M5.O09
- video_nula.scroll1.N.2-SCROLL-1.M5.O10
- video_nula.scroll1.N.2-SCROLL-1.M5.O11
- video_nula.scroll1.N.2-SCROLL-1.M5.O12
- video_nula.scroll1.N.2-SCROLL-1.M5.O13
- video_nula.scroll1.N.2-SCROLL-1.M5.O14
- video_nula.scroll1.N.2-SCROLL-1.M5.O15
- video_nula.scroll1.N.2-SCROLL-1.M6.O00
- video_nula.scroll1.N.2-SCROLL-1.M6.O01
- video_nula.scroll1.N.2-SCROLL-1.M6.O02
- video_nula.scroll1.N.2-SCROLL-1.M6.O03
- video_nula.scroll1.N.2-SCROLL-1.M6.O04
- video_nula.scroll1.N.2-SCROLL-1.M6.O05
- video_nula.scroll1.N.2-SCROLL-1.M6.O06
- video_nula.scroll1.N.2-SCROLL-1.M6.O07
- video_nula.scroll1.N.2-SCROLL-1.M6.O08
- video_nula.scroll1.N.2-SCROLL-1.M6.O09
- video_nula.scroll1.N.2-SCROLL-1.M6.O10
- video_nula.scroll1.N.2-SCROLL-1.M6.O11
- video_nula.scroll1.N.2-SCROLL-1.M6.O12
- video_nula.scroll1.N.2-SCROLL-1.M6.O13
- video_nula.scroll1.N.2-SCROLL-1.M6.O14
- video_nula.scroll1.N.2-SCROLL-1.M6.O15
- video_nula.scroll1.N.2-SCROLL-1.M7.O00
- video_nula.scroll1.N.2-SCROLL-1.M7.O01
- video_nula.scroll1.N.2-SCROLL-1.M7.O02
- video_nula.scroll1.N.2-SCROLL-1.M7.O03
- video_nula.scroll1.N.2-SCROLL-1.M7.O04
- video_nula.scroll1.N.2-SCROLL-1.M7.O05
- video_nula.scroll1.N.2-SCROLL-1.M7.O06
- video_nula.scroll1.N.2-SCROLL-1.M7.O07
- video_nula.scroll1.N.2-SCROLL-1.M7.O08
- video_nula.scroll1.N.2-SCROLL-1.M7.O09
- video_nula.scroll1.N.2-SCROLL-1.M7.O10
- video_nula.scroll1.N.2-SCROLL-1.M7.O11
- video_nula.scroll1.N.2-SCROLL-1.M7.O12
- video_nula.scroll1.N.2-SCROLL-1.M7.O13
- video_nula.scroll1.N.2-SCROLL-1.M7.O14
- video_nula.scroll1.N.2-SCROLL-1.M7.O15
- video_ula.ULAMODE.C0F0M0
- video_ula.ULAMODE.C0F0M1
- video_ula.ULAMODE.C0F0M2
- video_ula.ULAMODE.C0F0M3
- video_ula.ULAMODE.C0F1M0
- video_ula.ULAMODE.C0F1M1
- video_ula.ULAMODE.C0F1M2
- video_ula.ULAMODE.C0F1M3
- video_ula.ULAMODE.C1F0M0
- video_ula.ULAMODE.C1F0M1
- video_ula.ULAMODE.C1F0M2
- video_ula.ULAMODE.C1F0M3
- video_ula.ULAMODE.C1F1M0
- video_ula.ULAMODE.C1F1M1
- video_ula.ULAMODE.C1F1M2
- video_ula.ULAMODE.C1F1M3

** timings (before)

| Test                         |  Time |
|------------------------------+-------|
| 6502_basic_tests             |  0.23 |
| b2/test_http                 |  0.08 |
| b2/test_JobQueue             |  0.15 |
| b2/test_UTF8                 |  0.12 |
| klaus                        |  5.93 |
| lorenz                       | 40.48 |
| test_6522                    |  0.05 |
| test_basic                   |  0.08 |
| test_beeb_dp111              |  8.51 |
| test_beeb_kevin_edwards      | 18.77 |
| test_beeb_standard           | 22.66 |
| test_beeb_teletext           |  2.67 |
| test_beeb_tube               | 37.17 |
| test_beeb_video_ula          | 19.64 |
| test_CommandLineParser       |  0.03 |
| test_enum                    |  0.04 |
| test_load_store              |  0.03 |
| test_log                     |  0.05 |
| test_OutputDataBuffer        |  0.13 |
| test_path                    |  0.05 |
| test_relacy_OutputDataBuffer |  0.13 |
| test_sha1                    |  0.03 |
| tom_seddon_6502_tests        | 23.92 |
| visual6502                   | 25.97 |

** failure

10:

1113203 cycles
1243251 cycles
1374323 cycles
1504371 cycles
1635443 cycles
1657971 cycles
1737843 cycles
1817715 cycles
1897587 cycles
1977459 cycles

5:

1113203 cycles
1243251 cycles
1374323 cycles
1504371 cycles
1635443 cycles


** Logical palette tests for ULAMODE

See https://github.com/tom-seddon/b2/issues/418

Additional test cases (that currently fail):

#+begin_src c++
  if (options.wip) {
      for (int p = 0; p < 2; ++p) {
          std::string extra_paste = strprintf("?&FE22=&%x", 0x10 + p);
          for (int c = 0; c < 2; ++c) {
              for (int f = 0; f < 2; ++f) {
                  for (int m = 0; m < 4; ++m) {
                      auto test = new VideoNuLATest(strprintf("ulamode.P%d", p), "ULAMODE", {{"C", std::to_string(c)}, {"F", std::to_string(f)}, {"M", std::to_string(m)}});
                      all_tests.push_back(std::unique_ptr<VideoNuLATest>(test));
                  }
              }
          }
      }
  }
#+end_src

* Video NuLA fixes

Mode 0/3/4/6

Input data:

:  byte -1                          byte 0
: +---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---+
: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 || 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
: +---+---+---+---+---+---+---+---++---+---+---+---+---+---+---+---+
:       |                       |    |
:       |                       |    +- left pixel if offset=0
:       |                       +- left pixel if offset=1
:       +- left pixel if offset=7

Shifted right to produce screen data.

* inline =BBCMicro::GetRAM=

Looks like it will be called a lot in the test BBCMicro derived class.
See =TestBBCMicro::Update1=. But is that enough to make it a
worthwhile change?

3 runs with non inlined:

: test_beeb_standard ...............   Passed   20.82 sec
: test_beeb_standard ...............   Passed   21.60 sec
: test_beeb_standard ...............   Passed   20.81 sec

3 runs with inlined:

: test_beeb_standard ...............   Passed   21.76 sec
: test_beeb_standard ...............   Passed   21.38 sec
: test_beeb_standard ...............   Passed   21.49 sec

Not obviously!

* eof.
