-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVRAMViewer.java
More file actions
46 lines (35 loc) · 1.05 KB
/
VRAMViewer.java
File metadata and controls
46 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public final class VRAMViewer extends Frame {
Screen screen;
VDP vdp;
boolean enabled = false;
private File romFile;
private FileInputStream fileStream;
public VRAMViewer(VDP vdp) { // Creates a 16x28 tile matrix to display the VRAM contents
super("SMS VRAM Viewer - " + Remaster.APPNAME);
this.vdp = vdp;
setLocation(500, 5);
setSize(266, 540);
screen = new Screen(this, 128, 256);
addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); enabled = false; } } );
}
public void toggleEnabled() {
enabled = !enabled;
setVisible(enabled);
}
public void update() {
for(int j=0; j < 28; j++)
for(int i=0; i < 16; i++)
vdp.drawTile(screen, i << 3, j << 3, (j << 4) + i);
screen.drawScreen(5, 23);
}
public void paint(Graphics g) {
if(screen != null) screen.drawScreen(5, 23);
else {
g.setColor(Color.BLACK);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
}
}
}