Getting the tools to work

If you haven't realized it yet, assembly is hard.

However, getting everything to work so that you can deal with the confusion of assembly is even harder.

Thus, this tutorial... To tell you how to get the tools of assembly to work, but I won't tell you how to program in asm. Why am I doing this? Simple, I don't want anyone else to have to suffer the month it took me to actually get one asm program/app to work. It's a pain.

Hint: If you see a black link on this page, try holding the mouse over it for a few seconds, and you'll probably see a useful tip of some sort.

The first step to getting the world of assembly tools to behave is to get your computer ready for them... This is just a bit of housekeeping to keep your hard drive cleaner than it otherwise would be... Trust me, this is worth doing...

In the root of the drive you want to use, make the following set of folders:


What's the point of a directory structure that complex? It allows for a lot of adjustments in the future (including more assemblers, more debuggers, and the inclusion of other programming languages). It keeps things organized very well, and that's the first key to success in programming.


Downloads

Looking over the directories should give you some idea of what's in sore for your little computer, and what you need to use for assembly... You need primarily three programs.

Now, I can tell you how and where to download everything that you'll ever need for asm program/app creation.


If you just want to ignore everything I say, and simply download everything you could possibly download all at once, go here.

However, for those of us who follow directions a bit better, start by downloading:


Use

Congrats! Thanks to the hours you've now spent downloading and installing (though you can feel overjoyed about having the latest OS version because of TI-Connect), you're now ready to learn how to actually use the programs.

