-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Created the Ex-Machina Autoloader. It simulates the needed keypresses to load a demo program into Ben's computer's RAM. See README.TXT for more info.
- Loading branch information
Milton Maldonado Jr
committed
May 23, 2020
1 parent
928fb4c
commit b664c3c
Showing
8 changed files
with
180 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* exmachina.c | ||
* | ||
* Created on: 23 de mai de 2020 | ||
* Author: milton | ||
*/ | ||
|
||
#include <unistd.h> | ||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
|
||
const uint8_t demoprog[] = { | ||
|
||
0x00, /*OUT*/ 0xE0, | ||
0x01, /*ADD 15*/ 0x2F, | ||
0x02, /*JC 4*/ 0x74, | ||
0x03, /*JMP 0*/ 0x60, | ||
0x04, /*SUB 15*/ 0x3F, | ||
0x05, /*OUT*/ 0xE0, | ||
0x06, /*JZ 0*/ 0x80, | ||
0x07, /*JMP 4*/ 0x64, | ||
0x0F, /*1*/ 0x01, | ||
}; | ||
|
||
const int LINES_PROG = sizeof(demoprog)/2; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void write_key(board_ctx_t *bctx, int key){ | ||
|
||
board_write_key(bctx, key); | ||
usleep(100000); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void *exmachina_thread(void *args){ | ||
|
||
board_ctx_t *bctx = args; | ||
usleep(1000000); | ||
|
||
uint8_t addr = 0; | ||
uint8_t data = 0; | ||
|
||
int i; | ||
|
||
for (i = 0; i < LINES_PROG; i++){ | ||
|
||
uint8_t newaddr = demoprog[2*i]; | ||
uint8_t newdata = demoprog[2*i+1]; | ||
|
||
uint8_t deltaaddr = addr ^ newaddr; | ||
if (deltaaddr & 0x01){ | ||
write_key(bctx, 'l'); | ||
} | ||
|
||
if (deltaaddr & 0x02){ | ||
write_key(bctx, 'k'); | ||
} | ||
if (deltaaddr & 0x04){ | ||
write_key(bctx, 'j'); | ||
} | ||
if (deltaaddr & 0x08){ | ||
write_key(bctx, 'h'); | ||
} | ||
|
||
uint8_t deltadata = data ^ newdata; | ||
|
||
int j; | ||
for (j = 0; j < 8; j++){ | ||
|
||
if (deltadata & (1 << j)){ | ||
|
||
int key = '0' + j; | ||
write_key(bctx, key); | ||
} | ||
} | ||
|
||
addr = newaddr; | ||
data = newdata; | ||
|
||
write_key(bctx, 'w'); | ||
write_key(bctx, 'w'); | ||
} | ||
|
||
write_key(bctx, 'p'); | ||
write_key(bctx, KEY_F(2)); | ||
|
||
write_key(bctx, 'r'); | ||
write_key(bctx, 'r'); | ||
|
||
for (i = 0; i < 9; i++) | ||
write_key(bctx, KEY_F(12)); | ||
|
||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* exmachina.h | ||
* | ||
* Created on: 23 de mai de 2020 | ||
* Author: milton | ||
*/ | ||
|
||
#ifndef SRC_COMPUTER_EXMACHINA_H_ | ||
#define SRC_COMPUTER_EXMACHINA_H_ | ||
|
||
void *exmachina_thread(void *args); | ||
|
||
#endif /* SRC_COMPUTER_EXMACHINA_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
0 OUT E0 | ||
1 ADD 15 2F | ||
2 JC 4 74 | ||
3 JMP 0 60 | ||
4 SUB 15 3F | ||
5 OUT E0 | ||
6 JZ 0 80 | ||
7 JMP 4 64 | ||
15 1 01 | ||
ADDR MNEMONIC CODE | ||
00 OUT E0 | ||
01 ADD 15 2F | ||
02 JC 4 74 | ||
03 JMP 0 60 | ||
04 SUB 15 3F | ||
05 OUT E0 | ||
06 JZ 0 80 | ||
07 JMP 4 64 | ||
0F 1 01 |