TMF Hg

fixed timing on OSes that set a minimum time for sleeps (previously the main loop code assumed no minimum sleep time; the new version uses longer sleeps less frequently) default tip

  • Sat, 19 Apr 2014 02:19:39 -0600
  • by andrew@localhost [Sat, 19 Apr 2014 02:19:39 -0600] rev 152
  • fixed timing on OSes that set a minimum time for sleeps (previously the main loop code assumed no minimum sleep time; the new version uses longer sleeps less frequently)

added RTC emulation (attempts to set the date are ignored, and the year is currently hardcoded to 1987 because UNIX PC SysV has a few Y2K bugs)

  • Fri, 18 Apr 2014 01:34:20 -0600
  • by andrew@localhost [Fri, 18 Apr 2014 01:34:20 -0600] rev 151
  • added RTC emulation (attempts to set the date are ignored, and the year is currently hardcoded to 1987 because UNIX PC SysV has a few Y2K bugs)

treat all DMA reads/writes as kernel mode (previously it would depend on whether the processor happens to be in user mode or kernel mode when the DMA completes, which is totally incorrect); handle 32-bit accesses that straddle page boundaries properly (all 32-bit accesses are now split into two 16-bit accesses); allow reads to the entire zero page, rather than just address 0

  • Fri, 18 Apr 2014 01:26:01 -0600
  • by andrew@localhost [Fri, 18 Apr 2014 01:26:01 -0600] rev 150
  • treat all DMA reads/writes as kernel mode (previously it would depend on whether the processor happens to be in user mode or kernel mode when the DMA completes, which is totally incorrect); handle 32-bit accesses that straddle page boundaries properly (all 32-bit accesses are now split into two 16-bit accesses); allow reads to the entire zero page, rather than just address 0

disabled seek delay on WD2010 (Unix seems to work fine without it)

  • Thu, 17 Apr 2014 01:58:05 -0600
  • by andrew@localhost [Thu, 17 Apr 2014 01:58:05 -0600] rev 149
  • disabled seek delay on WD2010 (Unix seems to work fine without it)

ignore out-of-range addresses on low-level format commands (s4diag formats once sector past the end of each track)

  • Thu, 17 Apr 2014 01:50:41 -0600
  • by andrew@localhost [Thu, 17 Apr 2014 01:50:41 -0600] rev 148
  • ignore out-of-range addresses on low-level format commands (s4diag formats once sector past the end of each track)

fixed bus error handling for real this time (save registers before every instruction and push the saved registers if a bus error occurs, since the instruction may have changed registers before the bus error, and also stop the instruction immediately with longjmp so it won't change memory after the bus error)

  • Wed, 16 Apr 2014 02:20:43 -0600
  • by andrew@localhost [Wed, 16 Apr 2014 02:20:43 -0600] rev 147
  • fixed bus error handling for real this time (save registers before every instruction and push the saved registers if a bus error occurs, since the instruction may have changed registers before the bus error, and also stop the instruction immediately with longjmp so it won't change memory after the bus error)

    This isn't actually what a real 68k does, but it is a good enough approximation. A real 68k will jump back into the middle of the faulted instruction and resume it from the memory access that faulted as opposed to restarting from the beginning like this CPU emulation does. It would be a lot harder to do that with the way this CPU library is designed. Newer versions of MESS basically do the same thing (they use a newer version of this library).

added keyboard mappings for ENTER, CANCL, and EXIT

  • Wed, 16 Apr 2014 02:07:24 -0600
  • by andrew@localhost [Wed, 16 Apr 2014 02:07:24 -0600] rev 146
  • added keyboard mappings for ENTER, CANCL, and EXIT

Code clean up experimental_memory_mapper_v2

  • Tue, 21 May 2013 22:48:32 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 21 May 2013 22:48:32 +0100] rev 145
  • Code clean up

    * Tighten optimisation and warning options to find more potential issues
    * Remove unused variable in keyboard code
    * Display error message if ROMs fail to load
    * Fix format string bugs in WD2010

Don't set PS1 if there is a level-7 interrupt or bus error experimental_memory_mapper_v2

  • Fri, 12 Apr 2013 16:26:25 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 12 Apr 2013 16:26:25 +0100] rev 144
  • Don't set PS1 if there is a level-7 interrupt or bus error

    PS1 should only be set if the page was originally present (PS1 or PS0 set). If
    PS0 and PS1 are clear (page not present) then do NOT set PS1.

    Once again the TRM is blatantly and spectacularly wrong...

Flush stderr after printing debug messages experimental_memory_mapper_v2

  • Fri, 12 Apr 2013 12:37:34 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 12 Apr 2013 12:37:34 +0100] rev 143
  • Flush stderr after printing debug messages

