Vistas de página en total

89893

sábado, 6 de julio de 2013

CORTA CADENA





STRCUT.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
_modelo exe
_code
rutina _strcut destino,inicio,final,fuente

        PUSH SI
        PUSH DI
        PUSH ES
        PUSH DS
        POP ES

        MOV SI,[BP].fuente
        MOV DI,[BP].destino
        ADD SI,[BP].inicio
        MOV CX,[BP].FINAL
        SUB CX,[BP].INICIO
        CLD
   MAS: MOVSB
        CMP BYTE PTR [SI-1],0
        JZ FIN
        LOOP MAS
FIN:
        MOV BYTE PTR [DI],0
        POP ES
        POP DI
        POP SI
rutina_end
_data
_end

No hay comentarios:

Publicar un comentario

Si tienes algún comentario, duda o sugerencia, o si quieres aportar algún código creado a partir de las librerías expuestas aquí, por favor, indícamelo.