changeset 12:a1b93f4bd329

Named several variables. Added better names for several variables.
author William Astle <lost@l-w.ca>
date Mon, 21 Apr 2014 22:20:29 -0600
parents 258ca6c11b05
children 26d73f210da8
files dod.s
diffstat 1 files changed, 55 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Wed May 29 22:42:25 2013 -0600
+++ b/dod.s	Mon Apr 21 22:20:29 2014 -0600
@@ -88,7 +88,7 @@
 renderchar	macro noexpand
 		dod S04
 		endm
-; decode a 5 bit packed string from (X) to V335
+; decode a 5 bit packed string from (X) to stringbuf
 decodestrsb	macro noexpand
 		dod S05
 		endm
@@ -220,8 +220,8 @@
 V206		rmb 1
 V207		rmb 1
 V208		rmb 1
-V209		rmb 2				pointer to the parameter block of the currently shown screen
-V20B		rmb 2				pointer to the parameter block of the screen to use for drawing
+screenvis	rmb 2				pointer to the parameter block of the currently shown screen
+screendraw	rmb 2				pointer to the parameter block of the screen to use for drawing
 V20D		rmb 2				pointer to demo game command sequence
 V20F		rmb 2
 V211		rmb 2
@@ -242,8 +242,8 @@
 V228		rmb 1
 V229		rmb 2
 V22B		rmb 1
-V22C		rmb 1				the current level background colour mask
-V22D		rmb 1				the current light level, $ff means dark
+levbgmask	rmb 1				the current level background colour mask
+lightlevel	rmb 1				the current light level, $ff means dark
 lightcount	rmb 1				counter between pixels when drawing lines
 ybeg		rmb 2				start Y coord for line drawing
 xbeg		rmb 2				start X coord for line drawing
@@ -319,7 +319,7 @@
 V2B0		rmb 1
 V2B1		rmb 1
 V2B2		rmb 2
-V2B4		rmb 1				nonzero means we're ready to swap graphics screens during IRQ
+pageswap	rmb 1				nonzero means we're ready to swap graphics screens during IRQ
 V2B5		rmb 1
 V2B6		rmb 1
 V2B7		rmb 1				nonzero means nonstandard text location
@@ -341,8 +341,8 @@
 V311		rmb 2
 V313		rmb 32
 V333		rmb 2
-V335		rmb 34				temporary buffer used for decoding immediate packed strings
-V357		rmb 10				temporary buffer used for decoding font data
+stringbuf	rmb 34				temporary buffer used for decoding immediate packed strings
+fontbuf		rmb 10				temporary buffer used for decoding font data
 V361		rmb 31
 V380		rmb 2				screen start address of info text area
 V382		rmb 2				number of character cells in info text area
@@ -486,7 +486,7 @@
 		delay					;
 		fadeout
 		cleargfx2				clear second graphics screen
-		dec V2B4				flag graphics swap ready
+		dec pageswap				flag graphics swap ready
 		sync					wait for swap to happen
 		lda #2
 		ldu #LD7D5
@@ -569,7 +569,7 @@
 		bra LC1EC
 LC1C1		bsr LC17C
 		romcall CSRDON
-LC1C6		ldu V20B
+LC1C6		ldu screendraw
 		ldx ,u
 		bsr LC16D
 		bne LC1C6
@@ -664,15 +664,15 @@
 		lbpl LC320
 		lda #2
 		tfr a,dp
-		tst V2B4			do we have a screen swap to do?
+		tst pageswap			do we have a screen swap to do?
 		beq LC29D			brif not
-		ldd V209			get currently visible screen pointer
-		ldu V20B			get newly drawn screen pointer
-		std V20B			save current screen as screen to draw
-		stu V209			save drawn screen as current
+		ldd screenvis			get currently visible screen pointer
+		ldu screendraw			get newly drawn screen pointer
+		std screendraw			save current screen as screen to draw
+		stu screenvis			save drawn screen as current
 		ldd 4,u				get the SAM value for the new screen
 		bsr LC266			go program the SAM
