Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to create a emulator

807580Jun 10 2010 — edited Jun 10 2010
i want to create a program which can emulate the A86 assembler (its for my school project)

i am new to java ,this was my yesterdays question : http://forums.sun.com/thread.jspa?threadID=5441557&tstart=0

i want my program to parse through a given assembly code and store it in a manner that my emulator(or interpretor) will use it later

i thought of storing those instructions in an sqlite DB

instruction_name| source | destination| etc....etc
MOV |AX |BX |etc etc

and registers and variables will also be stored in different tables

according to the instruction the value of the variable or register will change or act according to the instruction

i just want my program to handle simple programs

this is normally what my parser does for a simple MOV instruction
consider 'S' to be a space

 MOVSSAX,BXSSSS;comment

 first remove all spaces
MOVAX,BX;comment

 split the comment
MOVAX,BX
take the first three-4 alphabets(since most of them are 3-4 lettered ones like MOV,PUSH,POP)

and match them with a instruction
then split using the comma into AX and BX
and insert the  MOV,AX,BX into a table
i just explained my algorithm,is there any better way to do that and sqlite is very slow for the runtime inserts and updates ,is there any way i can represent the same registers and variables in memory instead of using the filesystem


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2010
Added on Jun 10 2010
1 comment
194 views