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 GRÁFICO a partir de un MAPA
- *-----------------------------------------------------------
- WHITE EQU $FFFFFF
- BLACK EQU $000000
- ORG $1000
- START: ; first instruction of program
- MOVE.L #81,D0
- MOVE.L #WHITE,D1 *Relleno blanco
- TRAP #15
- MOVE.L #89,D0 *Rellena toda la pantalla
- MOVE.L #0,D1 *Desde el punto 0,0
- MOVE.L #0,D2
- TRAP #15
- MOVE.L #81,D0
- MOVE.L #BLACK,D1 *Relleno blanco
- TRAP #15
- CLR.L D1 *Inicializamos coordenadas en 0,0
- CLR.L D2
- MOVE.L #MAPA,A3
- BUCLE
- MOVE.B (A3)+,D0 *Tomamos valor del mapa del laberinto
- CMP.B #2,D0
- BEQ OTRALINEA
- CMP.B #0,D0
- BEQ NOPINTA
- JSR CUADRO20
- NOPINTA
- ADD.L #20,D1 *Avanza coordenada X
- JMP BUCLE
- OTRALINEA
- CLR.L D1 *Reinicia coordenada X
- ADD.L #20,D2 *Avanza coordenada Y
- CMP.L #140,D2 *Equivale a 7 líneas (7x20)
- BNE BUCLE
- SIMHALT
- CUADRO20 *Dibuja un cuadrito de 20x20 en coordenadas D1,D2
- MOVE.L #87,D0
- MOVE.L D1,D3
- MOVE.L D2,D4
- ADD.L #20,D3 *D3 es la coordenada X de la otra esquina
- ADD.L #20,D4 *D4 es la coordenada Y de la otra esquina
- TRAP #15
- RTS
- * Put program code here
- SIMHALT ; halt simulator
- * Put variables and constants here
- 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