Vistas de página en total

Mostrando entradas con la etiqueta listado. Mostrar todas las entradas
Mostrando entradas con la etiqueta listado. Mostrar todas las entradas

jueves, 30 de enero de 2014

EMULADOR 8051 (6/12) (LISTADO)


   Como función superior a las anteriores está la que pongo hoy. Esta función generará el listado completo del programa sobre fichero, apoyándose en las anteriores: PRN_INST e INTERPRETE.

    Abrirá un fichero e irá enviando a él todas las líneas de programa desensambladas.



LISTADO.ASM


; Copyright (C) 2013  José Ángel Moneo Fernández

;    This program is free software: you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation, either version 3 of the License, or
;   (at your option) any later version.

;    This program is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.

;    You should have received a copy of the GNU General Public License
;    along with this program.  If not, see <http://www.gnu.org/licenses/

include main.mac
include string.mac
include io.mac

.model compact,pascal

        public listado
.data
extrn prn_ini:word
extrn prn_fin:word
extrn nombrelst:byte
public bufferprn
dato dw 0,0
bufferprn db 50 dup (0)
handle dw 0
nb dw 0
tab1 db " ",0
tab db "       ",0


.code
        
        extrn interpreta:near
        extrn prn_inst:near
        extrn Dma_on:near
        extrn Dma_off:near
listado proc near
        call Dma_on
        creat nombrelst,_Archivo,handle

        mov dx,prn_ini
 otro:
        mov dato,dx
        itoa bufferprn,dato,16
        strlen bufferprn
        mov nb,ax
        cmp ax,3
        jz t3
        strcat bufferprn,bufferprn,tab1
        cmp nb,2
        jz t3
        strcat bufferprn,bufferprn,tab1
t3:
        strcat bufferprn,bufferprn,tab
        call prn_inst
        strlen bufferprn
        mov nb,ax
        write handle,nb,bufferprn
n_prn:
        call interpreta
        mov bx,ax
        mov al,[bx]
        cmp al,0
        jz contado
        inc dx
        cmp al,2
        jz acuenta
        cmp al,4
        jz acuenta
        cmp al,5
        jz acuenta
        cmp al,8
        jnz contado
acuenta:
        inc dx
contado:
        cmp dx,prn_fin
        jae fin
        jmp otro
fin:
        close handle
        call Dma_off
        ret

listado endp

end listado