Commit graph

236 commits

Author SHA1 Message Date
JetSetIlly
71ab13dbf0 fixed CPU functional test package
also removed 6507_functional_test build tag from the package. the
original idea was to exclude the package because it took relatively
longer than other tests but it is now considerably faster. the speed
comes from not recording the execution history, which is only needed if
the functional test fails for some reason. if the test does fail, then
the test is run again with history recording enabled

added ExpectApproximate() function to test package

the test harness can also create a pprof if required
2024-11-23 14:56:37 +00:00
JetSetIlly
393904abcb simplification of the memory sub-system
- preparation for adding 7800 emulation

cpu (6507) package uncoupled from upstream dependencies

- cpu no longer logs execution of KIL instruction
- randomisation of registers on startup can be handled by the called of
  the cpu's Reset() function
- address errors are filtered by an optional IsAddressError() function
  in the Memory interface implementation
- Error field removed from execution.Result type

all references to interface{} replaced with any
2024-11-23 14:56:37 +00:00
JetSetIlly
f66d020907 added lint target to Makefile
checks that linters exist before proceeding. project URL for each linter
in the Makefile comments

only go-errorlint and unconvert used at the moment

fixed all lint errors for the added linters
2024-11-23 14:56:36 +00:00
JetSetIlly
a196b21a93 logging functions called with real env instances from the hardware package
logger package will no longer create new log entires for environments
other than the main emulation (or the logging.Always shim)
2024-04-30 17:48:46 +01:00
JetSetIlly
cd2a00d4ba logger.Log() and logger.Logf() now require a logger.Permission instance
the logger.Permission interface indicates whether the environment making
the logging request is allowed to create new log entries. the
environment.Environment type satisifies the Permission interface

logger.Allow is provided as a convienient way of indicating the the log
entry should always be created
2024-04-30 11:23:40 +01:00
JetSetIlly
07e3b95f6e cycle ordering was broken the JSR instruction
bug introduced in db2d84c39, which would have first appeared in release
v0.27.0

this subtle bug broke the alignment of the ball and missile in the worm
whomper demo (by Manuel Rotschkar)

this fix adds the cycle boundary after the lo-byte read of the
destination address
2024-03-13 14:16:32 +00:00
JetSetIlly
de8da98f61 CPU in KIL start now ticks the TIA and RIOT by one cycle 2024-02-22 18:20:01 +00:00
JetSetIlly
8bb94f9654 nil protection on disassembly definition 2024-01-16 10:54:54 +00:00
JetSetIlly
0e6b1adc2a corrected bus sequence for RTS and JSR instructions 2023-11-26 14:47:41 +00:00
JetSetIlly
db2d84c397 corrected placement of cycle callback in JSR instruction
there is a JSR cycle that does not affect the bus. I now believe that it
is related to the loading of the new program counter value
2023-11-06 20:46:22 +00:00
JetSetIlly
eb09909e78 added CPU interface to TIA package
the TIA only needs to set the RDY flag. using an interface like this is
a better way of achieving that
2023-07-17 15:50:06 +01:00
JetSetIlly
732c433cd2 tidied and simplified test package 2023-07-06 13:49:18 +01:00
JetSetIlly
1ad07dc020 environment correctly propogated after Plumb() event
AudioTick() function in tracker interface accepts TrackerEnvironment
instance. tracker implementation differentiates emulation instances and
records AudioTick() information accordingly
2023-04-17 17:07:03 +01:00
JetSetIlly
6c3035e143 renamed hardware/instance package to environment 2023-04-16 21:24:09 +01:00
JetSetIlly
290b2c8500 removed read8BitZeroPage() from cpu implementation
this was a leftover from previous implementation of the memory system.
it's no longer required
2023-02-18 08:01:16 +00:00
JetSetIlly
057dddb020 added Klaus Dormann's "functional tests" for the 6502
the bugs fixed as a result of testing:

