Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print macro cadena
- LOCAL ETIQUETA
- ETIQUETA:
- MOV ah,09h
- MOV dx,@data
- MOV ds,dx
- MOV dx, offset cadena
- int 21h
- endm
- getChar macro
- mov ah,01h
- int 21h
- endm
- getRuta macro buffer
- LOCAL INICIO,FIN
- xor si,si
- INICIO:
- getChar
- cmp al,0dh
- je FIN
- mov buffer[si],al
- inc si
- jmp INICIO
- FIN:
- mov buffer[si],00h
- endm
- abrirF macro ruta,handle
- mov ah,3dh
- mov al,00h
- lea dx,ruta
- int 21h
- mov handle,ax
- jc ErrorAbrir
- endm
- leerF macro numbytes,buffer,handle
- mov ah,3fh
- mov bx,handle
- mov cx,numbytes
- lea dx,buffer
- int 21h
- jc ErrorLeer
- endm
- cerrarF macro handle
- mov ah,3eh
- mov handle,bx
- int 21h
- jc ErrorCerrar
- endm
- operar macro sumando,restando,multiplicando,dividiendo
- LOCAL SUMA,RESTA,MULTIPLICACION,DIVICION,FIN
- cmp ax,43
- je SUMA
- cmp ax,45
- je RESTA
- cmp ax,42
- je MULTIPLICACION
- cmp ax,47
- je DIVICION
- jmp FIN
- SUMA:
- print sumando
- push ax
- jmp FIN
- RESTA:
- print restando
- push ax
- jmp FIN
- MULTIPLICACION:
- print multiplicando
- push ax
- jmp FIN
- DIVICION:
- print dividiendo
- push ax
- jmp FIN
- FIN:
- endm
- automata macro buffer,ApCorchete,CiCorchete,Reconocio,ReconocioMul,ReconocioDiv,ReconocioSum,ReconocioRes,ReconocioNum,ReconocioId,ReconocioObjeto,divisor,sumando,restando,multiplicando,dividiendo,almacenando,obteniendo,negativ,positiv,digito
- LOCAL INICIO,SUMARCORCHETE,RESTACORCHETE,FIN,OPERADOR
- xor ax,ax
- xor bx,bx
- xor cx,cx
- xor si,si
- INICIO:
- mov bl,buffer[si]
- cmp bl,123
- je SUMARCORCHETE
- cmp bl,125
- je RESTACORCHETE
- cmp bl,34
- je OPERADOR
- inc si
- jmp INICIO
- SUMARCORCHETE:
- ;print ApCorchete
- inc cx
- inc si
- jmp INICIO
- RESTACORCHETE:
- sub cx,1b
- inc si
- cmp cx,0
- je FIN
- cmp cx,2
- je OBTENER
- cmp cx,1
- je GUARDAR
- print CiCorchete
- pop ax
- pop ax
- pop ax
- operar sumando,restando,multiplicando,dividiendo,almacenando
- print divisor
- jmp INICIO
- OBTENER:
- print obteniendo
- jmp INICIO
- GUARDAR:
- print almacenando
- jmp INICIO
- OPERADOR:
- inc si
- mov bl,buffer[si]
- cmp bl,42
- je MULTIPLICACION
- cmp bl,109
- je MULTIPLICACION2
- cmp bl,47
- je DIVICION
- cmp bl,100
- je DIVICION2
- cmp bl,43
- je SUMA
- cmp bl,97
- je SUMA2
- cmp bl,45
- je RESTA
- cmp bl,115
- je RESTA2
- cmp bl,35
- je NUMERO
- cmp bl,105
- je ID
- cmp bl,111
- je OBJETO
- inc si
- jmp INICIO
- MULTIPLICACION:
- print ReconocioMul
- getChar
- mov ax,42
- push ax
- inc si
- jmp INICIO
- MULTIPLICACION2:
- inc si
- mov bl,buffer[si]
- cmp bl,117
- jne INICIO
- inc si
- mov bl,buffer[si]
- cmp bl,108
- jne INICIO
- print ReconocioMul
- getChar
- mov ax,42
- push ax
- inc si
- jmp INICIO
- DIVICION:
- print ReconocioDiv
- getChar
- mov ax,47
- push ax
- inc si
- jmp INICIO
- DIVICION2:
- inc si
- mov bl,buffer[si]
- cmp bl,105
- jne INICIO
- inc si
- mov bl,buffer[si]
- cmp bl,118
- jne INICIO
- print ReconocioDiv
- getChar
- mov ax,47
- push ax
- inc si
- jmp INICIO
- SUMA:
- print ReconocioSum
- getChar
- mov ax,43
- push ax
- inc si
- jmp INICIO
- SUMA2:
- inc si
- mov bl,buffer[si]
- cmp bl,100
- jne INICIO
- inc si
- mov bl,buffer[si]
- cmp bl,100
- jne INICIO
- print ReconocioSum
- getChar
- mov ax,43
- push ax
- inc si
- jmp INICIO
- RESTA:
- print ReconocioRes
- getChar
- mov ax,45
- push ax
- inc si
- jmp INICIO
- RESTA2:
- inc si
- mov bl,buffer[si]
- cmp bl,117
- jne INICIO
- inc si
- mov bl,buffer[si]
- cmp bl,98
- jne INICIO
- print ReconocioRes
- getChar
- mov ax,45
- push ax
- inc si
- jmp INICIO
- NUMERO:
- xor dx,dx
- add si,3
- mov bl,buffer[si]
- cmp bl,45
- jne POSITIVO
- inc si
- jmp NEGATIVO
- POSITIVO:
- mov bl,buffer[si]
- cmp bl,48
- jl POSITIVO2
- cmp bl,57
- jg POSITIVO2
- inc si
- inc dl
- print digito
- jmp POSITIVO
- POSITIVO2:
- print positiv
- getChar
- mov ax,45
- push ax
- jmp INICIO
- NEGATIVO:
- mov bl,buffer[si]
- cmp bl,48
- jl NEGATIVO2
- cmp bl,57
- jg NEGATIVO2
- inc si
- inc dl
- print digito
- getChar
- jmp NEGATIVO
- NEGATIVO2:
- print negativ
- mov ax,45
- push ax
- jmp INICIO
- ID:
- print ReconocioId
- getChar
- mov ax,45
- push ax
- inc si
- jmp INICIO
- OBJETO:
- print ReconocioObjeto
- getChar
- mov ax,45
- push ax
- inc si
- jmp INICIO
- FIN:
- print Reconocio
- endm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement