avr: added some unit tests for LIST and TREE.

This commit is contained in:
Martin Preuss
2025-06-02 21:13:01 +02:00
parent 5153bd2f69
commit cd1fce313e
7 changed files with 909 additions and 49 deletions

View File

@@ -165,6 +165,20 @@
.include "modules/lcd2/ili9341/text.asm"
#endif
#ifdef MODULES_FONT
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/main.asm"
#endif
#ifdef MODULES_WIN
.include "common/list.asm"
.include "common/tree.asm"
.include "modules/lcd2/win/defs.asm"
.include "modules/lcd2/win/object.asm"
.include "modules/lcd2/win/widget.asm"
#endif
#ifdef MODULES_FONT_8X8
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/font8x8.asm"

View File

@@ -38,15 +38,6 @@
; ---------------------------------------------------------------------------
; heap
.equ HEAP_START = SRAM_START+0x200
.equ HEAP_SIZE = SRAM_SIZE-HEAP_START
; ---------------------------------------------------------------------------
; firmware settings including list of modules used
@@ -61,9 +52,8 @@
#define MODULES_UART_BITBANG
#define MODULES_SPI_HW
#define MODULES_ILI9341
;#define MODULES_FONT_8X8
#define MODULES_FONT_6X8
;#define MODULES_UART_BITBANG
#define MODULES_FONT
#define MODULES_WIN
;#define MODULES_TWI_MASTER
;#define MODULES_LCD
;#define LCD_MINIMAL_FONT
@@ -229,9 +219,15 @@ onEveryLoop:
;.include "common/debug.asm"
.include "modules/lcd2/font/font3.asm"
.include "modules/lcd2/font/font16x26.asm"
;.include "modules/lcd2/font/font2.asm"
;.include "modules/lcd2/font/font3.asm"
;.include "modules/lcd2/font/font16x26.asm"
;.include "modules/lcd2/font/font4.asm"
;.include "modules/lcd2/font/font12x16.asm"
.include "modules/lcd2/font/font5.asm"
.include "modules/lcd2/font/font12x20.asm"
;.include "common/list_t.asm"
.include "common/tree_t.asm"
; ---------------------------------------------------------------------------
@@ -314,8 +310,10 @@ test:
mov r7, r16
; set font
ldi zl, LOW(font3_16x26*2)
ldi zh, HIGH(font3_16x26*2)
; ldi zl, LOW(font3_16x26*2)
; ldi zh, HIGH(font3_16x26*2)
ldi zl, LOW(font5_12x20*2)
ldi zh, HIGH(font5_12x20*2)
; set buffer
ldi xl, LOW(glyphBuffer)
@@ -340,15 +338,110 @@ test:
ldi r16, 'E'
bigcall ili9341_WriteCharacterX1At
#if 0
push xl
push xh
rcall listTest1
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall listTest2
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall listTest3
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall listTest4
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
#endif
#if 1
push xl
push xh
rcall treeTest1
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall treeTest2
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall treeTest3
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
push xl
push xh
rcall treeTest4
pop xh
pop xl
brcc test_error
ldi r16, '!'
bigcall ili9341_WriteCharacterX1At
#endif
ret
test_error:
ldi r17, '0'
add r16, r17
bigcall ili9341_WriteCharacterX1At
ret
helloWorld: .db "Hello World", 0
.dseg
glyphBuffer: .byte 1024
heapStart:
.equ HEAP_START = heapStart
.equ HEAP_SIZE = SRAM_SIZE-HEAP_START