changeset 706:d68c6a6b1f38

aa fonts processor
author heinrichsweikamp
date Tue, 16 Apr 2013 15:40:27 +0200
parents 55983c4d6b2d
children 2129862bbfe6
files code_part1/OSTC_code_asm_part1/MAIN.ASM code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/display_lowlevel.asm code_part1/OSTC_code_asm_part1/outputs.asm code_part1/OSTC_code_asm_part1/strings.asm
diffstat 6 files changed, 116 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM	Tue Apr 16 15:40:27 2013 +0200
@@ -114,7 +114,7 @@
 #include	aa_fonts.asm
 
 ;=============================================================================
-    MESSG "OSTC - diving computer code,  Copyright (C) 2012 HeinrichsWeikamp"
+    MESSG "OSTC - diving computer code,  Copyright (C) 2013 HeinrichsWeikamp"
     MESSG "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the"
     MESSG "Free Software Foundation, either version 3 of the License, or (at your option) any later version."
     MESSG "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY"
@@ -122,9 +122,9 @@
     MESSG "You should have received a copy of the GNU General Public License along with this program.If not, see http://www.gnu.org/licenses/."
 
   ifdef __DEBUG
-   	MESSG "OSTC Mk.2 code compiled in DEBUG configuration!"
+   	MESSG "OSTC2 code compiled in DEBUG configuration!"
   else
-	MESSG "OSTC Mk.2 code compiled in RELEASE configuration!"
+	MESSG "OSTC2 code compiled in RELEASE configuration!"
   endif
 
 
--- a/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm	Tue Apr 16 15:40:27 2013 +0200
@@ -335,7 +335,7 @@
 		movff	aa_temp+1,PRODL         ; DISPLAY is big endian, so swap here.
 aa_decode_12:
 		btfss	aa_color_quart,ACCESS
-		bra		aa_decode_3
+		bra		aa_decode_12b
 
 		; Divide it once again by 2. Max red = 7/31.
 		rrcf	aa_temp+0,W,ACCESS      ; xxRRRxxG
@@ -350,32 +350,45 @@
 		movf	aa_temp+0,W,ACCESS      ; hence composants won't overlap.
 		addwfc	PRODH,F				    ; In right order, to propagate carry.
 
+aa_decode_12b:
         movff   win_flags,WREG          ; BEWARE: bank0 bit-test
         btfss   WREG,1                  ; Display1?
         bra		aa_decode_3			    ; No, Done.
 
-        ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'00RRRRRR 00GGGGGG 00BBBBBB'
+        ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
+                            ; PRODH     PRODL                  win_color4 win_color5 win_color6
         ; Blue
-        movff   PRODH,win_color3
+        movff   PRODL,win_color6
+        bcf     STATUS,C
+        rlcf    win_color6,F            ; = UUBBBBB0
         bcf     STATUS,C
-        rlcf    win_color3,F            ; = U0BBBBB0
-        bcf     win_color3,7            ; = 00BBBBB0
+        rlcf    win_color6,F            ; = UBBBBB00
+        bcf     STATUS,C
+        rlcf    win_color6,F            ; = BBBBB000
+        btfsc   win_color6,7
+        bsf     win_color6,2
+
         ; Green
-        rrcf    PRODL,F
         rrcf    PRODH,F
         rrcf    PRODL,F
         rrcf    PRODH,F
-        rrcf    PRODL,F                 ; = UUURRRRR
-        rrcf    PRODH,F                 ; = GGGGGGUU
-        bcf     STATUS,C
-        rrcf    PRODH,F                 ; = 0GGGGGGU
-        bcf     STATUS,C
-        rrcf    PRODH,F                 ; = 00GGGGGG
+        rrcf    PRODL,F
+        rrcf    PRODH,F                 ; = UUURRRRR
+        rrcf    PRODL,F                 ; = GGGGGGUU
+        bcf     PRODL,1                 ; = GGGGGG0U
+        bcf     PRODL,0                 ; = GGGGGG00
+        movff   PRODL,win_color5
+
         ; Red
         bcf     STATUS,C
-        rlcf    PRODL,F                 ; = UURRRRR0
-        bcf     PRODL,6                 ; = U0RRRRR0
-        bcf     PRODL,7                 ; = 00RRRRR0
+        rlcf    PRODH,F                 ; = UURRRRR0
+        bcf     STATUS,C
+        rlcf    PRODH,F                 ; = URRRRR00
+        bcf     STATUS,C
+        rlcf    PRODH,F                 ; = RRRRR000
+        btfsc   PRODH,7
+        bsf     PRODH,2
+        movff   PRODH,win_color4
 		bra		aa_decode_3			    ; Done.
 
 		; ---- Simple BLACK and WHITE cases ------------------------------
