changeset 16:03f9d6493148

Give the SAM setting routine a name. Give the SAM setting routine a name to make the code that calls it clearer.
author William Astle <>
date Wed, 24 Dec 2014 14:01:34 -0700
parents 58013a960ec6
children 972825b01d81
files dod.s
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Mon Dec 22 23:40:23 2014 -0700
+++ b/dod.s	Wed Dec 24 14:01:34 2014 -0700
@@ -388,7 +388,7 @@
 		lda #$3c			flags for data mode, no interrupts, sound enabled
 		sta 3,x				set side B for data mode
 		ldd #$2046			SAM value for "pmode 4" graphics, screen at $1000
-		jsr LC266			go set the SAM register
+		jsr setSAM			go set the SAM register
 		lda #$f8			value for "pmode 4", color set 1
 		sta 2,x				set VDG mode
 		ldx #V200			point to start of variables
@@ -646,17 +646,20 @@
 		leax 7,u
 		stx V2B9
 		puls x,pc
-LC266		pshs x,b,a			save registers
+; Set the SAM video mode and display offset register to the value in D. Starting at the lsb of
+; D, the SAM bits are programmed from FFC0 upward. This sets bits 9-0 of the SAM register
+; to match the value in D.
+setSAM		pshs x,b,a			save registers
 		ldx #SAMREG			point to SAM register
-LC26B		lsra				; shift the bit value to set to carry
+setSAM000	lsra				; shift the bit value to set to carry
 		rorb				;
-		bcs LC272			brif bit set
+		bcs setSAM001			brif bit set
 		sta ,x				clear the bit
 		skip2				skip next instruction
-LC272		sta 1,x				set the bit
+setSAM001	sta 1,x				set the bit
 		leax 2,x			move to next SAM register bit
 		cmpx #SAMREG+$14		are we at the end of the register?
-		blo LC26B			brif not
+		blo setSAM000			brif not
 		puls a,b,x,pc			restore registers and return
 ; IRQ service routine
 LC27D		ldx #PIA1
@@ -671,7 +674,7 @@
 		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
+		bsr setSAM			go program the SAM
 		clr pageswap			flag no swap needed
 LC29D		tst V29C
 		beq LC2A9