Changelog
---------

(Starting from RSX180 V6.15 of 24/03/20, P112 version)


03/04/20

- First RSX280 version will be for Bill Shen's Z280RC board. The clever
  ROM-less design, the simpler ZZmon and the built-in CF interface makes
  it easier to develop and test programs for the Z280RC than for the Tilmann
  Reh's CPU280 board, whose ROM mainly implements a CP/M 3 BIOS with no
  possibility of booting any foreign-OS disks. The CPU280 ROM BIOS also
  limits programs to run in user mode, meaning no privileged instructions
  can be executed that would allow one to e.g. take control of the MMU
  (a sort of back-door exists, but is a bit cumbersome to use).

- Modified the ZZmon so it will load the boot sector of an existing RSX180
  partition and execute it.


04/04/20

- Got the CF bootloader for the Z280RC board running. The system image is
  loaded starting from physical address zero, and can be up to 512K in size.
  That's more than enough since, unless you have a large number of tasks
  fixed in memory, the system image file will be smaller than 96K.

- Ported the system debugger to the Z280.

- Ported the system MMU initialization routine. System size will be limited
  at the moment to 1Mbyte (8-bit page numbers like in RSX180).

- The system now boots into the debugger, but (obviously) can't continue
  any further.


06/04/20

- More kernel modifications:
  * interrupt initialization and handling code.
  * task context switching: registers are now saved in the Task Context
    structure and not in task space like the Z180 version did; that's
    because the Z280 automatically switches stack upon entering a trap
    or an interrupt and therefore registers must be saved in system space.
  * new privileged and non-privileged task mapping code.

- Ported the device drivers:
  * DU: driver accesses the CF, partitions are fixed at the moment.
  * TT: driver supports only one terminal (Z280's built-in UART).
  * DY:, LP: and CT: drivers removed.


07/04/20

- Ported the loader task (just to take advantage of the more efficient Z280
  instruction set, for the rest it is still the same), but since the kernel
  $SWSTK routine is not ported yet the loader will not be operational.

- More kernel modifications:
  * timer interrupt is working.
  * task context switching seems to be equally working, the loader task
    starts, but generates an access violation trap when it tries to access
    the kernel database.
  * GTARGS and SVRSLT routines now get/save system call arguments from/to
    the task context register frame.
  * the system call trap routine seems to be working, but very likely
    several system functions will require modification.
  * privileged and non-privileged task mapping is working.

- The 'M' command of the built-in debugger now displays the MMU PDRs.

- The 'D' command of the built-in debugger now accepts an extra parameter
  (bank number), so task memory can be displayed in addition to system
  memory.


08/04/20

- The initialization task must switch to kernel mode before accessing the
  system database. That's irrelevant for RSX180, since the initialization
  task runs in the kernel partition, but on the Z280 that triggers an access
  violation trap.

- More kernel modifications:
  * new $SWSTK routine uses the syscall trap to switch to system mode.
  * new $MCOPY, $UGETx and $UPUTx routines.

- Debugging device drivers:
  * interrupts now reaching the driver code.
  * fork processing is working again.
  * fake a partition table for the DU: driver.

- The initialization task now runs, the banner message appears and the
  first MCR command is queued, but MCR gets aborted on startup.

- Added Z280-specific abort codes to TKTN.

- The Z280 is a really *great* CPU, but it's biggest annoyance is the
  I/O page selection/save/restore mechanism, as it wastes two registers
  and 3..4 instructions every time.


09/04/20

- More kernel modifications:
  * ported the AST routines.
  * DS1302 clock read/write routines.
  * added the extra Z280 abort codes to TKTN.
  * removed the "interrupt pool" from the old common area, since it is not
    needed on the Z280 (ITBs can be allocated from system core).

- Updated the Linux 'vol180' utility (the task context structure has
  changed). 

- The system now boots and works! (the port so far has been easier than 
  originally expected). Some utilities get aborted with a "Privileged
  instruction" message because they execute di/ei instructions in some
  parts of the code.


10/04/20

- SHUTUP: switch to system mode before halting the CPU to prevent the Z280
  privileged instruction trap from happening.

- The system has been working fully stable during the whole day. Getting
  ready for release on GitHub!


12/04/20

- DEVTT: do not call $UGET from the interrupt routine (e.g. via 'nextch'),
  since the $UGET and $UPUT routines change the user MMU pages and do not
  restore them. Instead, call $UGET from a fork process and use a separate
  queue to buffer the characters from user space for the transmitter
  interrupt routine.


14/04/20

- DEVTT bug fix: the wrong queue was used for the UART transmitter, and
  that caused the arrow keys not to work properly in e.g. MCE.


22/04/20

- More Z80 -> Z280 optimizations: clkq, connect, flags, session.


23/04/20

- vol180: don't allow duplicate directories.


26/04/20

- EXTSK: allow task size to reach 64K.

- MCR, VMR: use at least 5 digits to display task size in TAS command, else
  a size of 64K will be displayed as zero.

- MCR: the BRK command (break into the system debugger) is now working.


14/05/20

- DEVTT: adding support for Bill Shen's quad-serial port board (4 additional
  terminals).


