Commit Graph

192 Commits

Author SHA1 Message Date
Seth Morabito 0c026e38dd By default, do not halt on BRK (#14)
This change introduces a new command line flag, '-b', that cause the
simulator to halt on the `BRK` instruction. By default, however, the
simulator will no longer halt on `BRK`.

As before, this behavior can be toggled in the preferences at run-time.
2023-11-10 09:11:24 -08:00
Seth Morabito 5e56627f32 #13: Move cursor backward on ASCII Backspace 2023-10-31 08:28:26 -07:00
Chelsea Wilkinson 67f5e17f78 Added BenEaterMachine 2023-10-31 07:44:55 -07:00
Tim Allen 4423623816 Writing 0 to the 6551 ACIA's control register is not a program reset.
So far as I can tell, ever since the first version of the ACIA emulation in
Symon, writing 0x00 to the control register has been interpreted as a request
to reset, rather than to actually set the control register to 0x00. This is
strange for a number of reasons:

- All-zeros is actually a very sensible value for the control register, and
  is in fact the hardware-reset default.
- I can't find any description of such behaviour in the 6551, W65C51S, or
  W65C51N data sheets.
- The 6551 already has a way to trigger "program reset" by writing to the
  status register.

So I've removed that quirk, and writing to the control register now just
writes to the control register and nothing else.
2023-06-11 08:21:37 -07:00
Tim Allen 5df775bbb0 Make the emulated 6551's soft ("program") reset state match the MOS datasheet.
The only description of the effects of "program reset" in the original MOS
datasheet is in the section for each register. The W65C51S and W65C51N
datasheets have a heading "PROGRAM RESET OPERATION", but it amounts to:

- internal registers are modified as described in the section for each register
- changes to the DTR, DCD, and DSR pins which Symon does not emulate
- the overrun flag is cleared

...which is what this new implementation does.

It would make *sense* for the reset to do things like "cancel transmission or
reception in progress" and stop asserting an interrupt, as the old code did,
but I can't find any evidence of such behaviour in the datasheets.
2023-06-11 08:21:37 -07:00
Tim Allen d076046f57 Make the emulated 6551's hardware reset state match the MOS datasheet. 2023-06-11 08:21:37 -07:00
Tim Allen b725fb5fdd Fix comment: The 6551 baud rate is in the lower *four* bits.
The code is correct, the comment is wrong.
2023-06-10 10:19:24 -07:00
Tim Allen 9351d785ae Fix comment: The 6551 ACIA *does* support interrupts. 2023-06-10 10:19:24 -07:00
Tim Allen 66a92f4196 Use ACIA register names where we can. 2023-06-10 10:19:24 -07:00
Tim Allen b5a470d3ba Make the Processor Status register match a real 6502 at power-on.
When describing the CPU's reset pin, the W65C02S data sheet says:

> All Registers are initialized by software except the Decimal and Interrupt
> disable mode select bits of the Processor Status Register (P) are initialized
> by hardware.

It then has a diagram of the power-on state of the processor status register:

>     7 6 5 4 3 2 1 0
>     * * 1 1 0 1 * *
>     N V - B D I Z C
>
> * = software initialized

Confusingly the text indicates that only the D and I flags are initialised by
hardware, while the diagram indicates that the B flag is initialised too.

Meanwhile, https://www.nesdev.org/wiki/CPU_power_up_state says that
the power-on state of the NES CPU is $34 (exactly matching the diagram above)
but https://www.nesdev.org/wiki/Status_flags#The_B_flag says that the B flag
does not physically exist within P register, it's only relevant in the copy
of P that gets pushed to the stack by BRK (set), PHP (set), or an interrupt
signal (cleared).

As a result, the most sensible power-on state for the processor status register
is with the "interrupt disable" flag set and everything else cleared.
2023-02-03 18:16:57 +11:00
Seth Morabito e210a40639 Use correct Mockito package 2023-01-12 16:56:28 -08:00
Seth Morabito 0bad9912ce Repaint Video window at 30fps
A bug caused the video window to repaint only when the cursor was
blinking. This meant that if the cursor was disabled, the window would
never update!

This change removes the repaint logic from the cursor blinking timer,
and instead puts it into its own periodic timer callback that runs
independently of cursor blink.
2023-01-11 13:31:22 -08:00
Seth Morabito b36b442b14 Cleanup some IntelliJ IDEA warnings
Cleaning up some warnings for the first time in many eons.
2022-12-15 09:44:53 -08:00
Seth Morabito 087ba28b82 Force metal look-and-feel
* On Linux GTK+, the small text fields in the Status Panel displayed a
  large inner margin, cutting off text. This change forces Java to use the
  Metal look-and-feel for these fields, which forces no default inner
  margin.
2020-09-01 10:48:17 -07:00
Seth Morabito 0aeb97bb56 Add new options -cpu and -rom 2019-10-12 14:54:05 -07:00
Seth Morabito 73c474d606 POM cleanup 2018-02-04 11:49:26 -08:00
ccureau cb918c9906 Remove unnecessary package-info files 2017-08-30 10:40:45 -05:00
ccureau be72c2ff09 implement jterminal in source 2017-08-30 10:34:50 -05:00
ccureau 18ce120984 Add jterminal to source 2017-08-30 09:23:59 -05:00
Matt Harlum 441f7349a0 Fix PHY/PLY Addressing mode 2017-06-19 11:49:46 +10:00
Matt Harlum 11f61f50a9 Add cycle counts for illegal NMOS opcodes 2017-06-07 12:20:21 +10:00
Matt Harlum a9c6d5964f * Add Support for All 65C02 Opcodes and all Rockwell/WDC opcodes except WAI/STP
* Add 65C02 Opcode tests
* All tests pass, Klaus' 6502_functional_tests pass & Klaus' 65C02_extended_opcodes_test also all pass
2017-06-06 19:59:01 +10:00
Matt Harlum faf5d22660 * Add ACIA Interrupt tests.
* Fix ACIA6850 Interrupt behavior, Interrupt should be cleared on status register read.
* Remove unneeded cpuAccess if statement from Acia6850 write that was preventing build completion
* Fix ACIA6850 Tests so they run.
2017-06-06 12:55:35 +10:00
Izuan Nazrin 92f8fe3dd9 Fixed 6850 behaviour
+ Fixed interrupt bit reset behaviour
2017-05-30 01:33:12 +08:00
Izuan Nazrin 356822df71 Fixed typo
+ Fixed typo in Acia.java statusReg declaration
2017-05-30 01:14:50 +08:00
Izuan Nazrin f2ced29979 Added interrupt support for ACIA
+ Added interrupt support for ACIA
+ Auto-formatting (in case anyone cares)
2017-05-29 02:03:18 +08:00
Matt Harlum 96819f1bf7 Issue #16: Memory window should not reset device registers 2017-05-26 17:01:41 +10:00
Seth Morabito 5a2e057e69 Minor whitespace cleanup 2016-06-11 11:46:31 -07:00
Seth Morabito da88aadda2 Merge pull request #15 from LIV2/master
Correct BRK/IRQ behavior
2016-03-20 11:43:42 -07:00
Matt Harlum 657b69da6c Cleanup my comments 2016-03-20 17:05:48 +11:00
Seth Morabito eff98118d5 Fix a few straggling Java 8-isms. 2016-01-08 20:40:23 -08:00
Seth Morabito 66c52c8826 Revert Java 1.8 changes. Buildable with Java 1.7
There are still active users on Java 1.7, so building with Java 8
was a no-no. This change reverts the recent migration to Java 8,
allowing JDK 1.7 to compile the code.

This means, at least for the time being, no more Lambda expressions
(Boooooooooooooooo!!)
2016-01-08 19:11:42 -08:00
Seth Morabito 634ea933f1 Add disassembled instructions to breakpoints 2016-01-02 19:05:38 -08:00
Seth Morabito 3530e9e99a Enter key can add breakpoints 2016-01-02 09:40:34 -08:00
Seth Morabito df88c54f90 Support for breakpoints
- Adds a new window that allows adding and deleting breakpoints.
  Will halt the simulator when a breakpoint is reached.
2015-12-31 16:09:50 -08:00
Seth Morabito 6267d1d777 Allow runtime selection of CPU speed 2015-12-30 10:56:03 -08:00
Seth Morabito 84e5c5ad56 Refactor delay loop 2015-12-30 10:08:44 -08:00
Seth Morabito 6e8fd40014 Refactor for Java 1.8
- Clean up and refactor code

- Add 1.8 features

- Clean up IntelliJ inspector warnings
2015-12-29 17:55:41 -08:00
Seth Morabito a4a110dcef Bugfixes, change logger, update copyright
- IR field in status panel now correctly displays the next instruction
  to be executed, instead of the instruction that was just executed.

- Switched from built-in Java util logger to Logback

- Updated all copyright strings to 2016
2015-12-29 14:40:42 -08:00
Matt Harlum 8335cf5421 Correct BRK behaviour
IRQ/NMI clear the BRK flag
BRK is Non-Maskable
2015-06-01 08:58:17 +10:00
Maik Merten 72ba068beb mask all bits beyond bits 0 to 7 on bus reads to ensure no surplus bits cause unpredictable system behavior. 2014-08-23 16:50:34 +02:00
Seth Morabito 4796b65390 New ROMs. Better backspace handling. 2014-08-16 14:28:54 -07:00
Seth Morabito e0d6017d95 Unifying and cleaning up copyrights 2014-08-16 13:50:47 -07:00
Maik Merten e9f662cc17 Merge remote-tracking branch 'upstream/master'
Conflicts:
	src/main/java/com/loomcom/symon/machines/MulticompMachine.java
2014-08-15 20:11:33 +02:00
Seth Morabito f35fbce38b Add CRTC EhBASIC, switch char rom. 2014-08-14 11:50:51 -07:00
Seth Morabito eeb246ebc2 CRTC refactoring 2014-08-14 10:53:48 -07:00
Seth Morabito e157217f50 Fix missing repaint on Video Window 2014-08-13 15:46:20 -07:00
Maik Merten cc12e8f70a proper status value when SD controller is in write mode 2014-08-13 19:56:40 +02:00
Maik Merten a9a1c1aa52 get writing to a certain position in a file somewhat more correct 2014-08-13 19:38:54 +02:00
Seth Morabito 742e3a1027 Split PIA into PIA/VIA6522 2014-08-12 15:06:08 -07:00