Skip to content

Commit 63ff603

Browse files
Improve build system, minor cleanup of interrupts and startup code
1 parent fdef3dc commit 63ff603

File tree

14 files changed

+97
-73
lines changed

14 files changed

+97
-73
lines changed

CEdev/examples/library_examples/keypad/demo_1/src/main.c

+35-35
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,48 @@ void printText(int8_t xpos, int8_t ypos, const char *text);
1818

1919
/* Main Function */
2020
void main(void) {
21-
/* Key varaible */
22-
kb_key_t key;
23-
const char *erase_string = " ";
21+
/* Key varaible */
22+
kb_key_t key;
23+
const char *erase_string = " ";
2424

2525
prgm_CleanUp();
2626

27-
/* Loop until 2nd is pressed */
28-
do {
29-
30-
/* Update kb_Data */
31-
kb_Scan();
32-
33-
key = kb_Data[kb_group_7];
27+
/* Loop until 2nd is pressed */
28+
do {
29+
30+
/* Update kb_Data */
31+
kb_Scan();
32+
33+
key = kb_Data[kb_group_7];
3434

35-
/* Print the current arrow key input */
36-
if(key & kb_Down) {
37-
printText(0,0,"Down");
38-
} else {
39-
printText(0,0,erase_string);
40-
}
41-
if(key & kb_Up) {
42-
printText(0,1,"Up");
43-
} else {
44-
printText(0,1,erase_string);
45-
}
46-
if(key & kb_Left) {
47-
printText(0,2,"Left");
48-
} else {
49-
printText(0,2,erase_string);
50-
}
51-
if(key & kb_Right) {
52-
printText(0,3,"Right");
53-
} else {
54-
printText(0,3,erase_string);
55-
}
56-
} while( kb_Data[kb_group_1] != kb_2nd );
35+
/* Print the current arrow key input */
36+
if(key & kb_Down) {
37+
printText(0,0,"Down");
38+
} else {
39+
printText(0,0,erase_string);
40+
}
41+
if(key & kb_Up) {
42+
printText(0,1,"Up");
43+
} else {
44+
printText(0,1,erase_string);
45+
}
46+
if(key & kb_Left) {
47+
printText(0,2,"Left");
48+
} else {
49+
printText(0,2,erase_string);
50+
}
51+
if(key & kb_Right) {
52+
printText(0,3,"Right");
53+
} else {
54+
printText(0,3,erase_string);
55+
}
56+
} while(kb_Data[kb_group_1] != kb_2nd);
5757

58-
prgm_CleanUp();
58+
prgm_CleanUp();
5959
}
6060

6161
/* Draw text on the homescreen at the given X/Y location */
6262
void printText(int8_t xpos, int8_t ypos, const char *text) {
63-
os_SetCursorPos(ypos, xpos);
64-
os_PutStrFull(text);
63+
os_SetCursorPos(ypos, xpos);
64+
os_PutStrFull(text);
6565
}

CEdev/examples/library_examples/keypad/demo_2/src/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void main(void) {
3232
int_SetVector(ON_IVECT, isr_on);
3333
int_SetVector(KEYBOARD_IVECT, isr_keyboard);
3434

35-
/* Tell the interrupt controller that the ON flag should latch and be enabled */
36-
int_LatchConfig = int_EnableConfig = INT_ON | INT_KEYBOARD;
35+
/* Tell the interrupt controller that the ON flag to be enabled */
36+
int_EnableConfig = INT_ON | INT_KEYBOARD;
3737
kb_EnableInt = KB_DATA_CHANGED;
3838

3939
/* Configure the keypad to be continously scanning */
@@ -62,10 +62,10 @@ void interrupt isr_on(void) {
6262

6363
void interrupt isr_keyboard(void) {
6464
/* Read the keypad data */
65-
kb_key_t key = kb_DataArray[kb_group_6];
65+
kb_key_t key = kb_Data[kb_group_6];
6666

6767
/* If [enter] or [clear] are pressed, set the flag */
68-
if(key & (kb_Enter | kb_KeyClear)) {
68+
if(key & (kb_Enter | kb_Clear)) {
6969
exit_loop = true;
7070
}
7171

Binary file not shown.

CEdev/examples/library_examples/keypad/demo_3/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void main(void) {
3333
int_SetVector(KEYBOARD_IVECT, isr_keyboard);
3434

3535
/* Tell the interrupt controller that the ON flag should latch and be enabled */
36-
int_LatchConfig = int_EnableConfig = INT_ON | INT_KEYBOARD;
36+
int_EnableConfig = INT_ON | INT_KEYBOARD;
3737
kb_EnableInt = KB_MODE_1_PRESS;
3838

3939
/* Configure the keypad to be continously scanning */

CEdev/include/asm/cstartup.asm

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ _init:
5353
ld a,(hl)
5454
push af
5555
ld (hl),1 ; reduce flash wait states (because of rtl)
56-
call 0004F4h ; _usb_DisableTimer
56+
call 0004F4h ; usb_DisableTimers
5757
ld (__errsp+1),sp ; save the stack from death
5858
call _main
5959
__exit:
6060
ex de,hl
6161
__errsp:
62+
push de
63+
call 0004F0h ; usb_ResetTimers
64+
pop de
6265
ld sp,0
6366
pop af
6467
pop hl

CEdev/include/lib/ce/usb.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ void usb_ResetChip(void);
5959
/**
6060
* Disables the usb timer interrupt (timer 3)
6161
*/
62-
void usb_DisableTimer(void);
62+
void usb_DisableTimers(void);
6363

6464
/**
6565
* Enables the usb timer interrupt (timer 3)
6666
*/
67-
void usb_EnableTimer(void);
67+
void usb_EnableTimers(void);
6868

6969
/**
7070
* Resets the usb timer interrupt (timer 3)
7171
*/
72-
void usb_ResetTimer(void);
72+
void usb_ResetTimers(void);
7373

7474
#endif

CEdev/lib/src/buildall.bat

+13
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ set C_SRC=%RTL_STATIC_C_SRC%
113113
set ASM_SRC=%RTL_STATIC_ASM_SRC%
114114
call buildlib.bat crt_static.lib
115115

116+
echo -- Building Libraries...
117+
cd fileio
118+
call build.bat
119+
cd ..
120+
cd keypad
121+
call build.bat
122+
cd ..
123+
cd graphics/graphc
124+
call build.bat
125+
cd ../graphx
126+
call build.bat
127+
cd ../..
128+
116129
echo -- Copying the libraries...
117130

118131
REM -- copy the libraries --

CEdev/lib/src/ce/interrupts.asm

+8-14
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ intRtc equ 1000h
2525
;-------------------------------------------------------------------------------
2626
_int_Initialize:
2727
di
28-
ld de,lconf
29-
ld hl,mpIntMask
30-
ld bc,16
31-
ldir
3228
ld hl,cconf
3329
ld de,mpIntMask
3430
ld bc,16
@@ -129,14 +125,12 @@ _int_Reset:
129125
ldir
130126
im 1
131127
ret
132-
segment bss
133-
lconf: ds 16
134128
segment data
135-
cconf: ; Mask
136-
db 000h,000h,000h,000h
137-
; ACK
138-
db 0FFh,0FFh,0FFh,0FFh
139-
; Latch
140-
db 000h,000h,000h,000h
141-
; Invert
142-
db 000h,000h,000h,000h
129+
lconf: dw intOnKey | intOsTimer | intRtc | 2000h, 0
130+
dw 0FFFFh, 0FFFFh
131+
dw intOnKey | intOsTimer, 0
132+
dw 0, 0
133+
cconf: ;dw 0, 0
134+
dw 0FFFFh, 0FFFFh
135+
dw 0, 0
136+
dw 0, 0

CEdev/lib/src/ce/usb.asm

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
.def _usb_BusPowered
66
.def _usb_SelfPowered
77
.def _usb_ResetChip
8-
.def _usb_DisableTimer
9-
.def _usb_EnableTimer
10-
.def _usb_ResetTimer
8+
.def _usb_DisableTimers
9+
.def _usb_EnableTimers
10+
.def _usb_ResetTimers
1111
; --------------------------------------------
1212

1313
; --- Location Equates -----------------------
1414
_usb_BusPowered equ 0003E4h
1515
_usb_SelfPowered equ 0003E8h
1616
_usb_ResetChip equ 0003F4h
17-
_usb_DisableTimer equ 0004F4h
18-
_usb_EnableTimer equ 0004F8h
19-
_usb_ResetTimer equ 0004F0h
17+
_usb_DisableTimers equ 0004F4h
18+
_usb_EnableTimers equ 0004F8h
19+
_usb_ResetTimers equ 0004F0h
2020
; --------------------------------------------
2121

2222
end

CEdev/lib/src/fileio/make.bat CEdev/lib/src/fileio/build.bat

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
set LIB_NAME=FILEIOC
77
set LIB_SRC=fileio_lib.asm
8+
set SPASM_EXE=%CEDEV%\lib\src\include\spasm.exe
89

910
echo Assembling Library...
1011
mkdir lib
@@ -17,7 +18,7 @@ set BIN=%CEDEV%\bin
1718
set ASM=%BIN%\ez80asm.exe
1819
set LIB=%BIN%\ez80lib.exe
1920
set ASM_FLG=-genobj -NOigcase -NOlist -NOlistmac -pagelen:56 -pagewidth:100 -quiet -sdiopt -cpu:EZ80F91 -NOdebug
20-
..\include\spasm -E %LIB_SRC% %LIB_NAME%.8xv
21+
%SPASM_EXE% -E %LIB_SRC% %LIB_NAME%.8xv
2122
echo Building library...
2223
if exist *.obj del *.obj
2324
if exist %LIB_LIB% del %LIB_LIB%
@@ -31,4 +32,7 @@ move /Y %LIB_ASM% lib > nul
3132
move /Y %LIB_8XV% lib > nul
3233
move /Y %LIB_JMP% lib > nul
3334
cd lib
34-
for /F %%a in ('dir /L /B') do rename %%a %%a
35+
for /F %%a in ('dir /L /B') do rename %%a %%a
36+
move /Y %LIB_LIB% %CEDEV%/lib/ce/%LIB_NAME% > nul
37+
move /Y %LIB_ASM% %CEDEV%/lib/ce/%LIB_NAME% > nul
38+
cd ..

CEdev/lib/src/graphics/graphc/make.bat CEdev/lib/src/graphics/graphc/build.bat

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
set LIB_NAME=GRAPHC
77
set LIB_SRC=graphics_lib_old.asm
8+
set SPASM_EXE=%CEDEV%\lib\src\include\spasm.exe
89

910
echo Assembling Library...
1011
mkdir lib
@@ -17,7 +18,7 @@ set BIN=%CEDEV%\bin
1718
set ASM=%BIN%\ez80asm.exe
1819
set LIB=%BIN%\ez80lib.exe
1920
set ASM_FLG=-genobj -NOigcase -NOlist -NOlistmac -pagelen:56 -pagewidth:100 -quiet -sdiopt -cpu:EZ80F91 -NOdebug
20-
..\..\include\spasm -E %LIB_SRC% %LIB_NAME%.8xv
21+
%SPASM_EXE% -E %LIB_SRC% %LIB_NAME%.8xv
2122
echo Building library...
2223
if exist *.obj del *.obj
2324
if exist %LIB_LIB% del %LIB_LIB%
@@ -31,4 +32,7 @@ move /Y %LIB_ASM% lib > nul
3132
move /Y %LIB_8XV% lib > nul
3233
move /Y %LIB_JMP% lib > nul
3334
cd lib
34-
for /F %%a in ('dir /L /B') do rename %%a %%a
35+
for /F %%a in ('dir /L /B') do rename %%a %%a
36+
move /Y %LIB_LIB% %CEDEV%/lib/ce/%LIB_NAME% > nul
37+
move /Y %LIB_ASM% %CEDEV%/lib/ce/%LIB_NAME% > nul
38+
cd ..

CEdev/lib/src/graphics/graphx/build.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
set LIB_NAME=GRAPHX
77
set LIB_SRC=graphics_lib.asm
8+
set SPASM_EXE=%CEDEV%\lib\src\include\spasm.exe
89

910
echo Assembling Library...
1011
mkdir lib
@@ -17,7 +18,7 @@ set BIN=%CEDEV%\bin
1718
set ASM=%BIN%\ez80asm.exe
1819
set LIB=%BIN%\ez80lib.exe
1920
set ASM_FLG=-genobj -NOigcase -NOlist -NOlistmac -pagelen:56 -pagewidth:100 -quiet -sdiopt -cpu:EZ80F91 -NOdebug
20-
..\..\include\spasm -E %LIB_SRC% %LIB_NAME%.8xv
21+
%SPASM_EXE% -E %LIB_SRC% %LIB_NAME%.8xv
2122
echo Building library...
2223
if exist *.obj del *.obj
2324
if exist %LIB_LIB% del %LIB_LIB%
@@ -32,4 +33,6 @@ move /Y %LIB_8XV% lib > nul
3233
move /Y %LIB_JMP% lib > nul
3334
cd lib
3435
for /F %%a in ('dir /L /B') do rename %%a %%a
36+
move /Y %LIB_LIB% %CEDEV%/lib/ce/%LIB_NAME% > nul
37+
move /Y %LIB_ASM% %CEDEV%/lib/ce/%LIB_NAME% > nul
3538
cd ..

CEdev/lib/src/graphics/graphx/graphics_lib.asm

+1-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ _ZeroScreen:
406406
ldir
407407
ret
408408

409-
410409
;-------------------------------------------------------------------------------
411410
_SetPalette:
412411
; Sets the palette colors
@@ -562,7 +561,7 @@ _RectangleWidth1_SMC =$+1
562561
add hl,bc
563562
inc de
564563
ex de,hl
565-
_RectangleWidth2_SMC =$+1
564+
_RectangleWidth2_SMC =$+1
566565
ld bc,0
567566
ldir
568567
ld bc,2*lcdWidth-1

CEdev/lib/src/keypad/make.bat CEdev/lib/src/keypad/build.bat

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
set LIB_NAME=KEYPADC
77
set LIB_SRC=keypad_lib.asm
8+
set SPASM_EXE=%CEDEV%\lib\src\include\spasm.exe
89

910
echo Assembling Library...
1011
mkdir lib
@@ -17,7 +18,7 @@ set BIN=%CEDEV%\bin
1718
set ASM=%BIN%\ez80asm.exe
1819
set LIB=%BIN%\ez80lib.exe
1920
set ASM_FLG=-genobj -NOigcase -NOlist -NOlistmac -pagelen:56 -pagewidth:100 -quiet -sdiopt -cpu:EZ80F91 -NOdebug
20-
..\include\spasm -E %LIB_SRC% %LIB_NAME%.8xv
21+
%SPASM_EXE% -E %LIB_SRC% %LIB_NAME%.8xv
2122
echo Building library...
2223
if exist *.obj del *.obj
2324
if exist %LIB_LIB% del %LIB_LIB%
@@ -31,4 +32,7 @@ move /Y %LIB_ASM% lib > nul
3132
move /Y %LIB_8XV% lib > nul
3233
move /Y %LIB_JMP% lib > nul
3334
cd lib
34-
for /F %%a in ('dir /L /B') do rename %%a %%a
35+
for /F %%a in ('dir /L /B') do rename %%a %%a
36+
move /Y %LIB_LIB% %CEDEV%/lib/ce/%LIB_NAME% > nul
37+
move /Y %LIB_ASM% %CEDEV%/lib/ce/%LIB_NAME% > nul
38+
cd ..

0 commit comments

Comments
 (0)