The first thing you want to do is to create a template to base the rest of your work off of.

    To create a template:
  1. Open ZDS.
  2. Go to [File]->[New Project]
  3. Check that "Family" is selected in the "Selection by" box. If it's not selected, select it.
  4. On the Master list, select Z180.
  5. In the Project Target list, Z80180 should be selected. If it is not, select it.
  6. The Emulator box will probably read "Not Available", but that doesn't matter, that's why you downloaded the flash debugger.
  7. Now, click the   at the end of "Project Name"
  8. Go to your Programming\TI\Assembly\Source Code folder.
  9. Click the "make a new folder" button, and create a new folder called "Default APP".
  10. Go into your Default APP folder, and type in "Default APP" as the project name, and click OK.
  11. Click the OK button on the new project window.
  12. Click the OK button on the window that pops up complaining about your selected Emulator
  13. Good job! You're into your new project. Now, go to [File]->[New File], a blank file called "Untitled1" will pop open.
  14. Now, you need to fill that file with something useful. You could start by taking some of the pre-header information out of Debuggers\TI\Demo\hello.asm, and the rest of the header out of The Silver Addendum (Pages 3-4) (or perhaps even taking the entire header out of Debuggers\TI\Demo\hello.asm if the addendum doesn't work), or just copy the entire file out of here:

    This is the most updated header AT THIS TIME. If there's something made since this file, you can still use the pre and post header information, just not the header itself.

    ; (Your Name)
    ; Name: 
    ; Date: 
    ;  (YY)-(MM)-(DD)
    ; Action: 
    
    ; Include file needed to access system routines
    	include "..\..\Debuggers\TI\Inc\ti83plus.inc"
    		; Assuming the include file is at:
    		;  "(drive):\Programming\TI\Assembly\Debuggers\TI\Inc\ti83plus.inc"
    		; And assuming the source file is at:
    		;  "(drive):\Programming\TI\Assembly\Source Code\Default APP"
    
    EXT_APP equ 1   ; This definition is required of all apps
    cseg            ; This linker directive is required of all apps.
    
    ; This is the application header definition area required for all Apps.
    	DB	080h,	00Fh			; Field: Program length
    	DB	000h,	000h,	000h,	000h	; Length = 0 (N/A for unsigned
    						; Apps)
    ; ------------------------------------------------------------------------------
    ; * * * App types * * *
    ; This example uses shareware type for signing and the simulator.
    ; Replace with the commented developer ID for debugging on the calculator.
    ; Note the header will need to be adjusted depending on the number of bytes in
    ; this type field.
    ; ------------------------------------------------------------------------------
    	DB	080h,	012h			; Field: Program type (2 byte)
    	DB	001h,	004h			; Type = Shareware, TI-83 Plus
    ;						-------------------------------
    ;						; Use with 5 or 6 character ID
    ;	DB	080h,	013h			; Field: Program type (3 byte)
    ;	DB	001h,	07Fh,	004h		; Dev. ID = "17F04"
    ; ------------------------------------------------------------------------------
    	DB	080h,	021h			; Field: App ID
    	DB	001h				; Id = 1
    	DB	080h,	031h			; Field: App Build
    	DB	001h				; Build = 1
    ; ------------------------------------------------------------------------------
    ; -- App Name is to be 8 characters in size --
    	DB	080h,	048h			; Field: App Name
    	DB	"TEMP    "			; Name = "TEMP    "
    	DB	080h,	081h			; Field: App Pages
    	DB	001h				; App Pages = 1
    	DB	080h,	090h			; No default splash screen
    ; ------------------------------------------------------------------------------
    	DB	080h,	0A1h			; Field: App level
    	DB	001h				; Highest HW level = 1
    ; ------------------------------------------------------------------------------
    	DB	003h,	026h,	009h,	004h	; Field: Date stamp =
    	DB	005h,	0D4h,	062h,	000h	; 2/7/2000
    	DB	002h,	00Dh,	040h		; Dummy encrypted TI date
    	DB	055h,	073h,	021h,	0E3h	; stamp signature
    	DB	03Bh,	081h,	022h,	017h
    	DB	02Dh,	0D2h,	0D3h,	018h
    	DB	093h,	063h,	078h,	0A6h
    	DB	0A2h,	006h,	05Ch,	071h
    	DB	0C0h,	031h,	0E5h,	098h
    	DB	0DEh,	06Dh,	039h,	03Ch
    	DB	0F8h,	035h,	0E0h,	0A7h
    	DB	00Fh,	092h,	0A5h,	037h
    	DB	068h,	0F3h,	040h,	019h
    	DB	06Eh,	0CAh, 	02Fh,	064h
    	DB	0E9h,	0AAh,	0CFh,	0C9h
    	DB	035h,	039h,	0C0h,	043h
    	DB	05Bh,	0D3h,	037h,	086h
    	DB	041h,	0E2h,	001h,	090h
    ; ------------------------------------------------------------------------------
    	DB	080h,	07Fh			; Field: Program Image length
    	DB	000h,	000h,	000h,	000h	; Length = 0, N/A
    ; ------------------------------------------------------------------------------
    ; End of required Header.
    ; To allow for growth of header fields during the signing process, the
    ; following pad bytes are needed. Adjust as needed.
    	DB	0,	0,	0,	0	; Reserved Pad
    	DB	0,	0,	0,	0	; Reserved Pad
    	DB	0,	0,	0,	0	; Reserved Pad
    	DB	0				; Adjusted pad for level type
    ; ------------------------------------------------------------------------------
    ; Adjust header according to application type.
    ; This example uses shareware type (2-bytes).
    ; Replace with the commented pads if using a 3-byte developer ID.
    	DB	0,	0,	0,	0	; Reserved bytes with pad for
    						; 2-byte Program Type field
    ;	DB	0,	0,	0		; Reserved bytes with pad for
    						; 3-byte Program Type field
    ;
    ; End of 128 byte application header
    ; ------------------------------------------------------------------------------
    ;
    ; Execution starts here.
    
    StartApp:                 ;The app starts here
    ;     Pneumonic	Content		Comment
    	B_CALL	ClrLCDFull	; Clear the screen
    	xor	a		; A=0
    
    	
    
    	B_CALL	GetKey		; Wait for a keypress
    	B_JUMP	JForceCmdNoChar	; Exit the application
    

    The actual code to start the application goes in the tabbed in line between the "xor a" and "B_CALL GetKey", you may want to add a comment saying that.

  15. Now, you have enough of a file to be done with that part. Go to [Project]->[Settings], and from the settings window, click the Linker tab.
  16. Select "Ranges" in the "Category" window, and click the New button (under the text box).
  17. Type .text into the "Section Name" field
  18. Type "4000" into the "Start Address" field
  19. Type "4000" into the "End" field
  20. In the Bounds section, select "Length"
  21. Make sure "Hexadecimal" is selected in the Radix section
  22. Click OK.
  23. Click OK again.
  24. Now, go up to the row of buttons on the top, and look for the "Rebuild All" button, and click it.
  25. The program should ask you to save your file, so save it in the Default APP folder, as Default
  26. After you save, the build window should show you the following errors:
    Deleting output files for project
    Building...
    0 error(s), 0 warning(s)
    Linking...
    ZLD-E0029 Error: 'EXTIO' is neither an address space nor a control section name
    ZLD-W0001 Warning: Extra characters on command line
    ZLD-E0029 Error: 'INTIO' is neither an address space nor a control section name
    ZLD-W0001 Warning: Extra characters on command line
    
    Default APP.ld - 2 error(s), 2 warning(s)
    
    
  27. That's all because you forgot to include the file in your project... So, Right-Click the "Source Files" folder in the Project View window, and select "Add File(s) to project"
  28. Select your newly saved file, and click the "Add" button.
  29. Now, try Rebuilding again.
  30. Save your project. Rebuilding the file should work, and display something like:
    Deleting output files for project
    Building...
    default.asm
    0 error(s), 0 warning(s)
    Linking...
    
    Default APP.ld - 0 error(s), 0 warning(s)
    
    

ASM Program

    To create an assembly program (not an app), follow steps 1 - 13 on app creation (replacing "Default APP" with "Default Prog" where necessary).
  1. Now, since the program's different, you'll need a different source file... TI doesn't offer any good templates, so the only one I can give you is my own:

    ; (Your Name)
    ; Name: 
    ; Date: 
    ;  (YY)-(MM)-(DD)
    ; Action: 
    
    .NOLIST
    	include "..\..\Debuggers\TI\Inc\ti83plus.inc"
    
    
    .LIST
    ;     PNEUMONIC	CONTENT	COMMENT
    	B_CALL	ClrLCDFull	; Clear the screen
    	xor	a		; A=0
    
    	
    
    	B_CALL	GetKey		; Wait for a keypress
    	ret			; quit
    end
    END
    

  2. Now, you're ready to save (programs are so open ended, you don't even need to set the linker settings...) the file as Default in your Source Code\Default Prog folder.
  3. Hit Alt+F7 to rebuild it, and... it should work.

    If it doesn't work... See the possible fixes listed in the app section...