15/05/20

- Kernel: enable trickle charge when setting the DS1302 clock.


18/05/20

- Kernel bug fix: aborting a task with outstanding file I/O could corrupt
  the STD (bug from conversion to Z280 instructions).


19/05/20

- RMD: fix uptime day display (Z280 conversion mistake).


24/05/20

- DEVTT: fixed a race condition in TT1..TT4 transmitter interrupt handling.
  Removed the software transmitter queue for TT1..TT4, since the OX16C954
  quad-UART chip has a hardware one.


10/01/21

- DEVTT: added codes for future control of serial comm parameters. Added
  a set of codes for standard baud rates from 50 to 115200 baud.


11/01/21

- DEVTT: the code that sets the baud rate for the quad-serial port is now
  in a separate routine, so it could be called by a SF.SMC QIO function.
  Also, the prescaler now divides the clock frequency by 2 and not by 4 so
  the rare 76800 baud rate could be supported.


15/01/21

- DEVTT: implemented TC.SPD subfunction of SF.SMC, the baud rates for the
  Z280 UART and quad-port now can be set via QIO call.


16/01/21

- Implemented the 'SET /SPEED' MCR command. Setting the baud rate works,
  but displaying the current speed value is not done yet.


31/01/21

- Optimized a bit the $MCOPY routine (note: beware of 'add hl,a', which
  sign-extends A).


07/02/21

- Added a new system call that allows a task to specify a Synchronous System
  Trap (SST) vector table. When a task causes a Z280 trap to happen, the
  corresponding SST routine is now called. The task is aborted only if the
  user did not specify a SST table, or if the table contained a null vector
  for the specific trap type.

- Kernel bug fix: inhibit user I/O instructions.

- The kernel now traps the privileged RETIL instruction, which can be used
  by a user task to enter single-step mode.

- Working on a task-level debugger, based on the standalone Debug280. The
  idea is to have an ODT-like object module that can be linked to the user
  application (simplifies the debugger core in comparison with a standalone
  task and reduces chances of LUN and memory-management conflicts):
  * MMU-related code removed, since the debugger is meant to run only
    in user space.
  * Z280 interrupt-trap vector table initialization replaced by a SST
    vector table.
  * removed the I/O port-related commands, since user tasks are not allowed
    to access them anyway.
  * do not reenter the debug_trap routine from debug mode to avoid thrashing
    user task registers (traps can happen in debug mode too, e.g. when using
    the Dump command to display memory outside the allocated task limits.)


08/02/21

- The ODT debugger is now usable. Added an example program to the 'test'
  directory showing how to use the debugger.


06/03/21

- TTDRV:
  * the quadser ports (TT1..TT4) no longer use an intermediate input queue;
    the input fork processing routine now accesses directly the UART hardware
    FIFO, which results in a lower interrupt latency.
  * the typeahead queue size was incremented to 128 (the UART FIFO size)
  With the above changes Kermit is able to transfer files at the maximum
  UART-supported speed (115200 baud) without dropping packets. The effective
  transfer speed, however, does not seem to increase that much compared to
  19200 baud, probably due to the Kermit packet processing overhead.

- Kermit: restore terminal mode (disable binary mode) on exit.


15/04/21

