Skip to content

Commit

Permalink
code of package org.jens_mueller.z8 formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
IOOI-SqAR committed Jan 3, 2024
1 parent 374c4e0 commit 8f5b412
Show file tree
Hide file tree
Showing 9 changed files with 3,001 additions and 3,139 deletions.
4,242 changes: 2,077 additions & 2,165 deletions JTCEMUCommon/src/main/java/org/jens_mueller/z8/Z8.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.jens_mueller.z8;


public interface Z8Breakpoint
{
public boolean matches( Z8 z8 );
public interface Z8Breakpoint {
boolean matches(Z8 z8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

package org.jens_mueller.z8;

public interface Z8Debugger
{
public void z8DebugStatusChanged( Z8 z8 );
public interface Z8Debugger {
void z8DebugStatusChanged(Z8 z8);
}

8 changes: 4 additions & 4 deletions JTCEMUCommon/src/main/java/org/jens_mueller/z8/Z8IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
package org.jens_mueller.z8;


public interface Z8IO
{
public int getPortValue( int port );
public void setPortValue( int port, int value );
public interface Z8IO {
int getPortValue(int port);

void setPortValue(int port, int value);
}
20 changes: 11 additions & 9 deletions JTCEMUCommon/src/main/java/org/jens_mueller/z8/Z8Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
package org.jens_mueller.z8;


public interface Z8Listener
{
public enum Reason {
POWER_ON,
RESET,
PRE_INST_EXEC,
CYCLES_PER_SECOND_CHANGED,
STATUS_CHANGED };
public interface Z8Listener {
enum Reason {
POWER_ON,
RESET,
PRE_INST_EXEC,
CYCLES_PER_SECOND_CHANGED,
STATUS_CHANGED
}

public void z8Update( Z8 z8, Reason reason );
;

void z8Update(Z8 z8, Reason reason);
}
8 changes: 4 additions & 4 deletions JTCEMUCommon/src/main/java/org/jens_mueller/z8/Z8Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
package org.jens_mueller.z8;


public interface Z8Memory
{
public int getMemByte( int addr, boolean dataMemory );
public boolean setMemByte( int addr, boolean dataMemory, int value );
public interface Z8Memory {
int getMemByte(int addr, boolean dataMemory);

boolean setMemByte(int addr, boolean dataMemory, int value);
}
193 changes: 90 additions & 103 deletions JTCEMUCommon/src/main/java/org/jens_mueller/z8/Z8ReassInst.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,130 +7,117 @@
package org.jens_mueller.z8;


public class Z8ReassInst
{
private final int addr;
private int destAddr;
private int codeLen;
private final byte[] codeBytes;
private String mnemonic;
private String[] args;
private boolean unknown;


public Z8ReassInst( int addr )
{
this.addr = addr;
this.destAddr = -1;
this.codeBytes = new byte[ 3 ];
this.codeLen = 0;
this.mnemonic = null;
this.args = null;
this.unknown = false;
}


public void addCodeByte( byte b )
{
if( this.codeLen >= this.codeBytes.length ) {
throw new IllegalStateException(
"Zu viele Code-Bytes f\u00FCr Z8-Instruktion" );
public class Z8ReassInst {
private final int addr;
private int destAddr;
private int codeLen;
private final byte[] codeBytes;
private String mnemonic;
private String[] args;
private boolean unknown;


public Z8ReassInst(int addr) {
this.addr = addr;
this.destAddr = -1;
this.codeBytes = new byte[3];
this.codeLen = 0;
this.mnemonic = null;
this.args = null;
this.unknown = false;
}
this.codeBytes[ this.codeLen++ ] = b;
}


public void appendTo( StringBuilder buf )
{
int begPos = buf.length();
buf.append( String.format( "%04X ", this.addr ) );
int instCol = 19;
for( int i = 0;
(i < this.codeLen) && (i < this.codeBytes.length);
i++ )
{
if( i > 0 ) {
buf.append( '\u0020' );
}
buf.append( String.format(
"%02X",
(int) this.codeBytes[ i ] & 0xFF ) );
}
int n = begPos + instCol - buf.length();
if( n < 1 ) {
n = 1;


public void addCodeByte(byte b) {
if (this.codeLen >= this.codeBytes.length) {
throw new IllegalStateException(
"Zu viele Code-Bytes f\u00FCr Z8-Instruktion");
}
this.codeBytes[this.codeLen++] = b;
}
buf.append("\u0020".repeat(n));
begPos = buf.length();
buf.append( this.mnemonic );
if( this.args != null ) {
for (String arg : this.args) {
if (arg != null) {
if (begPos >= 0) {
n = begPos + 8 - buf.length();
if (n < 1) {
n = 1;


public void appendTo(StringBuilder buf) {
int begPos = buf.length();
buf.append(String.format("%04X ", this.addr));
int instCol = 19;
for (int i = 0;
(i < this.codeLen) && (i < this.codeBytes.length);
i++) {
if (i > 0) {
buf.append('\u0020');
}
buf.append(String.format(
"%02X",
(int) this.codeBytes[i] & 0xFF));
}
int n = begPos + instCol - buf.length();
if (n < 1) {
n = 1;
}
buf.append("\u0020".repeat(n));
begPos = buf.length();
buf.append(this.mnemonic);
if (this.args != null) {
for (String arg : this.args) {
if (arg != null) {
if (begPos >= 0) {
n = begPos + 8 - buf.length();
if (n < 1) {
n = 1;
}
buf.append("\u0020".repeat(n));
begPos = -1;
} else {
buf.append(", ");
}
buf.append("\u0020".repeat(n));
begPos = -1;
} else {
buf.append(", ");
buf.append(arg);
}
buf.append(arg);
}
}
if (this.unknown) {
buf.append("\t\t;???");
}
}
if( this.unknown ) {
buf.append( "\t\t;???" );
}
}


public int getAddr()
{
return this.addr;
}
public int getAddr() {
return this.addr;
}


public String[] getArgs()
{
return this.args;
}
public String[] getArgs() {
return this.args;
}


public int getDestAddr()
{
return this.destAddr;
}
public int getDestAddr() {
return this.destAddr;
}


public String getMnemonic()
{
return this.mnemonic;
}
public String getMnemonic() {
return this.mnemonic;
}


public boolean isUnknown()
{
return this.unknown;
}
public boolean isUnknown() {
return this.unknown;
}


public void setDestAddr( int addr )
{
this.destAddr = addr;
}
public void setDestAddr(int addr) {
this.destAddr = addr;
}


public void setMnemonic( String mnemonic, String... args )
{
this.mnemonic = mnemonic;
this.args = args;
}
public void setMnemonic(String mnemonic, String... args) {
this.mnemonic = mnemonic;
this.args = args;
}


public void setUnknown()
{
this.unknown = true;
}
public void setUnknown() {
this.unknown = true;
}
}
Loading

0 comments on commit 8f5b412

Please sign in to comment.