Skip to content

Commit

Permalink
default preferences values for disassembly and debugger
Browse files Browse the repository at this point in the history
supercharger tries to load BIOS before anything else meaning a quicker
failure if one is necessary

failed cartridge attachment will result in log entry rather than a
terminal error

loading cartridge without a coprocessor (ARM) when the Last Execution
window was open would cause a crash

added video link in readme
  • Loading branch information
JetSetIlly committed Jan 19, 2021
1 parent b9891dc commit 450f6ae
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ Below the menu-bar are the debugging windows. In this screenshot we can see:

Note that much of the information presented in the windows is editable in-place. For example, the contents of the CPU's PC register can be edited via the window. As in all areas of this project, the user is encouraged to experiment.

A video of the debugger in action can be found [here](https://www.youtube.com/watch?v=3vLyRw8iVCA).

#### Debugger Terminal

As an alternative to GUI interaction the debugger can also be controlled through a terminal. This is available through the `terminal` window. The rest of this section describes the operation of the terminal in detail.
Expand Down
4 changes: 2 additions & 2 deletions debugger/debugger.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ func (dbg *Debugger) attachCartridge(cartload cartridgeloader.Loader) error {
// reset of vcs is implied with attach cartridge
err = setup.AttachCartridge(dbg.VCS, cartload)
if err != nil && !curated.Has(err, cartridge.Ejected) {
dbg.printLine(terminal.StyleError, "%v", err)
logger.Log("attach", err.Error())

// an error has occured so attach the ejected cartridge
// an error has occurred so attach the ejected cartridge
err = setup.AttachCartridge(dbg.VCS, cartridgeloader.Loader{})
if err != nil {
return err
Expand Down
10 changes: 6 additions & 4 deletions disassembly/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ func (p *Preferences) String() string {

// newPreferences is the preferred method of initialisation for the Preferences type.
func newPreferences(dsm *Disassembly) (*Preferences, error) {
p := &Preferences{
dsm: dsm,
mirrorOrigin: memorymap.OriginCart,
}
p := &Preferences{dsm: dsm}

// set defaults
p.FxxxMirror.Set(true)
p.Symbols.Set(true)
p.mirrorOrigin = memorymap.OriginCartFxxxMirror

// save server using the prefs package
pth, err := paths.ResourcePath("", prefs.DefaultPrefsFile)
Expand Down
3 changes: 3 additions & 0 deletions gui/sdlimgui/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type preferences struct {
func newDebugPreferences(img *SdlImgui) (*preferences, error) {
p := &preferences{img: img}

// defaults
p.openOnError.Set(true)

// setup preferences
pth, err := paths.ResourcePath("", prefs.DefaultPrefsFile)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions gui/sdlimgui/win_coproc_lastexecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (win *winCoProcLastExecution) draw() {
return
}

if !win.img.lz.CoProc.HasCoProcBus || win.img.lz.Dbg.Disasm.Coprocessor == nil {
return
}

imgui.SetNextWindowPosV(imgui.Vec2{465, 285}, imgui.ConditionFirstUseEver, imgui.Vec2{0, 0})
imgui.SetNextWindowSizeV(imgui.Vec2{353, 466}, imgui.ConditionFirstUseEver)

Expand Down
12 changes: 6 additions & 6 deletions hardware/memory/cartridge/supercharger/supercharger.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ func NewSupercharger(cartload cartridgeloader.Loader) (mapper.CartMapper, error)

var err error

// load bios and activate
cart.bios, err = loadBIOS(path.Dir(cartload.Filename))
if err != nil {
return nil, curated.Errorf("supercharger: %v", err)
}

// set up tape
if cartload.IsSoundData {
cart.state.tape, err = newSoundLoad(cart, cartload)
Expand All @@ -78,12 +84,6 @@ func NewSupercharger(cartload cartridgeloader.Loader) (mapper.CartMapper, error)
return nil, curated.Errorf("supercharger: %v", err)
}

// load bios and activate
cart.bios, err = loadBIOS(path.Dir(cartload.Filename))
if err != nil {
return nil, curated.Errorf("supercharger: %v", err)
}

// prepare onLoaded function
if cartload.OnLoaded == nil {
cart.onLoaded = func(cart mapper.CartMapper) error { return nil }
Expand Down

0 comments on commit 450f6ae

Please sign in to comment.