-		clr V2B4			flag no swap needed
+		clr pageswap			flag no swap needed
 LC29D		tst V29C
 		beq LC2A9
 		com V29D
@@ -800,7 +800,7 @@
 		ble LC39F
 		ldx #LCB96
 		ldb a,x
-LC39F		stb V22D
+LC39F		stb lightlevel
 		rts
 ; SWI 1 routine
 ;***********************************************************************************************************
@@ -835,14 +835,14 @@
 ;
 ; V205		the horizontal centre point for rendering graphics and scaling
 ; V207		the vertical centre point for rendering graphics and scaling
-; V22D		the light level with respect to rendering the graphic
+; lightlevel	the light level with respect to rendering the graphic
 ; V24F		the horizontal scaling factor (binary point to the right of bit 7)
 ; V250		the vertical scaling factor (binary point to the right of bit 7)
 ; V251		nonzero if this is not the first coordinate in a polygon
 ; V252		the most recent absolute unscaled X coordinate
 ; V254		the most recent absolute unscaled Y coordinate
 LC3A2		clr V251			mark input as start of polygon
-		lda V22D			fetch dungeon light level
+		lda lightlevel			fetch dungeon light level
 		inca				is it $ff (dark)?
 		beq LC3F6			brif so - skip rendering
 LC3A9		ldb ,x				fetch input data
@@ -936,7 +936,7 @@
 LC448		ldx 12,s			fetch return address - string address
 		decodestrsb			go decode string
 		stx 12,s			save new return address - after string
-		ldx #V335			point to decoded string
+		ldx #stringbuf			point to decoded string
 		skip2				skip the next instruction - nothing to display yet
 LC452		renderchar			display character in A
 ; swi 3 routine
@@ -956,8 +956,8 @@
 		jsr LC9D4			go scroll the text area
 LC46C		stx 4,u				save new screen location
 		rts				return to caller
-; swi 5 routine - decode packed string at X to V335
-LC46F		ldu #V335			point to output buffer
+; swi 5 routine - decode packed string at X to stringbuf
+LC46F		ldu #stringbuf			point to output buffer
 ; swi 6 routine - decode a packed string at X to U
 ; the first value is the length of the string less one
 LC472		leay -1,u			point to working data before buffer
@@ -1046,11 +1046,11 @@
 		sta 3,s
 		rts
 ; swi 8 routine - clear first graphics screen
-LC4F3		ldu V209			point to first screen parameter block
+LC4F3		ldu screenvis			point to first screen parameter block
 		skip2				skip next instruction
 ; swi 9 routine - clear second graphics screen
-LC4F6		ldu V20B			point to second screen parameter block
-		ldb V22C			get current level background colour
+LC4F6		ldu screendraw			point to second screen parameter block
+		ldb levbgmask			get current level background colour
 		bsr LC517			go clear the graphics area of the screen
 		stu 10,s			save pointer to parameter block for the caller
 		rts				return to caller
@@ -1118,14 +1118,14 @@
 		sta V270
 LC578		dec V26F
 		jsr [V2B2]
-		dec V2B4			set graphics swap required
+		dec pageswap			set graphics swap required
 		sync				wait for swap to happen
 		dec V26E
 		lda V26E
 		cmpa #$f8
 		bgt LC578
 		cleargfx2
-		dec V2B4			set graphics swap required
+		dec pageswap			set graphics swap required
 		dec V228
 		clr keybufread			; reset keyboard buffer
 		clr keybufwrite			;
@@ -1133,7 +1133,7 @@
 LC595		cmpa #4
 		ble LC5AE
 LC599		jsr [V2B2]
-		dec V2B4			set graphics swap required
+		dec pageswap			set graphics swap required
 		sync				wait for swap to happen
 		inc V26F
 		inc V26E
@@ -1163,7 +1163,7 @@
 ; swi 13 routine
 LC5D9		ldu #V388
 		dec V2B7			set to nonstandard text area
