Software:GNUSim8085

From HandWiki
GNUsim8085
Gnusim8085 Logo.svg
GNUSim8085 Screenshot.jpg
GNUSim8085 - debugging the N-queens program.
Original author(s)Sridhar Ratnakumar
Initial release2003, 20–21 years ago
Stable release
1.4.1 / July 30, 2018; 5 years ago (2018-07-30)
Written inC
Operating systemLinux, Microsoft Windows
Available inEnglish, Arabic, Asturian, Brazilian Portuguese, Esperanto, French, German, Greek, Gujarati, Italian, Kannada, Russian, Spanish, Tamil
TypeComputer simulation
LicenseGNU General Public License
Websitegnusim8085.srid.ca

GNUSim8085 is a graphical simulator, assembler and debugger for the Intel 8085 microprocessor in Linux and Windows. It is among the 20 winners of the FOSS India Awards announced on February, 2008.[1] GNUSim8085 was originally written by Sridhar Ratnakumar in fall 2003 when he realized that no proper simulators existed for Linux. Several patches, bug fixes and software packaging have been contributed by the GNUSim8085 community.[2] GNUSim8085 users are encouraged to contribute to the simulator through coding, documenting, testing, translating and porting the simulator.[3]

GNUSim8085 development is becoming active as of 09/2016.[4]

Features

Editor

  1. Program editor with interactive input wizard for all the standard instructions
  2. Syntax highlighting in editor to distinguish between instructions, operands, comments etc.
  3. A separate opcode view which displays assembled code in hex

Assembler

  1. Support for all standard instructions of the 8085
  2. Minimalistic support for three assembler directives (.equ, .db, .ds) to control data locations, there exist no directives to directly control code locations
  3. Code start is defined outside source code ("load me at" entry) - if not defined (default), code is generated (strangely) from 4200h (instead from the real reset vector 0000h)
  4. Assembly results can be stored as listing file only (no binary file output)

Debugger

  1. Complete view of registers and flags
  2. Support for breakpoints
  3. Step by step execution/debugging of program
  4. Hex / Decimal Converter
  5. Runtime inspection of stack and source code variables defined
  6. Runtime inspection and manipulation of memory and I/O ports

Printing

  1. Printing of program from editor as well as assembled hex code (known not to work well in Windows)

Code examples

  • Function of Division.
jmp start
;data
v_divisor: ds 1;
v_dividend: ds 1;
v_rest: ds 1; 
v_result: ds 1;
;code
	;function to_divide_the party performs division by parts adding 1 to each "division"
para_dividir_parte: nop
		;saves the return address
		pop d;
		;takes the parameters in BC
		pop b;
	;throws the dividend in A
		mov a,b;
	cmp c; compares if the divisor is no bigger than the dividend	
		jc end_division
		;a the division is made from here
		division: sub c; decreases the value of the dividend divisor
	         		 inr h; increments the value of the result
	         		 cmp c; compares if the dividend is bigger than the divisor
	         		 jnc division; jump to the division if not bigger
	fim_divisao: mov b,a; takes the rest of the division
			        push h;pile the result
	       		        push b;pile the rest
	             	        push d;pil the return
ret
start: nop
		;resetting all the registers
		mvi b,00h;
		mvi c,00h;
		mvi d,00h;
		mvi e,00h;
		mvi h,00h;
		mvi l,00h;
		;dividend = 10
		mvi a,02h;
		sta v_dividend;
		;divisor = 2
		mvi a,02h;
		sta v_divisor;
		;zera result
		mvi a,00h;
		sta v_result;
	;load the values to BC
		lda v_dividend;
	mov b,a;
	lda v_divisor;
		mov c,a;
	;put the parameters on the stack
		push b;
	;call the division
		call para_divide_part;
	;recover the rest of the division
		pop b;
	mov a,b;
		sta v_rest
	;recover the rest of the division
		pop h;
		mov a,h;
		sta v_result

hlt;
  • factorial Interactive.
jmp start

;declaring the variables: fat, i, n; 
v_fat: ds 1;
v_i: ds 1;
v_n: ds 1;
;end of declaration;

start: nop; beginning of the program;
	
	mvi a, 05h; n <= 5 (registry A);	
	sta v_n; variable v_n stores the value recorder A;

call void_fatiter; call the method void_fatiter;

void_fatiter: nop; method fatiter {
	
	mvi a, 01h; fat <= 1 (recorder A);	
	sta v_fat; variable v_fat stores the value recorder A;

;begin do if (n > 0) { 
	
   	lda v_n; loads the value of the variable v_n to the recorder A;	
	mov b, a; moves the value of the register A to the recorder B;	
	mvi a, 00h; clears the register A;	
	cmp b; compares the value of register B with the recorder A;	
	jnz fim_if; jumps to function end_if if it is not zero (if the value isem B for = 0);

fim_if: jnc return_fat; call the function return_fat case o if is not made;

inicio_for: nop; beginning for (i = 1; i <= n; i++) {

	mvi a, 01h; i <= 1 (Recorder A);
	sta v_i; variable v_i stores the value recorder A;

r1:	nop; rotina 1;
	mov c, a; moves the value of the register A to the recorder C;
	lda v_n; loads the value of the variable v_n to the recorder A;
	cmp c; compares the value of register C with recorder A;
	jc r4; jumps to routine 4 se der carry;

r4: 	call multi; routine 4; call the function multi;

r3:	lda v_i; rotina 3; loads the value of the variable v_i to the recorder A;
	inr a; increment the value of the recorder A;
	sta v_i; variable v_i stores the value recorder A;
	jmp r1; jumps to routine 1;

r2:	call return_fat; routine 2; call the function return_fat;

multi:  nop; função multi;
	lda v_fat; loads the value of the variable v_fat to the recorder A;
	mov b, a; moves the value of the register A to the recorder B;
	lda v_i; carrega o valor da variavel v_i to the recorder A;
	mov d, a; loads the value of the recorder A to the recorder D;
	mov e, a; moves the value of the register A to the recorder E;
	cmp b; compares the value of the recorder B with the recorder A;
	jz r3; jumps to routine 3 if it is not zero;
	dcr d; decrements the value of the recorder D;
	lda v_fat; loads the value of the variable v_fat to the recorder A;

r5:	add b; rotina 5; soma o valor do registrador A com o valor do registrador B;
	dcr d; decrementa o valor do registrador D;
	jnz r5; pula para rotina 5 se não der zero;
	sta v_fat; variable v_fat stores the value recorder A;
	lda v_n; loads the value of the recorder v_n to the recorder A;
	cmp e; compares the value of the recorder E with the recorder A;
	jz r2; jumps to routine 2 se der zero;
	ret; return to calling multi;

;end for }
;end if }

return_fat: nop; function return_fat;

	lda v_fat; loads the value of the variable v_fat para o registrador A;

hlt; end;

References

External links