@@ -387,17 +400,42 @@
 		; WHITE pixel (ie. full color)
 		movff	win_color1,PRODH	    ; current draw color
 		movff	win_color2,PRODL	    ; (rem: DISPLAY is big endian)
-        setf    win_color3
-		bra		aa_decode_3
+		bra		aa_decode_12b
 
 aa_decode_2:
 		clrf	PRODH,A				    ; BLACK pixel
 		clrf	PRODL,A
-        clrf    win_color3
+        clrf    win_color4
+        clrf    win_color5
+        clrf    win_color6
 
 aa_decode_3:
 		;---- PIXEL WRITE LOOP -----------------------------------------------
-		AA_DATA_WRITE_PROD
+;		AA_DATA_WRITE_PROD
+    	bsf		DISPLAY_rs					; Data!
+
+        movff   win_flags,WREG          ; Display1? win_flags is in bank0...
+        btfsc   WREG,1                  ; Display1?
+        bra     aa_decode_3_display1    ; Yes.
+
+    	movff	PRODH,PORTD				; Move high byte to PORTD (DISPLAY is bigendian)
+        bcf		DISPLAY_rw
+        bsf		DISPLAY_rw
+        movff	PRODL,PORTD				; Move low byte to PORTD
+        bra     aa_decode_3_done
+
+aa_decode_3_display1:
+    	movff   win_color4,PORTD		; Move high byte to PORTD (DISPLAY is bigendian)
+        bcf		DISPLAY_rw
+        bsf		DISPLAY_rw
+        movff   win_color5,PORTD		; Move low byte to PORTD
+        bcf		DISPLAY_rw
+        bsf		DISPLAY_rw
+        movff   win_color6,PORTD        ; Move low(est) byte to PORTD
+aa_decode_3_done:
+        bcf		DISPLAY_rw
+        bsf		DISPLAY_rw
+
 		decf	aa_bitlen,F,ACCESS
 		bnz		aa_decode_3
 
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Apr 16 15:40:27 2013 +0200
@@ -139,6 +139,9 @@
 win_color1      res 1
 win_color2      res 1
 win_color3      res 1
+win_color4      res 1
+win_color5      res 1
+win_color6      res 1
 win_top         res 1           ; Box/text position (0..239).
 win_height      res 1           ; Box/text height (1..240)
 win_leftx2      res 1           ; Box/text position (0..159)
--- a/code_part1/OSTC_code_asm_part1/display_lowlevel.asm	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/display_lowlevel.asm	Tue Apr 16 15:40:27 2013 +0200
@@ -233,13 +233,13 @@
     	movlw	0x22					; Start Writing Data to GRAM
     	rcall	DISP_CmdWrite
     	bsf		DISPLAY_rs				; Data!
-    	movff	win_color1, PORTD
+    	movff	win_color4, PORTD
     	bcf		DISPLAY_rw
     	bsf		DISPLAY_rw				; Upper
-    	movff	win_color2, PORTD
+    	movff	win_color5, PORTD
     	bcf		DISPLAY_rw
     	bsf		DISPLAY_rw				; High
-    	movff	win_color3, PORTD
+    	movff	win_color6, PORTD
     	bcf		DISPLAY_rw
     	bsf		DISPLAY_rw				; Lower
     	return
@@ -527,34 +527,50 @@
 	movff	win_height,PRODL
     
 DISP_box3:                              ; loop width times
+    movff   win_flags,WREG              ; Display1? win_flags is in bank0...
+    btfsc   WREG,1                      ; Display1?
+    bra     DISP_box3aa                 ; Yes
+
 	movff	win_color1,PORTD
 	bcf		DISPLAY_rw
 	bsf		DISPLAY_rw                  ; Upper
 	movff	win_color2,PORTD
+    bra     DISP_box3a                  ; Done.
+DISP_box3aa:
+    movff	win_color4,PORTD
+	bcf		DISPLAY_rw
+	bsf		DISPLAY_rw                  ; Upper
+	movff	win_color5,PORTD
 	bcf		DISPLAY_rw
 	bsf		DISPLAY_rw                  ; Lower/High
-    movff   win_flags,WREG          ; Display1? win_flags is in bank0...
-    btfss   WREG,1                  ; Display1?
-    bra     DISP_box3a                  ; No
-    movff	win_color3,PORTD
-	bcf		DISPLAY_rw
-	bsf		DISPLAY_rw                  ; Lower
+	movff	win_color6,PORTD
 
 DISP_box3a:
+	bcf		DISPLAY_rw
+	bsf		DISPLAY_rw                  ; Lower/High
+
+    movff   win_flags,WREG              ; Display1? win_flags is in bank0...
+    btfsc   WREG,1                      ; Display1?
+    bra     DISP_box3ab                 ; Yes
+
 	movff	win_color1,PORTD
 	bcf		DISPLAY_rw
 	bsf		DISPLAY_rw                  ; Upper
 	movff	win_color2,PORTD