-		lda V22C
+		lda levbgmask
 		coma
 		sta 6,u
 		clra
@@ -1214,7 +1214,7 @@
 LC640		decodestrsb
 		deca
 		bpl LC640
-		ldx #V335+1
+		ldx #stringbuf+1
 LC648		lda ,x+
 		sta ,u+
 		bpl LC648
@@ -1225,7 +1225,7 @@
 LC656		tst V228
 		bne LC65F
 		bsr LC660
-		dec V2B4			flag graphics swap required
+		dec pageswap			flag graphics swap required
 		sync				wait for swap to happen
 LC65F		rts
 LC660		pshs a,b,x,y,u
@@ -1310,11 +1310,11 @@
 		clr V29C
 		rts				return to caller
 LC6D7		pshs x,u			save registers
-		stb V22D			set illumination value for graphic rendering
+		stb lightlevel			set illumination value for graphic rendering
 		stb V29D
 		cleargfx2			clear second graphics screen
 		drawgraphic			go draw graphic
-		dec V2B4			flag graphics swap required
+		dec pageswap			flag graphics swap required
 		sync				wait for swap to happen
 		puls x,u,pc			restore registers and return
 ; swi 22 routine - display the PREPARE! screen
@@ -1325,7 +1325,7 @@
 		fcb $3c,$24,$58,$06		packed string "PREPARE!"
 		fcb $45,$d8
 		clr V2B7			reset to standard text rendering
-		dec V2B4			set graphic swap required
+		dec pageswap			set graphic swap required
 		rts				return to caller
 ; swi 23 routine
 LC6FB		ldu V20F
@@ -1422,7 +1422,7 @@
 LC7B6		lda V281
 		anda #1
 		nega
-		sta V22C
+		sta levbgmask
 		sta V396
 		sta V386
 		coma
@@ -1812,12 +1812,12 @@
 		mul				get offset in table
 		addd #LDB1B			add in base address of table
 		tfr d,x				put pointer somewhere useful
-		ldu #V357			point to buffer to decode glyph data
+		ldu #fontbuf			point to buffer to decode glyph data
 		decodestr			go decode a packed string
-		ldx #V357+7			point one past end of buffer
+		ldx #fontbuf+7			point one past end of buffer
 LCA39		lsl ,-x				; centre glyph data in byte
 		lsl ,x				;
-		cmpx #V357			at start of buffer?
+		cmpx #fontbuf			at start of buffer?
 		bhi LCA39			brif not - keep centring
 		ldu 6,s				get back U value
 LCA44		ldd 4,u				get display address location
@@ -1880,11 +1880,11 @@
 		std ,s				save step value
 		puls a,b,x,pc			restore registers and return
 LCAB4		jmp LCB8A			go return from the line drawing routine
-; Draw a line from (xbeg,ybeg) to (xend,yend) respecting the light level in the dungeon (V22D)
+; Draw a line from (xbeg,ybeg) to (xend,yend) respecting the light level in the dungeon (lightlevel)
 ; which is used as a step count between when to actually draw pixels.
 ;
 ; Variables used:
-; V22D		the current light level in the dungeon
+; lightlevel	the current light level in the dungeon
 ; lightcount	how many pixels left before we actually draw another
 ; ybeg		input start Y
 ; xbeg		input start X
@@ -1904,9 +1904,9 @@
 ; Note: ypstep+1 and xpstep+1 are also used as temporary holding values for the
 ; integer difference in the Y and X coordinates respectively.
 drawline	pshs a,b,x,y,u			save registers
-		inc V22D			are we completely dark?
+		inc lightlevel			are we completely dark?
 		beq LCAB4			brif so - we can short circuit drawing entirely
-		lda V22D			get light level in dungeon
+		lda lightlevel			get light level in dungeon
 		sta lightcount			save in working count (skip count for pixel drawing)
 		ldd xend			get end X coordinate
 		subd xbeg			subtract start X coordinate
