Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37b24667fd | ||
|
|
768515710c |
@@ -0,0 +1,20 @@
|
||||
EMU51
|
||||
-----
|
||||
|
||||
Emu51 is a 80c51 emulator
|
||||
|
||||

|
||||
|
||||
### Informations
|
||||
|
||||
(from the original Readme file)
|
||||
|
||||
Emulator accepts `*.bin`, `*.hex` files.
|
||||
You can also compile source file by using external compiler, emu51 is compatible with free 8051 compiler by
|
||||
MetaLink Corporation (http://www.metaice.com/ASM51/Files/ASM51.zip).
|
||||
Just put asm51.exe into this directory and use Shift+F9 key combination to compile and load source file
|
||||
(only windows :-( ).
|
||||
I'm still searching multiplatform 8051 assembler compiler for emu51, because I want to add full compilation
|
||||
support for all supported platforms.
|
||||
|
||||
The original version from Mariusz Kasolik and can be found here: https://emu51.sourceforge.net/
|
||||
@@ -0,0 +1,8 @@
|
||||
TODO List
|
||||
=========
|
||||
|
||||
Work in progress and probably need to be updated
|
||||
|
||||
[ ] Correct timer0 issue
|
||||
[ ] Find invalids opcodes
|
||||
[ ] Expand GUI
|
||||
+2
-2
@@ -55,7 +55,7 @@ void dis_asm::draw(uint16_t adress)
|
||||
if ( asm51[ram[adress]].code == ram[adress] )
|
||||
{
|
||||
textprintf(surface, mainf, left, c, color, "%4x:", adress);
|
||||
for ( cnt = 0 ; cnt < asm51[ram[adress]].lenght ; cnt++ )
|
||||
for ( cnt = 0 ; cnt < asm51[ram[adress]].length ; cnt++ )
|
||||
{
|
||||
if ( PC == ( adress + cnt ))
|
||||
{
|
||||
@@ -68,7 +68,7 @@ void dis_asm::draw(uint16_t adress)
|
||||
hexoutB(left + 50 + cnt * 24, c, colPC, ram[adress + cnt]);
|
||||
}
|
||||
textprintf(surface, mainf, left + 144, c, color, "%s", asm51[ram[adress]].display_string);
|
||||
adress += asm51[ram[adress]].lenght;
|
||||
adress += asm51[ram[adress]].length;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -68,11 +68,11 @@ void init_8051(void)
|
||||
}
|
||||
|
||||
// 8051 assembler macros
|
||||
int get_lenght(uint8_t code)
|
||||
int get_length(uint8_t code)
|
||||
{
|
||||
if ( asm51[code].code == code )
|
||||
{
|
||||
return asm51[code].lenght;
|
||||
return asm51[code].length;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,7 +100,7 @@ int load_code_table(code_51 *tmp_tab)
|
||||
FILE *strio = NULL;
|
||||
char _mnem[6];
|
||||
int _code;
|
||||
int _lenght;
|
||||
int _length;
|
||||
int _cycles;
|
||||
char _datas[12];
|
||||
strio = fopen("list51.txt", "r");
|
||||
@@ -111,7 +111,7 @@ int load_code_table(code_51 *tmp_tab)
|
||||
fscanf(strio, "%x", &_code);
|
||||
fscanf(strio, "%s", _mnem);
|
||||
fscanf(strio, "%s", _datas);
|
||||
fscanf(strio, "%d", &_lenght);
|
||||
fscanf(strio, "%d", &_length);
|
||||
fscanf(strio, "%d", &_cycles);
|
||||
if ( _mnem[0] == 'E' && _mnem[1] == 'N' && _mnem[2] == 'D' )
|
||||
{
|
||||
@@ -120,7 +120,7 @@ int load_code_table(code_51 *tmp_tab)
|
||||
tmp_tab[_code].code = (uint8_t) _code;
|
||||
strcpy(tmp_tab[_code].mnem, _mnem);
|
||||
strcpy(tmp_tab[_code].datas, _datas);
|
||||
tmp_tab[_code].lenght = (uint8_t) _lenght;
|
||||
tmp_tab[_code].length = (uint8_t) _length;
|
||||
tmp_tab[_code].cycles = (uint8_t) _cycles;
|
||||
}
|
||||
fclose(strio);
|
||||
@@ -710,8 +710,8 @@ int main(void)
|
||||
}
|
||||
if ( key[KEY_DOWN] )
|
||||
{
|
||||
aadr += get_lenght(prog[aadr]);
|
||||
aadr += get_lenght(prog[aadr]);
|
||||
aadr += get_length(prog[aadr]);
|
||||
aadr += get_length(prog[aadr]);
|
||||
}
|
||||
if ( key[KEY_PGUP] && !( key[KEY_LSHIFT] || key[KEY_RSHIFT] ))
|
||||
{
|
||||
|
||||
@@ -136,22 +136,22 @@ void change_char(char *string, char ch, int pos)
|
||||
string[pos - 1] = ch;
|
||||
}
|
||||
|
||||
void insert_char(char *string, char ch, int pos, int lenght)
|
||||
void insert_char(char *string, char ch, int pos, int length)
|
||||
{
|
||||
for ( int c = lenght ; c > pos ; c-- )
|
||||
for ( int c = length ; c > pos ; c-- )
|
||||
{
|
||||
string[c - 1] = string[c - 2];
|
||||
}
|
||||
string[pos - 1] = ch;
|
||||
}
|
||||
|
||||
void cut_char(char *string, int pos, int lenght)
|
||||
void cut_char(char *string, int pos, int length)
|
||||
{
|
||||
for ( int c = pos ; c < lenght ; c++ )
|
||||
for ( int c = pos ; c < length ; c++ )
|
||||
{
|
||||
string[c - 1] = string[c];
|
||||
}
|
||||
string[lenght - 1] = (char) ( 32 );
|
||||
string[length - 1] = (char) ( 32 );
|
||||
}
|
||||
|
||||
void change_ext(char *s)
|
||||
@@ -170,7 +170,7 @@ void change_ext(char *s)
|
||||
return;
|
||||
}
|
||||
|
||||
void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, char *title)
|
||||
void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int length, char *title)
|
||||
{
|
||||
int c;
|
||||
BITMAP *surface = create_bitmap(w, h);
|
||||
@@ -188,11 +188,11 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch
|
||||
textprintf_centre(surface, mainf, surface->w / 2, 4, makecol(255, 255, 255), " %s ", title);
|
||||
text[0] = 32;
|
||||
|
||||
for ( c = 1 ; c <= lenght - 1 ; c++ )
|
||||
for ( c = 1 ; c <= length - 1 ; c++ )
|
||||
{
|
||||
text[c] = 32;
|
||||
}
|
||||
text[lenght - 1] = 0;
|
||||
text[length - 1] = 0;
|
||||
clear_keybuf();
|
||||
int pos = 1;
|
||||
uint16_t key_p;
|
||||
@@ -219,16 +219,16 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch
|
||||
if ( pos > 1 )
|
||||
{
|
||||
pos--;
|
||||
cut_char(text, pos, lenght);
|
||||
text[lenght - 2] = 32;
|
||||
text[lenght - 1] = 0;
|
||||
cut_char(text, pos, length);
|
||||
text[length - 2] = 32;
|
||||
text[length - 1] = 0;
|
||||
}
|
||||
flag = true;
|
||||
break;
|
||||
case KEY_DEL:
|
||||
cut_char(text, pos, lenght);
|
||||
text[lenght - 2] = 32;
|
||||
text[lenght - 1] = 0;
|
||||
cut_char(text, pos, length);
|
||||
text[length - 2] = 32;
|
||||
text[length - 1] = 0;
|
||||
flag = true;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
@@ -237,20 +237,20 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch
|
||||
flag = true;
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
if ( pos < lenght )
|
||||
if ( pos < length )
|
||||
{ pos++; }
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
if ( !key[KEY_ENTER] && key_ch != 0 && pos < lenght && !flag )
|
||||
if ( !key[KEY_ENTER] && key_ch != 0 && pos < length && !flag )
|
||||
{
|
||||
insert_char(text, key_ch, pos, lenght);
|
||||
insert_char(text, key_ch, pos, length);
|
||||
pos++;
|
||||
text[lenght - 1] = 0;
|
||||
text[length - 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
text[lenght - 1] = 0;
|
||||
text[length - 1] = 0;
|
||||
blit(cache, buf, 0, 0, x, y, w, h);
|
||||
destroy_bitmap(cache);
|
||||
destroy_bitmap(surface);
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ class code_51
|
||||
public:
|
||||
char mnem[6]; // instruction mnemonic (2-4 characters)
|
||||
uint8_t code; // instruction code
|
||||
uint8_t lenght; // bytes which are needed to write this instruction into memory
|
||||
uint8_t length; // bytes which are needed to write this instruction into memory
|
||||
uint8_t cycles; // time unit
|
||||
char display_string[20]; // string which is ready for displaying, it's made by make_ds(WORD) method
|
||||
char datas[12]; // string which contains datas which will be displayed after mnemonic
|
||||
|
||||
+3
-3
@@ -13,10 +13,10 @@ bool checkBit(uint8_t tmp_b, int pos);
|
||||
void draw_SEG_digit(BITMAP *buf, int x, int y, int color, int size, uint8_t segm_code);
|
||||
void draw_LED_bin(BITMAP *buf, int x, int y, int color, uint8_t code);
|
||||
void change_char(char *string, char ch, int pos);
|
||||
void insert_char(char *string, char ch, int pos, int lenght);
|
||||
void cut_char(char *string, int pos, int lenght);
|
||||
void insert_char(char *string, char ch, int pos, int length);
|
||||
void cut_char(char *string, int pos, int length);
|
||||
void change_ext(char *s);
|
||||
void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, char *title);
|
||||
void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int length, char *title);
|
||||
void ShowMessage(char *text, BITMAP *buf, int x, int y, int w, int h, char *title);
|
||||
bool QuestionBox(char *text, BITMAP *buf, int x, int y, int w, int h, char *title, int _color);
|
||||
void ShowMsgEx(char *text, BITMAP *buf, int x, int y, int w, int h, char *title, int _color);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
EMU51 (Mariusz Kasolik) - Modifications done by TRAPIER Manoel (godzil@free.fr)
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Source file (platform independed)
|
||||
---------------------------------
|
||||
|
||||
Emulator accepts *.bin, *.hex files.
|
||||
You can also compile source file by using external compiler, emu51 is compatible with
|
||||
free 8051 compiler by MetaLink Corporation (http://www.metaice.com/ASM51/Files/ASM51.zip).
|
||||
Just put asm51.exe into this directory and use Shift+F9 key combination to compile and load source file (only windows :-( ).
|
||||
I'm still searching multiplatform 8051 assembler compiler for emu51, because i want to add full compilation support for all supported platforms.
|
||||
|
||||
|
||||
You can find history in the file of the same name.
|
||||
|
||||
- Compilation has been tested with VisualStudio 6 using latest (4.1.9) allegro library.
|
||||
- Compilation tested too with DJGPP with GCC 3.2.1 and allegro 4.1.9
|
||||
Reference in New Issue
Block a user