Setup git repo
This commit is contained in:
commit
2719260c41
|
@ -0,0 +1 @@
|
||||||
|
bin/
|
|
@ -0,0 +1,17 @@
|
||||||
|
# ----------------------------
|
||||||
|
# Makefile Options
|
||||||
|
# ----------------------------
|
||||||
|
|
||||||
|
NAME = TEST
|
||||||
|
ICON = icon.png
|
||||||
|
DESCRIPTION = "Test TI-84 program"
|
||||||
|
COMPRESSED = NO
|
||||||
|
ARCHIVED = NO
|
||||||
|
|
||||||
|
CFLAGS = -Wall -Wextra -Oz
|
||||||
|
CXXFLAGS = -Wall -Wextra -Oz
|
||||||
|
HAS_PRINTF := NO
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
|
||||||
|
include $(shell cedev-config --makefile)
|
|
@ -0,0 +1,27 @@
|
||||||
|
section .icon
|
||||||
|
|
||||||
|
jp ___prgm_init
|
||||||
|
db $01
|
||||||
|
public ___icon
|
||||||
|
___icon:
|
||||||
|
db $10, $10
|
||||||
|
db $FF, $FF, $FF, $FF, $FE, $B5, $B5, $D6, $D6, $B5, $B5, $FE, $FF, $FF, $FF, $FF
|
||||||
|
db $FF, $FF, $FF, $B5, $DE, $DF, $96, $56, $56, $96, $DF, $DE, $B5, $FF, $FF, $FF
|
||||||
|
db $FF, $FF, $B5, $DF, $56, $0E, $0D, $0D, $0D, $0D, $0D, $4E, $DF, $B5, $FF, $FF
|
||||||
|
db $FF, $B5, $DF, $2E, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $2E, $DF, $B5, $FF
|
||||||
|
db $FE, $DE, $56, $0D, $0D, $05, $05, $05, $05, $05, $05, $0D, $0D, $4E, $DE, $FE
|
||||||
|
db $B5, $DF, $0D, $05, $2D, $B7, $DF, $96, $4D, $D7, $D7, $B6, $05, $0D, $B7, $B5
|
||||||
|
db $B5, $96, $05, $2D, $FF, $DE, $76, $96, $4D, $FF, $96, $6E, $05, $05, $76, $B5
|
||||||
|
db $D6, $4E, $05, $76, $FF, $0D, $05, $05, $4D, $FF, $B6, $76, $05, $05, $4D, $D6
|
||||||
|
db $D6, $4E, $05, $76, $FF, $05, $05, $05, $4D, $FF, $B6, $76, $05, $05, $4D, $D6
|
||||||
|
db $B5, $76, $05, $2D, $FF, $B7, $6E, $96, $4D, $FF, $76, $4E, $05, $05, $6D, $B5
|
||||||
|
db $B5, $DE, $05, $05, $4D, $DE, $FF, $96, $4D, $DE, $DE, $B7, $05, $05, $B6, $B5
|
||||||
|
db $FE, $DE, $4E, $05, $05, $04, $04, $04, $04, $04, $04, $05, $05, $2D, $DE, $FE
|
||||||
|
db $FF, $B5, $DF, $2D, $05, $04, $04, $04, $04, $04, $05, $05, $0D, $D6, $B5, $FF
|
||||||
|
db $FF, $FF, $B5, $DF, $4D, $05, $04, $04, $04, $04, $05, $2D, $B6, $B5, $FF, $FF
|
||||||
|
db $FF, $FF, $FF, $B5, $DE, $B6, $6D, $2D, $2D, $4D, $96, $DE, $B5, $FF, $FF, $FF
|
||||||
|
db $FF, $FF, $FF, $FF, $FE, $B5, $B5, $D6, $D6, $B5, $B5, $DE, $FF, $FF, $FF, $FF
|
||||||
|
public ___description
|
||||||
|
___description:
|
||||||
|
db "Test TI-84 program", 0
|
||||||
|
___prgm_init:
|
|
@ -0,0 +1,357 @@
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
assume adl = 1
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
public _print
|
||||||
|
_print:
|
||||||
|
call __frameset0
|
||||||
|
ld a, (ix + 9)
|
||||||
|
ld l, (ix + 12)
|
||||||
|
push hl
|
||||||
|
ld l, a
|
||||||
|
push hl
|
||||||
|
call _os_SetCursorPos
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, (ix + 6)
|
||||||
|
push hl
|
||||||
|
call _os_PutStrFull
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
public _clearLine
|
||||||
|
_clearLine:
|
||||||
|
call __frameset0
|
||||||
|
ld a, (ix + 6)
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
push hl
|
||||||
|
ld l, a
|
||||||
|
push hl
|
||||||
|
call _os_SetCursorPos
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, L_.str
|
||||||
|
push hl
|
||||||
|
call _os_PutStrFull
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
public _print_ui
|
||||||
|
_print_ui:
|
||||||
|
ld hl, -33
|
||||||
|
call __frameset
|
||||||
|
ld de, 0
|
||||||
|
lea hl, ix - 24
|
||||||
|
ld (ix - 27), hl
|
||||||
|
push de
|
||||||
|
push de
|
||||||
|
call _os_SetCursorPos
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
push hl
|
||||||
|
push hl
|
||||||
|
ld hl, L_.str.1
|
||||||
|
push hl
|
||||||
|
call _print
|
||||||
|
ld bc, (ix + 6)
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, L_.str.2
|
||||||
|
ld (ix - 24), hl
|
||||||
|
ld hl, L_.str.3
|
||||||
|
ld (ix - 21), hl
|
||||||
|
ld hl, L_.str.4
|
||||||
|
ld (ix - 18), hl
|
||||||
|
ld de, 3
|
||||||
|
push bc
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, de
|
||||||
|
inc de
|
||||||
|
jq nz, BB2_1
|
||||||
|
ld de, (ix + 9)
|
||||||
|
push de
|
||||||
|
pop hl
|
||||||
|
add hl, bc
|
||||||
|
or a, a
|
||||||
|
sbc hl, bc
|
||||||
|
ld hl, 2
|
||||||
|
jq z, BB2_7
|
||||||
|
dec de
|
||||||
|
ex de, hl
|
||||||
|
jq BB2_7
|
||||||
|
BB2_1:
|
||||||
|
ld iy, (ix + 9)
|
||||||
|
push bc
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, de
|
||||||
|
jq nz, BB2_2
|
||||||
|
ld de, 2
|
||||||
|
lea bc, iy
|
||||||
|
push bc
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, de
|
||||||
|
ld hl, 0
|
||||||
|
jq z, BB2_7
|
||||||
|
inc bc
|
||||||
|
push bc
|
||||||
|
pop hl
|
||||||
|
jq BB2_7
|
||||||
|
BB2_2:
|
||||||
|
lea hl, iy
|
||||||
|
BB2_7:
|
||||||
|
ld iy, L_.str.5
|
||||||
|
ld de, 1
|
||||||
|
ld bc, 3
|
||||||
|
ld (ix - 33), hl
|
||||||
|
call __imulu
|
||||||
|
push de
|
||||||
|
pop bc
|
||||||
|
push hl
|
||||||
|
pop de
|
||||||
|
ld hl, (ix - 27)
|
||||||
|
add hl, de
|
||||||
|
ld (hl), iy
|
||||||
|
ld de, 4
|
||||||
|
BB2_8:
|
||||||
|
push bc
|
||||||
|
pop hl
|
||||||
|
or a, a
|
||||||
|
sbc hl, de
|
||||||
|
jq z, BB2_10
|
||||||
|
push bc
|
||||||
|
ld (ix - 30), bc
|
||||||
|
call _clearLine
|
||||||
|
pop hl
|
||||||
|
ld hl, (ix - 27)
|
||||||
|
ld hl, (hl)
|
||||||
|
ld de, 2
|
||||||
|
push de
|
||||||
|
ld de, (ix - 30)
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
|
call _print
|
||||||
|
ld bc, (ix - 30)
|
||||||
|
ld de, 4
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
inc bc
|
||||||
|
ld iy, (ix - 27)
|
||||||
|
lea iy, iy + 3
|
||||||
|
ld (ix - 27), iy
|
||||||
|
jq BB2_8
|
||||||
|
BB2_10:
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
push hl
|
||||||
|
ld hl, 5
|
||||||
|
push hl
|
||||||
|
ld hl, L_.str.6
|
||||||
|
push hl
|
||||||
|
call _print
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, (ix - 33)
|
||||||
|
ld sp, ix
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
public _get_input
|
||||||
|
_get_input:
|
||||||
|
ld hl, -43
|
||||||
|
call __frameset
|
||||||
|
ld iy, -720868
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
lea de, ix - 25
|
||||||
|
ld (ix - 43), de
|
||||||
|
ld (ix - 37), hl
|
||||||
|
ld (ix - 40), hl
|
||||||
|
BB3_1:
|
||||||
|
ld l, (iy)
|
||||||
|
ld h, (iy + 1)
|
||||||
|
ld (ix - 31), hl
|
||||||
|
ld hl, -720866
|
||||||
|
push de
|
||||||
|
ld e, (hl)
|
||||||
|
inc hl
|
||||||
|
ld d, (hl)
|
||||||
|
ld l, e
|
||||||
|
ld h, d
|
||||||
|
pop de
|
||||||
|
ld (ix - 28), hl
|
||||||
|
call _kb_Scan
|
||||||
|
ld iy, -720868
|
||||||
|
ld l, (iy)
|
||||||
|
ld h, (iy + 1)
|
||||||
|
ld (ix - 34), hl
|
||||||
|
ld hl, -720866
|
||||||
|
ld e, (hl)
|
||||||
|
inc hl
|
||||||
|
ld d, (hl)
|
||||||
|
ld bc, (ix - 31)
|
||||||
|
ld a, c
|
||||||
|
cp a, 1
|
||||||
|
jq z, BB3_4
|
||||||
|
ld hl, (ix - 34)
|
||||||
|
ld a, l
|
||||||
|
cp a, 1
|
||||||
|
jq nz, BB3_4
|
||||||
|
ld hl, (ix - 37)
|
||||||
|
push hl
|
||||||
|
ld hl, L_.str.7
|
||||||
|
push hl
|
||||||
|
ld hl, (ix - 43)
|
||||||
|
push hl
|
||||||
|
ld (ix - 31), de
|
||||||
|
call ___sprintf
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, 17
|
||||||
|
push hl
|
||||||
|
ld hl, 5
|
||||||
|
push hl
|
||||||
|
ld hl, (ix - 43)
|
||||||
|
push hl
|
||||||
|
call _print
|
||||||
|
ld de, (ix - 31)
|
||||||
|
ld iy, -720868
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
ld hl, (ix - 37)
|
||||||
|
inc hl
|
||||||
|
ld (ix - 37), hl
|
||||||
|
BB3_4:
|
||||||
|
ld a, e
|
||||||
|
ld hl, (ix - 28)
|
||||||
|
xor a, l
|
||||||
|
or a, a
|
||||||
|
jq z, BB3_10
|
||||||
|
ld a, e
|
||||||
|
cp a, 1
|
||||||
|
ld hl, 4
|
||||||
|
jq z, BB3_8
|
||||||
|
ld a, e
|
||||||
|
cp a, 8
|
||||||
|
jq nz, BB3_9
|
||||||
|
ld hl, 3
|
||||||
|
BB3_8:
|
||||||
|
ld de, (ix - 40)
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
|
call _print_ui
|
||||||
|
ld (ix - 40), hl
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
BB3_9:
|
||||||
|
ld iy, -720868
|
||||||
|
BB3_10:
|
||||||
|
ld l, (iy)
|
||||||
|
ld h, (iy + 1)
|
||||||
|
ld a, l
|
||||||
|
cp a, 64
|
||||||
|
jq nz, BB3_1
|
||||||
|
ld sp, ix
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
public _main
|
||||||
|
_main:
|
||||||
|
ld iy, -3145600
|
||||||
|
call _os_ClrLCD
|
||||||
|
call _os_HomeUp
|
||||||
|
call _os_DrawStatusBar
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
push hl
|
||||||
|
push hl
|
||||||
|
call _print_ui
|
||||||
|
pop hl
|
||||||
|
pop hl
|
||||||
|
call _get_input
|
||||||
|
BB4_1:
|
||||||
|
call _os_GetCSC
|
||||||
|
or a, a
|
||||||
|
jq z, BB4_1
|
||||||
|
or a, a
|
||||||
|
sbc hl, hl
|
||||||
|
ret
|
||||||
|
section .text,"ax",@progbits
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str
|
||||||
|
L_.str:
|
||||||
|
db " ", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.1
|
||||||
|
L_.str.1:
|
||||||
|
db "Test: ", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.2
|
||||||
|
L_.str.2:
|
||||||
|
db "[ ] one", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.3
|
||||||
|
L_.str.3:
|
||||||
|
db "[ ] two", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.4
|
||||||
|
L_.str.4:
|
||||||
|
db "[ ] three", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.5
|
||||||
|
L_.str.5:
|
||||||
|
db "[x] three", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.6
|
||||||
|
L_.str.6:
|
||||||
|
db "<Enter> pressed: ", 0
|
||||||
|
|
||||||
|
section .rodata,"a",@progbits
|
||||||
|
private L_.str.7
|
||||||
|
L_.str.7:
|
||||||
|
db "%d", 0
|
||||||
|
|
||||||
|
ident "clang version 14.0.0 (https://github.com/jacobly0/llvm-project a139def90d26173f771eb1eca797633d1fbb2797)"
|
||||||
|
extern _os_DrawStatusBar
|
||||||
|
extern __Unwind_SjLj_Register
|
||||||
|
extern _os_ClrLCD
|
||||||
|
extern __Unwind_SjLj_Unregister
|
||||||
|
extern __frameset
|
||||||
|
extern _os_PutStrFull
|
||||||
|
extern __imulu
|
||||||
|
extern _kb_Scan
|
||||||
|
extern ___sprintf
|
||||||
|
extern __frameset0
|
||||||
|
extern _os_HomeUp
|
||||||
|
extern _os_SetCursorPos
|
||||||
|
extern _os_GetCSC
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*
|
||||||
|
*--------------------------------------
|
||||||
|
* Program Name: MY_PROGRAM
|
||||||
|
* Author: Erin L. Nova
|
||||||
|
* License: CNPLv7+
|
||||||
|
* Description: A test TI-84 program
|
||||||
|
*--------------------------------------
|
||||||
|
*/
|
||||||
|
#include <tice.h>
|
||||||
|
#include <keypadc.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
enum Directions {
|
||||||
|
None,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
};
|
||||||
|
|
||||||
|
int print(const char *string, int x, int y) { // Function to easily print to a location on screen
|
||||||
|
os_SetCursorPos(x, y);
|
||||||
|
os_PutStrFull(string);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int clearLine(int x) {
|
||||||
|
os_SetCursorPos(x, 0);
|
||||||
|
os_PutStrFull(" ");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int print_ui(enum Directions direction, int prev_index) {
|
||||||
|
os_SetCursorPos(0, 0); // Reset cursor position
|
||||||
|
|
||||||
|
print("Test: ", 0, 0);
|
||||||
|
|
||||||
|
int index = prev_index;
|
||||||
|
|
||||||
|
int num_items = 3;
|
||||||
|
|
||||||
|
char *items[8];
|
||||||
|
items[0] = "\[ ] one";
|
||||||
|
items[1] = "\[ ] two";
|
||||||
|
items[2] = "\[ ] three";
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case Down:
|
||||||
|
if (index != num_items-1) {
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Up:
|
||||||
|
if (index != 0) {
|
||||||
|
index--;
|
||||||
|
} else {
|
||||||
|
index = num_items-1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
items[index] = "\[x] three";
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < num_items; i++) {
|
||||||
|
clearLine(i+1);
|
||||||
|
print(items[i], i+1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
print("<Enter> pressed: ", num_items+2, 0);
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_input() {
|
||||||
|
// Key variable
|
||||||
|
kb_key_t key, dir_key, prev_key, prev_dir_key;
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
// Loop until 2nd is pressed
|
||||||
|
do {
|
||||||
|
// Update kb_Data
|
||||||
|
prev_key = kb_Data[6];
|
||||||
|
prev_dir_key = kb_Data[7];
|
||||||
|
kb_Scan();
|
||||||
|
|
||||||
|
// Load group registers
|
||||||
|
key = kb_Data[6];
|
||||||
|
dir_key = kb_Data[7];
|
||||||
|
|
||||||
|
char str[25];
|
||||||
|
|
||||||
|
// Make sure it's a new press
|
||||||
|
if (key != prev_key) {
|
||||||
|
// Check what key it is
|
||||||
|
switch (key) {
|
||||||
|
case kb_Enter:
|
||||||
|
sprintf(str, "%d", counter);
|
||||||
|
print(str, 5, 17);
|
||||||
|
counter++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure it's a new press
|
||||||
|
if (dir_key != prev_dir_key) {
|
||||||
|
// Check what key it is
|
||||||
|
switch (dir_key) {
|
||||||
|
case kb_Down:
|
||||||
|
index = print_ui(Down, index);
|
||||||
|
break;
|
||||||
|
case kb_Up:
|
||||||
|
index = print_ui(Up, index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (kb_Data[6] != kb_Clear);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
os_ClrHome(); // Clear the screen
|
||||||
|
print_ui(None, 0);
|
||||||
|
|
||||||
|
get_input();
|
||||||
|
|
||||||
|
// Wait for input
|
||||||
|
while (!os_GetCSC());
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue