Skip to content

Commit

Permalink
Move screen datatypes and add tests for instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
craigthomas committed Feb 20, 2025
1 parent bc0f323 commit e4643c4
Show file tree
Hide file tree
Showing 21 changed files with 460 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ca.craigthomas.yacoco3e.components;

import ca.craigthomas.yacoco3e.datatypes.*;
import ca.craigthomas.yacoco3e.datatypes.screen.ScreenMode;

import static ca.craigthomas.yacoco3e.datatypes.RegisterSet.*;

Expand Down
51 changes: 24 additions & 27 deletions src/main/java/ca/craigthomas/yacoco3e/components/Instruction.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,30 @@ public int execute(IOController io) throws MalformedInstructionException {
io.incrementPC();
}

if (!isValidInstruction) {
call(io);
return 0;
}

switch (addressingMode) {
case IMMEDIATE:
getImmediate(io);
break;

case INDEXED:
getIndexed(io);
break;

case DIRECT:
getDirect(io);
break;

case EXTENDED:
getExtended(io);
break;

default:
addressRead = new UnsignedWord(0);
wordRead = new UnsignedWord(0);
byteRead = new UnsignedByte(0);
break;
if (isValidInstruction) {
switch (addressingMode) {
case IMMEDIATE:
getImmediate(io);
break;

case INDEXED:
getIndexed(io);
break;

case DIRECT:
getDirect(io);
break;

case EXTENDED:
getExtended(io);
break;

default:
addressRead = new UnsignedWord(0);
wordRead = new UnsignedWord(0);
byteRead = new UnsignedByte(0);
break;
}
}

return call(io);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ca/craigthomas/yacoco3e/components/Screen.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
*/
package ca.craigthomas.yacoco3e.components;

import ca.craigthomas.yacoco3e.datatypes.*;
import ca.craigthomas.yacoco3e.datatypes.screen.*;

import java.awt.*;
import java.awt.image.BufferedImage;

public class Screen
Expand Down
36 changes: 0 additions & 36 deletions src/main/java/ca/craigthomas/yacoco3e/datatypes/MemoryResult.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (C) 2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.datatypes.UnsignedByte;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2017-2018 Craig Thomas
* This project uses an MIT style license - see LICENSE for details.
*/
package ca.craigthomas.yacoco3e.datatypes;
package ca.craigthomas.yacoco3e.datatypes.screen;

import ca.craigthomas.yacoco3e.components.IOController;

Expand Down
Loading

0 comments on commit e4643c4

Please sign in to comment.