Mostrar mensagens com a etiqueta programming programação. Mostrar todas as mensagens
Mostrar mensagens com a etiqueta programming programação. Mostrar todas as mensagens

sábado, 24 de outubro de 2015


programa em pascal

program exemplo;
uses crt;
var quantidade:real;
   preco:real;
begin
  clrscr;
  writeln;
  writeln('Programa para calcular o custo total de uma certa quantidade');
  writeln('de mercadoria a um determinado preço');
  writeln;
  repeat
     writeln;
     writeln('quantas unidades ? "introduza 0 para saír"'); 
     readln(quantidade);
     if(quantidade>0) then
     begin
       writeln('qual o preço de cada unidade?');
       readln(preco);
       if(preco>0) then writeln(' tem a pagar ', quantidade*preco);
     end;
  until quantidade=0;
end.

------------------------ output do programa-----------------------------------------------






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!