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!

quarta-feira, 22 de julho de 2015

ASSEMBLER 8085

;FR    La multiplication par additions successives
;PT    MULTIPLICACAO POR SOMAS SUCESSIVAS
;EN   Multiplication by successive additions

;FR    Le résultat est valable uniquement si moins d'un octet
;PT    O RESULTADO NAO PODE EXCEDER 1 BYTE
;EN   The result is only valid if less than one byte    

DADOS        EQU 2000h
CODIGO       EQU 3000h

                   ORG DADOS
NUM1:        DB 1    
NUM2:        DB 1   
   
       
                  ORG CODIGO
BEGIN:            LXI H,NUM1       ; HL APONTA NUM1
                        LDA NUM2;
                        CMP M                ; instrucctions to put
                        JC CONDICAO    ; the counter
                        MOV A,M            ; with the less number that we have
                        LXI H,NUM2       ; to multiply
CONDICAO:    MOV C,A   
                        INR C   
                        MVI A,0
LOOP:              DCR C
                        JZ FIM
                        ADD M
                        JMP LOOP
          
FIM:                RST 1



EN: The result of multiplying NUM1 by NUM2 is in the accumulator now at the end
FR: Le acumulateur va rester avec le resultat de la multiplication de le NUM1 e NUM2
PT: O resultado da multiplicação de NUM1 pelo NUM2 fica no acumulador 

means:         ça veux dire:          quer dizer:

A=NUM1xNUM2

very nice!



A lampada acesa     :)
     The lit lamp      
La lampe allumée   

It's very nice!   It's simple, ok. I intend to publish more interestings. its the begin.

terça-feira, 21 de julho de 2015

terça-feira, 14 de julho de 2015

FR: Petit programme assembler pour le 8085: Chercher le numero plus grand...

EN: Program assembler for the 8085 processor: Find the upper number...

PT: Programa assembler para o processador 8085: Procurar o maior numero...



; EN: program to find the upper number in a list TABELA of length LEN 
; FR: programme pour trouver le numero plus grand dans une list TABELA de dimension LEN
; PT: programa para encontrar o maior dum array TABELA de dimensao LEN
      

                 ORG 2000h
LEN:         DW 4          
TABELA:   DS 20
MAIOR:     DS 1
        

                  ORG 3000H

                  LXI H,LEN
                  MOV C,M
                  INX H
                  MOV B,M
                  LXI H,TABELA
                  MOV A,M

LOOP2:     INX H
                  DCX B
                  STA MAIOR
                  MOV A,B
                  ORA C
                  LDA MAIOR
                  JZ EXIT

                  CMP M 
IF:             JNC LOOP2

                 MOV A,M
                 MOV D,H
                 MOV E,L
       
FIM_DE_IF:    JMP LOOP2
         
       
EXIT        RST 1




quinta-feira, 4 de junho de 2015

Assembler 8085

EN: This program is intended to put the contents of memory "memx" in memory "memy" and the contents of "memy" in "memx"

FR: Ce programme est destiné à mettre le contenu de la mémoire "memx" en mémoire "memy" et le contenu de "memy" dans "memx"

PT: Neste programa pretende-se colocar o conteudo de memoria "memx" na memória  "memy" e o conteudo de "memy" em "memx"


dados      equ 5000h
codigo     equ 2000h

               org dados
memx      db 77h
memy      db 88h

               org codigo
inicio:     lxi h,memx
               mov b,m
               inx h
               mov a,m
               mov m,b
               sta memx
               rst 1


program firstexample;

    var name:string;

begin
    writeln('hello - Bonjour - ola');
    writeln;
    writeln('What is your name?');
    writeln('Qual é o teu nome?');
    writeln('Comment tu te appel?');
    readln(name);
    writeln('Hi ',name,'. Nice to meet you!');   
end.

------------------------------------------------------------------------------------------------------------------
Sample program that in the space of statements was declared a variable "name" that is a "string". We have the statement "readln" waiting for the introduction of a sequences of characters on the keyboard and places (in our case) in the variable "name". Then there is the "writeln" in which we use the contents of the variable "name" to the "output" of the "writeln" ...

Exemple de programme que dans l'espace des declarations a été déclaré "name"  qui est une variable  "string". Nous avons la déclaration "readln" en attente de l'introduction d'une des séquences de caractères sur le clavier et les lieux (dans notre cas) dans la variable "name" . Puis il ya le "writeln" dans laquelle nous utilisons le contenu de la variable "name" pour le "output" de la "writeln" ...

Exemplo de programa que no espaço das declarações foi declarada uma variavel "name" que é do tipo "string". Temos a instrução "readln" que espera a introdução de uma sequencias de caracteres no teclado e coloca (neste nosso caso) na variavel "name". Temos depois o "writeln"  em que usamos o conteudo da variavel "name" para o "output" do "writeln"... 
______________________________________________________________________________

And here we have the result of the program for the user Peter
Et ici, nous avons le résultat du programme pour l'utilisateur Peter
E temos aqui o resultado do programa para o utilizador Peter 


hello - Bonjour - ola

What is your name?
Qual é o teu nome?
Comment tu te appel?
Peter
Hi Peter. Nice to meet you!




And here we have the result of the program to the user Joana Dias
Et ici, nous avons le résultat du programme à l'utilisateur Joana Dias
E temos aqui o resultado do programa para a utilizadora Joana Dias


hello - Bonjour - ola

What is your name?
Qual é o teu nome?
Comment tu te appel?
Joana Dias
Hi Joana Dias. Nice to meet you!