diff --git a/build.sh b/build.sh deleted file mode 100644 index b3b5c00..0000000 --- a/build.sh +++ /dev/null @@ -1,32 +0,0 @@ -DIRECTORY=$(cd `dirname $0` && pwd) - - - -export MAINC="hello.c" -export OUT_NAME="helloworld" - - -# sdasz80 -p -g -o tios_crt0.rel $DIRECTORY/other_files/tios_crt0.s - - -# sdcc -DRAM_PROG --no-std-crt0 --code-loc 40347 --data-loc 0 --std-sdcc99 -mz80 --reserve-regs-iy -o $OUT_NAME.ihx tios_crt0.rel $MAINC - -# /opt/z88dk/lib/target/ti83p/classic/ti83p_crt0.asm -# docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -subtype=asm -Cz--altfmt -lm -o x/hello.bin hello.c - -docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -lm -o x/v.bin hello.c -create-app - -# sleep 1 - -cd x -cp v.bin x.bin -python $DIRECTORY/other_files/binpac8x.py x.bin -O ad -# docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -crt0 other_files/tios_crt0.s -lm -o x/hello.bin hello.c -# zcc +ti83p -startup=10 -Cz--altfmt -lm -o x/adv_a -create-app hello.c - -# python $DIRECTORY/other_files/binpac8x.py $DIRECTORY/x/hello.bin -O wee - - -# docker run -v ${DIRECTORY}:/src/ z88dk/z88dk z88dk-dis x/hello.bin - -# +z80 -vn -mz80 --reserve-regs-iy --no-cleanup -o examples/helloworld examples/helloworld/main.c \ No newline at end of file diff --git a/build_app.sh b/build_app.sh index de9dab2..2df85f2 100644 --- a/build_app.sh +++ b/build_app.sh @@ -13,23 +13,29 @@ echo $BC export MAINC="main.c" export OUT_NAME=$2 -trunkName=$(printf '%-8s' "$(head -c 8 <<<$2)") # truncate name and pad with extra spaces to make sure it is 8 char long +trunkName=$(head -c 8 <<<$2) # truncate name to make sure it is no more than 8 char long -crt="$DIRECTORY/other_files/tios_crt0_app.s" # just got path to crt0 +# Compile with custom crt0 +docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -subtype=asm -o $1/$OUT_NAME.bin $1/$MAINC -crt0 other_files/ti83p_crt0_app.asm -sed "s/qwertyui/$trunkName/" $crt > TEMP_crt0.s # fill in name in crt0 -sed "s/0x6969/$BC/" TEMP_crt0.s > TEMP_crt0.s.s +# Now we need to rebuild the .bin with our custom name -sdasz80 -p -g -o tios_crt0.rel TEMP_crt0.s.s -sdcc -DFLASH_APP --no-std-crt0 --code-loc 16429 --data-loc 0 --std-sdcc99 -mz80 --reserve-regs-iy -o $OUT_NAME.ihx tios_crt0.rel $MAINC +nameLn=${#trunkName} #length of trunkName +cat $OUT_NAME.bin | head -c 18 > x.bin # Write bytes before name in header +echo -n $trunkName >> x.bin # Write your name -objcopy -Iihex -Obinary $OUT_NAME.ihx $OUT_NAME.bin - - -rm $OUT_NAME.ihx $OUT_NAME.lk $OUT_NAME.lst $OUT_NAME.map $OUT_NAME.noi $OUT_NAME.rel $OUT_NAME.sym tios_crt0.rel TEMP_crt0.s TEMP_crt0.s.s +# Pad name (if needed) +while [ $nameLn -lt 8 ] +do + echo -n " " >> x.bin + ((nameLn++)) +done +# Write rest of app +cat $OUT_NAME.bin | tail -c+27 >> x.bin +mv x.bin $OUT_NAME.bin $DIRECTORY/other_files/rabbitsign -t 8xk -g -f $OUT_NAME.bin -rm $OUT_NAME.bin \ No newline at end of file +# rm $OUT_NAME.bin \ No newline at end of file diff --git a/build_prog.sh b/build_prog.sh index e371f73..d3b561f 100644 --- a/build_prog.sh +++ b/build_prog.sh @@ -1,19 +1,15 @@ DIRECTORY=$(cd `dirname $0` && pwd) -cd x -export MAINC="../hello.c" -export OUT_NAME="testtex" +export MAINC="main.c" +export OUT_NAME=$2 -sdasz80 -p -g -o tios_crt0.rel $DIRECTORY/other_files/tios_crt0.s +docker run -v ${DIRECTORY}:/src/ z88dk/z88dk zcc +ti83p -subtype=asm -o $1/$OUT_NAME.bin $1/$MAINC +cat <( echo -ne "\xbb\x6d" ) $1/$OUT_NAME.bin > $1/$OUT_NAME.bin2 -sdcc -DSDCC --no-std-crt0 --code-loc 40347 --data-loc 0 --std-sdcc99 -mz80 --reserve-regs-iy -o $OUT_NAME.ihx tios_crt0.rel $MAINC +cd $1 +python $DIRECTORY/other_files/binpac8x.py $OUT_NAME.bin2 -O $OUT_NAME -objcopy -Iihex -Obinary $OUT_NAME.ihx $OUT_NAME.bin -python $DIRECTORY/other_files/binpac8x.py $OUT_NAME.bin -O $OUT_NAME - -rm $OUT_NAME.bin $OUT_NAME.ihx $OUT_NAME.lk $OUT_NAME.lst $OUT_NAME.map $OUT_NAME.noi $OUT_NAME.rel $OUT_NAME.sym tios_crt0.rel -# rm $OUT_NAME.asm diff --git a/build_prog_zcc.sh b/build_prog_zcc.sh new file mode 100644 index 0000000..9612a50 --- /dev/null +++ b/build_prog_zcc.sh @@ -0,0 +1,2 @@ +# sh build_prog.sh examples/zcc_helloworld hllo +sh build_app.sh examples/zcc_helloworld tix \ No newline at end of file diff --git a/examples/zcc_helloworld/.buildid b/examples/zcc_helloworld/.buildid new file mode 100644 index 0000000..d0dc1e1 --- /dev/null +++ b/examples/zcc_helloworld/.buildid @@ -0,0 +1 @@ +0x82e3 diff --git a/examples/zcc_helloworld/main.c b/examples/zcc_helloworld/main.c new file mode 100644 index 0000000..d9275d6 --- /dev/null +++ b/examples/zcc_helloworld/main.c @@ -0,0 +1,59 @@ +#ifdef SDCC +#define bcall(__LABEL__) rst 40 \ + .dw __LABEL__ +// A bit of trash data so the program runs correctly +void _(){__asm ret + .ascii "0000000000" __endasm;} + +#else +#pragma string name teext +#define bcall(__LABEL__) rst 40 \ defw __LABEL__ + +// A bit of trash data so the program runs correctly +void _(){ + #asm + ret + defm "0000000000" + #endasm +} +#endif + + + + +void main() +{ + + #ifdef SDCC + __asm + #else + #asm + #endif + bcall(0x4540 ) ; _ClrLCDFull + + xor a, a + ld (0x86D7), a + ld (0x86D8), a + + #ifdef SDCC + ld a, #'!' + #else + ld a, '!' + #endif + + push ix + bcall(0x455E) ; _VPutMap + pop ix + + + bcall(0x4972 ) ; _getkey + + #ifdef SDCC + __endasm; + #else + #endasm + #endif + + + +} \ No newline at end of file diff --git a/examples/zcc_helloworld/tix.8xk b/examples/zcc_helloworld/tix.8xk new file mode 100644 index 0000000..b1cc1c9 Binary files /dev/null and b/examples/zcc_helloworld/tix.8xk differ diff --git a/examples/zcc_helloworld/tix.bin b/examples/zcc_helloworld/tix.bin new file mode 100644 index 0000000..bbd0e09 Binary files /dev/null and b/examples/zcc_helloworld/tix.bin differ diff --git a/hello.c b/hello.c index 1a7394e..c7c26c8 100644 --- a/hello.c +++ b/hello.c @@ -1,12 +1,4 @@ -#ifdef SDCC -#define bcall(__LABEL__) rst 40 \ - .dw __LABEL__ -// A bit of trash data so the program runs correctly -void _(){__asm ret - .ascii "0000000000" __endasm;} - -#else -#pragma string name ad +#pragma string name tes #define bcall(__LABEL__) rst 40 \ defw __LABEL__ // A bit of trash data so the program runs correctly @@ -16,7 +8,7 @@ void _(){ defm "0000000000" #endasm } -#endif + @@ -24,23 +16,18 @@ void _(){ void main() { - #ifdef SDCC - __asm - #else + #asm - #endif - rst 40 + bcall(0x4540 ) ; _ClrLCDFull xor a, a ld (0x86D7), a ld (0x86D8), a - #ifdef SDCC - ld a, #'!' - #else + ld a, '!' - #endif + push ix bcall(0x455E) ; _VPutMap @@ -49,11 +36,9 @@ void main() bcall(0x4972 ) ; _getkey - #ifdef SDCC - __endasm; - #else + #endasm - #endif + diff --git a/other_files/ti83p_crt0.asm b/other_files/ti83p_crt0.asm new file mode 100644 index 0000000..e9a2f98 --- /dev/null +++ b/other_files/ti83p_crt0.asm @@ -0,0 +1,283 @@ +; Stub for the TI 83+ calculator +; +; Stefano Bodrato - Dec 2000 +; Feb 2000 - Speeded up the cpygraph +; +; $Id: ti83p_crt0.asm,v 1.33 2016-07-11 05:58:34 stefano Exp $ +; +; startup = +; n - Primary shell, compatible shells +; (Primary shell merely means it's the smallest implementation +; for that shell, that uses full capabilities of the shell) +; +; 1 - Ion (default) +; 2 - MirageOS without quit key +; 3 - +; 4 - TSE Kernel +; 10 - asm( executable +; +;----------------------------------------------------- +; Some general PUBLICs and EXTERNs needed by the assembler +;----------------------------------------------------- + + MODULE Ti83plus_crt0 + + EXTERN _main ; No matter what set up we have, main is + ; always, always external to this file. + + PUBLIC cleanup ; used by exit() + PUBLIC l_dcal ; used by calculated calls = "call (hl)" + + + PUBLIC cpygraph ; TI calc specific stuff + PUBLIC tidi ; + PUBLIC tiei ; + +;------------------------- +; Begin of (shell) headers +;------------------------- + + INCLUDE "Ti83p.def" ; ROM / RAM adresses on Ti83+[SE] + defc crt0 = 1 + INCLUDE "zcc_opt.def" ; Receive all compiler-defines + + defc CONSOLE_ROWS = 8 + defc TAR__clib_exit_stack_size = 3 + defc TAR__register_sp = -1 + defc __CPU_CLOCK = 6000000 + INCLUDE "crt/classic/crt_rules.inc" + +;----------------------------- +;2 - MirageOS without quit key +;----------------------------- +IF (startup=2) + DEFINE MirageOS ;Used by greyscale interrupt etc. + DEFINE NOT_DEFAULT_SHELL ;Else we would use Ion + org $9D95 + ;org $9D93 + ;defb $BB,$6D + ret ;So TIOS wont run the program + defb 1 ;Identifier as MirageOS program + DEFINE NEED_mirage_icon + INCLUDE "zcc_opt.def" + UNDEFINE NEED_mirage_icon + IF !DEFINED_NEED_mirage_icon + defb @01111000,@00000000 ;Picture of a map with "C+" on it + defb @10000100,@00000000 + defb @10000011,@11111100 ;15x15 button + defb @10000000,@00000010 + defb @10011111,@00000010 + defb @10111111,@00000010 + defb @10110000,@00110010 + defb @10110000,@01111010 + defb @10110000,@01111010 + defb @10110000,@00110010 + defb @10111111,@00000010 + defb @10011111,@00000010 + defb @10000000,@00000010 + defb @10000000,@00000010 + defb @01111111,@11111100 + ENDIF + DEFINE NEED_name + INCLUDE "zcc_opt.def" ; Get namestring from zcc_opt.def + UNDEFINE NEED_name + IF !DEFINED_NEED_name + defm "Z88DK Small C+ Program" + ENDIF + defb $0 ; Termination zero + im 1 ; Disable MirageOS tasker interrupt... +ENDIF + +;-------------- +;4 - TSE Kernel +;-------------- +IF (startup = 4) + DEFINE TSE + DEFINE NOT_DEFAULT_SHELL + org $9D94 + ret + defm "TSE" + defb 1 + defm " " + DEFINE NEED_name + INCLUDE "zcc_opt.def" + UNDEFINE NEED_name + IF !DEFINED_NEED_name + defm "Z88DK Small C+ Program" + ENDIF + defb $0 +;----------------------------------------------------------------------------- +; External Data Required for virtual stack. I've set this to 400 +; (the normal size of the Ti83+ stack). You can use #pragma to set +; a userdefined value (RECOMMENDED): +; #pragma output StackNeeded = nnn; +;----------------------------------------------------------------------------- + IF !DEFINED_StackNeeded + defw 400 + ELSE + defw DEFINED_StackNeeded + ENDIF +ENDIF + +;-------------------- +;10 - asm( executable +;-------------------- +IF (startup=10) + DEFINE ASM + DEFINE NOT_DEFAULT_SHELL + ;org $9D95 + org $9D93 + defb $BB,$6D +ENDIF + +;----------------- +;1 - Ion (default) +;----------------- +IF !NOT_DEFAULT_SHELL + DEFINE Ion + org $9D95 + ;org $9D93 + ;defb $BB,$6D + ret + jr nc,start + DEFINE NEED_name + INCLUDE "zcc_opt.def" + UNDEFINE NEED_name + IF !DEFINED_NEED_name + defm "Z88DK Small C+ Program" + ENDIF + defb $0 +ENDIF + + +;------------------------------------- +; End of header, begin of startup part +;------------------------------------- +start: +IF DEFINED_GimmeSpeed + ld a,1 ; switch to 15MHz (extra fast) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; + ld (__restore_sp_onexit+1),sp ; + INCLUDE "crt/classic/crt_init_sp.asm" + INCLUDE "crt/classic/crt_init_atexit.asm" + call crt0_init_bss + ld (exitsp),sp + +IF DEFINED_USING_amalloc + INCLUDE "crt/classic/crt_init_amalloc.asm" +ENDIF + + + EXTERN fputc_cons + ld hl,12 + push hl + call fputc_cons + pop hl + +IF DEFINED_GRAYlib + IF DEFINED_GimmeSpeed + INCLUDE "target/ti83p/classic/gray83pSE.asm" ; 15MHz grayscale interrupt + ELSE + INCLUDE "target/ti83p/classic/gray83p.asm" ; 6MHz grayscale interrupt + ENDIF +ELSE + INCLUDE "target/ti83p/classic/intwrap83p.asm" ; Interrupt Wrapper +ENDIF + + im 2 ; enable IM2 interrupt + call _main ; call main() +cleanup: ; exit() jumps to this point + ld iy,_IY_TABLE ; Restore flag pointer + im 1 ; +IF DEFINED_GimmeSpeed ; + xor a ; Switch to 6MHz (normal speed) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; +__restore_sp_onexit: + ld sp,0 ; Restore SP +IF TSE ; TSE Kernel + call _tseForceYield ; Task-switch back to shell (can return...) + jp start ; begin again if needed... +ENDIF ; +tiei: ei ; +IF DEFINED_GRAYlib ; +cpygraph: +ENDIF ; +tidi: ret ; + +;---------------------------------------- +; End of startup part, routines following +;---------------------------------------- +l_dcal: + jp (hl) ; used as "call (hl)" + + + + + + +IF !DEFINED_GRAYlib + IF DEFINED_GimmeSpeed +cpygraph: + call $50 ; bjump(GrBufCpy) + defw GrBufCpy ; FastCopy is far too fast at 15MHz... + ELSE + IF Ion + defc cpygraph = $966E+80+15 ; Ion FastCopy call + ENDIF + IF MirageOS + defc cpygraph = $4092 ; MirageOS FastCopy call + ENDIF + IF TSE + defc cpygraph = $8A3A+18 ; TSE FastCopy call + ENDIF + IF ASM +cpygraph: +;(ion)FastCopy from Joe Wingbermuehle + di + ld a,$80 ; 7 + out ($10),a ; 11 + ld hl,plotSScreen-12-(-(12*64)+1) ; 10 + ld a,$20 ; 7 + ld c,a ; 4 + inc hl ; 6 waste + dec hl ; 6 waste +fastCopyAgain: + ld b,64 ; 7 + inc c ; 4 + ld de,-(12*64)+1 ; 10 + out ($10),a ; 11 + add hl,de ; 11 + ld de,10 ; 10 +fastCopyLoop: + add hl,de ; 11 + inc hl ; 6 waste + inc hl ; 6 waste + inc de ; 6 + ld a,(hl) ; 7 + out ($11),a ; 11 + dec de ; 6 + djnz fastCopyLoop ; 13/8 + ld a,c ; 4 + cp $2B+1 ; 7 + jr nz,fastCopyAgain ; 10/1 + ret ; 10 + ENDIF + ENDIF +ENDIF + + defc ansipixels = 96 + IF !DEFINED_ansicolumns + defc DEFINED_ansicolumns = 1 + defc ansicolumns = 32 + ENDIF + + INCLUDE "crt/classic/crt_runtime_selection.asm" + INCLUDE "crt/classic/crt_section.asm" + + SECTION code_crt_init + ld hl,plotSScreen + ld (base_graphics),hl diff --git a/other_files/ti83p_crt0_app.asm b/other_files/ti83p_crt0_app.asm new file mode 100644 index 0000000..af316dc --- /dev/null +++ b/other_files/ti83p_crt0_app.asm @@ -0,0 +1,247 @@ +; Stub for the TI 83+ calculator for building as an app +; +; Stefano Bodrato - Dec 2000 +; Feb 2000 - Speeded up the cpygraph +; +; $Id: ti83p_crt0_app.asm,v 1.33 2016-07-11 05:58:34 stefano Exp $ +;------------------------------------------------ +; Some general PUBLICs and EXTERNs needed by the assembler +;----------------------------------------------------- + + MODULE Ti83plus_App_crt0 + + DEFINE TI83PLUSAPP ;Used by grayscale interrupt and the such + + + EXTERN _main ; No matter what set up we have, main is + ; always, always external to this file. + + + + PUBLIC cleanup ; used by exit() + PUBLIC l_dcal ; used by calculated calls = "call (hl)" + + + PUBLIC cpygraph ; TI calc specific stuff + PUBLIC tidi ; + PUBLIC tiei ; + defc intcount = $8A8D + +;------------------------- +; Begin of (shell) headers +;------------------------- + + INCLUDE "Ti83p.def" ; ROM / RAM adresses on Ti83+[SE] + defc crt0 = 1 + INCLUDE "zcc_opt.def" ; Receive all compiler-defines + + defc CONSOLE_ROWS = 8 + defc TAR__clib_exit_stack_size = 3 + defc TAR__register_sp = -1 + defc __CPU_CLOCK = 6000000 + INCLUDE "crt/classic/crt_rules.inc" + + + +; Header data + DEFINE ASM + DEFINE NOT_DEFAULT_SHELL + + org $4000 + + DEFB $80,$0F ;Field: Program length + DEFB $00,$00,$00,$00 ;Length=0 (N/A for unsigned apps) + + DEFB $80,$12 ;Field: Program type + DEFB $01,$04 ;Type = Freeware, 0104 + + DEFB $80,$21 ;Field: App ID + DEFB $01 ;Id = 1 + + DEFB $80,$31 ;Field: App Build + DEFB $01 ;Build = 1 + + + DEFB $80,$48 ;Field: App Name + + + DEFm "TI83+APP" ;App Name (Needs to be 8 bytes) + + + + DEFB $80,$81 ;Field: App Pages + DEFB $01 ;App Pages = 1 + + DEFB $80,$90 ;No default splash screen + + DEFB $03,$26,$09,$04 ;Field: Date stamp = + DEFB $04,$6f,$1b,$80 ;5/12/1999 + + DEFB $02, $0d, $40 ;Dummy encrypted TI date stamp signature + DEFB $a1, $6b, $99, $f6 + DEFB $59, $bc, $67, $f5 + DEFB $85, $9c, $09, $6c + DEFB $0f, $b4, $03, $9b + DEFB $c9, $03, $32, $2c + DEFB $e0, $03, $20, $e3 + DEFB $2c, $f4, $2d, $73 + DEFB $b4, $27, $c4, $a0 + DEFB $72, $54, $b9, $ea + DEFB $7c, $3b, $aa, $16 + DEFB $f6, $77, $83, $7a + DEFB $ee, $1a, $d4, $42 + DEFB $4c, $6b, $8b, $13 + DEFB $1f, $bb, $93, $8b + DEFB $fc, $19, $1c, $3c + DEFB $ec, $4d, $e5, $75 + + DEFB $80,$7F ;Field: Program Image length + DEFB 0,0,0,0 ;Length=0, N/A + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + + + + + +;------------------------------------- +; End of header, begin of startup part +;------------------------------------- +start: +IF DEFINED_GimmeSpeed + ld a,1 ; switch to 15MHz (extra fast) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; + ld (__restore_sp_onexit+1),sp ; + INCLUDE "crt/classic/crt_init_sp.asm" + INCLUDE "crt/classic/crt_init_atexit.asm" + call crt0_init_bss + ld (exitsp),sp + +IF DEFINED_USING_amalloc + INCLUDE "crt/classic/crt_init_amalloc.asm" +ENDIF + + + EXTERN fputc_cons + ld hl,12 + push hl + call fputc_cons + pop hl + +IF DEFINED_GRAYlib + IF DEFINED_GimmeSpeed + INCLUDE "target/ti83p/classic/gray83pSE.asm" ; 15MHz grayscale interrupt + ELSE + INCLUDE "target/ti83p/classic/gray83p.asm" ; 6MHz grayscale interrupt + ENDIF +ELSE + INCLUDE "target/ti83p/classic/intwrap83p.asm" ; Interrupt Wrapper +ENDIF + + im 2 ; enable IM2 interrupt + call _main ; call main() +cleanup: ; exit() jumps to this point + ld iy,_IY_TABLE ; Restore flag pointer + im 1 ; +IF DEFINED_GimmeSpeed ; + xor a ; Switch to 6MHz (normal speed) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; +__restore_sp_onexit: + ld sp,0 ; Restore SP +IF TSE ; TSE Kernel + call _tseForceYield ; Task-switch back to shell (can return...) + jp start ; begin again if needed... +ENDIF ; +tiei: ei ; +IF DEFINED_GRAYlib ; +cpygraph: +ENDIF ; + call $50 ; B_JUMP(_jforcecmdnochar) + DEFW 4027h; +tidi: ret ; + +;---------------------------------------- +; End of startup part, routines following +;---------------------------------------- +l_dcal: + jp (hl) ; used as "call (hl)" + + + + + + +IF !DEFINED_GRAYlib + IF DEFINED_GimmeSpeed +cpygraph: + call $50 ; bjump(GrBufCpy) + defw GrBufCpy ; FastCopy is far too fast at 15MHz... + ELSE + IF Ion + defc cpygraph = $966E+80+15 ; Ion FastCopy call + ENDIF + IF MirageOS + defc cpygraph = $4092 ; MirageOS FastCopy call + ENDIF + IF TSE + defc cpygraph = $8A3A+18 ; TSE FastCopy call + ENDIF + IF ASM +cpygraph: +;(ion)FastCopy from Joe Wingbermuehle + di + ld a,$80 ; 7 + out ($10),a ; 11 + ld hl,plotSScreen-12-(-(12*64)+1) ; 10 + ld a,$20 ; 7 + ld c,a ; 4 + inc hl ; 6 waste + dec hl ; 6 waste +fastCopyAgain: + ld b,64 ; 7 + inc c ; 4 + ld de,-(12*64)+1 ; 10 + out ($10),a ; 11 + add hl,de ; 11 + ld de,10 ; 10 +fastCopyLoop: + add hl,de ; 11 + inc hl ; 6 waste + inc hl ; 6 waste + inc de ; 6 + ld a,(hl) ; 7 + out ($11),a ; 11 + dec de ; 6 + djnz fastCopyLoop ; 13/8 + ld a,c ; 4 + cp $2B+1 ; 7 + jr nz,fastCopyAgain ; 10/1 + ret ; 10 + ENDIF + ENDIF +ENDIF + + defc ansipixels = 96 + IF !DEFINED_ansicolumns + defc DEFINED_ansicolumns = 1 + defc ansicolumns = 32 + ENDIF + + INCLUDE "crt/classic/crt_runtime_selection.asm" + INCLUDE "crt/classic/crt_section.asm" + + SECTION code_crt_init + ld hl,plotSScreen + ld (base_graphics),hl + + + + + + diff --git a/other_files/ti83papp.asm b/other_files/ti83papp.asm new file mode 100644 index 0000000..2cb875b --- /dev/null +++ b/other_files/ti83papp.asm @@ -0,0 +1,281 @@ +; Cerberus Application Header (Ti83+[SE] App) +; +; hjp - 28 june 2001 - First (clumsy) attempt to write a header-file +; hjp - 29 june 2001 - Fixed/added things +; hjp - 3 july 2001 - Straightened up some things for grayscale +; hjp - 13 july 2001 - Reshaped variable initialisation (clears statvars now) + + MODULE Ti83plus_App_crt0 + + DEFINE TI83PLUSAPP ;Used by grayscale interrupt and the such + + EXTERN _main ; No matter what set up we have, main is + ; always, always external to this file. + + PUBLIC cleanup ; used by exit() + PUBLIC l_dcal ; used by calculated calls = "call (hl)" + + + PUBLIC _vfprintf ; vprintf is internal to this file so we + ; only ever include one of the set of + ; routines + + PUBLIC exitsp ; Exit variables + PUBLIC exitcount ; + + PUBLIC heaplast ;Near malloc heap variables + PUBLIC heapblocks + + PUBLIC __sgoioblk ; For stdin, stdout, stder + + PUBLIC base_graphics ; Graphics stuff + PUBLIC coords ; + + PUBLIC bit_irqstatus ; current irq status when DI is necessary + + PUBLIC cpygraph ; TI calc specific stuff + PUBLIC tidi ; + PUBLIC tiei ; +;------------------------------ +; Begin of Application header: +;------------------------------ + + INCLUDE "Ti83p.def" ; ROM / RAM adresses on Ti83+[SE] + defc crt0 = 1 + INCLUDE "zcc_opt.def" ;Get compiler defines + + org $4000 + + DEFB $80,$0F ;Field: Program length + DEFB $00,$00,$00,$00 ;Length=0 (N/A for unsigned apps) + + DEFB $80,$12 ;Field: Program type + DEFB $01,$04 ;Type = Freeware, 0104 + + DEFB $80,$21 ;Field: App ID + DEFB $01 ;Id = 1 + + DEFB $80,$31 ;Field: App Build + DEFB $01 ;Build = 1 + + + DEFB $80,$48 ;Field: App Name +beginname: + DEFINE NEED_AppName + INCLUDE "zcc_opt.def" + UNDEFINE NEED_AppName +endname0: +IF !DEFINED_NEED_AppName | ((endname0-beginname)=0) + DEFS "TI83+APP" ;App Name (Needs to be 8 bytes) +ENDIF +endname: + DEFINE NameLength = (endname-beginname) + IF NameLength < 2 ; Padd spaces if not 8 bytes... (horrible) + defm '' + ENDIF + IF NameLength < 3 + defm '' + ENDIF + IF NameLength < 4 + defm '' + ENDIF + IF NameLength < 5 + defm '' + ENDIF + IF NameLength < 6 + defm '' + ENDIF + IF NameLength < 7 + defm '' + ENDIF + IF NameLength < 8 + defm '' + ENDIF + + DEFB $80,$81 ;Field: App Pages + DEFB $01 ;App Pages = 1 + + DEFB $80,$90 ;No default splash screen + + DEFB $03,$26,$09,$04 ;Field: Date stamp = + DEFB $04,$6f,$1b,$80 ;5/12/1999 + + DEFB $02, $0d, $40 ;Dummy encrypted TI date stamp signature + DEFB $a1, $6b, $99, $f6 + DEFB $59, $bc, $67, $f5 + DEFB $85, $9c, $09, $6c + DEFB $0f, $b4, $03, $9b + DEFB $c9, $03, $32, $2c + DEFB $e0, $03, $20, $e3 + DEFB $2c, $f4, $2d, $73 + DEFB $b4, $27, $c4, $a0 + DEFB $72, $54, $b9, $ea + DEFB $7c, $3b, $aa, $16 + DEFB $f6, $77, $83, $7a + DEFB $ee, $1a, $d4, $42 + DEFB $4c, $6b, $8b, $13 + DEFB $1f, $bb, $93, $8b + DEFB $fc, $19, $1c, $3c + DEFB $ec, $4d, $e5, $75 + + DEFB $80,$7F ;Field: Program Image length + DEFB 0,0,0,0 ;Length=0, N/A + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + DEFB 0,0,0,0 ;Reserved + + +;-------------------------------------- +; End of header, begin of startup part +;-------------------------------------- +start: +IF DEFINED_GimmeSpeed ; + ld a,1 ; switch to 15MHz (extra fast) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; + rst $28 ; B_CALL(DelRes), we use the statvars-area, + DEFW DelRes ; Cerberus needs to know it's invalid now... + ; + ld hl,statvars ; Clear statvars + ld (hl),0 ; + ld d,h ; + ld e,l ; + inc de ; + ld bc,530 ; 531-1 bytes + ldir ; +IF !DEFINED_atexit ; Less stack use + ld hl,-6 ; 3 pointers (more likely value) + add hl,sp ; + ld sp,hl ; + ld (exitsp),sp ; +ELSE ; + ld hl,-64 ; 32 pointers (ANSI standard) + add hl,sp ; + ld sp,hl ; + ld (exitsp),sp ; +ENDIF ; + ld hl,plotSScreen ; + ld (base_graphics),hl +IF DEFINED_GRAYlib ; + ld (graybit1),hl ; + ld hl,appBackUpScreen + ld (graybit2),hl ; +ENDIF ; + ld hl,$8080 ; + ld (fp_seed),hl ; + + EXTERN fputc_cons + ld hl,12 + push hl + call fputc_cons + pop hl + +IF DEFINED_GRAYlib + IF DEFINED_GimmeSpeed + INCLUDE "target/ti83p/classic/gray83pSE.asm" ; 15MHz grayscale interrupt + ELSE + INCLUDE "target/ti83p/classic/gray83p.asm" ; 6MHz grayscale interrupt + ENDIF +ENDIF + + im 2 ; + call _main ; +cleanup: ; + ld iy,$89F0 ; Load IY (flags) with it's normal value + im 1 ; +IF DEFINED_GimmeSpeed ; + xor a ; switch to 6MHz (normal speed) + rst 28 ; bcall(SetExSpeed) + defw SetExSpeed ; +ENDIF ; + call $50 ; B_JUMP(_jforcecmdnochar) + DEFW _jforcecmdnochar; Exit back to Cerberus (TIOS) + +;----------------------------------------- +; End of startup part, routines following +;----------------------------------------- +l_dcal: + jp (hl) ; used as "call (hl)" + +tiei: ei +IF DEFINED_GRAYlib +cpygraph: +ENDIF +tidi: ret + + defc ansipixels = 96 + IF !DEFINED_ansicolumns + defc DEFINED_ansicolumns = 1 + defc ansicolumns = 32 + ENDIF + + INCLUDE "crt/classic/crt_runtime_selection.asm" + INCLUDE "crt/classic/crt_section.asm" + +IF !DEFINED_GRAYlib +cpygraph: + call $50 ; B_JUMP(GrBufCpy) + defw GrBufCpy ; Since we don't have any shellsupport... +ENDIF ; plus this is safe for possible + ; Ti83+ Silver Edition at 15MHz + +defc intuse = IntProcEnd-IntProcStart + +DEFVARS $8A3A ; statVars (531 bytes of free space) See graylib83p.asm +{ ; for more info on free space in this memory area. +__sgoioblk + ds.b 40 ; 40 bytes = 4 bytes * 10 handles +coords + ds.w 1 ; 2 bytes +base_graphics + ds.w 1 ; 2 bytes +gfx_bank + ds.w 1 ; 2 bytes +exitsp + ds.w 1 ; 2 bytes +exitcount + ds.b 1 ; 1 byte +fp_seed ;not used... + ds.w 3 ; 6 bytes +extra + ds.w 3 ; 6 bytes +fa + ds.w 3 ; 6 bytes +fasign + ds.b 1 ; 1 byte +heapblocks + ds.w 1 ; 2 bytes +heaplast + ds.w 1 ; 2 bytes +hl1save + ds.w 1 ; 2 bytes +de1save + ds.w 1 ; 2 bytes +bc1save + ds.w 1 ; 2 bytes +iysave + ds.w 1 ; 2 bytes ; total 80 bytes +;------------------------------------------------------------------------------ +; !!!BIG TROUBLE!!! +; Grayscale interrupt is 125/130 bytes now, that won't fit into +; the [max] 118 bytes free here... +; (intwrapper is 44 bytes, so that does fit) +;------------------------------------------------------------------------------ +jp_intprocstart ; $8A8A / $8xxx + ds.b intuse ; xx bytes used by interrupt routine +freestatvarsA: + ds.b 113-intuse +intcount + ds.b 1 ; 1 byte used by interrupt routine +graybit1 + ds.w 1 ; 2 bytes used by interrupt routine +graybit2 + ds.w 1 ; 2 bytes used by interrupt routine +IV_table ; $8B00 / $8C00 + ds.b 256 ;256 bytes used by interrupt routine +freestatvarsB: ; $8C01 / $8C4D + ds.b 77 ; 77 bytes free +} +ENDIF diff --git a/x/hello.8xp b/x/hello.8xp new file mode 100644 index 0000000..4619928 Binary files /dev/null and b/x/hello.8xp differ diff --git a/x/hello.bin b/x/hello.bin new file mode 100644 index 0000000..7834637 Binary files /dev/null and b/x/hello.bin differ diff --git a/x/v.8xp b/x/v.8xp deleted file mode 100644 index 09c90de..0000000 Binary files a/x/v.8xp and /dev/null differ diff --git a/x/v.bin b/x/v.bin deleted file mode 100644 index a91ce7a..0000000 Binary files a/x/v.bin and /dev/null differ diff --git a/x/x.8xp b/x/x.8xp deleted file mode 100644 index 4b6c4a3..0000000 Binary files a/x/x.8xp and /dev/null differ diff --git a/x/x.bin b/x/x.bin deleted file mode 100644 index a91ce7a..0000000 Binary files a/x/x.bin and /dev/null differ diff --git a/z88dk.Dockerfile b/z88dk.Dockerfile new file mode 100644 index 0000000..4595c4b --- /dev/null +++ b/z88dk.Dockerfile @@ -0,0 +1,36 @@ +# To create the image: +# $ docker build -t z88dk -f z88dk.Dockerfile . +# To run the container: +# $ docker run -v ${PWD}:/src/ -it z88dk + +FROM alpine:latest + +LABEL Version="0.8" \ + Date="2018-Apr-10" \ + Docker_Version="18.03.0-ce-mac60 (23751)" \ + Maintainer="Garrafon Software (@garrafonsoft)" \ + Description="A basic Docker container to compile and use z88dk from GIT" + +ENV Z88DK_PATH="/opt/z88dk" + +RUN apk add --no-cache build-base libxml2 m4 curl \ + && apk add --no-cache -t .build_deps bison flex libxml2-dev git subversion boost-dev texinfo \ + perl-template-toolkit perl-app-cpanminus \ + && git clone --depth 1 --recursive https://github.com/HeronErin/z88dk.git ${Z88DK_PATH} + +RUN cpanm -l $HOME/perl5 --no-wget local::lib Template::Plugin::YAML + +# Add, edit or uncomment the following lines to customize the z88dk compilation +# COPY clib_const.m4 ${Z88DK_PATH}/libsrc/_DEVELOPMENT/target/ +# COPY config_sp1.m4 ${Z88DK_PATH}/libsrc/_DEVELOPMENT/target/zx/config/ + +RUN cd ${Z88DK_PATH} \ + && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)" \ + && chmod 777 build.sh \ + && BUILD_SDCC=1 BUILD_SDCC_HTTP=1 ./build.sh \ + && apk del .build_deps + +ENV PATH="${Z88DK_PATH}/bin:${PATH}" \ + ZCCCFG="${Z88DK_PATH}/lib/config/" + +WORKDIR /src/