Save your project and close ZDS, and you've just completed the templates for both apps and progs. Good Job!

To prevent destruction/corruption of the two template projects you've just created, you may want to make backup copies of the source files or write protect them. If you write protect files however, ZDS will not let you edit them... It won't even let you type when they're open, however, you can still copy out the contents to a new file.


Prepping for the Calc

The next step (the next to last step) in getting your apps and progs ready for the calculator involves running the Apps through Wappsign, and running the progs through convhex. (Generally, you'd debug them with TI's Flash debugger before proceeding to this step, but with the completely empty program and app you've written so far, you can't do much harm to your calc. - TI's tutorial, starting on page 129 of the SDK guide, works well, so I won't say anything...) I'll start with the apps.

    App's Final Step
  1. Open Wappsign.exe, located in the Debuggers\TI\Utils folder.
  2. Turn on the "Auto detect key file", "Sign on drop", and "Save settings on exit" options, turning OFF the "Only run Fillapp" option.
  3. Hit the "Detect key File Now" button. If the output window displays something like: "WAPP1005: Key file cannot be successfully detected", click the triple dot button after the blank Key file field, and select the Debugger\TI\Utils directory, and select the key file there: 0104.key.
  4. Click OK.
  5. When asked to add the directory to your search path, select Yes.
  6. Now, you have two choices. Either open a window in Windows Explorer and drag and drop the file into the Applications field, or hit the triple dot button after the applications field and look for your hex file that way.
  7. Once you've selected your key file and app, if you used the "..." button to find your app, click the sign button, and you're done. If you just dragged and dropped your file, you're already done, it signs the file as soon as you drop it into the Application field.
    Prog's Final Step

    Unfortunately, the final step for programs is a lot longer than the one for apps... You have to run your hex file through a program called ConvHex.

  1. Start by downloading ConvHEX, and placing it in the Source Code directory.
  2. Now, you need two more files (well, you don't NEED them, they just make things a lot easier), this time, of your own creation. The first is a program to make convhexing easier, and the second makes selecting the file simpler. - If you don't want to store each project in it's own folder, then you can ignore these files and just run convhex.exe with your hex file from the command prompt (assuming they're in the same folder).

    The first file will be convhex.bat, placed in the Source Code directory.

    To save these files the way you need to, open Notepad, copy the contents in, and click the Save button. Put quotes around the name while you're saving it, and include the extension of the file name. (ie, type "convhex.bat" - WITH quotes into the text box) Under the name field, change the save type from "Text Documents (*.txt)" to "All files", and click save.

    The file contents The explanation
    @echo off
    copy %1\%1.hex %1.hex
    IF NOT EXIST %1.hex GOTO NOPRE
    convhex.exe %1.hex
    If NOT EXIST %1.8xp GOTO NOPOST
    del %1.hex
    exit
    :NOPRE
    echo Can't copy the file!
    echo  (check the directory/file names)
    pause
    exit
    :NOPOST
    echo Convhex can't fix the file!
    echo  (??????)
    pause
    exit
    
    don't display system messages
    copies the file to where convhex can deal with it
    If the program can't copy the file, it's an error
    convhexes the file
    If convhex can't convhex the file, it's an error
    deletes the used hex file (but keeps the original)
    quit if there weren't problems
    
    An error and it's description
    
    
    
    
    Another error and it's description
    

  3. And now, your second file: convhex.vbs, stored in the same directory.

    Dim ProgShell
    Dim input
    
    Set ProgShell = CreateObject("WScript.Shell")
    input = InputBox("ConvHEX Program:","TIASM",def)
    
    if input <> "" then
    	ProgShell.run "Convhex.bat "+input
    end if
    
    Create variables (window)
    (string)
    
    Assign the variables their values
      :
    
    If they typed something into the box:
    Run convhex.bat
    quit
    

  4. Make sure all three files are in the Source Code directory. Once they are, you can use them... Assuming you've built your program with ZDS
  5. To use the files, just open convhex.vbs and type in the file name that you want to convert... One warning though, use short project names (8 letters or less - the calc uses 8 letters, you can too), and don't use spaces, because convHex is restricted to DOS type file names. (So you'll have to make a new project to test the files)