+    bra     DISP_box3b
+
+DISP_box3ab:
+    movff	win_color4,PORTD
 	bcf		DISPLAY_rw
-	bsf		DISPLAY_rw                  ; Lower/High
-    movff   win_flags,WREG          ; Display1? win_flags is in bank0...
-    btfss   WREG,1                  ; Display1?
-    bra     DISP_box3b                  ; No
-    movff	win_color3,PORTD
+	bsf		DISPLAY_rw                  ; Upper
+	movff	win_color5,PORTD
+	bcf		DISPLAY_rw
+	bsf		DISPLAY_rw                  ; High
+	movff	win_color6,PORTD
+
+DISP_box3b:
 	bcf		DISPLAY_rw
 	bsf		DISPLAY_rw                  ; Lower
-
-DISP_box3b:
 	decfsz	PRODL,F                     ; row loop finished ?
 	bra		DISP_box3                   ; No: continue.
 
@@ -567,7 +583,10 @@
     clrf    WREG                        ; Yes: switch to black
     movff   WREG,win_color1
     movff   WREG,win_color2
-    movff   WREG,win_color3             ; Yes.
+    movff   WREG,win_color3
+    movff   WREG,win_color4
+    movff   WREG,win_color5
+    movff   WREG,win_color6
 DISP_box4:
     movff   win_width,WREG
     cpfseq  PRODH
@@ -1114,10 +1133,7 @@
 DISP_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB'
 	movwf	DISPLAY1_temp				; Get 8Bit RGB b'RRRGGGBB'
 	movwf	DISPLAY2_temp				; Copy
-
-    movff   win_flags,WREG          ; Display1? win_flags is in bank0...
-    btfsc   WREG,1                  ; Display1?
-    bra     DISP_set_color_display1 ; Yes
+    movff   WREG,win_color6             ; Another (bank-safe) copy
 
     ; Display0
 	; Mask Bit 7,6,5,4,3,2
@@ -1222,9 +1238,15 @@
 
 	movff	DISPLAY1_temp,win_color1
 	movff	DISPLAY3_temp,win_color2	; Set Bank0 Color registers...
-	return
+
+    movff   win_flags,WREG          ; Display1? win_flags is in bank0...
+    btfss   WREG,1                  ; Display1?
+	return                          ; No
 
 DISP_set_color_display1:;Converts 8Bit RGB b'RRRGGGBB' into 24Bit RGB b'00RRRRRR 00GGGGGG 00BBBBBB'
+    movff   win_color6,DISPLAY1_temp
+    movff   win_color6,DISPLAY2_temp
+
 	; Mask Bit 7,6,5,4,3,2
 	movlw	b'00000011'
 	andwf	DISPLAY2_temp,F
@@ -1236,7 +1258,7 @@
 	movlw	b'10100000'
 	dcfsnz	DISPLAY2_temp,F
 	movlw	b'11111000'
-    movff   WREG,win_color3              ; B
+    movff   WREG,win_color6              ; B
 
 	movff	DISPLAY1_temp,	DISPLAY2_temp	; Copy
 	; Mask Bit 7,6,5,1,0
@@ -1260,7 +1282,7 @@
 	movlw	b'10000000'
 	dcfsnz	DISPLAY2_temp,F
 	movlw	b'11111100'
-    movff   WREG,win_color2              ; G
+    movff   WREG,win_color5              ; G
 
 	; Mask Bit 4,3,2,1,0
 	movlw	b'11100000'
@@ -1287,5 +1309,5 @@
 	movlw	b'10000000'
 	dcfsnz	DISPLAY1_temp,F
 	movlw	b'11111100'
-    movff   WREG,win_color1              ; R
+    movff   WREG,win_color4              ; R
 	return
--- a/code_part1/OSTC_code_asm_part1/outputs.asm	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/outputs.asm	Tue Apr 16 15:40:27 2013 +0200
@@ -2778,7 +2778,9 @@
         movff   WREG,win_color1
         movff   WREG,win_color2
         movff   WREG,win_color3
-        
+        movff   WREG,win_color4
+        movff   WREG,win_color5
+        movff   WREG,win_color6
         goto	DISP_box
 
 ;-----------------------------------------------------------------------------
--- a/code_part1/OSTC_code_asm_part1/strings.asm	Mon Apr 15 21:13:14 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/strings.asm	Tue Apr 16 15:40:27 2013 +0200
@@ -158,6 +158,9 @@
         movff   WREG,win_color1         ; Bank-safe addressing.
         movff   WREG,win_color2
         movff   WREG,win_color3
+        movff   WREG,win_color4
+        movff   WREG,win_color5
+        movff   WREG,win_color6
 box_common:
         VARARGS_BEGIN
             VARARGS_GET8    win_top