* 6502 stack now is hardcoded to sit between 0x0100 and 0x01ff
    - new StackPointer type (instead of a plain Register type) handles
      the addressing of the stack through the Address() function
    - the VCS memory subsystem already masked the address bus correctly

* status register BRK flag always set regardless of Load() value
    - this means that popping the status register from the stack will
      reset the BRK flag correctly

ROMVectors test is disabled

build tag of "6507_functional_test" required for new tests (because test
is slow and we don't need to run it on a regular basis)
2023-02-15 19:54:44 +00:00
JetSetIlly
3aa5885ebe removed curated pacakge. replaced with wrapped errors
curated package predated the standard errors package introduced in
go1.13

the standard package does a better job of what curated attempted to do

the change of package also gave me a opportunity to clean up the error
messages a little bit
2023-02-13 21:58:39 +00:00
JetSetIlly
178f05f17b updated go minimum version to 1.20
applied gofmt to source tree to update the documentation comments
2023-02-12 13:09:07 +00:00
JetSetIlly
2e71730f36 PredictRTS() in CPU uses Peek() instead of Read()
Read() had the effect of updating debugging information that should
only be related to the execution of the ROM
2022-09-25 10:31:42 +01:00
JetSetIlly
20e6c00c1c fixed small typo in 6507 debugging output 2022-07-16 09:08:49 +01:00
JetSetIlly
a5468fc215 simplified CPU cycleCallback function. removed nil check 2022-05-23 14:29:33 +01:00
JetSetIlly
618e239bf6 operator field in instructions.Definition is now numeric
this significantly increases the speed of lookup in the cpu
2022-05-22 20:52:54 +01:00
JetSetIlly
0b1a883984 RAM window indicates whether address has a symbol
applies to Cart RAM window too

VCS RAM window shows extent of stack. tooltip shows predicted address in
event of RTS

DrawByteGrid() function is more flexible. old method is available as
DrawByteGridSimple()
2022-04-23 15:59:47 +01:00
JetSetIlly
eac90734c6 basic comment highlighting in CoProc source window 2022-04-01 18:43:38 +01:00
JetSetIlly
f5ff6f4f26 implemented all remaining 6507 instructions 2022-03-30 08:30:51 +01:00
JetSetIlly
21a9540753 added NOP opcode 0x34 2022-02-20 16:35:13 +00:00
JetSetIlly
43af2704e6 complete changes made in e01fd1ec
checking of operators for a match were trying to match uppercase
mnemonics and not the lower case we've changed to. visible in incomplete
disassemblies - not see "jmp" or "jsr" correctly
2022-02-18 10:12:07 +00:00
JetSetIlly
e01fd1ec4c 6507 instructions lowercase. undocumented instructions uppercase
this is the opposite as it was previously
2022-02-17 15:37:03 +00:00
JetSetIlly
6311063b89 random package can produce numbers faster for the running emulation 2022-01-19 22:31:50 +00:00
JetSetIlly
e44107ce91 added Cycles type for hardware.CPU package
moved DefnCycles from disassembly.Entry to instructions.Cycles type.
and now created during generation of instructions table. it makes more
sense to have the formatted string nearer the source of definition and
simplifies the disassembly.Entry type.
2022-01-16 19:42:56 +00:00
JetSetIlly
f2fb0091e7 simplified/clarified memory interface
addresses and bus interface removed and split into cpubus and chipbus
packages.

ReadZeroPage() no longer has any distinction from normal Read()
function.
2021-12-26 19:00:11 +00:00
JetSetIlly
305ac7c4b3 phantom memory access correctly noted
the change in commit 656c42bb2c seems to
have been incomplete
2021-12-26 18:06:12 +00:00
JetSetIlly
f9095714c1 fixed https://github.com/JetSetIlly/Gopher2600/issues/16
INPTx data mask was wrong. bit 6 is now "driven"

ZeroPageIndexedX and ZeroPageIndexedY did not cause a phatom read as
they should. cycles were accumulated correctly but no phantom read - I
missed this when adding the phantom reads to the CPU
2021-12-19 08:55:33 +00:00
JetSetIlly
e0d4c7cb7b added random package. random numbers "accessed" via instance package 2021-12-05 20:17:43 +00:00
JetSetIlly
085adf5159 added hardware/instance package 2021-12-05 20:17:43 +00:00
JetSetIlly
1ae6aff543 fixed crash caused when cartridge was changed mid CPU instruction
resetting the CPU when a new cartridge was inserted left the Defn field
of the LastResult type in a nil state. the CPU now checks for nil and
returns a sentinal error. error is caught in Start() function and
discarded
2021-11-15 22:33:08 +00:00
JetSetIlly
f44707057b counting for the timeline removed from reflection package
new counter package added (sub-package of reflection)

this new counting method is fast enough to be run while in playmode,
which means that historical timeline information is immediately
available in the debugger
2021-11-13 10:21:45 +00:00
JetSetIlly
656c42bb2c CPU notes phantom memory access. watches and traps ingore phantom accesss 2021-11-07 21:54:04 +00:00
JetSetIlly
31138f16f3 removed InstructionBoundary() interface and television.ReqState()
Instruction boundaries can be inferred by the debugging input loop,
which is the only place it is requred. reworked GetAdjustedCoords() in
the televsion package (now called AdjCoords()) to cope with this.

ReqState() is totally replaced by GetCoords()
2021-10-23 10:50:19 +01:00
JetSetIlly
64ab9e0be5 trying to record rewind state would panic on legitimate CPU error
legitimate errors include reading cartridge address with no cartridge
inserted. rewind will now check for CPU/Result state before logging and
returning before any recording has taken place

BRK instruction consumes two bytes but records only one. when
video-stepping over a BRK instruction this caused an error because the
adjustment to the number of bytes read value was done too late
2021-10-20 14:57:13 +01:00
JetSetIlly
82ed2b5429 CPU: simplified how cycleCallback function called 2021-06-09 20:01:39 +01:00
JetSetIlly
f09e444a2a 6507: added opcode 0x3f (absolute index x RLA) 2021-06-02 14:07:09 +01:00
JetSetIlly
ed175087f8 regenerated inststructions table 2021-04-02 20:41:45 +01:00
JetSetIlly
d42120f12d added OSD and controls to Movie Cart 2021-04-02 13:00:07 +01:00
JetSetIlly
f406736e80 implemented Movie Cart
added SLO (0x1b) opcode
2021-04-01 01:12:28 +01:00
JetSetIlly
36e7c3bd61 first pass at deep-poking
implemented deep-poking of playfield values. there may be pathological
instances where this does not work. not all addressing modes have been
added to the deep-poke function.

to be clear, non-playfield graphic elements (player, missile, ball) have
not had this feature added yet.

will probably also require some way of feeding back information, making
it clear what has actually happened or actually changed. changing of an
immediate value should probably trigger a redisassembly.
2021-03-23 11:27:28 +00:00
JetSetIlly
705da4252e STEP command now supports stepping backwards
limitation for the time being on stepping back by color clock

removed ability to step by the more obscure trap targets (registers
etc.)
2021-03-05 13:09:37 +00:00
JetSetIlly
e1ed563ea9 overlay selection is now in a popup
added colour key. potential for much more information.
2021-02-26 14:22:19 +00:00
JetSetIlly
d6463e0dae lint errors 2021-02-24 06:59:30 +00:00
JetSetIlly
2b7b8d1eca reworked linter package
added IterateBlessed() function for Disassembly type. more convenient
method of outputting disassembly to a string.

instruction defintion notes whether opcode is undocumented

linter flags use of undocumented opcodes

renamed DISASSEMBLY command to DISASM

added single address disassembly to DISASM command
2021-02-08 19:16:51 +00:00