Home
Downloads
Licenses Contact

OshonSoft

20th Anniversary

2021 - 20th Anniversary of the
OSHONSOFT PROJECT
OshonSoft © 2001 - 2024

Z80 Simulator IDE
External Modules Manual


Table Of Contents:

General info


Functions and procedures


External client/servers


• General info
Z80 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.

z80simulatoride.server
External client application can access Z80 Simulator IDE server services by creating an ActiveX object using z80simulatoride.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.
- getio
getio(address) function will return the value on the I/O port specified by 'address' argument [0-255].
- setio
setio(address,value) procedure will put the 'value' argument [0-255] on the I/O port specified by 'address' argument [0-255].
- z80nmi
z80nmi() procedure with no arguments will generate NMI interrupt signal.
- z80int
z80int() procedure with no arguments will generate INT interrupt signal.
- z80reset
z80reset() procedure with no arguments will generate RESET signal.
- gethalt
gethalt() function with no arguments will return the HALT state [0-1].
- 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.
- getf
getf() function will return the value in F (flag) register.
- getb
getb() function will return the value in B register.
- getc
getc() function will return the value in C register.
- getd
getd() function will return the value in D register.
- gete
gete() function will return the value in E register.
- geth
geth() function will return the value in H register.
- getl
getl() function will return the value in L register.
- getix
getix() function will return the value in IX register.
- getiy
getiy() function will return the value in IY register.
- getsp
getsp() function will return the value in SP register.
- getpc
getpc() function will return the value in PC register.
- geti
geti() function will return the value in I register.
- getr
getr() function will return the value in R register.
- geta1
geta1() function will return the value in alternate A' register.
- getf1
getf1() function will return the value in alternate F' register.
- getb1
getb1() function will return the value in alternate B' register.
- getc1
getc1() function will return the value in alternate C' register.
- getd1
getd1() function will return the value in alternate D' register.
- gete1
gete1() function will return the value in alternate E' register.
- geth1
geth1() function will return the value in alternate H' register.
- getl1
getl1() function will return the value in alternate L' register.

• 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 Z80 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.
- writeio
writeio(port,data) procedure will be called after every simulated OUT instruction and its 'port' and 'data' arguments will be available for the external module.
- readio
readio(port,data) procedure will be called during the simulation of every IN instruction and the external module should assign the byte value [0-255] to the 'data' argument, only if needed, if the module is assigned to the specified 'port' argument. 'data' argument should be addressed by reference and not by value.
- 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 Z80 Simulator IDE. External client/server applications will be started and terminated automatically with Z80 Simulator IDE.