sábado, 25 de julho de 2015

Assembler 8085 String Copy

Assembler 8085     String Copy


 ;    PROGRAM STRING COPY   STRCPY DO C++

DADOS         EQU 2000h
CODIGO       EQU 3000h

        ORG DADOS
SDEST           DS 10  ; HL  String target
SFONTE        DS 6   ; BC  String source

        ORG CODIGO
BEGIN:       LXI H,SDEST;
                   LXI B,SFONTE

STRCPY:     LDAX B
                   ANA A
                   MOV M,A
                   JZ FIM
                   INX B
                   INX H
                   JMP STRCPY
FIM:           RST 1

_______________________________
              SYMBOL TABLE
 
 BEGIN           3000
 FIM                3011
 SDEST           2000
 SFONTE        200A
 STACK        S 0000
 STRCPY        3006


The string ends at the value 0.
at the following example x means d'ont care.

If the string SFONTE='John'
means SFONTE memory 200A= 'J' , 'o' , 'h' , 'n' , 0 , x
              SDEST memory 2000= x , x , x , x , x , x , x , x , x , x

after we run the program the memory is:
   string SFONTE='John'
   string  SDEST='John'
means SFONTE memory 200A= 'J' , 'o' , 'h' , 'n' , 0 , x
              SDEST memory 2000 = 'J' , 'o' , 'h' , 'n' , 0 , x , x , x , x , x

cool!

Sem comentários:

Enviar um comentário