Skip to content

Commit

Permalink
Refactor: added <function_name>_end tags to all functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alanthonyc committed Apr 22, 2012
1 parent a84ee65 commit f985141
Showing 1 changed file with 53 additions and 33 deletions.
86 changes: 53 additions & 33 deletions wizwalk.dasm16
Expand Up @@ -5,7 +5,7 @@ set pc, main

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawDoorFacing

; locals:
set push, x
set push, y
set push, z
Expand Down Expand Up @@ -39,6 +39,7 @@ set z, 6
set a, 0x2006
jsr drawVerticalLine

:drawDoorFacing_end
set a, pop
set z, pop
set y, pop
Expand All @@ -53,7 +54,7 @@ set pc, pop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawDoorLeftNear

; locals:
set push, x
set push, y
set push, z
Expand Down Expand Up @@ -97,6 +98,7 @@ set z, 6
set a, 0x2007
jsr drawVerticalLine

:drawDoorLeftNear_end
set a, pop
set z, pop
set y, pop
Expand All @@ -111,7 +113,7 @@ set pc, pop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawDoorRightFar

; locals:
set push, x
set push, y
set push, z
Expand Down Expand Up @@ -155,6 +157,7 @@ set z, 3
set a, 0x2007
jsr drawVerticalLine

:drawDoorRightFar_end
set a, pop
set z, pop
set y, pop
Expand All @@ -169,7 +172,7 @@ set pc, pop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawMainWindow

; locals:
set push, x
set push, y
set push, z
Expand All @@ -194,6 +197,7 @@ set y, 0x0000
set z, 0x000a
jsr drawSquareRight

:drawMainWindow_end
set z, pop
set y, pop
set x, pop
Expand All @@ -207,7 +211,7 @@ set pc, pop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawMiddle

; locals
set push, x
set push, y
set push, z
Expand All @@ -232,6 +236,7 @@ set y, 0x0003
set z, 0x0005
jsr drawSquareRight

:drawMiddle_end
set z, pop
set y, pop
set x, pop
Expand All @@ -244,7 +249,6 @@ set pc, pop

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawFar

; locals:
set push, x
set push, y
Expand All @@ -270,6 +274,7 @@ set y, 0x0004
set z, 0x0002
jsr drawSquareRight

:drawFar_end
set z, pop
set y, pop
set x, pop
Expand All @@ -278,11 +283,10 @@ set pc, pop
;=================================================

;=================================================
;===| Draw a Solid Wall
;===| Draw Wall Facing

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawSolidWall

:drawWallFacing
; locals:
set push, x
set push, y
Expand All @@ -301,6 +305,7 @@ set z, 0x001e
set a, 0x2001
jsr drawHorizontalLine

:drawWallFacing_end
set a, pop
set z, pop
set y, pop
Expand All @@ -311,13 +316,11 @@ set pc, pop

;=================================================
;===| Drawing Functions
;===============
;=================================================

;===| Clear Screen

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:clearScreen

; locals:
set push, x

Expand All @@ -329,22 +332,21 @@ set [x], 0x0000
add x, 1
ifg 0x817f, x
set pc, clearNextCoordinate


:clearScreen_end
set x, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /


;===| Draw Lines

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:drawHorizontalLine
;Input:
; x - X coordinate of line origin
; y - Y coordinate of line origin
; z - length of line
; a - character to draw

; locals:
set push, i

Expand All @@ -363,6 +365,7 @@ set [x], a
ifg z, i
set PC, drawHorizontalLine_loop

:drawHorizontalLine_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand All @@ -374,7 +377,6 @@ set pc, pop
; y - Y coordinate of line origin
; z - length of line
; a - character to draw

; locals:
set push, i

Expand All @@ -393,6 +395,7 @@ set [x], a
ifg z, i
set PC, drawVerticalLine_loop

:drawVerticalLine_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand All @@ -405,7 +408,6 @@ set pc, pop
; x - X coordinate of line origin
; y - Y coordinate of line origin
; z - length of line

; locals:
set push, i

Expand All @@ -427,6 +429,7 @@ ifg z, i

set [x], 0x2002

:drawSquareTop_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand All @@ -437,7 +440,6 @@ set pc, pop
; x - X coordinate of line origin
; y - Y coordinate of line origin
; z - length of line

; locals:
set push, i

Expand All @@ -459,6 +461,7 @@ ifg z, i

set [x], 0x2005

:drawSquareBottom_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand All @@ -469,7 +472,6 @@ set pc, pop
; x - X coordinate of line origin
; y - Y coordinate of line origin
; z - length of line

; locals:
set push, i

Expand All @@ -488,6 +490,7 @@ set [x], 0x2006
ifg z, i
set PC, drawSquareLeft_loop

:drawSquareLeft_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand All @@ -498,7 +501,6 @@ set pc, pop
; x - X coordinate of line origin
; y - Y coordinate of line origin
; z - length of line

; locals:
set push, i

Expand All @@ -517,13 +519,13 @@ set [x], 0x2007
ifg z, i
set PC, drawSquareRight_loop

:drawSquareRight_end
set i, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
;=================================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \
:initStart

; locals:
set PUSH, a
set PUSH, b
Expand All @@ -535,6 +537,7 @@ set c, 0x8180
set a, border0
jsr loadtiles

:initStart_end
set c, pop
set b, pop
set a, pop
Expand All @@ -550,7 +553,6 @@ set pc, pop
; A = Data to Read
; B = Length
; C = Destination

; locals
set push,i

Expand All @@ -574,7 +576,6 @@ set pc, pop
:calculateCoordinateLocation
; Input: X, Y Cartesian Coordinates
; Output: Z for binary location

; locals:
set push, a

Expand All @@ -584,6 +585,7 @@ mul a, y
add z, a
add z, x

:calculateCoordinateLocation_end
set a, pop
set pc, pop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /
Expand Down Expand Up @@ -638,25 +640,43 @@ add b, 1
ife b, 16
set b, 0

ifn j, 0
set pc, faceTunnel

:faceSolidWall
set j, 1
add j, 1
ife j, 4
set j, 0

ife j, 1
set pc faceEast
ife j, 2
set pc faceSouth
ife j, 3
set pc faceWest

:faceNorth
jsr drawMainWindow
;jsr drawSolidWall
jsr drawDoorFacing
jsr drawMiddle
jsr drawFar
jsr drawDoorRightFar
jsr drawDoorLeftNear
set pc, inputLoop

:faceTunnel
set j, 0
:faceEast
jsr drawMainWindow
jsr drawWallFacing
set pc, inputLoop

:faceSouth
jsr drawMainWindow
jsr drawMiddle
jsr drawFar
jsr drawDoorRightFar
jsr drawDoorLeftNear
set pc, inputLoop

:faceWest
jsr drawMainWindow
jsr drawDoorFacing
set pc, inputLoop


; inifite loop at the end, otherwise, it falls through to some weird code and mucks up my screen
:end
set pc, end
Expand Down

0 comments on commit f985141

Please sign in to comment.