Skip to content

DanilaEremenko/LEX_YACC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

8080 EMULATOR GUIDE

REQUIREMENTS

-gcc

-flex

-yacc | bison

BUILDING & EXECUTION & TESTING & CLEANING :

  1. Compile emulator
./build.sh -c 8080_emulator
  1. Execute all *.in files in directory (must be used only after compilation) and print result to stdout
./build.sh -e 8080_emulator
  1. Run regression tests in 8080_emulator/tests
./build.sh -t 8080_emulator
  1. Remove all out files
./build.sh -r 8080_emulator

NOTES:

-not all commands are supported. Supported commands can be checked in 8080_emulator/emu_lex.l

-numbers in input file will be perceived as octal

-numbers in output file will be printed in octal format 

INPUT FILE EXAMPLE:

/*@initializing-----------------------------------------------*/
000:LXI SP;		/*initialize SP*/
001:200;
002:000;
003:LXI H;		/*HL = &v1*/
004:206;	
005:000;
006:LXI D;		/*DE = &v2*/
007:207;
010:000;
011:JMP;		/*just test jump*/
012:021;
013:000;

/*@exchange v1 <-> v2---------------*/
021:MOV A,M;	/*A = v1 (&v1 = HL)		*/
022:PUSH PSW;	/*save v1			*/
023:LDAX D;	/*A = v2 (&v2 = DE)		*/
024:MOV M,A;	/*v1 = v2			*/
025:POP PSW;	/*A = v1			*/
026:STAX D;	/*v2 = v1			*/
027:JMP;
030:104;
031:000;

/*@lonely sad HLT for JMP testing (NOTE:execution of your programs stops when pc = &HLT)*/
104:HLT;

/*exchanged variables*/
206:111;		/*v1*/
207:222;		/*v2*/

/*@Define mem areas which will be printed after executing	*/
FROM 0 TO 13;		/*binary code of initializing		*/
FROM 21 TO 29;		/*binary code of exchange v1 <-> v2	*/
FROM 104 TO 104;	/*binary code of lonelye sad HLT	*/
FROM 174 TO 200;	/*check stack				*/
FROM 206 TO 207;	/*check that v1 and v2 was exchanged	*/


/*@Execute code on emulator. Code will not be executed without this line!*/
EXEC;			

OUTPUT FILE EXAMPLE:

	z_0_example.out

----------regs----------
a 	= 111
b 	= 0
c 	= 0
d 	= 0
e 	= 207
h 	= 0
l 	= 206
m 	= 0
pws	= 0
sp 	= 200
f 	= 100
----------mem(0-13)---------
000:061
001:200
002:000
003:041
004:206
005:000
006:021
007:207
010:000
011:303
012:021
013:000
----------mem(21-31)---------
021:176
022:365
023:032
024:167
025:361
026:022
027:303
030:104
031:000
----------mem(104-104)---------
104:166
----------mem(174-200)---------
174:000
175:000
176:100
177:111
200:000
----------mem(206-207)---------
206:222
207:111
----------flags---------

About

Project for lex & yacc programms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published