Skip to content

this is 8085 microprocessor emulator written in JAVA. it emulates almost all 8085 instruction set

Notifications You must be signed in to change notification settings

singhroshan1999/8085-Emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo contains 8085 emulator

  • this 8085 emulator emulates almost all instructions accept few (see TODO.
  • it does not emulates at same speed though (3.2MHz) but at speed of host system.
  • it comes with 64K ram.
How to use?
  • write your assembly code as usual with few things in mind.
  • // this is 8085 assembly program to sort numbers
    LXI H,3000
    MVI M,6
    LXI H,3001
    MVI M,1
    LXI H,3002
    MVI M,5
    LXI H,3003
    MVI M,2
    LXI H,3004
    MVI M,4
    LXI H,3005
    MVI M,3
    hlt
    // this is comment
    %execute
    %getmemory 3000 3010
    MVI B,5
    START:
    LXI H,3000
    MVI C,5
    BACK:
    MOV A,M
    INX H
    CMP M
    JC SKIP
    JZ SKIP
    MOV D,M
    MOV M,A
    DCX H
    MOV M,D
    INX H
    SKIP:
    DCR C
    JNZ BACK
    DCR B
    JNZ START
    HLT
    %execute
    %getregister
    %getmemory 3000 3010
    q
    
  • // at beginning of line indicate comment.
  • label: should not follow any instruction but newline.
  • MOV M,A this type to instruction showld not contain space between comma(,) and oprands.
  • % sign following command is used to tell emulator what to do.
  • every file must end with q to mark end.
%instructions:
  • %execute executes instructions above can be called multiple times.
  • %getregisterprints register contents.
  • %getmemory start end returns memory content in range.
  • %setpc location set position of PC registor from here execution starts.
  • %setmemory location set position of memory where instruction is to be stored.
  • %initmemory set memory content to 0.
NOTE:
  • default PC=0 start memory=0 SP=65520
  • every registor and memory is 0 initially.
  • before execution HLT must be there else there uill be infinite loop.
OUTPUT:
######################
# Address  #  Value  #
######################
#   3000  #     6    #
#   3001  #     1    #
#   3002  #     5    #
#   3003  #     2    #
#   3004  #     4    #
#   3005  #     3    #
#   3006  #     0    #
#   3007  #     0    #
#   3008  #     0    #
#   3009  #     0    #
#   3010  #     0    #
######################
########################
# Register  #  values  #
########################
#    A      #     5    #
#    B      #     0    #
#    C      #     0    #
#    D      #     3    #
#    E      #     0    #
#    H      #    11    #
#    L      #   189    #
#    SP     # 65520    #
#    IR     #   118    #
#    PC     #    61    #
#    S      #     0    #
#    Z      #     1    #
#    AC     #     0    #
#    P      #     1    #
#    CY     #     0    #
#    BC     #     0    #
#    DE     #   768    #
#    HL     #  3005    #
########################
######################
# Address  #  Value  #
######################
#   3000  #     1    #
#   3001  #     2    #
#   3002  #     3    #
#   3003  #     4    #
#   3004  #     5    #
#   3005  #     6    #
#   3006  #     0    #
#   3007  #     0    #
#   3008  #     0    #
#   3009  #     0    #
#   3010  #     0    #
######################
How to execute file?
  • using commandline java -Dfile.encoding=UTf-8 -jar 8085-emulator.jar in.file
  • run JAR directly and enter in prompt java -Dfile.encoding=UTf-8 -jar 8085-emulator.jar > Enter file name to execute: in.file
References

About

this is 8085 microprocessor emulator written in JAVA. it emulates almost all 8085 instruction set

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages