summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-12-01 02:56:13 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-12-01 02:56:13 +1100
commit8ec080d0cd9fd62c0de20780581a4750d078ea94 (patch)
tree6ade354b2ddb37dba7dedd9d7eab0f8478071ff5 /src
parent580a7040ba53367c15ca682d4ea90c31fdcca45f (diff)
progress, still WIP
Diffstat (limited to 'src')
-rw-r--r--src/apple.c2
-rw-r--r--src/cpu/6502.c14
-rw-r--r--src/cpu/instructions.c2
-rw-r--r--src/video/ncurses.c19
-rw-r--r--src/video/signetics.c8
5 files changed, 25 insertions, 20 deletions
diff --git a/src/apple.c b/src/apple.c
index 6f48c10..6c977a2 100644
--- a/src/apple.c
+++ b/src/apple.c
@@ -108,7 +108,7 @@ void SetMemory(address x, byte y){
switch(x)
{
case DSP:
-
+ TerminalInput(y);
}
if (x < MEMORY_SIZE) {
Memory[x] = y;
diff --git a/src/cpu/6502.c b/src/cpu/6502.c
index ab8248e..366882f 100644
--- a/src/cpu/6502.c
+++ b/src/cpu/6502.c
@@ -40,15 +40,13 @@ void SetFlagN(byte x){
P = (x & flag_N) | (P & ~flag_N);
}
-//Perform prior to any changes
+//Perform prior to any changes TODO: FIX THIS! WTF WERE YOU THINKING?
void SetFlagV(byte x, byte y){
- if ((x & flag_N) == (y & flag_N)){
- if (((x + y) & (flag_N ^ 0xFF)) > 0x7F) SetFlag(flag_V, 1);
- else SetFlag(flag_V, 0);
- }else{
- if (((x - y) & (flag_N ^ 0xFF)) > 0x7F) SetFlag(flag_V, 1);
- else SetFlag(flag_V, 0);
- }
+ address z = (address)x + (address)y;
+ if (z > 0xFF)
+ SetFlag(flag_V, 1);
+ else
+ SetFlag(flag_V, 0);
}
/*void SetFlagB(){ //WORK ON
diff --git a/src/cpu/instructions.c b/src/cpu/instructions.c
index c043ac4..cf69fc2 100644
--- a/src/cpu/instructions.c
+++ b/src/cpu/instructions.c
@@ -136,7 +136,7 @@ void fEOR(Addressing addr, address val){
// Jump, Branch, Compare, and Test Bits
void fJMP(Addressing addr, address val){
- PC = val;
+ PC = val; PC -= 2;
}
void fBCC(Addressing addr, address val){ //FINISH ALL BRANCH INSTRUCTIONS
diff --git a/src/video/ncurses.c b/src/video/ncurses.c
index e4a7613..0e261bb 100644
--- a/src/video/ncurses.c
+++ b/src/video/ncurses.c
@@ -23,12 +23,15 @@ byte UserInput()
switch(c)
{
// Convert special characters
- case KEY_BACKSPACE:
+ case KEY_F(1): //backspace
r = 0xDF;
- case KEY_ENTER:
+ break;
+ case KEY_F(2): //enter
r = 0x8D;
- case KEY_EXIT: //TODO: Figure out if this is Esc or not.
+ break;
+ case KEY_F(3): //exit. TODO: Figure out if this is Esc or not.
r = 0x9B;
+ break;
// Convert regular characters
default:
if (c < 0x20 || c >= 0x60)
@@ -42,13 +45,13 @@ byte UserInput()
break;
}
- SetMemory(KBD, r);
+ //SetMemory(KBD, r);
- TerminalInput(r);
+ //TerminalInput(r);
- return c;
+ return r;
}
@@ -135,7 +138,7 @@ void TerminalInput(byte n)
{
// Place character
mvwaddch(AppleWindow, TermY, TermX, ' ');
- mvwaddch(AppleWindow, TermY, TermX, CharacterROM[n]);
+ mvwaddch(AppleWindow, TermY, TermX, CharacterROM(n));
// Add character to register
*TerminalShiftRegisterPosition = n;
@@ -168,7 +171,7 @@ void TerminalInput(byte n)
for (int j = 0; j < 40; j++) {
if (offset >= (TerminalShiftRegister + 960))
offset -= TerminalShiftRegister;
- mvwaddch(AppleWindow, i, j, CharacterROM[*offset] );
+ mvwaddch(AppleWindow, i, j, CharacterROM(*offset) );
offset++;
}}
diff --git a/src/video/signetics.c b/src/video/signetics.c
index 09e9836..3dd279b 100644
--- a/src/video/signetics.c
+++ b/src/video/signetics.c
@@ -2,15 +2,19 @@
// Signetics refers to the various Signetics brand chips which the Apple I came with, including a character ROM, and a shift-register based video memory.
// Intended to be included during pre-processing into the .c of the used video library.
-const byte CharacterROM[0x40] = {
+const byte SigneticsROM[0x40] = {
'@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' ,
'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' , 'X' , 'Y' , 'Z' , '[' , '\\', ']' , '^' , '_' ,
' ' , '!' , '"' , '#' , '$' , '%' , '&' , '\'', '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' ,
'0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , ':' , ';' , '<' , '=' , '>' , '?'
};
+byte CharacterROM(byte x) {
+ return SigneticsROM[ x & 0b01111111 ];
+}
+
const byte* TerminalShiftRegister;
byte* TerminalShiftRegisterPosition;
-int TerminalShiftRegisterOffset; \ No newline at end of file
+int TerminalShiftRegisterOffset;