I am considering attempting to write a program that would run on either ti-83+ or latter or ti-84+ or latter. I have decided that it would be best to write a flash application. I know how to program already and have written some programs in assembly for different cpus before I just want to know the header needed to do such. I do not want to require anything to be installed on the calculator such as a shell. If I understand correct. I need to assemble my program using an assembler such as z80asm then use rabbitsign on the final binary then I can get it into the emulator and then I should just be able to run the program. Are there any tutorials on getting starting for a flash application. All the ones I see use TASM which is obsolete and is shareware and they are for a particular shell and I want to avoid the requirement of a shell.
Header for Brass:


Code:
.nolist
.include "ti83plus.inc"
.list

;====== Header =================================================================

.binarymode intel
.defpage   0, 16384, 4000h
.page   0
   ; Master Field
   .db   80h, 0Fh, 0, 0, 0, 0
   ; Name
   .db   80h, 40h + {2@} - {@}
@:   .db   "App Name"
@:   ; Disable TI splash screen.
   .db   80h, 90h
   ; Revision
   .db   80h, 21h, 1
   ; Build
   .db   80h, 32h
   .db   BUILD >> 8
   .db   BUILD & 255
   ; Pages
   .db   80h, 81h, 1
   ; Signing Key ID
   .db   80h, 12h, 1, 4
   ; Date stamp.  Nothing ever checks this, so you can put nothing in it.
   .db   03h, 22h, 09h, 00h
   ; Date stamp signature.  Since nothing ever checks this, there's no
   ; reason ever to update it.  Or even have data in it.
   .db   02h, 00
   ; Final field
   .db   80h, 70h

;====== Your Code Starts Here ==================================================

Build script for Windows:

Code:
brass myapp.asm myapp.hex -l myapp.html
rabbitsign -g -o myapp.8xk myapp.hex



Header for Spasm:

Code:
.nolist
#include "ti83plus.inc"
.list

;====== Header =================================================================

.org   4000h
   ; Master Field
   .db   80h, 0Fh, 0, 0, 0, 0
   ; Name
   .db   80h, 40h + ++_ - +_
_:   .db   "App Name"
_:   ; Disable TI splash screen.
   .db   80h, 90h
   ; Revision
   .db   80h, 21h, 1
   ; Build
   .db   80h, 32h
   .db   BUILD >> 8
   .db   BUILD & 255
   ; Pages
   .db   80h, 81h, 1
   ; Signing Key ID
   .db   80h, 12h, 1, 4
   ; Date stamp.  Nothing ever checks this, so you can put nothing in it.
   .db   03h, 22h, 09h, 00h
   ; Date stamp signature.  Since nothing ever checks this, there's no
   ; reason ever to update it.  Or even have data in it.
   .db   02h, 00
   ; Final field
   .db   80h, 70h

;====== Your Code Starts Here ==================================================


Build script:

Code:
spasm myapp.asm myapp.bin -T
rabbitsign -t 8xk -g -f myapp.bin
Thank you I will try it out. Also about the datestamp why not put program data there if nothing checks it?
ProgrammerNerd wrote:
Also about the datestamp why not put program data there if nothing checks it?

You could. Or you could leave the field completely empty, which is what you see in the header samples I gave.
Alright I will go with the later. A more flexible way to reduce memory although that will most likely not be a concern for me as programs must be aligned by 16kb. Could

Code:

   .db   03h, 22h, 09h, 00h

Also be removed?
Where can I find documentation on this header?
I end of with these two errors with the simple act of trying to assemble what you have posted using SPASM

Code:

main.asm:19: error SE106: Could not find label or macro 'BUILD'
main.asm:20: error SE106: Could not find label or macro 'BUILD'

Edit: I googled part of the header and found http://wikiti.brandonw.net/index.php?title=83Plus:OS:Certificate/Headers:Fields:Application_Headers it turns out that field is not needed.
Edit2: Got the program up and running but garabge is displayed on screen.

Code:

.nolist
#include "ti83plus.inc"
.list

;====== Header =================================================================

.org   4000h
   ; Master Field
   .db   80h, 0Fh, 0, 0, 0, 0
   ; Name
   .db   80h, 44h,"Test"
   ; Disable TI splash screen.
   .db   80h, 90h
   ; Pages
   .db   80h, 81h, 1
   ; Signing Key ID
   .db   80h, 12h, 1, 4
   ; Date stamp.  Nothing ever checks this, so you can put nothing in it.
   .db   03h, 22h, 09h, 00h
   ; Date stamp signature.  Since nothing ever checks this, there's no
   ; reason ever to update it.  Or even have data in it.
   .db   02h, 00
   ; Final field
   .db   80h, 70h

;====== Your Code Starts Here ==================================================
   bcall(_ForceFullScreen)
   bcall(_ClrLCDFull)
   ld hl,0
   ld (curRow),hl
   ld hl,TestStr
   bcall(_PutS)
   bcall(_getkey)
   bcall(_JForceCmdNoChar)
TestStr:
   .db "TI program Test",0

Code:
   ld hl,TestStr
   bcall(_PutS)
   bcall(_getkey)
   bcall(_JForceCmdNoChar)
TestStr:
   .db "TI program Test",0
You can't just _PutS in apps, since your string is in bank 1 which gets swapped out during romcalls. TI's recommended way is to copy strings to RAM then call _PutS, but that's rather silly. I prefer to just implement PutS on-page so no copy is required:
Code:
puts:
    ld a,(hl)
    or a
    ret z
    bcall(_PutC)
    inc hl
    jr puts

Invocation is trivial:

Code:
   ld hl,TestStr
   call puts
   bcall(_getkey)
   bcall(_JForceCmdNoChar)
TestStr:
   .db "TI program Test",0
Thank you. It works perfect. I'll do more reading into memory mapping to avoid further issues like this.
Edit: It appears as though if I put the lenght of the string as the first byte I can make a faster function

Code:

TestStr:
   .db 15,"TI program Test"
puts:
   ld b,(hl);7
puts2:
   inc hl;6
   ld a,(hl);7
   bcall(_PutC);11
   djnz puts2;13/8
   ret;10
;7+(15*(6+7+11))+(13*14)+8+10=567
TestStr:
   .db "TI program Test",0
puts:
    ld a,(hl);7
    or a;4
    ret z;11/5
    bcall(_PutC);11
    inc hl;6
    jr puts;12
;(16*(7+4))+(5*15)+11+(15*(11+6+12))=697

This was based on http://www.z80.info/z80time.txt
Did I do my math correctly?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement