Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Title : PINTA LABERINTO
- * Written by : FULGENCIO
- * Date : ABRIL 2018
- * Description: Laberinto en modo TEXTO a partir de un MAPA
- *-----------------------------------------------------------
- LF EQU $0A *Avance línea
- CR EQU $0D *Retorno carro
- ORG $1000
- START: ; first instruction of program
- MOVE.L #MAPA,A3
- CLR.L D2 *D2 contará las filas
- BUCLE
- MOVE.B (A3)+,D0 *Tomamos valor del mapa del laberinto
- CMP.B #2,D0
- BEQ OTRALINEA
- MOVE.B #' ',D1 *Espacio en blanco por defecto
- CMP.B #0,D0
- BEQ NOPINTA
- MOVE.B #'*',D1 *Cambia el caracter por una pared=*
- NOPINTA
- JSR PINTAPARED
- JMP BUCLE
- OTRALINEA
- MOVE.L #14,D0
- MOVE.L #SALTOLIN,A1
- TRAP #15
- ADD.L #1,D2
- CMP.L #7,D2 *Límite en 7 líneas
- BNE BUCLE
- SIMHALT
- PINTAPARED
- MOVE.L #6,D0 *Pinta el caracter que está en D1
- TRAP #15
- RTS
- * Put program code here
- SIMHALT ; halt simulator
- * Put variables and constants here
- SALTOLIN DC.B LF,CR,0
- MAPA DC.B 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,2
- DC.B 1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,2
- DC.B 1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,2
- DC.B 1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,1,2
- DC.B 1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,2
- DC.B 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,2
- DC.B 1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,2
- END START ; last line of source
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement