Home
Downloads
Licenses Contact

OshonSoft

20th Anniversary

20th Anniversary of the
OSHONSOFT PROJECT
(2001 - 2021)

6502 Simulator IDE
External Modules Manual


Table Of Contents:

General info


Functions and procedures


External client/servers


• General info
6502 Simulator IDE is an automation (ActiveX) server/client application. This feature enables communication with external simulation modules that can be developed by home developers and third parties using various Development Systems for Windows.

i6502simulatoride.server
External client application can access 6502 Simulator IDE server services by creating an ActiveX object using i6502simulatoride.server class.

• Functions and procedures
Here is the list of functions and procedures available for external client applications:
- getmem
getmem(address) function will return the value in the memory location specified by 'address' argument [0-65535].
- getmem_arr
getmem_arr(address, data_arr) procedure will copy the values from the consecutive memory locations starting from the 'address' argument to the 'data_arr' array argument that should be passed by reference. The array length can be arbitrary.
- setmem
setmem(address,value) procedure will put the 'value' argument [0-255] in the memory location specified by 'address' argument [0-65535].
- setmem_arr
setmem_arr(address, data_arr) procedure will put the values from the 'data_arr' array argument that should be passed by reference to the consecutive memory locations starting from the 'address' argument. The array length can be arbitrary.
- i6502nmi
i6502nmi() procedure with no arguments will generate NMI interrupt signal.
- i6502irq
i6502irq() procedure with no arguments will generate IRQ interrupt signal.
- i6502reset
i6502reset() procedure with no arguments will generate RESET signal.
- getinst
getinst() function with no arguments will return the mnemonics of last executed instruction [string].
- getcrystal
getcrystal() function with no arguments will return the clock frequency parameter [string].
- getclockcycles
getclockcycles() function with no arguments will return the number of clock cycles passed after the start of the simulation. The last two functions will enable the external client application to develop a real time behavior if needed.
- geta
geta() function will return the value in A register (the accumulator).
- getsr, getp
getsr() function will return the value in processor status register. getp() can be used for the same purpose.
- getx
getx() function will return the value in index register X.
- gety
gety() function will return the value in index register Y.
- getsp
getsp() function will return the value in SP register (the stack pointer).
- getpc
getpc() function will return the value in PC register (the program counter).

• External client/servers
Full support and full synchronization is available for external applications with client/server capabilities. External server module should provide the following procedures:

- objectinit
objectinit() procedure will be called at the beginning of the simulation in 6502 Simulator IDE. With this procedure external module should be initialized to a known initial state.
- objectrefresh
objectrefresh() procedure will be called after every simulated instruction.
- writemem
writemem(address,data) procedure will be called during the simulation whenever instruction performs writing to a memory location. Procedure arguments will contain information about the individual memory write operation ('address' range [0-65535], 'data' range [0-255]). Stack pushes are excluded.
- readmem
readmem(address,data) procedure will be called during the simulation before every memory read access by simulated instructions. Only if needed, the external module can assign value to the 'data' argument [0-255] that will be written to memory buffer at provided 'address' location, before the individual memory read operation. 'data' argument should be addressed by reference and not by value. Stack pops are excluded.
- objectterm
objectterm() procedure needs to contain the code to terminate external module application (typically End statement).

External modules interface
The class name should be set using External Modules interface available from Tools menu of 6502 Simulator IDE. External client/server applications will be started and terminated automatically with 6502 Simulator IDE.