Make the page table volatile (it may change behind gcc's back) experimental_memory_mapper_v2

  • Fri, 12 Apr 2013 12:37:13 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 12 Apr 2013 12:37:13 +0100] rev 142
  • Make the page table volatile (it may change behind gcc's back)

Make mapper debug logic more verbose (but disable by default) experimental_memory_mapper_v2

  • Fri, 12 Apr 2013 12:36:28 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 12 Apr 2013 12:36:28 +0100] rev 141
  • Make mapper debug logic more verbose (but disable by default)

Fix read-after-write logic experimental_memory_mapper_v2

  • Fri, 12 Apr 2013 12:34:32 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 12 Apr 2013 12:34:32 +0100] rev 140
  • Fix read-after-write logic

    In some cases (notably reading from a page after having written to it), the
    mapper may change the pagestate from "accessed and written" ("dirty"; PS0,PS1)
    to "accessed but not written" (clean; PS1,!PS0). This should never, ever, EVER
    happen. Once a page is dirty, it remains so until the 68k clears the DIRTY
    bit.

    Once again, this wonderful bit of logic was missing from the TRM.

Fix potential unassigned variable

  • Thu, 11 Apr 2013 09:37:25 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 11 Apr 2013 09:37:25 +0100] rev 139
  • Fix potential unassigned variable

Check return value of fread()

  • Thu, 11 Apr 2013 09:37:11 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 11 Apr 2013 09:37:11 +0100] rev 138
  • Check return value of fread()

Enable code optimisation to improve quality of GCC warnings

  • Thu, 11 Apr 2013 09:36:53 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 11 Apr 2013 09:36:53 +0100] rev 137
  • Enable code optimisation to improve quality of GCC warnings

Code cleanup

  • Thu, 11 Apr 2013 09:18:31 +0100
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 11 Apr 2013 09:18:31 +0100] rev 136
  • Code cleanup

    * Fix some compiler warnings --
    * string format
    * shift greater than type size,
    * unused variable.

merge changes from default experimental_memory_mapper_v2

  • Wed, 13 Mar 2013 01:10:34 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 13 Mar 2013 01:10:34 +0000] rev 135
  • merge changes from default

[wd2010,main] WD2010 disc geometry fixes

  • Wed, 13 Mar 2013 00:43:25 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 13 Mar 2013 00:43:25 +0000] rev 134
  • [wd2010,main] WD2010 disc geometry fixes

    I believe I have fixed the geometry problem with FreeBee. The geometry was set
    to 17 sectors per track instead of 16, which obviously throws off addressing.
    I changed it to use 16 sectors per track. However, s4diag tries to format
    sector 17, so I changed the WD2010 emulation to accept any address when
    formatting (since the format command doesn't actually do anything, it doesn't
    matter). It is now possible to format the hard disk, initialize the file
    system, and mount it. However, cpio still fails to copy the system to the hard
    disk.

    Author: Andrew Warkentin <andreww591 gmail com>

use MAP_ADDR_TO_PAGE for memory mapping experimental_memory_mapper_v2

  • Wed, 13 Mar 2013 00:40:42 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 13 Mar 2013 00:40:42 +0000] rev 133
  • use MAP_ADDR_TO_PAGE for memory mapping

merge in changes from default branch experimental_memory_mapper_v2

  • Fri, 18 Jan 2013 22:52:43 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 22:52:43 +0000] rev 132
  • merge in changes from default branch

add TODO

  • Fri, 18 Jan 2013 18:51:50 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 18:51:50 +0000] rev 131
  • add TODO

[wd2010] disable DMA pagefault workaround (no longer required)

  • Fri, 18 Jan 2013 17:20:07 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:20:07 +0000] rev 130
  • [wd2010] disable DMA pagefault workaround (no longer required)

[memory] Emulate main memory read wrap-around

  • Fri, 18 Jan 2013 17:18:50 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:18:50 +0000] rev 129
  • [memory] Emulate main memory read wrap-around

    3B1s with 512K or 1MB of base memory have a decoding quirk which causes reads
    to 'wrap around'. That is to say, on a 512K machine, reading from addresses 0,
    512K, 1024K or 1536K will address the same RAM byte. On a 1MB machine,
    addresses 0 and 1024K address the same RAM byte.

    Emulating this incorrectly causes P4TEST to report an incorrect amount of
    available base RAM.

experimental memory mapper, not quite working experimental_memory_mapper_v2

  • Fri, 18 Jan 2013 17:03:48 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:03:48 +0000] rev 128
  • experimental memory mapper, not quite working

fix default HDD sectors-per-track

  • Wed, 16 Jan 2013 00:41:51 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:41:51 +0000] rev 127
  • fix default HDD sectors-per-track

    The 64MB Micropolis drive we're trying to emulate in FreeBee has 17 sectors
    per track. Fix this in main.c to avoid tripping the sector range checks.

[wd2010] allow seek delay to be overridden at compile time

  • Wed, 16 Jan 2013 00:40:18 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:40:18 +0000] rev 126
  • [wd2010] allow seek delay to be overridden at compile time

