print the maximal stack pointer value when pressing shift
This commit is contained in:
parent
2a9801e676
commit
a491ab0461
2
Makefile
2
Makefile
@ -4,7 +4,7 @@ SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --idata-loc 0x80
|
|||||||
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
|
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
|
||||||
FLASHFILE ?= main.hex
|
FLASHFILE ?= main.hex
|
||||||
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/
|
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/
|
||||||
# CFLAGS += -DSTACK_DEBUG # write the stack pointer to P3_4
|
# CFLAGS += -DSTACK_DEBUG -DSHOW_STACK # write the stack pointer to P3_4
|
||||||
|
|
||||||
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c src/stack_debug.c
|
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c src/stack_debug.c
|
||||||
|
|
||||||
|
12
src/lcd.c
12
src/lcd.c
@ -285,3 +285,15 @@ void LCD_Clear() {
|
|||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TERMIO_PrintU8(uint8_t x) {
|
||||||
|
uint8_t i;
|
||||||
|
for (i = 2; i; i--) {
|
||||||
|
const uint8_t upper_nibble = (x & 0xf0) >> 4;
|
||||||
|
if (upper_nibble <= 9) {
|
||||||
|
TERMIO_PutChar(upper_nibble + '0');
|
||||||
|
} else {
|
||||||
|
TERMIO_PutChar((upper_nibble - 0x0a) + 'A');
|
||||||
|
}
|
||||||
|
x <<= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -31,6 +31,7 @@ void LCD_GoTo(uint8_t row, uint8_t col);
|
|||||||
void LCD_OutString(__xdata const char* string, uint8_t max_chars);
|
void LCD_OutString(__xdata const char* string, uint8_t max_chars);
|
||||||
void LCD_OutString_Initial(__code const char* string);
|
void LCD_OutString_Initial(__code const char* string);
|
||||||
short TERMIO_PutChar(unsigned char letter);
|
short TERMIO_PutChar(unsigned char letter);
|
||||||
|
void TERMIO_PrintU8(uint8_t x);
|
||||||
void LCD_OutNibble(uint8_t x);
|
void LCD_OutNibble(uint8_t x);
|
||||||
void LCD_ClearToEnd(uint8_t curr_row);
|
void LCD_ClearToEnd(uint8_t curr_row);
|
||||||
|
|
||||||
|
@ -523,6 +523,10 @@ int main()
|
|||||||
//print shifted status
|
//print shifted status
|
||||||
if (IsShifted){
|
if (IsShifted){
|
||||||
TERMIO_PutChar('^');
|
TERMIO_PutChar('^');
|
||||||
|
#if defined(STACK_DEBUG) && defined(SHOW_STACK)
|
||||||
|
TERMIO_PutChar(' ');
|
||||||
|
TERMIO_PrintU8(stack_max);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DESKTOP
|
#ifdef DESKTOP
|
||||||
|
@ -84,8 +84,15 @@ stack_debug_3$:
|
|||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(STACK_DEBUG) && defined(SHOW_STACK)
|
||||||
|
__xdata uint8_t stack_max = 0x00;
|
||||||
|
#endif
|
||||||
|
|
||||||
void stack_debug(uint8_t marker) {
|
void stack_debug(uint8_t marker) {
|
||||||
|
#ifdef SHOW_STACK
|
||||||
|
if (SP > stack_max) stack_max = SP;
|
||||||
|
#endif
|
||||||
stack_debug_write(marker);
|
stack_debug_write(marker);
|
||||||
stack_debug_write(SP);
|
stack_debug_write(SP);
|
||||||
}
|
}
|
||||||
#endif // !defined(DESKTOP)
|
#endif // defined(STACK_DEBUG)
|
||||||
|
@ -35,6 +35,10 @@ void stack_debug_write(uint8_t value) __naked;
|
|||||||
#define stack_debug(marker)
|
#define stack_debug(marker)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(STACK_DEBUG) && defined(SHOW_STACK)
|
||||||
|
extern __xdata uint8_t stack_max;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DESKTOP) || defined(STACK_DEBUG)
|
#if defined(DESKTOP) || defined(STACK_DEBUG)
|
||||||
#define backlight_on()
|
#define backlight_on()
|
||||||
#define backlight_off()
|
#define backlight_off()
|
||||||
|
Loading…
Reference in New Issue
Block a user