Well, you're done! Now, all that's left is to send the files to your calculator, and you're finished.


Publishing Your Masterpieces

    For users of TI-Connect, the solution is oddly simple:
  1. Open TI-Connect from the Start Menu.
  2. Make sure your calculator is on at the Home screen (what you normally get when you turn it on), plugged into your link cable, and that the link cable is plugged into the computer.
  3. Click the purple options button in the lower right corner of the TI-Connect main screen.
  4. Click the Communications Settings button on the bottom of the menu that pops up, and click the "Find" button on the communication settings menu.
  5. When it's found the calculator, click OK on both menus, and quit TI-Connect.

    If it can't find your communication settings, make sure both the calc and link cable are plugged in to each other and the computer, respectively. Beyond that, check the TI-Connect documentation.

  6. Now, go to your wonderful App/Program and right click it. On the menu that pops up, select "Send To", and go to the "Connected TI Device" folder.
  7. Send it to your RAM if it's a program, and your Archive if it's an App.

If when sending your app to your calculator, you receive an error message reading something like: "Cannot transfer the application to the connected TI device. A certificate is required for a successful transer. (8C02001D)", you've forgotten something. Go back to ZDS, and steps 15-24, and include the Linker Range. If TI-Connect gives you any other errors, try setting the linker range, making sure that you selected the right processor, making sure that you are sending yourself the signed app, or if none of that works, try using another header file.

To get the most out of your program (not app), follow the Cleaning Up Steps after the TI-Graph Link instructions...


    The TI-Graph Link Instructions (for programs)
  1. Open TI-Graph Link.
  2. Find and open your program.
  3. Set your communication settings in the [Link] menu... First, select your cable color in the [Link]->[Cable Type] bar.
  4. Now, if you know your com port, select it and then click the "Send to RAM" button on the corner of the program's window.
  5. If it sends, wonderful! If it doesn't, try changing your com port and trying again. If you go through every com port and it still doesn't work, try restarting your computer and having absolutely no other programs (or at least, as close as you can get to no other programs) open before you try to send.
    Instructions for Apps
  1. Open TI-Graph Link, and select your cable type.
  2. Again, if you know your com port, you're almost done... Select [Link]->[Send Flash Software]->[Applications and Certificates].
  3. Select your app and click OK
  4. If your com port is right, and you don't have too many other programs open, the file should send. If it doesn't work, try closing some other programs, and then try changing your com settings.

(Sorry, there really isn't much help I can give you about TI-Graph Link... TI abandoned it for TI-Connect for a good reason... It kind of sucks.)


The Last Thing Possibly Possible! (housekeeping for programs)

Now that you've got the wonderful program (not app - apps should ignore this section) that you wrote on your calculator, you do like any sensible person, and try to use it. But all of a sudden, the calc goes haywire, and gives you this crazy thing called a "Syntax Error"... What? Didn't you just compile it perfectly? Didn't you just send it to the calc without a hitch? Didn't it even run in the debugger perfectly?

Yup. But the answer is that it doesn't matter, the calc's stupid. There's one last step left to get the calc to run your program nicely...

    Making The Program Run Flawlessly!
  1. Hit the yellow Second button, followed by the 0 button, to bring up the Catalog.
  2. Scroll through the catalog until you reach an entry labeled "AsmComp(" (the first one beyond the screen), and hit enter.
  3. "AsmComp(" pastes itself to the home screen.
  4. Without hitting any other buttons, hit the [PRGM] button to bring up the list of executable programs, and select the program you just sent to yourself.
  5. Now, hit the "," button, and go to [PRGM] again, and select the same program again... Except this time, change the name a bit... Maybe add a 1 on the end, or a Z at the beginning (keep it to a max of 8 letters though... just misspell it a bit).
  6. Hit enter. This compiles your assembly program (again), into a new, improved, and even smaller version, titled whatever you titled the second file. If you want proof, hit "2nd" and "+" to bring up the memory screen, hit 2 to bring up the management screen, and 7 to just show the programs. Find both programs, and the new one will be smaller than the first one.
  7. Now, even though you're in the memory management screen and could easily delete the first program, because you don't need it anymore, DON'T!
  8. Instead, go to the program menu again, and hit right to edit the programs... Start editing the first program (the one you originally sent to the calculator), and clear it out... Completely! Just hit [CLEAR] + [DEL] a bunch of times, and you'll be done quite quickly...
  9. Now, you've got a completely empty program to mess with. It has a purpose. Open the catalog again, and select the choice at the bottom of the screen, "Asm(". It'll paste into the program.
  10. Now, while still in the program, hit the [PRGM] button again, and go all the way right to the "EXEC" menu. Select your new program (the one you just compiled), and hit enter, so that it pastes into the program you just cleared out...
    It should look like Asm(prgmWHATEVER
  11. Now quit, and use the emptied out program just like any other normal program, except for how it runs the newly compiled program without forcing the user to type in Asm(prgmWHATEVER before every run!

Congratulations! You're FINISHED!!!!

Programmed completely in HTML by Nick Daly on June 1, 2003
Note: Any changes to websites after this date may destroy the linking power of any included links.