Mercurial > public > hwos_code
diff src/strings.inc @ 634:4050675965ea
3.10 stable release
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2020 17:34:31 +0200 |
parents | cd58f7fc86db |
children | 75e90cd0c2c3 |
line wrap: on
line diff
--- a/src/strings.inc Thu Mar 05 15:06:14 2020 +0100 +++ b/src/strings.inc Tue Apr 28 17:34:31 2020 +0200 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File strings.asm combined next generation V3.03.5 +; File strings.inc * combined next generation V3.08.5 ; ; Implementation code various string functions ; @@ -10,206 +10,199 @@ ; 2010-12-02 : [jDG] Creation ; -;============================================================================= -; Copy a short embedded string to the start of the string buffer -; Input : string after macro name -; Output : chars are copied to the start of the string buffer -; FSR2 points to the first unused char containing the NULL termination -; Trashed: WREG, TBLPTR, TABLAT, PRODL -; Note : uses bank-safe calls only + +;----------------------------------------------------------------------------- +; Initialize the Buffer +; +INIT_BUFFER macro + lfsr FSR2,buffer ; load FSR2 with base address of the buffer + endm + + +;----------------------------------------------------------------------------- +; Re-Initialize the Buffer ; - extern strcpy_block -STRCPY macro string - call strcpy_block - DB string, 0 +REINIT_BUFFER macro + clrf FSR2L ; reset the buffer pointer + endm + + +;----------------------------------------------------------------------------- +; Font Size Selection +; +FONT_SIZE macro font_size_input + movlw font_size_input + movwf font_size + endm + + +;----------------------------------------------------------------------------- +; Dump the Buffer to Screen +; +PRINT macro + extern print + call print ; append terminator to buffer and print buffer endm -;============================================================================= -; A variant of STRCPY that appends chars in the string buffer at the current -; FSR2 pointer position -; Input/Output/Trashed: see STRCPY + +;----------------------------------------------------------------------------- +; Macros to print embedded (untranslated) Texts +;----------------------------------------------------------------------------- + +;----------------------------------------------------------------------------- +; Copy an embedded (untranslated) Text to the Buffer ; - extern strcat_block -STRCAT macro string - call strcat_block - DB string, 0 +STRCPY macro string + extern strcpy_block + call strcpy_block ; copy text to buffer + DB string, 0 ; inline text with terminator endm -;============================================================================= -; A variant of STRCAT when there is just on char to output -; Input/Output/Trashed: see STRCPY + +;----------------------------------------------------------------------------- +; Append an embedded (untranslated) Text to the Buffer ; -PUTC macro char - movlw char - movwf POSTINC2 +STRCAT macro string + extern strcat_block + call strcat_block ; append text to buffer + DB string, 0 ; inline text with terminator endm -;============================================================================= -; A variant of STRCPY that sends the string to the word processor afterwards -; Input/Output: see STRCPY -; Trashed : see STRCPY + word_processor. In particular, switches RAM to Bank1 + +;----------------------------------------------------------------------------- +; Append a single Character to the Buffer ; - extern strcpy_block_print -STRCPY_PRINT macro string - call strcpy_block_print - DB string, 0 +PUTC macro char + movlw char ; get character into WREG + movwf POSTINC2 ; append character to buffer + endm + + +;----------------------------------------------------------------------------- +; Append a single Character to the Buffer and dump the Buffer to Screen +; +PUTC_PRINT macro char + extern putc_print + movlw char ; get character into WREG + call putc_print ; append charcator to buffer and print whole buffer endm -;============================================================================= -; A variant of STRCAT that sends the string to the word processor afterwards -; Input/Output: see STRCAT -; Trashed : see STRCPY + word_processor. In particular, switches RAM to Bank1 + +;----------------------------------------------------------------------------- +; Copy an embedded Text to the Start of the Buffer and dump the Buffer to Screen ; - extern strcat_block_print -STRCAT_PRINT macro string - call strcat_block_print - DB string, 0 +STRCPY_PRINT macro string + extern strcpy_block_print + call strcpy_block_print ; copy text to buffer and print whole buffer + DB string, 0 ; inline text with terminator endm -;============================================================================= -; Subroutines to operate on strings from PROM code + +;----------------------------------------------------------------------------- +; Append an embedded Text to the Content of the Buffer and dump the Buffer to Screen ; -; Input : TBLPTR : string pointer into PROM -; Trashed: FSR1 -; Output : string in buffer, FSR2 pointer on the closing null byte - - extern strcpy_prom, strcat_prom - extern strcpy_prom_print, strcat_prom_print - -;============================================================================= -; Subroutines and macros to operate on multilingual text -; - extern strcpy_text -STRCPY_TEXT macro txt - extern txt - lfsr FSR1, txt - call strcpy_text +STRCAT_PRINT macro string + extern strcat_block_print + call strcat_block_print ; append text to buffer and print whole buffer + DB string, 0 ; inline text with terminator endm - extern strcpy_text_print -STRCPY_TEXT_PRINT macro txt + +;----------------------------------------------------------------------------- +; Functions for direct printing of multi-lingual Texts pointed to by FSR1 +;----------------------------------------------------------------------------- + + extern strcpy_text_FSR ; translate and copy text to buffer + extern strcat_text_FSR ; translate and append text to buffer + + +;----------------------------------------------------------------------------- +; Macros to print multi-lingual (translated) Texts +;----------------------------------------------------------------------------- + +;----------------------------------------------------------------------------- +; Copy a multi-lingual Text to the Start of the Buffer +; +STRCPY_TEXT macro txt + extern strcpy_text extern txt - lfsr FSR1, txt - call strcpy_text_print - endm - - extern strcat_text -STRCAT_TEXT macro txt - extern txt - lfsr FSR1, txt - call strcat_text + call strcpy_text ; translate and copy text to buffer + DB LOW(txt), HIGH(txt) endm - extern strcat_text_print -STRCAT_TEXT_PRINT macro txt + +;----------------------------------------------------------------------------- +; Append a multi-lingual Text to the Content of the Buffer +; +STRCAT_TEXT macro txt + extern strcat_text extern txt - lfsr FSR1, txt - call strcat_text_print + call strcat_text ; translate and append text to buffer + DB LOW(txt), HIGH(txt) endm -;============================================================================= -; A shortcut for the macros WIN_TOP + WIN_LEFT + WIN_FONT -; The idea is to replace a 4x6=24 bytes sequence by a more compact 6 bytes one. + +;----------------------------------------------------------------------------- +; Copy a multi-lingual Text to the Start of the Buffer and dump the Buffer to Screen +; +STRCPY_TEXT_PRINT macro txt + extern strcpy_text_print + extern txt + call strcpy_text_print ; translate and copy text to buffer, then dump buffer to screen + DB LOW(txt), HIGH(txt) + endm + + +;----------------------------------------------------------------------------- +; Append a multi-lingual Text to the Content of the Buffer and dump the Buffer to Screen ; -; Trashed: TBLPTR, TABLAT, WREG. -; Note : uses bank-safe calls only -; +STRCAT_TEXT_PRINT macro txt + extern strcat_text_print + extern txt + call strcat_text_print ; translate and copy text to buffer, then dump buffer to screen + DB LOW(txt), HIGH(txt) + endm + + +;----------------------------------------------------------------------------- +; Macros to set Font Size and Output Position in one Batch +;----------------------------------------------------------------------------- + +WIN_TINY macro x, y extern start_tiny_block -WIN_TINY macro x, y call start_tiny_block DB x, y endm +WIN_SMALL macro x, y extern start_small_block -WIN_SMALL macro x, y call start_small_block DB x, y endm +WIN_STD macro x, y extern start_std_block -WIN_STD macro x, y call start_std_block DB x, y endm +WIN_MEDIUM macro x, y extern start_medium_block -WIN_MEDIUM macro x, y call start_medium_block DB x, y endm +WIN_LARGE macro x, y extern start_large_block -WIN_LARGE macro x, y call start_large_block DB x, y endm +WIN_HUGE macro x, y extern start_huge_block -WIN_HUGE macro x, y call start_huge_block DB x, y endm -;============================================================================= -; Shortcuts for compact display programmings -; -TEXT_TINY macro x, y, txt - WIN_TINY x,y - STRCPY_TEXT_PRINT txt - endm - -TEXT_SMALL macro x, y, txt - WIN_SMALL x,y - STRCPY_TEXT_PRINT txt - endm - -TEXT_SMALL_INVERT macro x, y, txt - WIN_SMALL_INVERT x,y - STRCPY_TEXT_PRINT txt - endm - -TEXT_STD macro x, y, txt - WIN_STD x,y - STRCPY_TEXT_PRINT txt - endm - -TEXT_MEDIUM macro x, y, txt - WIN_MEDIUM x,y - STRCPY_TEXT_PRINT txt - endm +;----------------------------------------------------------------------------- -TEXT_LARGE macro x, y, txt - WIN_LARGE x,y - STRCPY_TEXT_PRINT txt - endm - -TEXT_HUGE macro x, y, txt - WIN_HUGE x,y - STRCPY_TEXT_PRINT txt - endm - - -STRING_TINY macro x, y, string - WIN_SMALL x,y - STRCPY_PRINT string - endm - -STRING_SMALL macro x, y, string - WIN_SMALL x,y - STRCPY_PRINT string - endm - -STRING_MEDIUM macro x, y, string - WIN_MEDIUM x,y - STRCPY_PRINT string - endm - -STRING_LARGE macro x, y, string - WIN_LARGE x,y - STRCPY_PRINT string - endm - -STRING_HUGE macro x, y, string - WIN_HUGE x,y - STRCPY_PRINT string - endm