Difference between revisions of "Beginners"

From WikiTI
Jump to: navigation, search
(Hello World)
m (Prose tuning, style.)
 
(8 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
=== Getting a ROM dump ===
 
=== Getting a ROM dump ===
  
Getting a ROM dump is the essential first step of running a calculator emulator. Because the calculator operating system is intellectual property of Texas Instruments, it is illegal to distribute ROM images, but you can extract your own ROM image from your own calculator under "Fair use" regulations.
+
Getting a ROM dump is the essential first step of running a calculator emulator. Because the calculator operating system is intellectual property of Texas Instruments, it is illegal to distribute ROM images, but you can extract your own ROM image from your own calculator under "Fair use" copyright doctrine.
  
 
To download your own ROM image from your calculator to your PC you need some software. Your options are:
 
To download your own ROM image from your calculator to your PC you need some software. Your options are:
Line 11: Line 11:
 
* Uhm... need to find some more ;)
 
* Uhm... need to find some more ;)
  
Ticalc.org has an excellent howto page on getting a ROM image [http://www.ticalc.org/programming/emulators/romdump.html here]. Or, you could do a Google search on something like TI83.rom, and see what comes up.
+
Ticalc.org has an [http://www.ticalc.org/programming/emulators/romdump.html excellent howto page on getting a ROM image]. Or, you could do a Google search on something like TI83.rom, and see what comes up.
  
 
Of course, if you want to develop an operating system yourself (if you're working on [[Vera]] for example) you don't need a ROM image.
 
Of course, if you want to develop an operating system yourself (if you're working on [[Vera]] for example) you don't need a ROM image.
  
=== Getting emulator software ===
+
=== Choice of Emulator ===
  
 
The second step is selecting an [[:Category:Emulators|emulator]] that suits you:
 
The second step is selecting an [[:Category:Emulators|emulator]] that suits you:
Line 21: Line 21:
 
* [[:Emulators:Virtual TI|Virtual TI]] - Long time favourite, but mostly because it was the only one
 
* [[:Emulators:Virtual TI|Virtual TI]] - Long time favourite, but mostly because it was the only one
 
* [[:Emulators:PindurTI|PindurTI]] - Very basic emulator with very good hardware emulation and animated screenshotting
 
* [[:Emulators:PindurTI|PindurTI]] - Very basic emulator with very good hardware emulation and animated screenshotting
* [[:Emulators:Wabbitemu|WabbitEmu]] - The newest breed, with a very nice GUI and a port to MAC, Linux is on the way
+
* [[:Emulators:Wabbitemu|WabbitEmu]] - The newest breed, with a very nice GUI and a port to Mac, Linux is on the way
  
 
There are a few more, but these are the most popular. Virtual TI's emulation is quite poor compared to the others, but the others are still under development. It's usually best to have a few around so that in case you run into something unexpected you can get a second opinion from another emulator.
 
There are a few more, but these are the most popular. Virtual TI's emulation is quite poor compared to the others, but the others are still under development. It's usually best to have a few around so that in case you run into something unexpected you can get a second opinion from another emulator.
Line 33: Line 33:
 
=== Choice of assembler ===
 
=== Choice of assembler ===
  
Once again, you'll have to make a choice. A few years ago, things were simple; there was TASM and nothing else, so you'd use TASM. These days we have TASM, Brass and Spasm (and probably a few others), all with subtle little differences and improvements, but the latter two are clearly superior to the old TASM. Brass is written in C# for .NET, and can run under Linux using Mono. Spasm was written in C, and has been ported to Linux(?).
+
Once again, you'll have to make a choice. A few years ago, things were simple; there was TASM and nothing else, so you'd use TASM. These days we have TASM, Brass and Spasm (and probably a few others), all with subtle little differences and improvements, but the latter two are clearly superior to the old TASM. Brass is written in C# for .NET, and can run under Linux using Mono. Spasm was written in C, and will compile on most systems with the GNU toolchain.
  
 
* Brass [http://kvince83.tengun.net/maxboard/viewforum.php?f=25 subforum], [http://benryves.com/bin/brass/ website] and [http://benryves.com/bin/brass/Brass.exe latest download]
 
* Brass [http://kvince83.tengun.net/maxboard/viewforum.php?f=25 subforum], [http://benryves.com/bin/brass/ website] and [http://benryves.com/bin/brass/Brass.exe latest download]
* Spasm [http://www.revsoft.org/phpBB2/viewforum.php?f=21 subforum] and [http://www.revsoft.org/wabbitspasm.zip latest download]
+
* Spasm [http://www.revsoft.org/phpBB2/viewforum.php?f=21 subforum] and [http://www.group.revsoft.org/spasm.exe latest download]
  
 
=== Assembling source to binaries ===
 
=== Assembling source to binaries ===
Line 46: Line 46:
 
or
 
or
  
  wabbitspasm input.asm output.8?p
+
  spasm input.asm output.8?p
  
Both modern assemblers can output files in TI calculator specific formats, which TASM can not. Spasm will do this automatically(?), and in the case of Brass you can [http://benryves.com/bin/brass/directives/binarymode.htm specify] your output format in your source code:
+
Both modern assemblers can output files in TI calculator specific formats, which TASM can not. Some versions of Spasm will do this automatically based on the output file extension, and in the case of Brass you can [http://benryves.com/bin/brass/directives/binarymode.htm specify] your output format in your source code:
  
 
  .binarymode TI8X
 
  .binarymode TI8X
Line 54: Line 54:
 
=== Include files ===
 
=== Include files ===
  
Whelp!
+
Include files contain predefined memory locations, locations of TI-OS calls and macros to make your life easier. Strictly speaking you don't need any, but without them you'll have to type in every address by hand (and either memorize them or look them up each time).
 +
 
 +
Depending on which calculator model and which shell you want to develop for (Ion, MirageOS, Venus, etc.), you'll need to get some include files. For the sake of demonstration (and because most other shells can run them) we'll be choosing Ion for now. Developing for Ion also has the advantage that your applications can be compiled for TI-83 and TI-83+ (and relatives) without changing the source. Go [http://www.ticalc.org/archives/files/fileinfo/130/13058.html here] and download the zip file, which contains ion.inc. You'll also need the shell itself for testing.
  
 
=== Hello World ===
 
=== Hello World ===
Line 60: Line 62:
 
Save this file as hello.asm in the same directory as your assembler, for ease of testing:
 
Save this file as hello.asm in the same directory as your assembler, for ease of testing:
  
<pre>.binarymode TI8X   ; only required if you use Brass
+
<pre>#define TI83P   ; If you want to compile for TI-83+ family calcs
 +
;#define TI83  ; If you want to compile for TI-83, don't uncomment both!
  
#include   "ti83plus.inc"
+
#include "ion.inc"
#include    "ion.inc"
+
  
 
; ====
 
; ====
Line 69: Line 71:
  
 
#ifdef TI83P
 
#ifdef TI83P
     .org   progstart-2
+
    .binarymode TI8X  ; only required if you use Brass
     .db     $BB,$6D
+
     .org progstart-2
 +
     .db $BB,$6D
 
#else
 
#else
     .org   progstart
+
    .binarymode TI83  ; only required if you use Brass
 +
     .org progstart
 
#endif
 
#endif
 
     ret
 
     ret
     jr     nc,main
+
     jr nc,main
 
title:
 
title:
   .db   "Hello World Test",0
+
   .db "Hello World Test",0
  
 
; End of Ion header
 
; End of Ion header
Line 84: Line 88:
 
main:
 
main:
 
     ; Program execution starts here:
 
     ; Program execution starts here:
 +
    bcall(_homeup)
 
     ld hl,string
 
     ld hl,string
 
     bcall(_puts)
 
     bcall(_puts)

Latest revision as of 17:43, 4 September 2011

Starting with assembly programming can be quite a pain. You need to find yourself an assembler, preferably a nice emulator, and lots of documentation. While this wiki provides you with a lot of documentation, and many websites and teams can provide you with links to good tutorials, people keep asking the community how to get started. I hope this will answer their questions once and for all :)

Emulating

Getting a ROM dump

Getting a ROM dump is the essential first step of running a calculator emulator. Because the calculator operating system is intellectual property of Texas Instruments, it is illegal to distribute ROM images, but you can extract your own ROM image from your own calculator under "Fair use" copyright doctrine.

To download your own ROM image from your calculator to your PC you need some software. Your options are:

  • Rom8x
  • Uhm... need to find some more ;)

Ticalc.org has an excellent howto page on getting a ROM image. Or, you could do a Google search on something like TI83.rom, and see what comes up.

Of course, if you want to develop an operating system yourself (if you're working on Vera for example) you don't need a ROM image.

Choice of Emulator

The second step is selecting an emulator that suits you:

  • Virtual TI - Long time favourite, but mostly because it was the only one
  • PindurTI - Very basic emulator with very good hardware emulation and animated screenshotting
  • WabbitEmu - The newest breed, with a very nice GUI and a port to Mac, Linux is on the way

There are a few more, but these are the most popular. Virtual TI's emulation is quite poor compared to the others, but the others are still under development. It's usually best to have a few around so that in case you run into something unexpected you can get a second opinion from another emulator.

Please read the respective README's on how to get your ROM image running in these emulators.

Assembler

An assembler -- sometimes referred to as "compiler", though formally it is no such thing -- can assemble your source code into binaries for the Z80 processor that runs our calculators.

Choice of assembler

Once again, you'll have to make a choice. A few years ago, things were simple; there was TASM and nothing else, so you'd use TASM. These days we have TASM, Brass and Spasm (and probably a few others), all with subtle little differences and improvements, but the latter two are clearly superior to the old TASM. Brass is written in C# for .NET, and can run under Linux using Mono. Spasm was written in C, and will compile on most systems with the GNU toolchain.

Assembling source to binaries

The syntax for assembling input.asm to either output.8xp or output.83p is:

Brass.exe input.asm output.8?p

or

spasm input.asm output.8?p

Both modern assemblers can output files in TI calculator specific formats, which TASM can not. Some versions of Spasm will do this automatically based on the output file extension, and in the case of Brass you can specify your output format in your source code:

.binarymode TI8X

Include files

Include files contain predefined memory locations, locations of TI-OS calls and macros to make your life easier. Strictly speaking you don't need any, but without them you'll have to type in every address by hand (and either memorize them or look them up each time).

Depending on which calculator model and which shell you want to develop for (Ion, MirageOS, Venus, etc.), you'll need to get some include files. For the sake of demonstration (and because most other shells can run them) we'll be choosing Ion for now. Developing for Ion also has the advantage that your applications can be compiled for TI-83 and TI-83+ (and relatives) without changing the source. Go here and download the zip file, which contains ion.inc. You'll also need the shell itself for testing.

Hello World

Save this file as hello.asm in the same directory as your assembler, for ease of testing:

#define TI83P   ; If you want to compile for TI-83+ family calcs
;#define TI83   ; If you want to compile for TI-83, don't uncomment both!

#include "ion.inc"

; ====
; Start of Ion header

#ifdef TI83P
    .binarymode TI8X   ; only required if you use Brass
    .org progstart-2
    .db $BB,$6D
#else
    .binarymode TI83   ; only required if you use Brass
    .org progstart
#endif
    ret
    jr nc,main
title:
   .db "Hello World Test",0

; End of Ion header
; ====

main:
    ; Program execution starts here:
    bcall(_homeup)
    ld hl,string
    bcall(_puts)
    bcall(_getkey)
    ret

string:
    .db "Hello world!",0

Open a console, cd to your directory and issue:

<your assembler> hello.asm hello.8xp

Now load hello.8xp into your emulator and try to run it with Ion.