- Supporting 12-bit page numbers:
  * bank numbers are now passed to $MCOPY, $UGETB, $UGETW, $UPUTB and $UPUTW
    routines in register pairs.
  * memory partition allocation routines now treat P.BASE and P.SIZE as 16-bit
    values (12 bits used by the Z280).
  * modified the drivers and relevant privileged tasks.
  * MCR now displays 24-bit addresses in ATL, TAL and PAR commands.
  * VMR now displays 24-bit addresses in PAR command.


25/04/21

- Supporting 12-bit page numbers:
  * VMR now uses 12-bit page numbers when creating partitions and loading
    tasks.


01/05/21

- ICP, RMD: use full 12-bit page numbers.


22/05/21

- MCR: the SET /SPEED=ttn: command now displays the current terminal speed.

- VMR: implemented the SET /SPEED command, so the default speed could be
  set for each terminal.


21/12/21

- ODT: the G command now accepts a break address as second argument.


22/12/21

- ODT: align neatly the output of the D command when address is not a
  multiple of 16 (borrowing code from Tony Nicholson's CP/M emulator).


05/10/21

- Kernel: fixed a bug in the MMUINI routine: must divide PDR by 16 and not
  by 4 in order to obtain page address (case of MMU in system mode).


06/11/22

- Kernel: the Z280 doesn't seem to care for the unused address bits in the
  SAL, SAH, DAL and DAH registers, so we're not forcing them to 1 (neither
  does the CPU280 ROM code, and the Z280 docs are not entirely clear about
  this.)


08/11/22

- Kernel: fixed another bug in the MMUINI routine: the low nibble of the
  physical address in the PDR was being cleared by mistake.


10/11/22

- Porting the system to the CPU280 platform:
  * writing a floppy boot loader.
  * porting the terminal device driver: only two terminals supported (TT0:
    on the Z280 internal UART, TT1: on the on-board 81C17.)
  * porting the floppy device driver: the CPU280 supports up to 4 floppies,
    at this point only 3.5" HD floppies are supported.


11/11/22

- CPU280 port:
  * modified the main Makefile so the target platform could be selected,
    as well as system image name and size, etc. (done via a simple makefile
    include file that sets the appropriate variables.)
  * got the floppy bootloader working, but requires launching it from CP/M
    until the CPU280 ROM is modified to support booting non-CP/M disks.
  * wrote a simple CP/M application to boot RSX280 floppies.
  * writing CPU280 kernel system-dependent routines (mainly to read the
    RTC clock and any relevant NVRAM data such as CPU freq. and mem size.)


12/11/22

- CPU280 port:
  * using DMA3 for memory-to-memory copy ($MCOPY routine), as the RDY signal
    of the DMA2 is not asserted by default on the CPU280.
  * DMA3 in continuous mode may interfere with floppy DMA transfers even
    when the DMA0 used by the floppy driver has higher priority, as in
    the Z280 a higher-priority DMA request cannot preempt a lower-priority
    one that is in progress.
  * got the terminal driver working.


13/11/22

- Kernel monitor/debugger:
  * the 'I' and 'O' commands now take a 'W' (word) modifier (e.g. 'IW40').
    Before, the word modifier had to be passed as a non-zero 3rd parameter
    for the 'I' command, and for the 'O' it was simply not supported.
  * the 'E' command now accepts a bank number as a second parameter.


14/11/22

- CPU280 port:
  * first working version of the floppy disk driver, the system boots and
    runs as expected! but the driver still needs polishing.
  * the floppy driver now displays a small light pattern using the on-board
    LEDs to show it's alive.


15/11/22

- CPU280 port, floppy driver:
  * in case of errors, the I/O operation is retried up to 5 times.
  * new wait-for-interrupt routines yields control back to system (and
    other tasks) until an interrupt or timeout happens, then continues
    I/O processing via fork block.


17/11/22

- CPU280 port:
  * $MCOPY now uses DMA3 in single-transaction mode, else a background
    floppy disk I/O operation will fail with a DMA Overrun Error if a
    memory-to-memory operation is in progress; the downside being slower
    memory-to-memory transfers.

- Kernel, CHKWD routine: save/restore I/O page before calling the device
  timeout entry point.


26/11/22

