Mercurial > public > mk2
changeset 123:6a94f96e9cea
The big cleanup, again.
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Thu Dec 30 23:45:20 2010 +0100 @@ -87,9 +87,11 @@ #include displaytext.asm ; sends texts to wordprocessor #include math.asm ; mathematical functions #include wait.asm ; waitroutines +#include oled_samsung.asm ; Attached in 80-System 8-Bit Mode +#include aa_wordprocessor.asm ; New antialiased word processor and fonts +#include color_processor.asm ; Color image drawing. #include valconv.asm ; outputs to POSTINC2 #include eeprom_rs232.asm ; Internal EEPROM and RS232 Interface -#include oled_samsung.asm ; Attached in 80-System 8-Bit Mode #include menu_custom.asm ; Menu "Custom FunctionsI" and "Custom FunctionsII" #include menu.asm ; Main Menu and Setup Menu #include menu_reset.asm ; Submenu "Reset" @@ -117,21 +119,11 @@ #include strings.asm ; Basic string operations ;============================================================================= -; Include C sub-routines automatically - -p3_wp code 0x09A00 ; Mark segment name into the .map file - - ifdef AAFONTS - ; New antialiased word processor and fonts - #include aa_wordprocessor.asm ; ASM wordprocessor under tests. - else - #include ostc_part3_wordprocessor_NEW_CURSOR_9A00_to_B960_jump_in_B410.txt ; Christians fonts... - endif +#include dive_icons.asm ; Draw dive type icons in surface mode. ;============================================================================= -; (should be after aa_wordprocessor) -#include color_processor.asm ; Color image drawing. -#include dive_icons.asm ; Draw dive type icons in surface mode. +; Extracted from p3_wordprocessor includes: +#include aa_fonts.asm ;============================================================================= MESSG "OSTC - diving computer code, Copyright (C) 2010 HeinrichsWeikamp GbR"
--- a/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm Thu Dec 30 23:45:20 2010 +0100 @@ -22,6 +22,7 @@ ; HISTORY ; 2010-11-22 : [jDG] Creation. ; 2010-12-01 : [jDG] Adding 3bits antialiased fonts. +; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0 ; ; BUGS : ; * If the three fonts are not in the same half of the PROM memory, TBLPTRU @@ -49,201 +50,208 @@ ; PRODH, PRODL (needed for array indexing) ; FSRx 12bits. Usefull as RAM pointers. ;============================================================================= +; Temporary variables are overlayed in bank 0 ACCESS, used also by C-code +; (p2_deco), MPLAB math abd stdlib libraries. + + CBLOCK 0x000 + aa_flags ; Various flags for aa_wordprocessor + aa_width:2 ; Width in pixels (0..319) + aa_bitlen ; Count of pixels when decoding bitmaps. + aa_start:2 ; PROM ptr to start of encoded bitmap + aa_end:2 ; and end of it. + aa_colorDiv:2 ; Current color, divided by 2 or 4 + ENDC ; Flags allocation: #define aa_antialias aa_flags,0 #define aa_color_quart aa_flags,1 #define aa_color_half aa_flags,2 -; Extracted from p3_wordprocessor includes: -#include aa_fonts.asm -aa_wp code ; Mark segment into the .map file - ;------------------------------------------------------------------------------ ; Setup pointers for a char: ; Inputs WREG = char to draw, win_font -; Output aa_start, aa_end, aa_height, aa_flags +; Output aa_start, aa_end, win_height, aa_flags ; Trashed PRODH, PRODL, TBLPTR, TABLAT ; aa_char_setup: - movwf PRODL,A ; save char into PROD for now. + movwf PRODL,A ; save char into PROD for now. - movf win_font,W,BANKED ; Get font number (updates Z flag) - bnz aa_char_1 + movf win_font,W,BANKED ; Get font number (updates Z flag) + bnz aa_char_1 - ; SMALL font ----------------------------------------------------- - ; Font SMALL character folding... + ; SMALL font --------------------------------------------------------- + ; Font SMALL character folding... aa_char_0: - movlw LOW aa_font28_block - movwf TBLPTRL,A - movlw HIGH aa_font28_block - movwf TBLPTRH,A - bra aa_char_3 + movlw LOW aa_font28_block + movwf TBLPTRL,A + movlw HIGH aa_font28_block + movwf TBLPTRH,A + bra aa_char_3 - ; MEDIUM font ---------------------------------------------------- + ; MEDIUM font -------------------------------------------------------- aa_char_1: - decfsz WREG,A ; This is medium font ??? - bra aa_char_2 + decfsz WREG,A ; This is medium font ??? + bra aa_char_2 - ; Font MEDIUM block: - movlw LOW aa_font48_block - movwf TBLPTRL,A - movlw HIGH aa_font48_block - movwf TBLPTRH,A - bra aa_char_3 + ; Font MEDIUM block: + movlw LOW aa_font48_block + movwf TBLPTRL,A + movlw HIGH aa_font48_block + movwf TBLPTRH,A + bra aa_char_3 - ; LARGE font ----------------------------------------------------- + ; LARGE font --------------------------------------------------------- aa_char_2: - ; Font LARGE block: - movlw LOW aa_font90_block - movwf TBLPTRL,A - movlw HIGH aa_font90_block - movwf TBLPTRH,A + ; Font LARGE block: + movlw LOW aa_font90_block + movwf TBLPTRL,A + movlw HIGH aa_font90_block + movwf TBLPTRH,A - ; Execute font block --------------------------------------------- + ; Execute font block ------------------------------------------------- aa_char_3: - ; This is safe iff the three fonts are in the same code segment - ; (and that segment do not span the 64K edge...) - movlw UPPER aa_font28_block - movwf TBLPTRU,A + ; This is safe iff the three fonts are in the same code segment + ; (and that segment do not span the 64K edge...) + movlw UPPER aa_font28_block + movwf TBLPTRU,A - ; Proceed to character substitutions + ; Proceed to character substitutions aa_char_30: - tblrd*+ ; Read FROM char - movf TABLAT,W ; Get it, and set Z,N - bz aa_char_32 ; Break at end of translations - - tblrd*+ ; Read TO char - cpfseq PRODL,A ; FROM == current char ? - bra aa_char_30 ; Different: loop - movff TABLAT, PRODL ; make substitution - bra aa_char_30 ; Loop. + tblrd*+ ; Read FROM char + movf TABLAT,W ; Get it, and set Z,N + bz aa_char_32 ; Break at end of translations + + tblrd*+ ; Read TO char + cpfseq PRODL,A ; FROM == current char ? + bra aa_char_30 ; Different: loop + movff TABLAT, PRODL ; make substitution + bra aa_char_30 ; Loop. - ; Make sure char is in the available range + ; Make sure char is in the available range aa_char_32: - tblrd*+ ; Read first char - movf TABLAT,W ; get it. - subwf PRODL,F ; (char - first) --> PRODL + tblrd*+ ; Read first char + movf TABLAT,W ; get it. + subwf PRODL,F ; (char - first) --> PRODL - tblrd*+ ; Read nb chars - movf TABLAT,W ; nbchars --> WREG - tblrd*+ ; Read default char - cpfslt PRODL ; if char > WREG ? - movff TABLAT,PRODL ; replace PRODL + tblrd*+ ; Read nb chars + movf TABLAT,W ; nbchars --> WREG + tblrd*+ ; Read default char + cpfslt PRODL ; if char > WREG ? + movff TABLAT,PRODL ; replace PRODL - ; Decode font height and anti-aliasing mode - clrf aa_flags,BANKED ; Default to no AA - tblrd*+ ; Read font height + AA flag - movf TABLAT,W ; into WREG - bnn aa_char_34 ; High bit set ? - bsf aa_antialias,BANKED ; YES : then the font is AA. -aa_char_34 - andlw 0x7F ; Keep just font height, - movwf aa_height,BANKED ; then save it (its a register) + ; Decode font height and anti-aliasing mode + clrf aa_flags,ACCESS ; Default to no AA + tblrd*+ ; Read font height + AA flag + movf TABLAT,W ; into WREG + bnn aa_char_34 ; High bit set ? + bsf aa_antialias,ACCESS ; YES : then the font is AA. +aa_char_34: + andlw 0x7F ; Keep just font height, + movwf win_height,BANKED ; then save it (its a register) - ; Set PROM pointer to the char index - movf PRODL,W ; Read back char - mullw 2 ; PROD = 2*(char - base), TBLPTR=idx - movf PRODL,W - addwf TBLPTRL,F ; Add into TBLPTR (low byte) - movf PRODH,W - addwfc TBLPTRH,F ; and high byte. + ; Set PROM pointer to the char index + movf PRODL,W ; Read back char + mullw 2 ; PROD = 2*(char - base), TBLPTR=idx + movf PRODL,W + addwf TBLPTRL,F ; Add into TBLPTR (low byte) + movf PRODH,W + addwfc TBLPTRH,F ; and high byte. - ; Read start and stop pointers - tblrd*+ ; aa_start = PROM16(*tblptr++) - movff TABLAT,aa_start ; Read low byte - tblrd*+ - movff TABLAT,aa_start+1 ; and high byte + ; Read start and stop pointers + tblrd*+ ; aa_start = PROM16(*tblptr++) + movff TABLAT,aa_start+0 ; Read low byte + tblrd*+ + movff TABLAT,aa_start+1 ; and high byte - tblrd*+ ; aa_end = PROM16(*tblptr++) - movff TABLAT,aa_end ; Read low byte - tblrd*+ - movff TABLAT,aa_end+1 ; and high byte + tblrd*+ ; aa_end = PROM16(*tblptr++) + movff TABLAT,aa_end+0 ; Read low byte + tblrd*+ + movff TABLAT,aa_end+1 ; and high byte - return + return ;------------------------------------------------------------------------------ ; Character width -; Inputs aa_start, aa_end, aa_width, aa_height, aa_flags +; Inputs aa_start, aa_end, aa_width, win_height, aa_flags ; Output width added to aa_width ; Trashed aa_bitlen, TBLPTR, TABLAT ; aa_char_width: - movff aa_start, TBLPTRL ; TBLPTR = aa_start - movff aa_start+1, TBLPTRH - clrf aa_bitlen,BANKED ; clear reminders... + movff aa_start+0, TBLPTRL ; TBLPTR = aa_start + movff aa_start+1, TBLPTRH + clrf aa_bitlen,ACCESS ; clear reminders... - ; Read bitmap byte, and decode length: + ; Read bitmap byte, and decode length: aa_char_width_1: - ifdef AA_BYTE_SWAP - btg TBLPTRL,0,A ; Toggle low ptr bit. - tblrd* - movf TABLAT,W,A ; Store to WREG - btg TBLPTRL,0,A ; Get is back - tblrd*+ ; then increment (but trash TABLAT) - movwf TABLAT,A ; Then restore copy to TABLAT. - else - tblrd*+ ; Normal read... - movf TABLAT,W,A ; Store copy to WREG - endif - btfss aa_antialias,BANKED ; Antialiased font ? - bra aa_char_width_10 ; No: always 7 bits count + ifdef AA_BYTE_SWAP + btg TBLPTRL,0,A ; Toggle low ptr bit. + tblrd* + movf TABLAT,W,A ; Store to WREG + btg TBLPTRL,0,A ; Get is back + tblrd*+ ; then increment (but trash TABLAT) + movwf TABLAT,A ; Then restore copy to TABLAT. + else + tblrd*+ ; Normal read... + movf TABLAT,W,A ; Store copy to WREG + endif + btfss aa_antialias,ACCESS ; Antialiased font ? + bra aa_char_width_10 ; No: always 7 bits count - bn aa_char_width_10 ; Non-white pixels ? - andlw 0x1F ; Yes : 5 bits count. + bn aa_char_width_10 ; Non-white pixels ? + andlw 0x1F ; Yes : 5 bits count. aa_char_width_10: - andlw 0x7F ; No: 7 bit count. - incf WREG,A ; WREG = repetition count - addwf aa_bitlen,F,BANKED ; Add remaining pixels from last code. - - movf aa_height,W,BANKED ; WREG = - height - negf WREG,A + andlw 0x7F ; No: 7 bit count. + incf WREG,A ; WREG = repetition count + addwf aa_bitlen,F,ACCESS ; Add remaining pixels from last code. + + movf win_height,W,BANKED ; WREG = - height + negf WREG,A - ; This is a hand-made division by successive substraction of height + ; This is a hand-made division by successive substraction of height aa_char_width_2: - addwf aa_bitlen,F,BANKED ; Try to substract aa_height - bn aa_char_width_3 ; If neg it was a bad idea... + addwf aa_bitlen,F,ACCESS ; Try to substract win_height + bn aa_char_width_3 ; If neg it was a bad idea... - infsnz aa_width,F,BANKED ; Succeded: do a 12bit increment - incf aa_width+1,F,BANKED ; on the aa_width counter. - bra aa_char_width_2 ; and loop. + infsnz aa_width+0,F,ACCESS ; Succeded: do a 16bit increment + incf aa_width+1,F,ACCESS ; on the aa_width counter. + bra aa_char_width_2 ; and loop. aa_char_width_3: - negf WREG,A ; WREG = +height - addwf aa_bitlen,F,BANKED ; Restore true reminder. + negf WREG,A ; WREG = +height + addwf aa_bitlen,F,ACCESS ; Restore true reminder. - ; Are we done ? - movf TBLPTRL,W,A ; Compare TBLPTR to aa_end - cpfseq aa_end,BANKED - bra aa_char_width_1 ; Loop if LOW is different - movf TBLPTRH,W,A - cpfseq aa_end+1,BANKED ; Loop to if HIGH is different - bra aa_char_width_1 + ; Are we done ? + movf TBLPTRL,W,A ; Compare TBLPTR to aa_end + cpfseq aa_end+0,ACCESS + bra aa_char_width_1 ; Loop if LOW is different + movf TBLPTRH,W,A + cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different + bra aa_char_width_1 - return + return ;------------------------------------------------------------------------------ ; String width ; Inputs letter (SHOULD BE NULL TERMINATED) -; Output aa_width, aa_height +; Output aa_width, win_height ; Trashed PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, aa_flags ; aa_string_width: - lfsr FSR2, letter ; FSR2 pointer to start of string. + lfsr FSR2, letter ; FSR2 pointer to start of string. - clrf aa_width,BANKED ; Clear width sum. - clrf aa_width+1,BANKED ; (12 bit counter) + clrf aa_width+0,ACCESS ; Clear width sum. + clrf aa_width+1,ACCESS ; (16 bit counter) aa_string_width_1: - movf POSTINC2,W,A ; WREG = *FSR2++ - bz aa_string_width99 ; Exit if null byte encountered. + movf POSTINC2,W,A ; WREG = *FSR2++ + bz aa_string_width99 ; Exit if null byte encountered. - rcall aa_char_setup ; setup aa_start / aa_end - rcall aa_char_width ; sum-up width into aa_width - bra aa_string_width_1 ; and loop. + rcall aa_char_setup ; setup aa_start / aa_end + rcall aa_char_width ; sum-up width into aa_width + bra aa_string_width_1 ; and loop. aa_string_width99: - return + return ;------------------------------------------------------------------------------ ; Fast macros to write to OLED display. @@ -255,200 +263,202 @@ ; Trash : WREG ; AA_CMD_WRITE macro cmd - movlw cmd - bcf oled_rs ; Cmd mode - movwf PORTD,A - bcf oled_rw ; Tick the clock - bsf oled_rw - endm + movlw cmd + rcall PLED_CmdWrite +; bcf oled_rs ; Cmd mode +; movwf PORTD,A +; bcf oled_rw ; Tick the clock +; bsf oled_rw + endm ; ; Input : PRODH:L as 16bits data. ; Output : NONE ; Trash : NONE ; AA_DATA_WRITE_PROD macro - bsf oled_rs ; Data mode - movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! - bcf oled_rw ; Tick the clock - bsf oled_rw - movff PRODL,PORTD - bcf oled_rw ; Tick the clock - bsf oled_rw - endm + rcall PLED_DataWrite_PROD +; bsf oled_rs ; Data mode +; movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! +; bcf oled_rw ; Tick the clock +; bsf oled_rw +; movff PRODL,PORTD +; bcf oled_rw ; Tick the clock +; bsf oled_rw + endm ;------------------------------------------------------------------------------ ; Output OLED Window Address commands. -; Inputs : win_top, win_leftx2, aa_height, aa_width. +; Inputs : win_top, win_leftx2, win_height, aa_width. ; Output : PortD commands. ; Trashed: PROD ; aa_box_cmd: - movf win_leftx2,W,BANKED ; Compute left = 2*leftx2 - mullw 2 - AA_CMD_WRITE 0x35 ; this is the left border - AA_DATA_WRITE_PROD + movf win_leftx2,W,BANKED ; Compute left = 2*leftx2 + mullw 2 + AA_CMD_WRITE 0x35 ; this is the left border + AA_DATA_WRITE_PROD - movf aa_width,W,BANKED ; right = left + width - 1 - addwf PRODL,F,A - movf aa_width+1,W,BANKED - addwfc PRODH,F,A - decf PRODL,F,A ; decrement result - bc aa_box_cmd_1 ; No borrow (/Carry) ? skip propagating. - decf PRODH,F,A + movf aa_width+0,W,ACCESS ; right = left + width - 1 + addwf PRODL,F,A + movf aa_width+1,W,ACCESS + addwfc PRODH,F,A + decf PRODL,F,A ; decrement result + bc aa_box_cmd_1 ; No borrow (/Carry) ? skip propagating. + decf PRODH,F,A aa_box_cmd_1: - AA_CMD_WRITE 0x36 ; Write and the right border - AA_DATA_WRITE_PROD + AA_CMD_WRITE 0x36 ; Write and the right border + AA_DATA_WRITE_PROD - movf win_top,W,BANKED ; Write top / bottom window - movwf PRODH,A ; (remember PRODH output first) - addwf aa_height,W,BANKED - decf WREG,A - movwf PRODL,A ; And PRODL is later... - AA_CMD_WRITE 0x37 - AA_DATA_WRITE_PROD + movf win_top,W,BANKED ; Write top / bottom window + movwf PRODH,A ; (remember PRODH output first) + addwf win_height,W,BANKED + decf WREG,A + movwf PRODL,A ; And PRODL is later... + AA_CMD_WRITE 0x37 + AA_DATA_WRITE_PROD - movf win_top,W,BANKED ; Start ptr top - mullw 1 ; Load into PRODH:L - AA_CMD_WRITE 0x20 - AA_DATA_WRITE_PROD + movf win_top,W,BANKED ; Start ptr top + mullw 1 ; Load into PRODH:L + AA_CMD_WRITE 0x20 + AA_DATA_WRITE_PROD - movf win_leftx2,W,BANKED ; Start ptr left - mullw 2 - AA_CMD_WRITE 0x21 - AA_DATA_WRITE_PROD + movf win_leftx2,W,BANKED ; Start ptr left + mullw 2 + AA_CMD_WRITE 0x21 + AA_DATA_WRITE_PROD - return + return ;------------------------------------------------------------------------------ ; Decode a compressed char. -; Inputs aa_start, aa_end, aa_height, win_invert, win_color1, win_color2 +; Inputs aa_start, aa_end, win_height, win_invert, win_color1, win_color2 ; Output none ; Trashed TBLPTR, TABLAT, PROD, aa_bitlen, aa_flags, aa_colorDir:2 ; aa_decode_char: - movff aa_start, TBLPTRL ; TBLPTR = aa_start - movff aa_start+1, TBLPTRH + movff aa_start+0, TBLPTRL ; TBLPTR = aa_start + movff aa_start+1, TBLPTRH - ; Read bitmap byte, and decode color & length + ; Read bitmap byte, and decode color & length aa_decode_1: - ifdef AA_BYTE_SWAP - btg TBLPTRL,0,A ; Toggle low ptr bit. - tblrd* - movf TABLAT,W,A ; Store to WREG - btg TBLPTRL,0,A ; Get is back - tblrd*+ ; then increment (but trash TABLAT) - movwf TABLAT,A ; Then restore copy to TABLAT. - else - tblrd*+ ; Normal read... - movf TABLAT,W,A ; Store copy to WREG - endif - btfss aa_antialias,BANKED ; Antialiased font ? - bra aa_decode_10 ; No: always 7 bits count - bn aa_decode_10 ; Non-white pixels ? - andlw 0x1F ; Yes : 5 bits count. + ifdef AA_BYTE_SWAP + btg TBLPTRL,0,A ; Toggle low ptr bit. + tblrd* + movf TABLAT,W,A ; Store to WREG + btg TBLPTRL,0,A ; Get is back + tblrd*+ ; then increment (but trash TABLAT) + movwf TABLAT,A ; Then restore copy to TABLAT. + else + tblrd*+ ; Normal read... + movf TABLAT,W,A ; Store copy to WREG + endif + btfss aa_antialias,ACCESS ; Antialiased font ? + bra aa_decode_10 ; No: always 7 bits count + bn aa_decode_10 ; Non-white pixels ? + andlw 0x1F ; Yes : 5 bits count. aa_decode_10: - andlw 0x7F ; No: 7 bit count. - incf WREG,A - movwf aa_bitlen,BANKED ; repetition count --> aa_bitlen + andlw 0x7F ; No: 7 bit count. + incf WREG,A + movwf aa_bitlen,ACCESS ; repetition count --> aa_bitlen - ;---- COLOR DECODING --------------------------------------------- - ; - ; Code Normal Inverse - ; 1xx 0% 100% : Managed by aa_decode_13 - ; 011 25% 75% - ; 010 50% 50% - ; 001 75% 25% - ; 000 100% 0% : Managed by aa_decode_13 too. - ; - movf TABLAT,W,A ; Get back code - btfss aa_antialias,BANKED ; Antialiased font ? - bra aa_decode_13 ; NO: 1bit case + ;---- COLOR DECODING ------------------------------------------------- + ; + ; Code Normal Inverse + ; 1xx 0% 100% : Managed by aa_decode_13 + ; 011 25% 75% + ; 010 50% 50% + ; 001 75% 25% + ; 000 100% 0% : Managed by aa_decode_13 too. + ; + movf TABLAT,W,A ; Get back code + btfss aa_antialias,ACCESS ; Antialiased font ? + bra aa_decode_13 ; NO: 1bit case - ; Asymetry test: 1xx code is another case for 1bit color. - ; This have to be done before inverse video, because - ; of the asymetric processing ! - bn aa_decode_13 ; decode as not-aa + ; Asymetry test: 1xx code is another case for 1bit color. + ; This have to be done before inverse video, because + ; of the asymetric processing ! + bn aa_decode_13 ; decode as not-aa - ; Manage 000 special case too: - andlw 0xE0 ; Select color bits - bz aa_decode_13 ; That's a 000 ! + ; Manage 000 special case too: + andlw 0xE0 ; Select color bits + bz aa_decode_13 ; That's a 000 ! - ; Apply reverse video, in a reversed way - btfss win_invert,0 ; Inverse video mode ? - sublw 0x80 + ; Apply reverse video, in a reversed way + btfss win_invert,0 ; Inverse video mode ? + sublw 0x80 - ; Move the two bits to aa_color_half and aa_color_quarter: - swapf WREG ; --> 0000.0LL0 byte - iorlw b'001' ; We are in AA mode, don't forget it ! - movwf aa_flags ; save that to aa_color_(half/quad)/AA flags. + ; Move the two bits to aa_color_half and aa_color_quarter: + swapf WREG ; --> 0000.0LL0 byte + iorlw b'001' ; We are in AA mode, don't forget it ! + movwf aa_flags,ACCESS ; save that to aa_color_(half/quad)/AA flags. - ;---- 2 bit x RGB(16bits) computation ---------------------------- - clrf PRODL ; We will accumulate result here... - clrf PRODH + ;---- 2 bit x RGB(16bits) computation -------------------------------- + clrf PRODL ; We will accumulate result here... + clrf PRODH - ; Take color div 2 into aa_colorDiv. Max red = 15/31 - rrcf win_color1,W,BANKED ; xRRRRxGG - andlw b'01111011' ; 0RRRR0GG (don't change C) - movwf aa_colorDiv+0,BANKED - rrcf win_color2,W,BANKED ; GGGxBBBB - andlw b'11101111' ; GGG0BBBB - movwf aa_colorDiv+1,BANKED + ; Take color div 2 into aa_colorDiv. Max red = 15/31 + rrcf win_color1,W,BANKED ; xRRRRxGG + andlw b'01111011' ; 0RRRR0GG (don't change C) + movwf aa_colorDiv+0,ACCESS + rrcf win_color2,W,BANKED ; GGGxBBBB + andlw b'11101111' ; GGG0BBBB + movwf aa_colorDiv+1,ACCESS - btfss aa_color_half - bra aa_decode_12 + btfss aa_color_half,ACCESS + bra aa_decode_12 - movff aa_colorDiv+0,PRODH ; Add color/2 if bit set. - movff aa_colorDiv+1,PRODL ; OLED is big endian, so swap here. + movff aa_colorDiv+0,PRODH ; Add color/2 if bit set. + movff aa_colorDiv+1,PRODL ; OLED is big endian, so swap here. aa_decode_12: - btfss aa_color_quart - bra aa_decode_3 + btfss aa_color_quart,ACCESS + bra aa_decode_3 - ; Divide it once again by 2. Max red = 7/31. - rrcf aa_colorDiv+0,W,BANKED ; xxRRRxxG - andlw b'00111001' ; 00RRR00G (don't change C) - movwf aa_colorDiv+0,BANKED - rrcf aa_colorDiv+1,W,BANKED ; GGGxxBBB - andlw b'11100111' ; GGG00BBB - movwf aa_colorDiv+1,BANKED + ; Divide it once again by 2. Max red = 7/31. + rrcf aa_colorDiv+0,W,ACCESS ; xxRRRxxG + andlw b'00111001' ; 00RRR00G (don't change C) + movwf aa_colorDiv+0,ACCESS + rrcf aa_colorDiv+1,W,ACCESS ; GGGxxBBB + andlw b'11100111' ; GGG00BBB + movwf aa_colorDiv+1,ACCESS - movf aa_colorDiv+1,W,BANKED ; Add color/4 - addwf PRODL,F ; NOTE: 7/31+15/31=22/31, - movf aa_colorDiv+0,W,BANKED ; hence composants won't overlap. - addwfc PRODH,F ; In right order, to propagate carry. + movf aa_colorDiv+1,W,ACCESS ; Add color/4 + addwf PRODL,F ; NOTE: 7/31+15/31=22/31, + movf aa_colorDiv+0,W,ACCESS ; hence composants won't overlap. + addwfc PRODH,F ; In right order, to propagate carry. - bra aa_decode_3 ; Done. + bra aa_decode_3 ; Done. - ; ---- Simple BLACK and WHITE cases ------------------------------ + ; ---- Simple BLACK and WHITE cases ------------------------------ aa_decode_13: ; Got a 1xx or a 000 code... - btfsc win_invert,0 ; Inverse video mode ? - xorlw 0x80 ; YES: invert levels. - bn aa_decode_2 ; Then test high bit. + btfsc win_invert,0 ; Inverse video mode ? + xorlw 0x80 ; YES: invert levels. + bn aa_decode_2 ; Then test high bit. - ; WHITE pixel (ie. full color) - movff win_color1,PRODH ; current draw color - movff win_color2,PRODL ; (rem: OLED is big endian) - bra aa_decode_3 + ; WHITE pixel (ie. full color) + movff win_color1,PRODH ; current draw color + movff win_color2,PRODL ; (rem: OLED is big endian) + bra aa_decode_3 aa_decode_2: - clrf PRODH,A ; BLACK pixel - clrf PRODL,A + clrf PRODH,A ; BLACK pixel + clrf PRODL,A aa_decode_3: - ;---- PIXEL WRITE LOOP ------------------------------------------- - AA_DATA_WRITE_PROD - decf aa_bitlen,BANKED - bnz aa_decode_3 + ;---- PIXEL WRITE LOOP ----------------------------------------------- + AA_DATA_WRITE_PROD + decf aa_bitlen,F,ACCESS + bnz aa_decode_3 - ;---- BYTE-CODE LOOP --------------------------------------------- - ; Are we done ? - movf TBLPTRL,W,A ; Compare TBLPTR to aa_end - cpfseq aa_end,BANKED - bra aa_decode_1 ; Loop if LOW is different - movf TBLPTRH,W,A - cpfseq aa_end+1,BANKED ; Loop to if HIGH is different - bra aa_decode_1 - - return + ;---- BYTE-CODE LOOP ------------------------------------------------- + ; Are we done ? + movf TBLPTRL,W,A ; Compare TBLPTR to aa_end + cpfseq aa_end+0,ACCESS + bra aa_decode_1 ; Loop if LOW is different + movf TBLPTRH,W,A + cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different + bra aa_decode_1 + + return ;------------------------------------------------------------------------------ ; Setup pointers for a char: @@ -456,28 +466,28 @@ ; Output : OLED commands on port D + clocks. ; aa_wordprocessor: - ; Make sure context is well known - movlb HIGH aa_start ; Switch to bank 0... + ; Make sure context is well known + movlb HIGH win_top ; Switch to bank 0... - rcall aa_string_width ; Set aa_height, compute aa_width - rcall aa_box_cmd ; Use that for the box. + rcall aa_string_width ; Set win_height, compute win_width + rcall aa_box_cmd ; Use that for the box. - ; Restart the loop for each char to print - lfsr FSR2, letter ; FSR2 pointer to start of string. + ; Restart the loop for each char to print + lfsr FSR2, letter ; FSR2 pointer to start of string. - ; DATA bloc commande: - AA_CMD_WRITE 0x22 + ; DATA bloc commande: + AA_CMD_WRITE 0x22 aa_wordprocessor_1: - movf POSTINC2,W,A ; WREG = *FSR2++ - bz aa_wordprocessor_99 ; Exit if null byte encountered. + movf POSTINC2,W,A ; WREG = *FSR2++ + bz aa_wordprocessor_99 ; Exit if null byte encountered. - rcall aa_char_setup ; setup aa_start / aa_end - rcall aa_decode_char ; sum-up width into aa_width - bra aa_wordprocessor_1 ; and loop. + rcall aa_char_setup ; setup aa_start / aa_end + rcall aa_decode_char ; write pixels to screen + bra aa_wordprocessor_1 ; and loop. aa_wordprocessor_99: - ; END of bloc commande - AA_CMD_WRITE 0x00 + ; END of bloc commande + AA_CMD_WRITE 0x00 - return + return
--- a/code_part1/OSTC_code_asm_part1/color_processor.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/color_processor.asm Thu Dec 30 23:45:20 2010 +0100 @@ -20,7 +20,8 @@ ; Copyright (c) 2010, JD Gascuel. ;============================================================================= ; HISTORY -; 2010-12-13 : [jDG] Creation +; 2010-12-13 : [jDG] Creation. +; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0 ; ; RATIONALS: The OSTC have a nice color screen, and a std geek attitude impose ; to show off ... ;-) @@ -49,22 +50,17 @@ ; bf is 16 pixels of color .11 ; F1 F2 F3 04 is 0x1235 pixels of color 0. ; -;Temporary overlay (in bank 0) -img_width equ aa_width -img_height equ aa_height -img_top equ win_top -img_left equ win_leftx2 -img_pixelsL equ aa_start+0 -img_pixelsH equ aa_start+1 -img_pixelsU equ aa_end+0 -img_countL equ aa_end+1 -img_countH equ aa_colorDiv+0 -img_colors equ aa_colorDiv+1 -colorTable equ letter - -;----------------------------------------------------------------------------- -; Make an entry in the link map. -color_processor code +;Temporary overlay (in bank 0), ACCESS area + CBLOCK 0x000 + img_colors + img_width:2 ; SHOULD be @1, because of aa_box_cmd + img_pixelsL + img_pixelsH + img_pixelsU + img_countL + img_countH + colorTable:.30 + ENDC ;----------------------------------------------------------------------------- color_image: @@ -74,7 +70,7 @@ tblrd*+ movff TABLAT,img_width tblrd*+ - movff TABLAT,img_height + movff TABLAT,win_height tblrd*+ movff TABLAT,img_colors tblrd*+ @@ -91,8 +87,8 @@ ; Compute width * height * 2 : the number of pixels to write. clrf img_pixelsU - movf img_width,W ; Compute number of pixels to draw - mulwf img_height ; 0 .. 160x240 + movf img_width,W,ACCESS ; Compute number of pixels to draw + mulwf win_height ; 0 .. 160x240 bcf STATUS,C ; BEWARE: milw does not reset carry flag ! rlcf PRODL ; x2 --> 0 .. 320x240, might by > 0xFFFF rlcf PRODH @@ -141,7 +137,7 @@ xorlw 0xF0 ; Get back index. swapf WREG ; Get color index to lower bits. addwf WREG ; x2 - addlw LOW(letter) ; 0x60 + 2 * .15 < 0x80. + addlw LOW(colorTable) ; 0x60 + 2 * .15 < 0x80. movff WREG,FSR2L movff POSTINC2,PRODL movff POSTINC2,PRODH
--- a/code_part1/OSTC_code_asm_part1/customview.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Thu Dec 30 23:45:20 2010 +0100 @@ -174,6 +174,7 @@ bra surfcustomview_toggle_exit surfcustomview_init_interval: + call PLED_standard_color DISPLAYTEXT d'189' ; Surface DISPLAYTEXT d'240' ; Interval: call PLED_interval ; Display the interval
--- a/code_part1/OSTC_code_asm_part1/definitions.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Thu Dec 30 23:45:20 2010 +0100 @@ -35,8 +35,6 @@ #DEFINE FT_MEDIUM .1 #DEFINE FT_LARGE .2 -#DEFINE AAFONTS ; The nicer fonts (not working yet...) - ; Color Definitions: 8Bit RGB b'RRRGGGBB' ;#DEFINE color_red b'11100000' #DEFINE color_blue b'00000011' @@ -84,22 +82,13 @@ win_color1 win_color2 win_top + win_height ; String (and font) height win_leftx2 + win_width ; String width (more than 255 for aa_wordprocessor !) win_font win_invert - wp_temp ENDC - ifdef AAFONTS - CBLOCK - aa_flags ; Various flags for aa_wordprocessor - aa_width:2 ; String width (more than 255...) ! - aa_height ; String (and font) height - aa_bitlen ; Count of pixels when decoding bitmaps. - aa_start:2 ; PROM ptr to start of encoded bitmap - aa_end:2 ; and end of it. - aa_colorDiv:2 ; Current color, divided by 2 or 4 - ENDC - endif + ; the following is used by the C-code up to 0x0E0!! CBLOCK 0x0E0 ;Bank 0 gf_decolist_copy:.32 @@ -126,18 +115,12 @@ textlength textaddress:2 - LastSetRow - LastSetColumn average_depth_hold:4 ; Holds Sum of depths b0_lo ; Temp (calculate_average) b0_hi ; Temp (calculate_average) average_divesecs:2 ; Used for resetable average depth display surface_interval:2 ; Surface Interval [mins] - draw_box_temp1 - draw_box_temp2 - draw_box_temp3 - flag1 ;Flag register 33 flag2 flag3 @@ -181,7 +164,7 @@ timer1int_counter2 ;Timer 1 counter uart1_temp ;RS232 temp variables - uart2_temp;70 + uart2_temp ;70 divA:2 ;math routines divB @@ -329,18 +312,9 @@ logbook_temp6 ; Temp used in logbook display&Divemode&Gassetup convert_value_temp:3 ; used in menu_battery_state_convert_date - box_temp:5 time_correction_value ; Adds to Seconds on midnight ENDC - ifndef AAFONTS - CBLOCK - win_color1_temp - win_color2_temp ; Backup color registers - ENDC - endif - - CBLOCK 0x200 ;Bank 2 int_O_tissue_for_debug:.32 ; deco_debug copies pressure of tissue to this variable int_O_GF_spare____:2; // 0x240 @@ -422,8 +396,6 @@ char_I_deco_gas_change3; // 0x568 new in v.102 char_I_deco_gas_change4; // 0x569 new in v.102 char_I_deco_gas_change5; // 0x56A new in v.102 - - ENDC CBLOCK 0x700 ;Bank 7 @@ -459,13 +431,6 @@ char_O_hash:.16 ; MD2 hash values = d'16' ENDC - -; C-code Routines -; PART 3 - ifndef AAFONTS - #DEFINE main_wordprocessor 0x0B468 - endif - ; C-code Routines ; PART 2 extern deco_calc_CNS_decrease_15min
--- a/code_part1/OSTC_code_asm_part1/dive_icons.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/dive_icons.asm Thu Dec 30 23:45:20 2010 +0100 @@ -28,6 +28,9 @@ ; ; Known bug: ;============================================================================= +mixtype_icons code + +;============================================================================= ; Display either Air, Nitrox, or Trimix icon (in surface mode). ; Inputs: None: explore the gaz list. ; Ouputs: None. @@ -46,9 +49,9 @@ ;---- Common setup ----------------------------------------------- movlw .170 - movff WREG, img_top + movff WREG, win_top movlw .110 - movff WREG, img_left + movff WREG, win_leftx2 movlw UPPER(dive_air_block) movwf TBLPTRU @@ -135,7 +138,7 @@ movwf TBLPTRL dive_gaz_99: - rcall color_image + call color_image movlb 1 ; Back to bank 1. return
--- a/code_part1/OSTC_code_asm_part1/menu.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu.asm Thu Dec 30 23:45:20 2010 +0100 @@ -490,15 +490,7 @@ bsf leftbind output_16dp d'3' bcf leftbind - movlw 'k' - movwf POSTINC2 - movlw 'g' - movwf POSTINC2 - movlw '/' - movwf POSTINC2 - movlw 'l' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "kg/l" return toggle_salinity_reset2:
--- a/code_part1/OSTC_code_asm_part1/menu_battery.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm Thu Dec 30 23:45:20 2010 +0100 @@ -42,19 +42,14 @@ movff EEDATA,hi bsf leftbind output_16 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 + STRCAT " (" read_int_eeprom d'52' ; Get complete cycles movff EEDATA,lo read_int_eeprom d'53' movff EEDATA,hi bsf leftbind output_16 - movlw ')' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ")" WIN_TOP .65 lfsr FSR2,letter @@ -80,9 +75,7 @@ bsf leftbind output_16dp d'2' bcf leftbind - movlw 'V' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "V" WIN_TOP .125 lfsr FSR2,letter @@ -108,12 +101,7 @@ bsf leftbind ; left orientated output output_16dp d'2' bcf leftbind - movlw '°' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 + STRCAT "° (" read_int_eeprom d'56' ; Month movff EEDATA,convert_value_temp+0 read_int_eeprom d'57' ; Day @@ -121,11 +109,7 @@ read_int_eeprom d'58' ; Year movff EEDATA,convert_value_temp+2 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - movlw ')' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ") " WIN_TOP .185 lfsr FSR2,letter @@ -139,12 +123,7 @@ bsf leftbind ; left orientated output output_16dp d'2' bcf leftbind - movlw '°' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 + STRCAT "° (" read_int_eeprom d'61' ; Month movff EEDATA,convert_value_temp+0 read_int_eeprom d'62' ; Day @@ -152,11 +131,7 @@ read_int_eeprom d'63' ; Year movff EEDATA,convert_value_temp+2 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - movlw ')' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ") " menu_battery_state5: btfss SWITCH2
--- a/code_part1/OSTC_code_asm_part1/menu_custom.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm Thu Dec 30 23:45:20 2010 +0100 @@ -178,11 +178,11 @@ WIN_INVERT .0 ; Init new Wordprocessor menu_custom_functions1: - call PLED_standard_color + call PLED_standard_color ; Trash EEADRH... - movlw d'1' - btfss customfunction_page ; Use Page II... - movlw d'0' + movlw d'1' ; So restore it ! + btfss customfunction_page ; Use Page II ? + movlw d'0' ; NO: this is page 1. movwf EEADRH clrf timeout_counter2 @@ -199,11 +199,7 @@ addwf lo,F output_99x - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ": " movf customfunction_temp1,W ; start of custom function descriptors addwf decodata+0,W ; add # of current custom function, place result in wreg @@ -232,46 +228,19 @@ menu_custom_functions10a: WIN_LEFT .20 WIN_TOP .65 - lfsr FSR2,letter - movlw '+' - movwf POSTINC2 - movlw '/' - movwf POSTINC2 - movlw '-' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCPY "+/-: " movlw '+' btfsc first_FA movlw '-' movwf POSTINC2 call word_processor - WIN_LEFT .20 WIN_TOP .95 - lfsr FSR2,letter - movlw '1' - movwf POSTINC2 - movlw '/' - movwf POSTINC2 - movlw '1' - movwf POSTINC2 - movlw '0' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw '1' - movwf POSTINC2 + STRCPY "1/10: 1" movlw '0' btfsc second_FA movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " menu_custom_functions10b: WIN_LEFT .20 @@ -299,6 +268,7 @@ call read_eeprom ; Highbyte movff EEDATA,hi + call PLED_standard_color ; Changed by color swatches, but trash EEADRH... call display_customfunction ; End of mask: min/max and the exit line... @@ -411,9 +381,13 @@ movff EEADRH, FSR1H ; Backup... rcall display_formated + incf WREG ; Color swatch drawn ? + bz display_customfunction_1 ; YES: skip line fill... + rcall cf_fill_line call word_processor +display_customfunction_1: movff FSR1H, EEADRH return @@ -443,10 +417,7 @@ WIN_INVERT 1 cf_min_passed: - movlw '>' ; A min value follows - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "> " ; A min value follows movff cf_min, lo rcall display_formated @@ -474,10 +445,7 @@ WIN_INVERT 1 cf_max_passed: - movlw '<' ; A max value follows - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "< " ; A max value follows movff cf_max, lo rcall display_formated @@ -526,8 +494,7 @@ cf_type_01: ; Type == 1 is CF_PERCENT mode bcf leftbind output_8 - movlw '%' - movwf POSTINC2 + PUTC '%' retlw 0 cf_type_02: ; Type == 2 is CF_DECI mode. @@ -559,33 +526,28 @@ cf_type_06: ; Type == 6 is CF_SECS mode (mm:ss or hh:mm) clrf hi call convert_time ; Convert to min:sec into hi:low. - movff lo,wp_temp ; Save seconds, + movff lo,TABLAT ; Save seconds for later. movff hi,lo ; Get minutes bsf leftbind ; Skip leading space(s). output_8 ; Print them - movlw ':' ; Separator - movwf POSTINC2 - movff wp_temp,lo ; Get back seconds + PUTC ':' ; Separator + movff TABLAT,lo ; Get back seconds output_99x ; lo in 2 digits with trailing zeros. retlw 0 cf_type_07: ; Type == 7 is CF_COLOR swatch. bcf leftbind ; Keep leading space (better alignement) output_8 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " movf lo,W ; Get color. - movff WREG,box_temp+0 ; Set color - movff win_top,WREG ; BEWARE : this is a bank0 variable ! - movff WREG,box_temp+1 ; row top (0-239) - addlw .23 - movff WREG,box_temp+2 ; row bottom (0-239) + call PLED_set_color + movlw .23 + movff WREG,win_height ; row bottom (0-239) movlw .110 - movff WREG,box_temp+3 ; column left (0-159) - movlw .148 - movff WREG,box_temp+4 ; column right (0-159) + movff WREG,win_leftx2 ; column left (0-159) + movlw .148-.110+1 + movff WREG,win_width ; column right (0-159) call PLED_box retlw -1 ; wp already done. Skip it... @@ -606,8 +568,7 @@ sublw (LOW letter) + .18 ; Remaining chars to fill: (letter + 18) - PTR btfsc STATUS,N ; Add chars until none left... return - movlw ' ' - movwf POSTINC2 + PUTC ' ' bra cf_fill_line ;----------------------------------------------------------------------------- @@ -799,18 +760,10 @@ WIN_INVERT .1 ; Init new Wordprocessor call PLED_warnings_color - lfsr FSR2,letter - movlw ' ' - movwf POSTINC2 - movlw 'C' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 + STRCPY " CF" movff cf_checker_counter,lo output_99x - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " ; When failed, increment counter modulo 64, to restart checks. incf cf_checker_counter,W
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Thu Dec 30 23:45:20 2010 +0100 @@ -55,14 +55,12 @@ movf waitms_temp,W ; Load row into WREG movff WREG,win_top lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 + PUTC 'G' movff decodata+0,lo incf lo,F bsf leftbind output_99 - movlw ':' - movwf POSTINC2 + PUTC ':' movf decodata+0,W call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases @@ -78,8 +76,7 @@ decf EEDATA,W ; 0-4 cpfseq decodata+0 ; =current displayed gas #? bra menu_gassetup_Tx ; no, do not display * - movlw '*' ; display * - movwf POSTINC2 + PUTC '*' ; display * ; New v1.44se menu_gassetup_Tx: @@ -107,8 +104,7 @@ call read_eeprom ; O2 value movff EEDATA,lo output_8 - movlw '/' - movwf POSTINC2 + PUTC '/' incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM call read_eeprom ; He value movff EEDATA,lo @@ -135,12 +131,7 @@ ; New v1.44se menu_gassetup_O2: - movlw 'O' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "O2 " output_8 bra menu_gassetup_list0 @@ -149,27 +140,13 @@ cpfseq lo ; o2 = 21% call menu_gassetup_Err - movlw 'A' - movwf POSTINC2 - movlw 'I' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "AIR " output_8 bra menu_gassetup_list0 ; New v1.44se menu_gassetup_Err: - movlw 'E' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "ERR " output_8 ; Changed v1.44se @@ -183,22 +160,14 @@ movff WREG,win_top lfsr FSR2,letter - movlw ' ' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw 'n' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT " in " movf decodata+0,W ; read current value addlw d'28' ; offset in memory movwf EEADR call read_eeprom ; Low-value movff EEDATA,lo output_8 - movlw 'm' - movwf POSTINC2 + PUTC 'm' movf decodata+0,W call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases call word_processor @@ -332,15 +301,8 @@ WIN_TOP .65 WIN_LEFT .20 - lfsr FSR2,letter - movlw 'O' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + + STRCPY "O2: " movf divemins+0,W addlw 0x06 @@ -348,20 +310,7 @@ call read_eeprom ; O2 value movff EEDATA,lo output_8 - movlw '%' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 - movlw 'M' - movwf POSTINC2 - movlw 'O' - movwf POSTINC2 - movlw 'D' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCAT "% (MOD:" ; Show MOD in m GETCUSTOM8 .18 ; ppO2 warnvalue in WREG @@ -383,46 +332,17 @@ subwfb xC+1,F movff xC+1,hi output_16 - movlw 'm' - movwf POSTINC2 - movlw ')' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m) " WIN_TOP .95 - lfsr FSR2,letter - movlw 'H' - movwf POSTINC2 - movlw 'e' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCPY "He: " movf divemins+0,W addlw 0x07 movwf EEADR call read_eeprom ; He value movff EEDATA,lo output_8 - movlw '%' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 - movlw 'E' - movwf POSTINC2 - movlw 'N' - movwf POSTINC2 - movlw 'D' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCAT "% (END:" ; Show END in m GETCUSTOM8 .18 ; ppO2 warnvalue in WREG @@ -473,29 +393,10 @@ subwfb xC+1,F movff xC+1,hi output_16 - movlw 'm' - movwf POSTINC2 - movlw ')' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - - call word_processor + STRCAT_PRINT "m) " WIN_TOP .125 - lfsr FSR2,letter - movlw '+' - movwf POSTINC2 - movlw '/' - movwf POSTINC2 - movlw '-' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCPY "+/-: " movlw '+' btfsc first_FA movlw '-' @@ -511,19 +412,14 @@ call read_eeprom ; Default O2 value movff EEDATA,lo output_8 - movlw '/' - movwf POSTINC2 + PUTC '/' movf divemins+0,W addlw 0x05 movwf EEADR call read_eeprom ; Default He value movff EEDATA,lo output_8 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " call wait_switches ; Waits until switches are released, resets flag if button stays pressed! call PLED_menu_cursor @@ -774,12 +670,7 @@ bra active_gas_display_end active_gas_display_no: - movlw ' ' ; three spaces instead of "Yes" - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT " " ; three spaces instead of "Yes" active_gas_display_end: call word_processor @@ -788,8 +679,7 @@ WIN_LEFT .20 lfsr FSR2,letter OUTPUTTEXT .88 ; First Gas? - movlw ' ' - movwf POSTINC2 + PUTC ' ' movlw d'33' movwf EEADR @@ -802,12 +692,7 @@ bra menu_firstgas1 menu_firstgas0: - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT " " ; 3 spaces. menu_firstgas1: call word_processor @@ -985,11 +870,7 @@ incf lo,F bsf leftbind output_99 - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ": " WIN_TOP .2 WIN_LEFT .50 @@ -1014,8 +895,7 @@ call read_eeprom ; O2 value movff EEDATA,lo output_8 ; Write O2 - movlw '/' - movwf POSTINC2 + PUTC '/' movf divemins+0,W addlw 0x07 movwf EEADR @@ -1047,12 +927,7 @@ ; New v1.44se gassetup_title_bar4: - movlw 'O' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "O2 " output_8 bra gassetup_title_bar7 @@ -1061,72 +936,37 @@ cpfseq lo ; o2 = 21% bra gassetup_title_bar6 - movlw 'A' - movwf POSTINC2 - movlw 'I' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "AIR " output_8 bra gassetup_title_bar7 ; New v1.44se gassetup_title_bar6: ; ERROR - movlw 'E' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw 'R' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "ERR " output_8 bra gassetup_title_bar7 gassetup_title_bar7: - movlw ' ' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw 'n' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT " in " movf decodata+0,W ; read current value addlw d'28' ; offset in memory movwf EEADR call read_eeprom ; Low-value movff EEDATA,lo output_8 - movlw 'm' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT_PRINT "m " - call word_processor WIN_INVERT .0 ; Init new Wordprocessor return ; New v1.44se gassetup_write_Nx: - movlw 'N' - movwf POSTINC2 - movlw 'X' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "NX " return ; New v1.44se gassetup_write_Tx: - movlw 'T' - movwf POSTINC2 - movlw 'X' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "TX " return gassetup_show_ppO2:
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Thu Dec 30 23:45:20 2010 +0100 @@ -262,9 +262,7 @@ call PLED_display_wait_clear WIN_TOP .0 WIN_LEFT .0 - lfsr FSR2,letter - movlw '#' - movwf POSTINC2 + STRCPY "#" GETCUSTOM15 .28 ; Logbook Offset -> lo, hi tstfsz lo ; lo=0? @@ -294,8 +292,7 @@ output_99x ; # of dive display_profile_offset3: - movlw ' ' - movwf POSTINC2 + PUTC ' ' call I2CREAD2 movff SSPBUF,lo ; @@ -321,13 +318,11 @@ movff SSPBUF,convert_value_temp+2 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - movlw ' ' - movwf POSTINC2 + PUTC ' ' call I2CREAD2 ; hour movff SSPBUF,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' call I2CREAD2 ; Minute movff SSPBUF,lo output_99x @@ -354,10 +349,7 @@ bsf leftbind output_16dp d'3' ; max. depth - movlw 'm' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "m " call I2CREAD2 movff SSPBUF,lo call I2CREAD2 @@ -372,8 +364,7 @@ bsf leftbind output_16 ; divetime minutes - movlw d'39' - movwf POSTINC2 + PUTC d'39' call I2CREAD2 movff SSPBUF,lo movf lo,W ; add seconds to total seconds @@ -400,10 +391,7 @@ bsf leftbind output_99x ; divetime seconds - movlw '"' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "\" " call I2CREAD2 movff SSPBUF,lo call I2CREAD2 @@ -412,11 +400,7 @@ movwf ignore_digits bsf leftbind output_16dp d'2' ; temperature - movlw '°' - movwf POSTINC2 - movlw 'C' - movwf POSTINC2 - call word_processor ; Display 2nd row of details + STRCAT_PRINT "°C" ; Display 2nd row of details WIN_TOP .50 WIN_LEFT .05 @@ -428,29 +412,7 @@ movff SSPBUF,hi bsf leftbind output_16 ; Air pressure before dive - movlw 'm' - movwf POSTINC2 - movlw 'b' - movwf POSTINC2 - movlw 'a' - movwf POSTINC2 - movlw 'r' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - - movlw 'D' - movwf POSTINC2 - movlw 'e' - movwf POSTINC2 - movlw 's' - movwf POSTINC2 - movlw 'a' - movwf POSTINC2 - movlw 't' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "mbar Desat " call I2CREAD2 movff SSPBUF,lo @@ -462,8 +424,7 @@ movff hi,lo movwf hi ; exchange lo and hi... output_8 ; Hours - movlw ':' - movwf POSTINC2 + PUTC ':' movff hi,lo ; Minutes output_99x bcf leftbind @@ -517,17 +478,7 @@ ; Start Profile display movlw color_deepblue - movff WREG,box_temp+0 ; Data - movlw .75 - movff WREG,box_temp+1 ; row top (0-239) - movlw .239 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .0 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - + WIN_BOX_COLOR .75, .239, .0, .159 call I2CREAD2 ; skip 0xFB (Header-end) clrf timeout_counter2 ; here: used as counter for depth readings @@ -844,8 +795,7 @@ lfsr FSR2,letter movff divenumber,lo output_99x ; # of dive - movlw ' ' - movwf POSTINC2 + PUTC ' ' call I2CREAD2 movff SSPBUF,lo movlw d'13' @@ -861,13 +811,12 @@ movff SSPBUF,convert_value_temp+1 call I2CREAD2 ; Year movff SSPBUF,convert_value_temp+2 - call PLED_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 + call PLED_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in s call I2CREAD2 ; hours (Skip) call I2CREAD2 ; minutes (skip) - movlw ' ' - movwf POSTINC2 + PUTC ' ' call I2CREAD2 ; Depth movff SSPBUF,lo call I2CREAD2 @@ -875,20 +824,14 @@ bsf leftbind bsf ignore_digit5 ; Do not display 1cm figure output_16dp d'3' ; max. depth - movlw 'm' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT "m " call I2CREAD2 movff SSPBUF,lo call I2CREAD2 movff SSPBUF,hi bsf leftbind output_16 ; Divetime minutes - movlw d'39' ; "'" - movwf POSTINC2 - - call word_processor ; Display header-row in list + STRCAT_PRINT "'" ; Display header-row in list return
--- a/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Thu Dec 30 23:45:20 2010 +0100 @@ -56,14 +56,10 @@ incf lo,F bsf leftbind output_99 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 + STRCAT " (" OUTPUTTEXT d'192' ; Dil. - movlw ' ' - movwf POSTINC2 + PUTC ' ' read_int_eeprom d'33' ; Read byte (stored in EEDATA) movff EEDATA,active_gas ; Read start gas (1-5) @@ -80,8 +76,7 @@ bsf leftbind output_99 - movlw '/' - movwf POSTINC2 + PUTC '/' decf active_gas,W ; Gas 0-4 mullw d'4' @@ -93,9 +88,7 @@ bsf leftbind output_99 - movlw ')' - movwf POSTINC2 - call word_processor + STRCAT_PRINT ")" WIN_LEFT .20 @@ -112,15 +105,7 @@ bsf leftbind output_16dp d'3' bcf leftbind - movlw 'B' - movwf POSTINC2 - movlw 'a' - movwf POSTINC2 - movlw 'r' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "Bar " WIN_LEFT .20 WIN_TOP .95 @@ -141,15 +126,7 @@ lfsr FSR2,letter OUTPUTTEXT .89 ; "Default: " - movlw '1' - movwf POSTINC2 - movlw '.' - movwf POSTINC2 - movlw '0' - movwf POSTINC2 - movlw '0' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "1.00" DISPLAYTEXT .11 ; Exit call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Thu Dec 30 23:45:20 2010 +0100 @@ -267,7 +267,9 @@ do_menu_reset_logbook2: call PLED_ClearScreen - DISPLAYTEXT .25 ; "Reset..." + setf win_color1 ; Make sure to display in white color. + setf win_color2 + DISPLAYTEXT .25 ; "Reset..." call reset_external_eeprom ; delete profile memory bra do_menu_reset_exit
--- a/code_part1/OSTC_code_asm_part1/menu_settime.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_settime.asm Thu Dec 30 23:45:20 2010 +0100 @@ -85,15 +85,10 @@ lfsr FSR2,letter movff hours,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff mins,lo output_99x - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " set_date_refresh: WIN_LEFT .70 @@ -103,13 +98,8 @@ movff day,convert_value_temp+1 movff year,convert_value_temp+2 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - movlw ' ' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor - return - + STRCAT_PRINT " " + return set_time_done: ; Check date movff month,lo ; new month @@ -166,17 +156,13 @@ lfsr FSR2,letter movff hours,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff mins,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff secs,lo output_99x - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " decfsz wait_temp,F bra set_time_done_loop @@ -203,6 +189,7 @@ WIN_LEFT .32 WIN_TOP .155 + call PLED_standard_color lfsr FSR2,letter OUTPUTTEXT .94 ; Set
--- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm Thu Dec 30 23:45:20 2010 +0100 @@ -47,104 +47,52 @@ call PLED_set_color endm - word_processor: ; word_processor: - clrf POSTINC2 ; Required! - - ifdef AAFONTS + clrf POSTINC2 ; Required, to mark end of string. call aa_wordprocessor movlb b'00000001' ; Back to Rambank1 - else - movff win_color2,win_color2_temp - movff win_color1,win_color1_temp - call main_wordprocessor ; C-Code - movlb b'00000001' ; Back to Rambank1 - movff win_color2_temp,win_color2 - movff win_color1_temp,win_color1 - endif - return ; ----------------------------- ; PLED_SetColumnPixel: ; ----------------------------- PLED_SetColumnPixel: - movwf LastSetColumn ; d'0' ... d'159' - movff LastSetColumn,win_leftx2 + movwf win_leftx2 ; d'0' ... d'159' + mullw 2 ; Copy to POD, times 2. + movlw 0x21 ; Start Address Vertical (.0 - .319) rcall PLED_CmdWrite - bcf STATUS,C - rlcf LastSetColumn,W ; x2 -> WREG - movlw d'0' - btfsc STATUS,C ; Result >255? - movlw d'1' ; Yes: Upper=1! - rcall PLED_DatWrite ; Upper - bcf STATUS,C - rlcf LastSetColumn,W ; x2 -> WREG - rcall PLED_DatWrite ; Lower - return + bra PLED_DataWrite_PROD ; ----------------------------- ; PLED_SetRow: +; Backup WREG --> win_top, for the next write pixel. +; Setup OLED pixel horizontal address. ; ----------------------------- PLED_SetRow: - movwf LastSetRow ; d'0' ... d'239' - movff LastSetRow,win_top + movff WREG,win_top ; d'0' ... d'239' + mullw 1 ; Copy row to PRODH:L movlw 0x20 ; Horizontal Address START:END rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movf LastSetRow,W - rcall PLED_DatWrite - return + bra PLED_DataWrite_PROD ; ----------------------------- ; PLED Write Two Pixel ; ----------------------------- + PLED_PxlWrite: - movlw 0x22 ; Start Writing Data to GRAM - rcall PLED_CmdWrite - bsf oled_rs ; Data! - movff win_color1,PORTD - bcf oled_rw - bsf oled_rw ; Upper - movff win_color2,PORTD - bcf oled_rw - bsf oled_rw ; Lower + rcall PLED_PxlWrite_Single ; Write first pixel. -; Reset Column+1 +; Write 2nd Pixel on same row but one column to the right + movwf win_leftx2,W ; Increment column address. + mullw 2 + incf PRODL + clrf WREG ; Does not reset CARRY... + addwfc PRODH movlw 0x21 ; Start Address Vertical (.0 - .319) rcall PLED_CmdWrite - bcf STATUS,C - rlcf LastSetColumn,W ; x2 - movlw d'0' - btfsc STATUS,C ; Result >256? - movlw d'1' ; Yes! - rcall PLED_DatWrite ; Upper - bcf STATUS,C - rlcf LastSetColumn,F - incf LastSetColumn,W ; x2 - rcall PLED_DatWrite ; Lower - -; Reset Row - movlw 0x20 ; Horizontal Address START:END - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movf LastSetRow,W - rcall PLED_DatWrite - -; Write 2nd Pixel on same row but one column to the right - movlw 0x22 ; Start Writing Data to GRAM - rcall PLED_CmdWrite - bsf oled_rs ; Data! - movff win_color1,PORTD - bcf oled_rw - bsf oled_rw ; Upper - movff win_color2,PORTD - bcf oled_rw - bsf oled_rw ; Lower - return + rcall PLED_DataWrite_PROD + ; Continue with PLED_PxlWrite_Single... ; ----------------------------- ; PLED Write One Pixel @@ -174,166 +122,101 @@ bcf oled_nreset return -; ----------------------------- -; PLED FRAME (win_color1 and win_color2) -; ----------------------------- -PLED_frame: - movf box_temp+0,W - call PLED_set_color - ; draw right line from row top (box_temp+1) to row bottom (box_temp+2) - movff box_temp+1,draw_box_temp1 ; Store start row -PLED_frame2: - movf draw_box_temp1,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - movf box_temp+3,W ; d'0' ... d'159' - call PLED_SetColumnPixel ; Set left column - rcall PLED_PxlWrite_Single ; Write Pixel - incf draw_box_temp1,F - movf draw_box_temp1,W ; Copy to W - cpfseq box_temp+2 ; Done? - bra PLED_frame2 ; Not yet... +;============================================================================= +; PLED_frame : draw a frame around current box with current color. +; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 +; Outputs: (none) +; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 - movf draw_box_temp1,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - movf box_temp+3,W ; d'0' ... d'159' - call PLED_SetColumnPixel ; Set left column - rcall PLED_PxlWrite_Single ; Write Pixel +PLED_frame: + movff win_top,aa_start+0 ; Backup everything. + movff win_height,aa_start+1 + movff win_leftx2,aa_end+0 + movff win_width,aa_end+1 - ; draw left line from row top (box_temp+1) to row bottom (box_temp+2) - movff box_temp+1,draw_box_temp1 ; Store start row -PLED_frame3: - movf draw_box_temp1,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - movf box_temp+4,W ; d'0' ... d'159' - call PLED_SetColumnPixel ; Set left column - rcall PLED_PxlWrite_Single ; Write Pixel - incf draw_box_temp1,F - movf draw_box_temp1,W ; Copy to W - cpfseq box_temp+2 ; Done? - bra PLED_frame3 ; Not yet... + ;---- TOP line ----------------------------------------------------------- + movlw 1 ; row ~ height=1 + movff WREG,win_height + rcall PLED_box - movf draw_box_temp1,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - movf box_temp+4,W ; d'0' ... d'159' - call PLED_SetColumnPixel ; Set left column - rcall PLED_PxlWrite_Single ; Write Pixel + ;---- BOTTOM line -------------------------------------------------------- + movff aa_start+0,PRODL ; Get back top, + movff aa_start+1,WREG ; and height + addwf PRODL,W ; top+height + decf WREG ; top+height-1 + movff WREG,win_top ; top+height-1 --> top + rcall PLED_box - ; draw top line from box_temp+3 (0-159) to box_temp+4 (0-159) - movff box_temp+3,draw_box_temp1 ; Store start column -PLED_frame4: - movf draw_box_temp1,W ; d'0' ... d'159' - rcall PLED_SetColumnPixel ; Set Column - movf box_temp+1,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - rcall PLED_PxlWrite ; Write 2 Pixels - incf draw_box_temp1,F - movf draw_box_temp1,W - cpfseq box_temp+4 - bra PLED_frame4 + ;---- LEFT column -------------------------------------------------------- + movff aa_start+0,win_top ; Restore top/height. + movff aa_start+1,win_height + movlw 1 ; column ~ width=1 + movff WREG,win_width + rcall PLED_box - ; draw bottom line from box_temp+3 (0-159) to box_temp+4 (0-159) - movff box_temp+3,draw_box_temp1 ; Store start column -PLED_frame5: - movf draw_box_temp1,W ; d'0' ... d'159' - rcall PLED_SetColumnPixel ; Set Column - movf box_temp+2,W ; d'0' ... d'239' - rcall PLED_SetRow ; Set Row - rcall PLED_PxlWrite ; Write 2 Pixels - incf draw_box_temp1,F - movf draw_box_temp1,W - cpfseq box_temp+4 - bra PLED_frame5 + ;---- RIGHT column ------------------------------------------------------- + movff aa_end+0,WREG + movff aa_end+1,PRODL + addwf PRODL,W + decf WREG + movff WREG,win_leftx2 + bra PLED_box - call PLED_standard_color - - return +;============================================================================= +; PLED_box : fills current box with current color. +; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 +; Outputs: (none) +; Trashed: WREG, PROD -; ----------------------------- -; PLED Box (win_color1 and win_color2) -; ----------------------------- PLED_box: - movf box_temp+0,W - call PLED_set_color -; /Define Window + ;---- Define Window ------------------------------------------------------ movlw 0x35 ; VerticalStartAddress HIGH:LOW rcall PLED_CmdWrite - movff box_temp+3,draw_box_temp1 - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 - movlw d'0' - btfsc STATUS,C ; Result >255? - movlw d'1' ; Yes: Upper=1! - rcall PLED_DatWrite ; Upper - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 -> WREG - rcall PLED_DatWrite ; Lower + movff win_leftx2,WREG + mullw 2 + rcall PLED_DataWrite_PROD movlw 0x36 ; VerticalEndAddress HIGH:LOW rcall PLED_CmdWrite - movff box_temp+4,draw_box_temp1 - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 - movlw d'0' - btfsc STATUS,C ; Result >255? - movlw d'1' ; Yes: Upper=1! - rcall PLED_DatWrite ; Upper - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 -> WREG - rcall PLED_DatWrite ; Lower + movff win_width,PRODL ; Bank-safe addressing + movff win_leftx2,WREG + addwf PRODL,W ; left+width + decf WREG ; left+width-1 + mullw 2 ; times 2 --> rightx2 + rcall PLED_DataWrite_PROD movlw 0x37 ; HorizontalAddress START:END rcall PLED_CmdWrite - movff box_temp+1,draw_box_temp1 - movf draw_box_temp1,W - rcall PLED_DatWrite - movff box_temp+2,draw_box_temp1 - movf draw_box_temp1,W - rcall PLED_DatWrite + movff win_top,PRODH ; Start row. + movff win_height,PRODL ; height + movf PRODH,W + addwf PRODL,F ; top + height + decf PRODL,F ; top + height - 1 --> bottom. + rcall PLED_DataWrite_PROD + ;---- Start pointer ------------------------------------------------------ movlw 0x20 ; Start Address Horizontal (.0 - .239) rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movff box_temp+1,draw_box_temp1 - movf draw_box_temp1,W - rcall PLED_DatWrite + movff win_top,WREG + mullw 1 + rcall PLED_DataWrite_PROD movlw 0x21 ; Start Address Vertical (.0 - .319) rcall PLED_CmdWrite - movff box_temp+3,draw_box_temp1 - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 - movlw d'0' - btfsc STATUS,C ; Result >255? - movlw d'1' ; Yes: Upper=1! - rcall PLED_DatWrite ; Upper - bcf STATUS,C - rlcf draw_box_temp1,W ; x2 -> WREG - rcall PLED_DatWrite ; Lower -; /Define Window + movff win_leftx2,WREG + mullw 2 + rcall PLED_DataWrite_PROD -; Fill Window + ;---- Fill Window -------------------------------------------------------- movlw 0x22 ; Start Writing Data to GRAM rcall PLED_CmdWrite - movff box_temp+1,draw_box_temp1 - movff box_temp+2,draw_box_temp2 - movf draw_box_temp1,W - subwf draw_box_temp2,F ; X length - incf draw_box_temp2,F - - movff box_temp+3,draw_box_temp1 - movff box_temp+4,draw_box_temp3 - movf draw_box_temp1,W - subwf draw_box_temp3,F ; Y length/2 - - incf draw_box_temp3,F ; Last pixel... - + movff win_height,PRODH bsf oled_rs ; Data! -PLED_box2: - movff draw_box_temp3,draw_box_temp1 -PLED_box3: +PLED_box2: ; Loop height times + movff win_width,PRODL +PLED_box3: ; loop width times movff win_color1,PORTD bcf oled_rw bsf oled_rw ; Upper @@ -348,55 +231,45 @@ bcf oled_rw bsf oled_rw ; Lower - decfsz draw_box_temp1,F + decfsz PRODL,F bra PLED_box3 - decfsz draw_box_temp2,F + decfsz PRODH,F bra PLED_box2 movlw 0x00 ; NOP, to stop Address Update Counter - rcall PLED_CmdWrite + bra PLED_CmdWrite - call PLED_standard_color - return +;============================================================================= +; PLED_ClearScreen: An optimized version of PLEX_box, for ful screen black. +; Trashed: WREG, PROD -; ----------------------------- -; PLED_ClearScreen: -; ----------------------------- PLED_ClearScreen: movlw 0x35 ; VerticalStartAddress HIGH:LOW rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movlw 0x00 - rcall PLED_DatWrite + mullw 0 + rcall PLED_DataWrite_PROD movlw 0x36 ; VerticalEndAddress HIGH:LOW rcall PLED_CmdWrite movlw 0x01 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x3F - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x37 ; HorizontalAddress START:END rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0xEF - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x20 ; Start Address Horizontal (.0 - .239) rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite_PROD movlw 0x21 ; Start Address Vertical (.0 - .319) rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DatWrite - movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite_PROD movlw 0x22 ; Start Writing Data to GRAM rcall PLED_CmdWrite @@ -404,14 +277,12 @@ ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks bsf oled_rs ; Data! - movlw d'10' - movwf draw_box_temp3 + movlw .160 + movwf PRODH PLED_ClearScreen2: - movlw d'30' - movwf draw_box_temp2 + movlw .240 + movwf PRODL PLED_ClearScreen3: - clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320 -PLED_ClearScreen4: clrf PORTD ; Need to generate trace here too. bcf oled_rw @@ -421,18 +292,21 @@ bcf oled_rw bsf oled_rw ; Lower - decfsz draw_box_temp1,F - bra PLED_ClearScreen4 - decfsz draw_box_temp2,F + clrf PORTD ; Need to generate trace here too. + bcf oled_rw + bsf oled_rw ; Upper + + clrf PORTD ; Need to generate trace here too. + bcf oled_rw + bsf oled_rw ; Lower + + decfsz PRODL,F bra PLED_ClearScreen3 - decfsz draw_box_temp3,F + decfsz PRODH,F bra PLED_ClearScreen2 movlw 0x00 ; NOP, to stop Address Update Counter - rcall PLED_CmdWrite - - return - + bra PLED_CmdWrite ; ----------------------------- ; PLED Write Cmd via W @@ -448,13 +322,21 @@ ; PLED Write Display Data via W ; ----------------------------- PLED_DataWrite: + bsf oled_rs ; Data! + movwf PORTD ; Move Data to PORTD + bcf oled_rw + bsf oled_rw + return ; ----------------------------- ; PLED Data Cmd via W ; ----------------------------- -PLED_DatWrite: +PLED_DataWrite_PROD: bsf oled_rs ; Data! - movwf PORTD ; Move Data to PORTD + movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian) + bcf oled_rw + bsf oled_rw + movff PRODL,PORTD ; Move low byte to PORTD bcf oled_rw bsf oled_rw return @@ -485,44 +367,44 @@ movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) rcall PLED_CmdWrite movlw 0x00 ; X X X X X X X RM - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL - rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock + rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) rcall PLED_CmdWrite movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color - rcall PLED_DatWrite + rcall PLED_DataWrite movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x18 rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x28 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0xF8 rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x0F - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0xF9 rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x0F - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x10 rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite ; Now Gamma settings... rcall PLED_brightness_full @@ -537,9 +419,9 @@ movlw 0x05 rcall PLED_CmdWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x01 - rcall PLED_DatWrite ; Display ON + rcall PLED_DataWrite ; Display ON return @@ -547,60 +429,60 @@ movlw 0x70 rcall PLED_CmdWrite movlw 0x1F - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x71 rcall PLED_CmdWrite movlw 0x23 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x80 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x72 rcall PLED_CmdWrite movlw 0x2A - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x80 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x73 rcall PLED_CmdWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x11 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x74 rcall PLED_CmdWrite movlw 0x1C - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x11 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x75 rcall PLED_CmdWrite movlw 0x1B - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x76 rcall PLED_CmdWrite movlw 0x1A - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x77 rcall PLED_CmdWrite movlw 0x1C - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x18 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x78 rcall PLED_CmdWrite movlw 0x21 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite return @@ -608,60 +490,60 @@ movlw 0x70 rcall PLED_CmdWrite movlw 0x14 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x71 rcall PLED_CmdWrite movlw 0x17 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x00 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x72 rcall PLED_CmdWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x80 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x73 rcall PLED_CmdWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x11 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x74 rcall PLED_CmdWrite movlw 0x14 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x0B - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x75 rcall PLED_CmdWrite movlw 0x1B - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x76 rcall PLED_CmdWrite movlw 0x13 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x0E - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x77 rcall PLED_CmdWrite movlw 0x1C - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x18 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x78 rcall PLED_CmdWrite movlw 0x15 - rcall PLED_DatWrite + rcall PLED_DataWrite movlw 0x0E - rcall PLED_DatWrite + rcall PLED_DataWrite return
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Dec 30 23:45:20 2010 +0100 @@ -275,9 +275,8 @@ movwf POSTINC2 movf debug_char+5,W movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + + STRCAT_PRINT " " return @@ -314,14 +313,10 @@ movwf POSTINC2 movf debug_char+5,W movwf POSTINC2 - movlw '.' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT ". " movff flag1,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag2,lo output_8 call word_processor @@ -335,20 +330,16 @@ lfsr FSR2,letter movff flag3,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag4,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag5,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag6,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag7,lo output_8 call word_processor @@ -362,20 +353,16 @@ lfsr FSR2,letter movff flag8,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag9,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag10,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag11,lo output_8 - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff flag12,lo output_8 call word_processor @@ -395,45 +382,15 @@ return PLED_clear_customview_divemode: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .168 - movff WREG,box_temp+1 ; row top (0-239) - movlw .239 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .090 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .168, .239, .90, .159 return PLED_clear_customview_surfmode: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .25 - movff WREG,box_temp+1 ; row top (0-239) - movlw .121 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .82 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .25, .121, .82, .159 return PLED_clear_decoarea: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .54 - movff WREG,box_temp+1 ; row top (0-239) - movlw .168 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .090 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .54, .168, .90, .159 return PLED_display_ndl_mask: @@ -468,9 +425,8 @@ lfsr FSR2,letter movff char_O_nullzeit,lo ; NDL in minutes output_8 - movlw 0x27 ; "'" - movwf POSTINC2 - call word_processor + STRCAT_PRINT "'" + WIN_FONT FT_SMALL return @@ -500,13 +456,10 @@ lfsr FSR2,letter movff char_O_array_decodepth+0,lo ; Ceiling in m output_99 - movlw 'm' ; "m" - movwf POSTINC2 + PUTC 'm' movff char_O_array_decotime,lo ; length of first stop in m output_99 - movlw 0x27 ; "'" - movwf POSTINC2 - call word_processor + STRCAT_PRINT "'" WIN_FONT FT_SMALL ;PLED_display_deko1: @@ -524,9 +477,7 @@ movwf lo bcf leftbind output_8 - movlw 0x27 ; "'" - movwf POSTINC2 - call word_processor + STRCAT_PRINT "'" PLED_display_deko1: movff char_O_gradient_factor,lo ; gradient factor @@ -543,20 +494,11 @@ WIN_LEFT .0 WIN_FONT FT_SMALL PLED_color_code warn_gf ; Color-code Output - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + + STRCPY "GF:" movff char_O_gradient_factor,lo ; gradient factor output_8 - movlw '%' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "% " call PLED_standard_color return @@ -570,15 +512,7 @@ bsf leftbind output_8 bcf leftbind - movlw 'm' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw 'n' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "min " WIN_TOP .95 WIN_LEFT .100 @@ -589,11 +523,7 @@ bsf leftbind output_8 bcf leftbind - movlw 'm' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m " return PLED_display_velocity: @@ -642,8 +572,7 @@ PLED_display_clear_common1: lfsr FSR2,letter PLED_display_clear_common2: - movlw ' ' - movwf POSTINC2 + PUTC ' ' decfsz temp1,F bra PLED_display_clear_common2 call word_processor @@ -665,8 +594,7 @@ lfsr FSR2,letter movff hours,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff mins,lo output_99x call word_processor @@ -682,17 +610,13 @@ lfsr FSR2,letter movff hours,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff mins,lo output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff secs,lo output_99x - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " return PLED_interval: @@ -711,13 +635,10 @@ movff lo,hi movwf lo ; exchange lo and hi output_99x - movlw ':' - movwf POSTINC2 + PUTC ':' movff hi,lo output_99x - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " return @@ -727,117 +648,56 @@ WIN_FONT FT_SMALL WIN_INVERT .0 ; Init new Wordprocessor call PLED_standard_color - lfsr FSR2,letter + STRCPY "CF11:" + GETCUSTOM8 d'11' movwf lo - movlw 'C' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw '1' - movwf POSTINC2 - movlw '1' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 bsf leftbind output_8 - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" WIN_TOP .50 - lfsr FSR2,letter + STRCPY "CF12:" + GETCUSTOM8 d'12' movwf lo - movlw 'C' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw '1' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 bsf leftbind output_8 - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" PLED_show_cf11_cf12_cf29_2: WIN_TOP .75 - lfsr FSR2,letter + STRCPY "CF29:" GETCUSTOM8 d'29' movwf lo - movlw 'C' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw '9' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 bsf leftbind output_8 - movlw 'm' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m" + bcf leftbind return - PLED_show_cf32_cf33_cf29:; Display GF_LOW, GF_HIGH and last deco in the customview field WIN_TOP .25 WIN_LEFT .90 WIN_FONT FT_SMALL WIN_INVERT .0 ; Init new Wordprocessor call PLED_standard_color - lfsr FSR2,letter GETCUSTOM8 d'32' movwf lo - movlw 'G' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw '_' - movwf POSTINC2 - movlw 'l' - movwf POSTINC2 - movlw 'o' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + + STRCPY "GF_lo:" bsf leftbind output_8 - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" WIN_TOP .50 - lfsr FSR2,letter GETCUSTOM8 d'33' movwf lo - movlw 'G' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movlw '_' - movwf POSTINC2 - movlw 'h' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCPY "GF_hi:" bsf leftbind output_8 - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" bra PLED_show_cf11_cf12_cf29_2 ; Display CF29 in the third row and RETURN @@ -845,17 +705,7 @@ PLED_logbook_cursor: PLED_menu_cursor: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .35 - movff WREG,box_temp+1 ; row top (0-239) - movlw .239 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .0 - movff WREG,box_temp+3 ; column left (0-159) - movlw .16 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .35, .239, .0, .16 WIN_LEFT .0 WIN_FONT FT_SMALL @@ -877,10 +727,7 @@ movlw d'185' movff WREG,win_top - lfsr FSR2,letter - movlw 0xB7 - movwf POSTINC2 - call word_processor + STRCPY_PRINT "\xB7" return PLED_menu_mask: @@ -981,13 +828,7 @@ bsf leftbind ; left orientated output output_16dp d'2' bcf leftbind - movlw '°' - movwf POSTINC2 - movlw 'C' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "°C " return PLED_temp_divemode: @@ -1017,11 +858,7 @@ bsf leftbind ; left orientated output output_16dp d'2' bcf leftbind - movlw '°' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "° " return PLED_show_ppO2: ; Show ppO2 @@ -1031,17 +868,7 @@ WIN_FONT FT_SMALL PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) - lfsr FSR2,letter - movlw 'p' - movwf POSTINC2 - movlw 'p' - movwf POSTINC2 - movlw 'O' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCPY "ppO2:" ; Check very high ppO2 manually tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar? @@ -1053,21 +880,12 @@ output_16dp d'1' bcf ignore_digit4 PLED_show_ppO2_2: - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT " " call PLED_standard_color return PLED_show_ppO2_3: - movlw '>' - movwf POSTINC2 - movlw '6' - movwf POSTINC2 - movlw '.' - movwf POSTINC2 - movlw '6' - movwf POSTINC2 + STRCAT ">6.6" bra PLED_show_ppO2_2 PLED_show_ppO2_clear: ; Clear ppO2 @@ -1163,8 +981,7 @@ lfsr FSR2,letter bsf leftbind ; left orientated output output_8 ; O2 ratio is still in "lo" - movlw '/' - movwf POSTINC2 + PUTC '/' movff char_I_He_ratio,lo ; copy He ratio into lo output_8 movlw ' ' @@ -1181,6 +998,8 @@ WIN_LEFT .85 WIN_FONT FT_SMALL WIN_INVERT .0 ; Init new Wordprocessor + call PLED_standard_color + clrf EEADRH read_int_eeprom d'34' ; Read deco data tstfsz EEDATA @@ -1188,23 +1007,12 @@ ;ZH-L16 WIN_TOP .125 - call PLED_standard_color - - lfsr FSR2,letter - movlw 'O' - movwf POSTINC2 - call word_processor - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor + STRCPY_PRINT "O" + WIN_TOP .150 - call PLED_standard_color - - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - call word_processor + STRCPY_PRINT "C" return + show_decotype_surface2: decf EEDATA,F tstfsz EEDATA @@ -1213,87 +1021,38 @@ return show_decotype_surface3: - decf EEDATA,F - tstfsz EEDATA - bra show_decotype_surface4 - ; const. ppO2 - WIN_TOP .125 - call PLED_standard_color - - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call word_processor - WIN_TOP .150 - call PLED_standard_color - - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call word_processor - return + decf EEDATA,F + tstfsz EEDATA + bra show_decotype_surface4 + ; const. ppO2 + WIN_TOP .125 + call PLED_standard_color + + STRCPY_PRINT "C" + + WIN_TOP .150 + call word_processor ; Twice the same string. + return + show_decotype_surface4: decf EEDATA,F tstfsz EEDATA bra show_decotype_surface5 ; Apnoe return + show_decotype_surface5: - decf EEDATA,F - tstfsz EEDATA - bra show_decotype_surface6 - ; Multi-GF OC - WIN_TOP .125 - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - call word_processor - WIN_TOP .150 - lfsr FSR2,letter - movlw 'F' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - call word_processor - return - show_decotype_surface6: - ; Multi-GF CC - WIN_TOP .125 - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - call word_processor - WIN_TOP .150 - lfsr FSR2,letter - movlw 'F' - movwf POSTINC2 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - call word_processor - return + decf EEDATA,F + tstfsz EEDATA + bra show_decotype_surface6 + ; Multi-GF OC + WIN_TOP .125 + STRCPY_PRINT "G" + + WIN_TOP .150 + STRCPY_PRINT "F" + return ;----------------------------------------------------------------------------- ; Set color to grey when gas is inactive @@ -1334,20 +1093,9 @@ goto PLED_set_color ; grey out inactive gases! ;----------------------------------------------------------------------------- - -PLED_pre_dive_screen: ;Display Pre-Dive Screen -; movlw .0 -; movff WREG,box_temp+0 ; Data -; movlw .25 -; movff WREG,box_temp+1 ; row top (0-239) -; movlw .120 -; movff WREG,box_temp+2 ; row bottom (0-239) -; movlw .82 -; movff WREG,box_temp+3 ; column left (0-159) -; movlw .159 -; movff WREG,box_temp+4 ; column right (0-159) -; call PLED_box - +; Display Pre-Dive Screen + +PLED_pre_dive_screen: ; List active gases/Setpoints btfsc FLAG_const_ppO2_mode ; in ppO2 mode? @@ -1371,21 +1119,15 @@ movlw d'4' addwf wait_temp,F ; Increase eeprom address for gas list - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 + STRCPY "G" movff hi,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT ": " movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo output_8 ; outputs into Postinc2! - movlw '/' - movwf POSTINC2 + PUTC '/' incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo @@ -1435,17 +1177,10 @@ WIN_LEFT .90 movff waitms_temp,win_top ; Set Row - lfsr FSR2,letter - movlw 'S' - movwf POSTINC2 - movlw 'P' - movwf POSTINC2 + STRCPY "SP" movff temp6,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT ": " movff wait_temp, EEADR; SP #hi position call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo @@ -1476,18 +1211,9 @@ WIN_LEFT .90 WIN_TOP .100 - lfsr FSR2,letter - movlw 'D' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw 'l' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCPY "Dil:" output_8 ; O2 Ratio - movlw '/' - movwf POSTINC2 + PUTC '/' movff hi,lo output_8 ; He Ratio call word_processor @@ -1519,14 +1245,9 @@ movff EEDATA,lo ; copy to lo clrf hi output_16dp d'3' ; outputs into Postinc2! - movlw 'B' - movwf POSTINC2 - movlw 'a' - movwf POSTINC2 - movlw 'r' - movwf POSTINC2 bcf leftbind - call word_processor + + STRCAT_PRINT "Bar" bra PLED_active_gas_surfmode_exit PLED_active_gas_surfmode2: @@ -1587,8 +1308,7 @@ lfsr FSR2,letter bsf leftbind ; left orientated output output_99 ; O2 ratio is still in "lo" - movlw '/' - movwf POSTINC2 + PUTC '/' movff char_I_He_ratio,lo ; copy He ratio into lo output_99 bcf leftbind @@ -1596,43 +1316,13 @@ bra PLED_active_gas_surfmode_exit PLED_active_gas_surfmode_exit: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .122 - movff WREG,box_temp+1 ; row top (0-239) - movlw .175 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .82 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame +; WIN_FRAME_BLACK .122, .175, .82, .159 return PLED_confirmbox: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .68 - movff WREG,box_temp+1 ; row top (0-239) - movlw .146 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .34 - movff WREG,box_temp+3 ; column left (0-159) - movlw .101 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .70 - movff WREG,box_temp+1 ; row top (0-239) - movlw .144 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .35 - movff WREG,box_temp+3 ; column left (0-159) - movlw .100 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame + WIN_BOX_BLACK .68, .146, .34, .101 + WIN_FRAME_STD .70, .144, .35, .100 + DISPLAYTEXT .143 ; Confirm: DISPLAYTEXT .145 ; Cancel DISPLAYTEXT .146 ; OK! @@ -1641,17 +1331,7 @@ movwf menupos PLED_confirmbox2: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .96 - movff WREG,box_temp+1 ; row top (0-239) - movlw .143 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .39 - movff WREG,box_temp+3 ; column left (0-159) - movlw .51 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .96, .143, .39, .51 movff menupos,temp1 movlw d'96' @@ -1665,10 +1345,7 @@ WIN_INVERT .0 ; Init new Wordprocessor call PLED_standard_color - lfsr FSR2,letter - movlw 0xB7 ; Arrow for menu - movwf POSTINC2 - call word_processor + STRCPY_PRINT "\xB7" bcf sleepmode ; clear some flags bcf menubit2 @@ -1775,8 +1452,8 @@ bra pled_depth3 pled_depth2: - movlw '0' - movwf POSTINC2 + PUTC '0' + pled_depth3: call word_processor bcf ignore_digit4 @@ -1789,9 +1466,8 @@ movff rel_pressure+1,hi movff rel_pressure+0,lo call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] - lfsr FSR2,letter - movlw '.' - movwf POSTINC2 + + STRCPY "." movlw HIGH d'9' movwf sub_a+1 @@ -1810,8 +1486,7 @@ bra pled_depth5 pled_depth4: - movlw '0' - movwf POSTINC2 + PUTC '0' pled_depth5: call word_processor ; decimeters in medium font @@ -1842,26 +1517,14 @@ return depth_less_10mtr: - movlw ' ' - movwf POSTINC2 + PUTC ' ' return PLED_clear_depth ; No, clear depth area and set flag - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .24 - movff WREG,box_temp+1 ; row top (0-239) - movlw .90 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .0 - movff WREG,box_temp+3 ; column left (0-159) - movlw .90 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .24, .90, .0, .90 bsf depth_greater_100m ; Set Flag return - PLED_desaturation_time: ostc_debug 'h' WIN_TOP .150 @@ -1872,8 +1535,7 @@ lfsr FSR2,letter OUTPUTTEXT d'14' ; Desat - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff int_O_desaturation_time+0,lo ; divide by 60... movff int_O_desaturation_time+1,hi call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) @@ -1882,8 +1544,7 @@ movff hi,lo movwf hi ; exchange lo and hi... output_8 ; Hours - movlw ':' - movwf POSTINC2 + PUTC ':' movff hi,lo ; Minutes output_99x bcf leftbind @@ -1900,8 +1561,7 @@ lfsr FSR2,letter OUTPUTTEXT d'35' ; NoFly - movlw ' ' - movwf POSTINC2 + PUTC ' ' movff nofly_time+0,lo ; divide by 60... movff nofly_time+1,hi call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) @@ -1910,8 +1570,7 @@ movff hi,lo movwf hi ; exchange lo and hi... output_8 ; Hours - movlw ':' - movwf POSTINC2 + PUTC ':' movff hi,lo ; Minutes decf lo,F btfsc lo,7 ; keep Nofly time @@ -1939,17 +1598,7 @@ bsf leftbind output_16 bcf leftbind - movlw 'm' - movwf POSTINC2 - movlw 'b' - movwf POSTINC2 - movlw 'a' - movwf POSTINC2 - movlw 'r' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "mbar " return update_batt_voltage_divemode: @@ -1978,25 +1627,11 @@ bsf leftbind output_16dp d'2' ; e.g. 3.45V bcf leftbind - movlw 'V' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "V " return update_batt_voltage2: - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .174 - movff WREG,box_temp+1 ; row top (0-239) - movlw .194 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .1 - movff WREG,box_temp+3 ; column left (0-159) - movlw .32 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame + WIN_FRAME_STD .174, .194, .1, .32 ; 4100-Vbatt movlw LOW d'4100' @@ -2039,28 +1674,19 @@ movwf wait_temp ; Minimum = 3 update_batt_voltage2a: - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .181 - movff WREG,box_temp+1 ; row top (0-239) - movlw .187 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .32 - movff WREG,box_temp+3 ; column left (0-159) - movlw .34 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box ; Full Cap + WIN_BOX_STD .181, .187, .32, .34 update_batt_voltage3: GETCUSTOM8 d'34' ; Color battery - movff WREG,box_temp+0 ; Color Data + call PLED_set_color + movlw .176 - movff WREG,box_temp+1 ; row top (0-239) - movlw .192 - movff WREG,box_temp+2 ; row bottom (0-239) + movff WREG,win_top ; row top (0-239) + movlw .192-.176 + movff WREG,win_height ; row bottom (0-239) movlw .2 - movff WREG,box_temp+3 ; column left (0-159) - movff wait_temp,box_temp+4 ; column right (0-159) + movff WREG,win_leftx2 ; column left (0-159) + movff wait_temp,win_width ; column right (0-159) call PLED_box call PLED_standard_color @@ -2086,8 +1712,7 @@ bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+1,lo ;day bra PLED_convert_date1_common ;year @@ -2101,16 +1726,14 @@ bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+0,lo ;month PLED_convert_date1_common: bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+2,lo ;year bsf leftbind output_99x @@ -2122,14 +1745,12 @@ bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+0,lo ;month bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+1,lo ;day bsf leftbind output_99x @@ -2146,8 +1767,7 @@ bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+1,lo ;day bsf leftbind output_99x @@ -2164,8 +1784,7 @@ bsf leftbind output_99x bcf leftbind - movlw '/' - movwf POSTINC2 + PUTC '/' movff convert_value_temp+0,lo ;month bsf leftbind output_99x @@ -2190,17 +1809,7 @@ return PLED_menu_clear: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .0 - movff WREG,box_temp+1 ; row top (0-239) - movlw .26 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .65 - movff WREG,box_temp+3 ; column left (0-159) - movlw .100 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .0, .26, .65, .100 return PLED_max_pressure: @@ -2252,17 +1861,7 @@ return PLED_clear_maxdepth: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .184 - movff WREG,box_temp+1 ; row top (0-239) - movlw .215 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .0 - movff WREG,box_temp+3 ; column left (0-159) - movlw .41 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .184, .215, .0, .41 bsf maxdepth_greater_100m ; Set Flag return @@ -2318,8 +1917,7 @@ bcf leftbind lfsr FSR2,letter output_8 - movlw ':' - movwf POSTINC2 + PUTC ':' movff apnoe_surface_secs,lo output_99x call word_processor @@ -2328,17 +1926,7 @@ PLED_apnoe_clear_surface: ; Clear Surface timer.... - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .60 - movff WREG,box_temp+1 ; row top (0-239) - movlw .119 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .90 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .60, .119, .90, .159 return @@ -2357,8 +1945,7 @@ movff apnoe_mins,lo lfsr FSR2,letter output_8 - movlw ':' - movwf POSTINC2 + PUTC ':' movff apnoe_secs,lo output_99x call word_processor @@ -2374,8 +1961,7 @@ bsf show_last3 lfsr FSR2,letter output_16_3 ;Displays only 0...999 - movlw ':' - movwf POSTINC2 + PUTC ':' movff divesecs,lo output_99x WIN_TOP .20 @@ -2419,8 +2005,7 @@ bcf leftbind bsf show_last3 output_16_3 ;Displays only 0...999 - movlw ':' - movwf POSTINC2 + PUTC ':' movff wait_temp,lo output_99x bcf leftbind @@ -2440,9 +2025,7 @@ bsf ignore_digit5 ; do not display 1cm depth output_16dp d'3' bcf leftbind - movlw 'm' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m" return @@ -2466,33 +2049,25 @@ bsf leftbind output_16 - movlw ' ' - movwf POSTINC2 - movlw 0x85 ; New aa_font_28 5 grays HW logo. - movwf POSTINC2 - movlw 0x86 - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - movlw 'V' - movwf POSTINC2 + STRCAT " \x85\x86 V" movlw softwareversion_x movwf lo bsf leftbind output_8 - movlw '.' - movwf POSTINC2 + PUTC '.' movlw softwareversion_y movwf lo bsf leftbind output_99x bcf leftbind + call word_processor return PLED_divemode_menu_mask_first: ; Write Divemode menu1 mask ostc_debug 'o' ; Sends debug-information to screen if debugmode active call PLED_menu_clear ; clear "Menu?" + call PLED_standard_color btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode? bra PLED_divemode_menu_mask_first2 @@ -2520,19 +2095,12 @@ WIN_FONT FT_SMALL call PLED_standard_color - lfsr FSR2,letter - movlw 'S' - movwf POSTINC2 - movlw 'e' - movwf POSTINC2 - movlw 'l' - movwf POSTINC2 + STRCPY "Sel" read_int_eeprom d'24' ; Get Gas6 %O2 movff EEDATA,lo bcf leftbind output_99 ; outputs into Postinc2! - movlw '/' - movwf POSTINC2 + PUTC '/' read_int_eeprom d'25' ; Get Gas6 %He movff EEDATA,lo output_99 ; outputs into Postinc2! @@ -2551,61 +2119,63 @@ DISPLAYTEXT .253 ; -10m return +;----------------------------------------------------------------------------- +; Draw the bar graph used for deco stops (decoplan in simulator or dive). +; Inputs: lo = minutes. range 1..many. PLED_decoplan_bargraph: - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movff hi,win_top - incf win_top,F ; +1 - movff win_top,box_temp+1 ; row top (0-239) - movff win_top,box_temp+2 ; - movlw d'18' - addwf box_temp+2,F ; row bottom (0-239) + ; Common bargraph setup: + movf hi,W ; hi+1 --> top (bank safe !) + incf WREG + movff WREG,win_top + movlw d'18'+1 ; 19 --> height (bank safe !) + movff WREG,win_height movlw .122 - movff WREG,box_temp+3 ; column left (0-159) - addwf lo,F ; Add time offset - btfsc STATUS,C ; >255? - setf lo ; limit to 255 - decf lo,F ; No, minus one - movlw d'138' ; Limit length (16min) + movff WREG,win_leftx2 ; column left (0-159) + + ; Draw used area (lo = minutes): + call PLED_standard_color + movlw d'16' ; Limit length (16min) cpfslt lo movwf lo - movff lo,box_temp+4 ; column right (0-159) - call PLED_box - - movlw .0 - movff WREG,box_temp+0 ; Data - movff win_top,box_temp+1 ; row top (0-239) - movff win_top,box_temp+2 ; - movlw d'18' - addwf box_temp+2,F ; row bottom (0-239) - movff lo,box_temp+3 ; - incf box_temp+3,F ; column left (0-159) - movlw .139 - movff WREG,box_temp+4 ; column right (0-159) + movff lo,win_width ; Bar width + tstfsz lo ; Skip 0-size bar... call PLED_box - return - -PLED_decoplan_delete_gf: ; Delete unused rows - movlw .238 - movff WREG,box_temp+2 ; row bottom (0-239) - bra PLED_decoplan_delete_common - -PLED_decoplan_delete: ; Delete unused rows - movlw .171 - movff WREG,box_temp+2 ; row bottom (0-239) -PLED_decoplan_delete_common: + + ; Clear unused area: movlw .0 - movff WREG,box_temp+0 ; data 00, x0, 0y, xy clear, links, rechts, beide - movff hi,box_temp+1 ; row top (0-239) + movff WREG,win_color1 + movff WREG,win_color2 + movlw .122 ; (width+left-1)+1 + addwf lo,W + movff WREG,win_leftx2 ; --> left + movf lo,W + sublw .16 ; 16-left --> width + movff WREG,win_width + tstfsz WREG ; Skip 0-size bar. + goto PLED_box + +;----------------------------------------------------------------------------- +PLED_decoplan_delete_gf: ; Delete unused rows (GF model) +PLED_decoplan_delete: ; Delete unused rows (OC model) + movlw .171 +PLED_decoplan_delete_common: + movff hi,win_top ; row top (0-239) + subwf hi,W + negf WREG + movff WREG,win_height movlw .100 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + movff WREG,win_leftx2 ; column left (0-159) + movlw .60 + movff WREG,win_width ; area width (right-left+1, 0-159) + + clrf WREG ; BG color is black. + movff WREG,win_color1 + movff WREG,win_color2 + bsf last_ceiling_gf_shown ; Set flag - return - - + goto PLED_box + +;----------------------------------------------------------------------------- PLED_decoplan_gf_page_current: movlw d'0' cpfseq temp8 @@ -2648,7 +2218,7 @@ clrf temp8 ; Page 0-3 of deco list GETCUSTOM8 d'29' ; Last Deco in m movwf temp7 ; Start with last stop - setf temp5 + clrf temp5 movlw .231 movwf temp6 ; row @@ -2687,6 +2257,7 @@ PLED_decoplan_show_stop_gf: bsf leftbind WIN_LEFT .100 + call PLED_standard_color movff temp6,win_top movff temp6,hi ; copy for PLED_decoplan_bargraph @@ -2697,24 +2268,19 @@ lfsr FSR2,letter output_99x ; outputs into Postinc2! - movlw 'm' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m" + + PUTC ' ' WIN_LEFT .140 movff temp6,win_top -; lfsr FSR1,0x251 - lfsr FSR1,0x0E1 ; Gf_decolist_copy + lfsr FSR1,0x0E0+1 ; Gf_decolist_copy movf temp5,W ; number of entry movff PLUSW1,lo ; Stop length incf lo,F ; add one dummy minute lfsr FSR2,letter output_99x ; outputs into Postinc2! - movlw d'39' ;"'" - movwf POSTINC2 - call word_processor - tstfsz lo ; 0 min "Stop"? + STRCAT_PRINT "'" + rcall PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth return @@ -2726,7 +2292,6 @@ tstfsz lo bra PLED_decoplan1 ; No Deco, show "no Deco" -; call PLED_clear_divemode_menu ; Clear Deco area DISPLAYTEXT d'239' ;"No Deco" return @@ -2747,10 +2312,11 @@ PLED_decoplan_show_stop: bsf leftbind WIN_LEFT .100 + call PLED_standard_color movff temp6,win_top movff temp6,hi ; copy for PLED_decoplan_bargraph - lfsr FSR1,char_O_array_decodepth;+0 + lfsr FSR1,char_O_array_decodepth movf temp5,W ; number of entry movff PLUSW1,lo movf lo,w @@ -2759,9 +2325,7 @@ lfsr FSR2,letter output_8 ; outputs into Postinc2! - movlw 'm' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "m " WIN_LEFT .140 movff temp6,win_top @@ -2772,10 +2336,8 @@ lfsr FSR2,letter output_99x ; outputs into Postinc2! - movlw d'39' ;"'" - movwf POSTINC2 - call word_processor - tstfsz lo ; 0 min "Stop"? + STRCAT_PRINT "'" + rcall PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth return @@ -2802,19 +2364,15 @@ WIN_LEFT .100 movff waitms_temp,win_top ; Set Row - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 + STRCPY "G" movff hi,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 + PUTC ':' movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo output_8 ; outputs into Postinc2! - movlw '/' - movwf POSTINC2 + PUTC '/' incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo @@ -2867,15 +2425,10 @@ movff waitms_temp,win_top ; Set Row WIN_LEFT .100 - lfsr FSR2,letter - movlw 'S' - movwf POSTINC2 - movlw 'P' - movwf POSTINC2 + STRCPY "SP" movff temp5,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 + PUTC ':' movff wait_temp, EEADR; SP #hi position call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo @@ -2891,33 +2444,13 @@ return ; no, return PLED_clear_divemode_menu: - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .0 - movff WREG,box_temp+1 ; row top (0-239) - movlw .169 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .082 - movff WREG,box_temp+3 ; column left (0-159) - movlw .160 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .0, .169, .82, .160 return PLED_divemenu_cursor: ostc_debug 'l' ; Sends debug-information to screen if debugmode active - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .0 - movff WREG,box_temp+1 ; row top (0-239) - movlw .150 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .85 - movff WREG,box_temp+3 ; column left (0-159) - movlw .95 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_BLACK .0, .150, .85, .95 WIN_TOP .0 WIN_LEFT .85 @@ -2941,10 +2474,7 @@ movlw d'125' movff WREG,win_top - lfsr FSR2,letter - movlw 0xB7 ; Arrow for menu - movwf POSTINC2 - call word_processor + STRCPY_PRINT "\xB7" return ;PLED_profileview_menu: @@ -2953,115 +2483,46 @@ ;; DISPLAYTEXT .132 ;"Format" ; return -custom_warn_surfmode: ; With CF in temp1 - movlw .0 - movff WREG,box_temp+0 ; Data - movlw .56 - movff WREG,box_temp+1 ; row top (0-239) - movlw .88 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .69 - movff WREG,box_temp+3 ; column left (0-159) - movlw .115 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .58 - movff WREG,box_temp+1 ; row top (0-239) - movlw .86 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .70 - movff WREG,box_temp+3 ; column left (0-159) - movlw .114 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame - ; warning text - - WIN_TOP .60 - WIN_LEFT .71 - WIN_FONT FT_SMALL - WIN_INVERT .1 ; Init new Wordprocessor - call PLED_warnings_color ; Set Color for Warning - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - movlw 'F' - movwf POSTINC2 - movff temp1,lo - output_8 - movlw '!' - movwf POSTINC2 - call word_processor - - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - return - ;PLED_saturation_graph_divemode: ; ostc_debug 'h' ; Sends debug-information to screen if debugmode active PLED_tissue_saturation_graph: ostc_debug 'i' ; Sends debug-information to screen if debugmode active ;; Clear graph area... -; movlw .0 -; movff WREG,box_temp+0 ; Data -; movlw .25 -; movff WREG,box_temp+1 ; row top (0-239) -; movlw .120 -; movff WREG,box_temp+2 ; row bottom (0-239) -; movlw .82 -; movff WREG,box_temp+3 ; column left (0-159) -; movlw .159 -; movff WREG,box_temp+4 ; column right (0-159) -; call PLED_box +; WIN_BOX_BLACK .25, .120, .82, .159 ; Draw Frame - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .25 - movff WREG,box_temp+1 ; row top (0-239) - movlw .120 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .82 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame + WIN_FRAME_STD .25, .120, .82, .159 ; Draw N2 Tissues lfsr FSR2, char_O_tissue_saturation+.000 ; N2 movlw d'16' movwf wait_temp ; 16 tissues clrf waitms_temp ; Row offset + + movlw .1 + movff WREG,win_height ; row bottom (0-239) + movlw .100 + movff WREG,win_leftx2 ; column left (0-159) + PLED_tissue_saturation_graph3: - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data + movlw .28 addwf waitms_temp,W - movff WREG,box_temp+1 ; row top (0-239) - movlw .28 - addwf waitms_temp,W - movff WREG,box_temp+2 ; row bottom (0-239) + movff WREG,win_top ; row top (0-239) incf waitms_temp,F incf waitms_temp,F - movlw .100 - movff WREG,box_temp+3 ; column left (0-159) - - movff POSTINC2,box_temp+4 - bcf STATUS,C - rrcf box_temp+4,F + movf POSTINC2,W + bcf STATUS,C ; Clear carry + rrcf WREG ; And divide by 4 bcf STATUS,C - rrcf box_temp+4,F - movlw .100 - addwf box_temp+4,F ; column right (0-159) - - movlw d'157' ; limit display - cpfslt box_temp+4 ; skip if 157 (WREG) < box_temp+4 - movwf box_temp+4 + rrcf WREG + movff WREG,win_width + movlw d'57' ; limit display + cpfslt win_width ; skip if 157 (WREG) < box_temp+4 + movwf win_width call PLED_box @@ -3073,33 +2534,31 @@ movlw d'16' movwf wait_temp ; 16 tissues clrf waitms_temp ; Row offset + +; movlw .1 +; movff WREG,win_height ; row bottom (0-239) +; movlw .100 +; movff WREG,win_leftx2 ; column left (0-159) +; call PLED_standard_color + PLED_tissue_saturation_graph2: - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data + movlw .86 addwf waitms_temp,W - movff WREG,box_temp+1 ; row top (0-239) - movlw .86 - addwf waitms_temp,W - movff WREG,box_temp+2 ; row bottom (0-239) + movff WREG,win_top ; row top (0-239) incf waitms_temp,F incf waitms_temp,F - movlw .100 - movff WREG,box_temp+3 ; column left (0-159) - - movff POSTINC2,box_temp+4 - bcf STATUS,C - rrcf box_temp+4,F + movf POSTINC2,W + bcf STATUS,C ; Clear carry + rrcf WREG ; And divide by 4 bcf STATUS,C - rrcf box_temp+4,F - movlw .100 - addwf box_temp+4,F ; column right (0-159) - - movlw d'157' ; limit display - cpfslt box_temp+4 ; skip if 157 (WREG) < box_temp+4 - movwf box_temp+4 + rrcf WREG + movff WREG,win_width + movlw d'57' ; limit display + cpfslt win_width ; skip if 157 (WREG) < box_temp+4 + movwf win_width call PLED_box @@ -3109,116 +2568,39 @@ ; Draw Text WIN_LEFT .84 WIN_TOP .32 - call PLED_standard_color - lfsr FSR2,letter - movlw 'N' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 - call word_processor - WIN_LEFT .84 + STRCPY_PRINT "N2" + WIN_TOP .90 - call PLED_standard_color - lfsr FSR2,letter - movlw 'H' - movwf POSTINC2 - movlw 'e' - movwf POSTINC2 - call word_processor + STRCPY_PRINT "He" movff char_O_gtissue_no,wait_temp ; used as temp - lfsr FSR2,letter lfsr FSR1,char_O_tissue_saturation+0 incf wait_temp,F ; make 1-16 of 0-15 + PLED_tissue_saturation_graph4: ; point to leading tissue... movff POSTINC1,lo ; copy/overwrite to lo register decfsz wait_temp,F ; count until zero bra PLED_tissue_saturation_graph4 ;loop + + lfsr FSR2,letter output_8 - movlw '%' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 - WIN_LEFT .84 + STRCAT "% " + WIN_TOP .62 WIN_FONT FT_SMALL - call PLED_standard_color call word_processor bcf leftbind ; Draw Scale - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .73 - movff WREG,box_temp+1 ; row top (0-239) - movlw .74 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121 - movff WREG,box_temp+3 ; column left (0-159) - movlw .157 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_frame - - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .61 - movff WREG,box_temp+1 ; row top (0-239) - movlw .84 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121 - movff WREG,box_temp+3 ; column left (0-159) - movlw .122 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .65 - movff WREG,box_temp+1 ; row top (0-239) - movlw .80 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121+.9 - movff WREG,box_temp+3 ; column left (0-159) - movlw .122+.9 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .65 - movff WREG,box_temp+1 ; row top (0-239) - movlw .80 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121+.18 - movff WREG,box_temp+3 ; column left (0-159) - movlw .122+.18 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .65 - movff WREG,box_temp+1 ; row top (0-239) - movlw .80 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121+.27 - movff WREG,box_temp+3 ; column left (0-159) - movlw .122+.27 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - GETCUSTOM8 d'35' ; Standard output color - movff WREG,box_temp+0 ; Data - movlw .61 - movff WREG,box_temp+1 ; row top (0-239) - movlw .84 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .121+.36 - movff WREG,box_temp+3 ; column left (0-159) - movlw .122+.36 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box - + WIN_BOX_STD .73, .74, .121, .157 + WIN_BOX_STD .61, .84, .121, .122 + WIN_BOX_STD .65, .80, .130, .131 + WIN_BOX_STD .65, .80, .139, .140 + WIN_BOX_STD .65, .80, .148, .149 + WIN_BOX_STD .61, .84, .157, .158 return - PLED_startupscreen1: call PLED_topline_box WIN_INVERT .1 ; Init new Wordprocessor @@ -3362,58 +2744,44 @@ call deco_calc_desaturation_time ; calculate desaturation time movlb b'00000001' ; select ram bank 1 - lfsr FSR2,letter - movlw '#' - movwf POSTINC2 + STRCPY "#" movff char_O_gtissue_no,lo movff char_O_gtissue_no,wait_temp ; used as temp bsf leftbind output_8 - movlw ' ' - movwf POSTINC2 - movlw '(' - movwf POSTINC2 + STRCAT " (" movlw d'16' cpfslt wait_temp bra PLED_show_leading_tissue_he - movlw 'N' - movwf POSTINC2 - movlw '2' - movwf POSTINC2 + STRCAT "N2" bra PLED_show_leading_tissue2 + PLED_show_leading_tissue_he: - movlw 'H' - movwf POSTINC2 - movlw 'e' - movwf POSTINC2 + STRCAT "He" + PLED_show_leading_tissue2: - movlw ')' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 WIN_LEFT .95 WIN_TOP .192 WIN_FONT FT_SMALL call PLED_standard_color - call word_processor - - lfsr FSR2,letter + + STRCAT_PRINT ") " + lfsr FSR1,char_O_tissue_saturation+0 incf wait_temp,F ; make 1-16 of 0-15 PLED_show_leading_tissue3: ; point to leading tissue... movff POSTINC1,lo ; copy/overwrite to lo register decfsz wait_temp,F ; count until zero bra PLED_show_leading_tissue3 ;loop - output_8 - movlw '%' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + WIN_LEFT .95 WIN_TOP .216 WIN_FONT FT_SMALL - call word_processor + + lfsr FSR2,letter + output_8 + STRCAT_PRINT "% " bcf leftbind return @@ -3423,16 +2791,7 @@ PLED_topline_box: ; Writes a filled box... GETCUSTOM8 d'35' ; ... with the standard color PLED_topline_box2: - movff WREG,box_temp+0 ; Data - movlw .000 - movff WREG,box_temp+1 ; row top (0-239) - movlw .026 - movff WREG,box_temp+2 ; row bottom (0-239) - movlw .000 - movff WREG,box_temp+3 ; column left (0-159) - movlw .159 - movff WREG,box_temp+4 ; column right (0-159) - call PLED_box + WIN_BOX_COLOR .0, .26, .0, .159 return PLED_display_cns: @@ -3455,22 +2814,12 @@ WIN_FONT FT_SMALL PLED_color_code warn_cns ; Color-code CNS output - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - movlw 'N' - movwf POSTINC2 - movlw 'S' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCPY "CNS:" movff char_O_CNS_fraction,lo bsf leftbind output_8 bcf leftbind - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" return PLED_display_cns_surface: @@ -3490,22 +2839,12 @@ WIN_INVERT .0 ; Init new Wordprocessor PLED_color_code warn_cns ; Color-code CNS output - lfsr FSR2,letter - movlw 'C' - movwf POSTINC2 - movlw 'N' - movwf POSTINC2 - movlw 'S' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + STRCPY "CNS:" movff char_O_CNS_fraction,lo bsf leftbind output_8 bcf leftbind - movlw '%' - movwf POSTINC2 - call word_processor + STRCAT_PRINT "%" return @@ -3580,32 +2919,26 @@ movlw d'4' addwf wait_temp,F ; Increase eeprom address for gas list - lfsr FSR2,letter - movlw 'G' - movwf POSTINC2 + STRCPY "G" movff hi,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 + PUTC ':' movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo output_8 ; outputs into Postinc2! - movlw '/' - movwf POSTINC2 + PUTC '/' incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo output_8 ; outputs into Postinc2! - movlw ' ' - movwf POSTINC2 + PUTC ' ' movf hi,W ; Gas number addlw d'27' ; -> Adress of change depth register call read_int_eeprom_1 movff EEDATA,lo ; Change depth in m output_99 ; outputs into Postinc2! - movlw 'm' - movwf POSTINC2 + PUTC 'm' read_int_eeprom d'27' ; read flag register movff hi,lo ; copy gas number PLED_simdata_screen2_loop1: @@ -3660,17 +2993,10 @@ WIN_LEFT .0 movff waitms_temp,win_top ; Set Row - lfsr FSR2,letter - movlw 'S' - movwf POSTINC2 - movlw 'P' - movwf POSTINC2 + STRCPY "SP" movff temp6,lo ; copy gas number output_8 ; display gas number - movlw ':' - movwf POSTINC2 - movlw ' ' - movwf POSTINC2 + STRCAT ": " movff wait_temp, EEADR; SP #hi position call read_eeprom ; get byte (stored in EEDATA) movff EEDATA,lo ; copy to lo @@ -3701,18 +3027,10 @@ WIN_LEFT .0 WIN_TOP .110 - lfsr FSR2,letter - movlw 'D' - movwf POSTINC2 - movlw 'i' - movwf POSTINC2 - movlw 'l' - movwf POSTINC2 - movlw ':' - movwf POSTINC2 + + STRCPY "Dil:" output_8 ; O2 Ratio - movlw '/' - movwf POSTINC2 + STRCAT "/" movff hi,lo output_8 ; He Ratio call word_processor
--- a/code_part1/OSTC_code_asm_part1/simulator.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/simulator.asm Thu Dec 30 23:45:20 2010 +0100 @@ -161,6 +161,8 @@ WIN_LEFT .0 WIN_TOP .160 + call PLED_standard_color + STRCPY "TTS: " movff char_O_ascenttime,lo bcf leftbind
--- a/code_part1/OSTC_code_asm_part1/strings.asm Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/strings.asm Thu Dec 30 23:45:20 2010 +0100 @@ -144,3 +144,34 @@ VARARGS_GET8 win_top VARARGS_END return + +;============================================================================= + +box_std_block: ; Use standard color (CF#35) + call PLED_standard_color + bra box_common +box_color_block: ; Use color from WREG + call PLED_set_color + bra box_common +box_black_block: ; Use black color + clrf WREG + movff WREG,win_color1 ; Bank-safe addressing. + movff WREG,win_color2 +box_common: + VARARGS_BEGIN + VARARGS_GET8 win_top + VARARGS_GET8 win_height + VARARGS_GET8 win_leftx2 + VARARGS_GET8 win_width + VARARGS_END + goto PLED_box + +box_frame_std: + call PLED_standard_color + VARARGS_BEGIN + VARARGS_GET8 win_top + VARARGS_GET8 win_height + VARARGS_GET8 win_leftx2 + VARARGS_GET8 win_width + VARARGS_END + goto PLED_frame
--- a/code_part1/OSTC_code_asm_part1/strings.inc Tue Dec 28 15:28:55 2010 +0100 +++ b/code_part1/OSTC_code_asm_part1/strings.inc Thu Dec 30 23:45:20 2010 +0100 @@ -92,6 +92,14 @@ endm ;============================================================================= +; A variant of STRCAT when there is just on char to output +; Input/Output/Trashed : none. +PUTC macro char + movlw char + movwf POSTINC2 + endm + +;============================================================================= ; A variant of STRCPY that send the string to the word processor afterwards. ; Input/Output: see STRCPY. ; Trashed: See STRCPY + word_processor. In particular, switch RAM to Bank1 @@ -143,3 +151,32 @@ call start_large_invert_block DB x, y endm + +;============================================================================= +; A shortcut for PLED_box and PLED_frame call sequences. +; +; Erase a given screen area. +WIN_BOX_BLACK macro top, bottom, left, right + call box_black_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm + +; Fill a given screen area with standard color (CF35). +WIN_BOX_STD macro top, bottom, left, right + call box_std_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm + +; Fill a given screen area with color from WREG (8bits rrrgggbb) +WIN_BOX_COLOR macro top, bottom, left, right + call box_color_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm + +; Draw a frame in standard color (CF35). +WIN_FRAME_STD macro top, bottom, left, right + call box_frame_std + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm + +