gnusim8085-devel team mailing list archive
-
gnusim8085-devel team
-
Mailing list archive
-
Message #00373
Re: unable to use the memory address in the simulator Gnusim8085
Dear Ramesh,
Actually when we want to store any result in any particular memory location,
we would make use of ST opcode, but we (gnusim8085) have an alternate opcode
to do the same job, look at the following program, which assumes that the
initial data is stored in memory location 50, and then keeps on adding till
it finds 00, then it stores the results the memory location 4500 (LOB) and
4501 (HOD). Same logic can be made used to store the results in any memory
location.
The same example can be found in the previous releases but with results
stored at different memory location (80H and 81H).
Hope this helps.
;<Sum of Numbers>
; This program reads the numbers from the memory location 50 till it
;finds 00 (end of input) and then sums up and stores the result in
;4500(LOB),4501(HOB) respectively.
; this program demonstrates 1) comparision and 2) addition
jmp start
;code
start: LXI H,50 ;set up HL as memory pointer
MVI C,00H ;clear C to save sum
MOV B,C ;Clear B to save carry
nxtbyte: MOV A,M ; Transfer current reading to (A)
CPI 00h ;Is it last reading
JZ OUTPUT ;If yes go to output section
ADD C ;Add previous sun to accumulator
JNC SAVE ; Skip CY register if there is no carry
INR B ;Update carry register
SAVE: MOV C,A ;Save sum
INX H ; point to next reading
JMP nxtbyte ;Go back to get next reading
OUTPUT: LXI H,4500 ;Point to 080H memory location
MOV M,C ;Store low-order byte of sum in 080h
INX H ; ;Point to 081H memory location
MOV M,B
hlt
--
regards
On Tue, Feb 22, 2011 at 10:38 AM, Sridhar Ratnakumar <
sridhar.ratna@xxxxxxxxx> wrote:
> +list
>
> On Friday, January 21, 2011 at 8:41 AM, ramesh wrote:
>
> Sir,
>
> your software is wonderful. here our students from KLNCE are learning 8085
> programs by using your simulator.we felt one difficult in using the memory
> address. suppose if we want to store the result at memory location 4500,
> after the program execution, the updated result is not available at that
> memory location.
>
> is we need any requirement.
>
> awaiting your reply
>
> yours faithfully,
> G.Ramesh
> Asso. prof.
> KLNCE
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~gnusim8085-devel
> Post to : gnusim8085-devel@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~gnusim8085-devel
> More help : https://help.launchpad.net/ListHelp
>
>
References