@@ -1964,7 +1964,7 @@
 		ldy pixelcount			get number of pixels to draw
 LCB2E		dec lightcount			are we ready to draw another pixel (due to light level)?
 		bne LCB54			brif not
-		lda V22D			get light level
+		lda lightlevel			get light level
 		sta lightcount			reset current "pixel delay"
 		tst xcur			is X coordinate off the right of the screen?
 		bne LCB54			brif so
@@ -1975,7 +1975,7 @@
 		ldb xcur+1			get X coordinate lsb
 		andb #7				mask off low 3 bits for offset in byte
 		lda b,u				get pixel mask to use
-		tst V22C			currently using black background?
+		tst levbgmask			currently using black background?
 		beq LCB50			brif so
 		coma				invert mask for white background
 		anda ,x				merge in existing graphics data
@@ -2009,7 +2009,7 @@
 		leax b,x			move pointer appropriately
 LCB86		leay -1,y			have we drawn all the pixels?
 		bne LCB2E			brif not - draw another
-LCB8A		dec V22D			compensate for "inc" above
+LCB8A		dec lightlevel			compensate for "inc" above
 		puls a,b,x,y,u,pc		restore registers and return
 LCB8E		fcb $80,$40,$20,$10		pixels 0, 1, 2, 3 (left to right) in byte
 		fcb $08,$04,$02,$01		pixels 4, 5, 6, 7 (left to right) in byte
@@ -2065,7 +2065,7 @@
 		stb V279
 LCBFC		ldu #V313
 		decodestrsb
-		ldy #V335+1
+		ldy #stringbuf+1
 LCC05		ldb ,u+
 		bmi LCC17
 		cmpb ,y+
@@ -2078,7 +2078,7 @@
 LCC17		tst V278
 		bne LCC2B
 		inc V278
-		ldb V335
+		ldb stringbuf
 		std ,s
 LCC22		inca
 		dec V279
@@ -2274,7 +2274,7 @@
 LCDA6		fcb $03,$0c,$30,$c0
 LCDAA		fcb $01,$04,$10,$40
 LCDAE		fcb $02,$08,$20,$80
-LCDB2		ldu V20B
+LCDB2		ldu screendraw
 		ldd #$1f1f
 		std V27C
 LCDB9		ldd V27C
@@ -2409,7 +2409,7 @@
 		dec V275
 LCECE		pshs u
 		dod S00
-		ldu V20B
+		ldu screendraw
 		drawgraphic
 		puls u,pc
 LCED8		ldd V27C
@@ -3165,7 +3165,7 @@
 LD505		pshs a,b,x
 		jsr LC617
 		renderstr
-		lda V22C
+		lda levbgmask
 		sta 6,u
 		com V2B6
 		beq LD51E
@@ -3331,7 +3331,7 @@
 		bsr LD66D
 		bsr LD684
 LD667		bsr LD684
-LD669		dec V2B4			set graoguc swao required
+LD669		dec pageswap			set graoguc swao required
 		sync				wait for swap to happen
 		rts
 LD66D		andb #3
@@ -3373,7 +3373,7 @@
 		std xend
 		bsr LD6C0
 LD6C0		jsr drawline
-		com V22C
+		com levbgmask
 		rts
 LD6C6		fcb $10,$00,$10,$ff
 		fcb $ff,$88,$00,$88
@@ -3414,7 +3414,7 @@
 		addd V221
 		std V221
 		dod S0C
-		dec V2B4			set graphics swap required
+		dec pageswap			set graphics swap required
 		sync				wait for swap to happen
 		rts
 LD720		pshs a,b
@@ -3529,8 +3529,8 @@
 		fcb $80				V206
 		fcb 0				V207
 		fcb $4c				V208
-		fdb LD870			V209 - pointer to primary display screen info
-		fdb LD876			V20B - pointer to secondary display screen info
+		fdb LD870			screenvis - pointer to primary display screen info
+		fdb LD876			screendraw - pointer to secondary display screen info
 		fdb LD988			V20D - pointer to demo game command sequence
 		fdb VB15			V20F
 		fdb V2F1			V211