Vistas de página en total

89910

lunes, 19 de agosto de 2013

USO DE FOR...NEXT

    Este sería un ejemplo del uso de la macro for....next. Como se ve es idéntico a como sería en basic. No resulta por lo tanto difícil de usar.
   En este caso imprime 5 veces un mensaje indicando el contador de cada mensaje.




EJEMPLO FOR.MAC
; 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 stdio.mac
include Hi_nivel.mac

.model compact,pascal
.stack 100

.data

valor db 0,0,0,0
msgtexto db "Mensaje ",0

.code

p proc 
      main
     clrscr
  for valor,0,5
      gotoxy 10,valor
      mov ax,word ptr valor
      mov word ptr numero,ax
      puts msgtexto
      printf numero
  next valor
     exit 0
p endp
end p

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.