[wd2010] properly constrain R/W ops based on end sector

  • Wed, 16 Jan 2013 00:38:13 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:38:13 +0000] rev 125
  • [wd2010] properly constrain R/W ops based on end sector

[wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

  • Wed, 16 Jan 2013 00:36:51 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:36:51 +0000] rev 124
  • [wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

[wd2010] fix confusing expressions used for multisector mode

  • Wed, 16 Jan 2013 00:35:10 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:35:10 +0000] rev 123
  • [wd2010] fix confusing expressions used for multisector mode

[wd2010] use size_t for init filesize, make disc init more verbose

  • Wed, 16 Jan 2013 00:34:11 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:34:11 +0000] rev 122
  • [wd2010] use size_t for init filesize, make disc init more verbose

Implement m68k_read_disassembler_* properly

  • Tue, 15 Jan 2013 17:02:56 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 15 Jan 2013 17:02:56 +0000] rev 121
  • Implement m68k_read_disassembler_* properly

    The previous implementations of m68k_read_disassembler are unsuitable due to
    interactions with the memory mapper. A read from memory by the DASM should not
    mutate system state.

    So we modify the m68k_read_disassembler_{8,16,32} functions to do the memory
    mapping themselves without causing page faults (bus error exception) or
    updating the page flag bits (which could really upset the kernel).

    Now all we need is a debugger/disassembler...

Max out system memory by default

  • Mon, 14 Jan 2013 09:50:37 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:50:37 +0000] rev 120
  • Max out system memory by default

    Set the system memory to 2MiB base, 2MiB ext. This is a fully loaded 3B1
    motherboard with a RAM expansion board. 512KiB base/no ext is the minimum
    which can be specified (e.g. kernel memory map area only) but does not leave
    any room for userspace. The kernel doesn't like that and doesn't handle it
    gracefully...!

Handle memory more gracefully

  • Mon, 14 Jan 2013 09:48:21 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:48:21 +0000] rev 119
  • Handle memory more gracefully

    Fixed in this cset:

    * Return an 'empty space' value if the memory wraps around

    * Allow the 'empty bus' value to be changed via an ifdef

    * Properly handle situations where expansion memory is turned off

More bus error fixes for FreeBee

  • Mon, 14 Jan 2013 09:22:12 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:22:12 +0000] rev 118
  • More bus error fixes for FreeBee

    I have fixed two more bus error handling bugs in FreeBee. First, the CPU core was executing the instruction regardless of whether a bus error occurs when fetching the opcode (which caused it to execute a bogus instruction in such cases). The other one was related to one of my previous fixes - the jump to the bus error vector was at the beginning of the main loop, so it wouldn't be called immediately after the bus error occurred if the timeslot expired, causing the return address to be off.

    With these fixes, Unix now runs enough to get into userspace and run the install script (it is also possible to break out and get a shell prompt). However, many commands segfault semi-randomly (or more specifically, it seems that some child processes forked by the shell might be segfaulting before they can exec the command program), so installing the system isn't possible yet. I am not sure exactly what the bug is, but it seems to be related to some function in the shell returning null when the code calling it is assuming that it won't. What the function is, or why it is returning null, I'm not sure (the shell is built without the shared libc and is stripped, making identifying the function harder). I suspect that the function might be in libc, but that is hard to tell.

    Author: Andrew Warkentin <andreww591 gmail com>

show LED state change only if SHOW_LEDS is defined

  • Tue, 20 Nov 2012 23:31:03 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 20 Nov 2012 23:31:03 +0000] rev 117
  • show LED state change only if SHOW_LEDS is defined

Add support for MSR2, partial reads from GENSTAT

  • Sat, 17 Nov 2012 22:26:53 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:26:53 +0000] rev 116
  • Add support for MSR2, partial reads from GENSTAT

    * GENSTAT is sometimes read in 8bit mode. Handle this properly.

    * Add support for the MSR2 register (additional HDD head select bit only at
    the moment)

wd2010: use LOGS when logging unformatted strings

  • Sat, 17 Nov 2012 22:15:23 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:15:23 +0000] rev 115
  • wd2010: use LOGS when logging unformatted strings

Fix bit masking logic in 'dead bus' return

  • Sat, 17 Nov 2012 22:14:09 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:14:09 +0000] rev 114
  • Fix bit masking logic in 'dead bus' return

    In some cases (e.g. 16bit reads) a bad 'idle bus' return may be provided.
    Promote the '1' to unsigned long prior to left-shifting it.

ACCESS_CHECK_RD should return the right number of bits!

  • Sat, 17 Nov 2012 21:28:48 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 21:28:48 +0000] rev 113
  • ACCESS_CHECK_RD should return the right number of bits!

    If the ACCESS_CHECK_RD() macro detects a page fault, it always returns a
    32-bit error response ("all bus pins high"). Musashi really doesn't like it
    when we pass in a 32-bit value when it expects a 16-bit one!