- CPU280 port: certain device-driver-related problems remain:
  * TT1 interrupts (Rx or Tx) causes disk I/O to fail often with a 'DMA
    overrun' error. TT0 interrupts do not seem to affect disk data transfers.
    The problem is observed mostly when running DMP (which uses asynchronous
    double-buffered I/O) on TT1, but also when running tasks simultaneously
    on TT0 and TT1 that access the disk. Switching FDC I/O waiting code from
    fork-process-driven to static wait loops (but interrupt-flag-driven)
    seems to fix the problem at the cost of degraded system performance.
    Thus, a device driver bug or even a kernel problem is not excluded.
  * TT0 Rx interrupts randomly affect TT1 Tx operation, causing the terminal
    driver to end prematurely an output operation for no apparent reason,
    with characters still waiting in the output buffer. Disabling the CPU
    cache fixed the problem (?).


20/01/23

- Kernel: abort task if AST or SST stack frame is outside task limits.


05/02/23

- Working on a debugger that could be attached to an external task, and
  easier to use than ODT, which requires linking to the task to debug:
  * the debugger is a privileged task, since it needs to gain access to
    the task's register frame and task's address space (thus, potentially
    less safe than ODT.)
  * non-privileged users are allowed to debug only non-privileged tasks
    started from their own terminal.


06/02/23

- Added TX.XDT field to the Task Context Block. The TX.XDT is a pointer
  to an allocated memory block containing further debugger-related
  parameters, such as the TCB address of the debugger, event flag number
  to set on debugger events, etc.


07/02/23

- Kernel: added TS.BPT (breakpoint stop) task status bit. When set, the
  task will be blocked from execution (not even ASTs will be dispatched)
  so the debugger could safely examine task registers, memory, etc.


08/02/23

- Kernel: task exceptions now block the task if it is attached to a
  debugger, and informs the debugger about the exception cause.

- The debbugger can now succesfully connect to a task, examine memory
  and registers, and single-step through code.


10/02/23

- Debugger: ^C now breaks the execution of a running task.


11/02/23

- Debugger:
  * changed the main command line syntax:
      DDT>connect tsknam  <- connect to a running task and enter debug session
      DDT>run tsknam      <- run task in debug mode
      DDT>terminal ttn:   <- set the debug console to another terminal
    the commands can be abreviated to the first non-ambiguous char seq ('c',
    'r' and 't' in this case); only the 'connect' command is implemented at
    this point.
  * added 'I' (info) debug command that displays debugged task status similar
    to the MCR ATL command.
  * moved debug connect, disconnect, break and resume routines to the kernel
    API (disconnect and break were already duplicated there; being part of
    the kernel core also guarantees atomic execution.)

- Kernel:
  * if the debuger is aborted or unexpectedly exits, break links and resume
    execution of the debugged task.
  * likewise, if the debugged tasks aborts, break links and notify the
    debugger.


12/02/23

- Kernel, $DBNOT: if the debugger is checkpointed, queue special AST to
  delay storing debug event status until the deugger returns to memory
  (part of the SENDST routine is reused because of operation similarity.)

- Debugger:
  * if the task to debug is out of memory (checkpointed or just requested),
    wait for the task to be (re)loaded before starting the debugging session.
  * the 'Q' (quit) command now takes an optional 'A' argument to abort the
    debugged task when exiting the debugging session; without the option,
    the debugged task will resume normal execution.


18/02/23

- Debugger:
  * the 'run' command now loads a task image file (into an external,
    separate partition as before) for debugging if the name specified
    in the command line does not corresponds to an installed task.
  * implemented the 'terminal' command; now a task started via the 'run'
    command can be debugged from another terminal, avoiding I/O conflicts.


19/02/23

- The debugger is already usable, but the following restrictions must be
  observed:
  * debugging of privileged tasks can lead to system deadlocks, e.g. when
    single-stepping into code that disables task dispatching (this applies
    to ODT too.)
  * debugging tasks that specify an SST vector table (e.g. tasks linked to
    ODT) may cause the task to enter an infinite loop when certain Z280
    exceptions (such as single-step) are triggered.
  * the 'run' command doesn't accept yet a command line tail for the task
    being debugged.


26/02/23

- Kernel: removed the unused XD.AST parameter from the debugger data block
  (debug event ASTs are global and specified via .ASTDF)

- DDT: ^C now interrupts a long Tnnnn trace command.


