Shop OBEX P1 Docs P2 Docs Learn Events
Using a debug routine with multiple text strings without repeating DEBUG CRSRX — Parallax Forums

Using a debug routine with multiple text strings without repeating DEBUG CRSRX

beazleybubbeazleybub Posts: 102
edited 2008-08-17 20:26 in BASIC Stamp
In my program I am using subroutines to print text in the debug window based on a value.
How·do I trim the fat on this program by getting rid of the additional DEBUG CRSRXY, 0, 10, CLREOL statements?
I have tried to use DATA with no success. Could someone please tell me at least what·command I should use?
 IF Work = 1 THEN
 GOSUB Print1:
 ENDIF
 
 IF Work = 2 THEN
 GOSUB Print2:
 ENDIF
 
 IF Work = 3 THEN
 GOSUB Print3:
 ENDIF
 
 
Print1:
 
DEBUG CRSRXY, 0, 10, CLREOL, "Some text"
DEBUG CRSRXY, 0, 11, CLREOL, "Some more text"
RETURN
 
Print2:
 
DEBUG CRSRXY, 0, 10, CLREOL, "Additional text"
DEBUG CRSRXY, 0, 11, CLREOL, "Some more additional text" 
RETURN 
Print3:
 
DEBUG CRSRXY, 0, 10, CLREOL, "Even more text"
DEBUG CRSRXY, 0, 11, CLREOL, "Even more additional text" 
RETURN

 

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-17 19:08
    You could set up another level of subroutine like this
    Clear1:
    DEBUG CRSRXY, 0, 10, CLREOL
    RETURN
    Clear2:
    DEBUG CRSRXY, 0, 11, CLREOL
    RETURN
    Print1:
    GOSUB Clear1
    DEBUG "Some text"
    GOSUB Clear2
    DEBUG "Some more text"
    RETURN
    
  • beazleybubbeazleybub Posts: 102
    edited 2008-08-17 19:27
    Mike,

    Your soluton works but it uses even more of the eeprom. I am trying to free eeprom space.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!

    Post Edited (beazleybub) : 8/17/2008 7:34:54 PM GMT
  • beazleybubbeazleybub Posts: 102
    edited 2008-08-17 19:48
    Mike,

    I realized that·even if I completely remove the "DEBUG·CRSRXY,·0,·10,·CLREOL" And "DEBUG·CRSRXY,·0,·11,·CLREOL"
    statements from my entire program entirely it only saves around 3% of the EEPROM's space. So removing them is pointless.

    Thanks again.




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    How can there be·nothing? Nothing is something!
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-17 20:26
    Generally this sort of cleanup doesn't yield much in the way of EEPROM space. If part of the issue is DEBUG statements, often abbreviating the text will save a lot of space. Some programs really have to be rewritten making better use of subroutines and table-driven logic. Often the rewriting of a program will produce something not only smaller, but easier to understand and maintain.
Sign In or Register to comment.