mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 14:56:29 -04:00
added some documentation
This commit is contained in:
parent
4506c2cdb5
commit
5422cad06e
@ -6,12 +6,21 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Represents a ROM listing
|
||||
*
|
||||
* @author hneemann
|
||||
*/
|
||||
public class Listing implements javax.swing.ListModel<String> {
|
||||
private final ArrayList<String> lines;
|
||||
private final HashMap<Integer, Integer> addrMap;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* The given file is read.
|
||||
*
|
||||
* @param filename the filename
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public Listing(File filename) throws IOException {
|
||||
lines = new ArrayList<String>();
|
||||
addrMap = new HashMap<>();
|
||||
@ -55,6 +64,12 @@ public class Listing implements javax.swing.ListModel<String> {
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the line belonging to the given address
|
||||
*
|
||||
* @param addr the address
|
||||
* @return the line or null if not found.
|
||||
*/
|
||||
public Integer getLine(int addr) {
|
||||
return addrMap.get(addr);
|
||||
}
|
||||
|
@ -10,6 +10,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The dialog to show the ROM listing while running.
|
||||
* Used to debug assembler code.
|
||||
*
|
||||
* @author hneemann
|
||||
*/
|
||||
public class ROMListingDialog extends JDialog implements Observer {
|
||||
@ -19,6 +22,13 @@ public class ROMListingDialog extends JDialog implements Observer {
|
||||
private final JList<String> list;
|
||||
private int lastAddr = -1;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param parent the parent frame
|
||||
* @param rom the rom element
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public ROMListingDialog(JFrame parent, ROM rom) throws IOException {
|
||||
super(parent, Lang.get("win_listing"), false);
|
||||
this.rom = rom;
|
||||
@ -36,6 +46,7 @@ public class ROMListingDialog extends JDialog implements Observer {
|
||||
listing = new Listing(filename);
|
||||
list = new JList<>(listing);
|
||||
list.setFont(new Font("monospaced", Font.PLAIN, 12));
|
||||
list.setVisibleRowCount(30);
|
||||
|
||||
rom.getAddrIn().addObserver(this);
|
||||
hasChanged();
|
||||
|
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Contains the classes to hold and show a ROM-Listing
|
||||
*
|
||||
* @author hneemann
|
||||
*/
|
||||
package de.neemann.digital.gui.components.listing;
|
Loading…
x
Reference in New Issue
Block a user