Embedded Strings in your Code Space


Results 1 to 40 of 50

Threaded View

  1. #31
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    Hi Guys,

    Hope you don't mind me butting in...

    I've been using a similar method for 18F' devices in assembler for awhile now and I wonder if you might need to account for the occasional odd length character string to make sure the address is word aligned before placing it back into TOS?

    Regards, Mike

    Code:
    ;
    ;  Example macro usage
    ;
            _Title  "K8LH Az/El Controller\r\n\n"
            _Print  "Satellite AOS:\r\n"
            _Print  "Satellite LOS:\r\n"
    
    ;******************************************************************
    ;
    ;  print the in-line string using Stack Pointer & TBLPTR
    ;
    PutString
    	movff	TOSH,TBLPTRH	; copy SP address to TBLPTR
    	movff	TOSL,TBLPTRL	;
    	clrf	TBLPTRU		;
    PutNxt	tblrd	*+		; get character
    	movf	TABLAT,W	; last character (00)?
    	bz	PutXit		; yes, exit
    	rcall	Put232		; else, print character
    	bra	PutNxt		; do another
    PutXit	btfsc	TBLPTRL,0	; odd address?
    	tblrd	*+		; yes, make it even (fix PC)
    	movf	TBLPTRH,W	;
    	movwf	TOSH		; update the return stack
    	movf	TBLPTRL,W	;
    	movwf	TOSL		;
            return                  ;
    ;
    ;******************************************************************
    Last edited by Mike, K8LH; - 29th August 2005 at 03:02.

Similar Threads

  1. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Please help with storing strings in codespace
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th May 2008, 01:02

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts