Skip to content

Commit

Permalink
Made it easy to add icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mateoconlechuga committed Feb 11, 2016
1 parent 5d37c79 commit 5ac6b1a
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 75 deletions.
4 changes: 2 additions & 2 deletions CEdev/examples/template/Linkcmd → CEdev/demos/demo0/Linkcmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
-sort ADDRESS=ascending -warn -NOdebug -NOigcase
define __copy_code_to_ram = 0

range rom $000000 : $7FFFFF
range ram $D00000 : $D65800
range rom $000000 : $FFFFFF
range ram $D00000 : $FFFFFF
range bss $D031F6 : $D13FD6

change code is ram
Expand Down
35 changes: 26 additions & 9 deletions CEdev/examples/template/Makefile → CEdev/demos/demo0/Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
#Change 'template' to the name of your program
TARGET ?= template

#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon
ICONC ?= ICON
DESCRIPTION ?= "Template C Program"

REALWINPATH = $(subst /,\,$(realpath $(1)))
CEDEV ?= $(call REALWINPATH,..\..)
BIN = $(CEDEV)\bin
INCLUDE = $(CEDEV)\include

TARGET ?= template

CC = @ "$(BIN)\eZ80cc"
LD = @ "$(BIN)\eZ80link"
CV = @ "$(BIN)\convhex"
PG = @ "$(BIN)\convpng"
RM = del /f

SOURCES = $(wildcard *.c)
ASMSOURCES = $(wildcard *.asm)
ICONASM = iconc.asm
ifeq ($(ICONC),ICON)
ASMSOURCES = $(wildcard *.asm)
ASMSOURCES += $(ICONASM)
PNG_FLAGS = -c
else
ASMSOURCES = $(filter-out iconc.asm, $(wildcard *.asm))
PNG_FLAGS = -h
endif
OBJECTS = $(SOURCES:%.c=%.obj) $(ASMSOURCES:%.asm=%.obj)

HEADERS = .;$(CEDEV)\include\ce;$(CEDEV)\include\ce\asm;$(CEDEV)\include;$(CEDEV)\include\std;$(CEDEV)\lib\ce;$(CEDEV)\lib\ce\asm
LIBRARIES = $(CEDEV)\lib\std\cdebug.lib $(CEDEV)\lib\std\chelp.lib $(CEDEV)\lib\std\crt.lib $(CEDEV)\lib\std\crtS.lib $(CEDEV)\lib\std\nokernel.lib $(CEDEV)\lib\std\fplib.lib $(CEDEV)\lib\std\fplibS.lib
STARTUPMODULE = $(CEDEV)\include\startup\cstartup.obj

ASM_FLAGS = \
-name -define:_EZ80=1 -define:_SIMULATE=1 -include:$(HEADERS) -NOlist -NOlistmac \
-name -define:_EZ80=1 -define:_SIMULATE=1 -define:$(ICONC) -include:$(HEADERS) -NOlist -NOlistmac \
-pagelen:250 -pagewidth:132 -quiet -sdiopt -warn -NOdebug -NOigcase -cpu:eZ80190

CFLAGS = \
-quiet -define:NDEBUG -define:_EZ80190 -define:_EZ80 -define:_SIMULATE -NOlistinc -NOmodsect -cpu:eZ80190 -keepasm \
-quiet -define:NDEBUG -define:_EZ80190 -define:_EZ80 -define:$(ICONC) -define:_SIMULATE -NOlistinc -NOmodsect -cpu:eZ80190 -keepasm \
-optspeed -NOreduceopt -NOgenprintf -stdinc:"$(HEADERS)" -usrinc:"." -NOdebug \
-asmsw:"$(ASM_FLAGS)" -asm $(ASMSOURCES)

Expand All @@ -35,20 +48,24 @@ comma = ,

all : $(TARGET).8xp

$(TARGET).hex : $(OBJECTS) $(STARTUPMODULE) $(LIBRARIES)
$(TARGET).hex : $(OBJECTS) $(LIBRARIES)
$(LD) @Linkcmd $@ = $(subst $(space),$(comma),$^) $(LDFLAGS)

%.8xp : %.hex
$(CV) $(@:%.8xp=%)

%.obj : %.c
$(PG) $(PNG_FLAGS) $(DESCRIPTION) > nul
@ cd $(dir $@) && \
$(CC) $(CFLAGS) $(notdir $<)

%.obj : %.asm
$(CC) $(CFLAGS) $<


%.obj : %.src
$(CC) $(CFLAGS) $<

clean :
$(RM) $(OBJECTS:%.obj=%.src) $(OBJECTS) $(TARGET).*)
$(RM) $(ICONASM) $(OBJECTS:%.obj=%.src) $(OBJECTS) $(TARGET).*

.PHONY : all clean
Binary file added CEdev/demos/demo0/iconc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
80 changes: 80 additions & 0 deletions CEdev/include/ce/asm/cstartup.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
; Parts from Matt "MateoConLechuga" Waltz and
; contributors of http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File
; Latest as of 11 February 2016
ifndef STARTUP_MODULE
define STARTUP_MODULE
;-------------------------------------------------------------------------------
; Standard CE startup module definitions and references
;-------------------------------------------------------------------------------
xref __low_bss
xref __len_code
xref __low_code
xref _main
xref _PopErrorHandler
xref _RunIndicOff
xdef _errno
xdef _init
xdef _exit
xdef __exit
xdef __saveIY
xdef __saveSP
xdef __c_startup
xdef _c_int0
.assume ADL = 1
define .header,space=ram
define .icon,space=ram
define .launcher,space=ram
define .libs,space=ram
define .startup,space=ram

;-------------------------------------------------------------------------------
; Standard CE startup module code
;-------------------------------------------------------------------------------
segment .header
db %EF
db %7B
_init:
db %00 ; Magic byte recognition for C programs
ifdef ICON
xref __program_description_end
jp __program_description_end
endif
;-------------------------------------------------------------------------------
segment .startup
__c_startup:
_c_int0:
di
call %020848 ; _RunIndicOff
ld hl,__low_bss
ld bc,%10DE2 ; Maximum size of BSS+Heap
call %0210DC ; _MemClear

ld hl,__exit
ld (__saveSP),sp
call _main
__exit:
_exit:
ld sp,(__saveSP)
ld iy,%D00080 ; Restore IY for OS
ret
;-------------------------------------------------------------------------------
segment bss
__saveSP:
ds 3
__saveIY:
ds 3
_errno:
ds 3
;-------------------------------------------------------------------------------
segment code
;-------------------------------------------------------------------------------
; End Standard Startup Module
;-------------------------------------------------------------------------------
endif
end
7 changes: 2 additions & 5 deletions CEdev/include/ce/asm/libheader.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

ifndef USING_SHARED_LIBRARIES
define USING_SHARED_LIBRARIES

define .launcher,space=ram
define .libs,space=ram
segment .launcher
ld hl,__libloadappvar
Expand Down Expand Up @@ -50,6 +47,6 @@ __missingappvar:
db "Need"
__libloadappvar:
db " LibLoad",0
endif
segment .libs
segment .libs
end
6 changes: 5 additions & 1 deletion CEdev/include/ce/asm/tice.asm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ifndef TICEASM_MODULE
define TICEASM_MODULE
; === Location Equates =======================
_GetBootVerMajor equ 000080h ; Boot Call
_GetHardwareVers equ 000084h ; Boot Call
Expand Down Expand Up @@ -113,6 +115,7 @@ _memcpy equ 0000A4h ; Boot Call
_memmove equ 0000A8h ; Boot Call
_memset equ 0000ACh ; Boot Call
_memclear equ 0000B0h ; Boot Call
_printf equ 0000B4h ; Boot Call
_DoNothing equ 0000F8h ; Boot Call
_setjmp equ 0000B8h ; Boot Call
_longjmp equ 000098h ; Boot Call
Expand Down Expand Up @@ -5475,4 +5478,5 @@ is24Hour equ 2 ;1 = clock in 24 hour mode
inAfternoon equ 3 ;1 = current time is in afternoon (PM) (I think)
useTokensInString equ 4 ;1 = use tokens instead of characters when displaying clock as string (for getTmStr and getDtStr vs. MODE screen) (keep this reset)
displayClock equ 5 ;1 = display clock (this is set every second, reset otherwise)
clockOn equ 6 ;1 = clock on
clockOn equ 6 ;1 = clock on
endif
33 changes: 33 additions & 0 deletions CEdev/include/ce/debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*************************************************
* CE debug header file
*************************************************/

/* To print to the console, just use
* dbg_printf(dbgout, const char*, ...); */

#ifdef dbg_printf
#undef dbg_printf
#endif

#ifdef dbgout
#undef dbgout
#endif

#ifdef debugger
#undef debugger
#endif

#ifndef NDEBUG

#define dbg_printf sprintf
#define dbgout ((const char*)0xFB0000)

void debugger(void); /* Opens the debugger */

#else

#define dbg_printf (void)
#define dbgout (NULL)
#define debugger (void)

#endif
Binary file added CEdev/include/ce/pal/icon_palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions CEdev/include/ce/ti84pce.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdint.h>

#pragma asm "include "./asm/tice.asm""
#pragma asm "include "./asm/cstartup.asm""
#pragma asm "xref __saveIY"

/* === Function Prototypes ==================== */
Expand Down
58 changes: 0 additions & 58 deletions CEdev/include/startup/src/cstartup.asm

This file was deleted.

0 comments on commit 5ac6b1a

Please sign in to comment.