Author Topic: TI-85 Programming: Getting Started  (Read 7774 times)

0 Members and 1 Guest are viewing this topic.

Offline utz

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 161
  • Rating: +28/-0
    • View Profile
    • official hp - music, demos, and more
TI-85 Programming: Getting Started
« on: March 28, 2014, 06:02:19 pm »
So, I'm planning to do some TI-85 programming. I know most of you omnimagicians aren't really concerned with that old piece of j***, but maybe some of the more senior members can shed some light. So, my questions for the time being:

- What is the recommended shell? I'm using Usgard at the moment, but I'm not really happy with it. The build chain seems quite convoluted and unflexible. Also, having to put an & in front of all labels makes writing platform independant code very tedious. So, are there any good alternatives?

- Where can I find information on the 85 ports? I thought they would be the same as on the 86 but seems that's not the case, see question #3.

- Coming from TI-82, are there any special quirks to watch out for (other than the memory mapped display)? For instance, my custom keyhandler that works nicely on 82 through 84+ flat out crashes on 85, and I don't really understand why.

Thanks in advance :)

Offline JamesV

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 276
  • Rating: +77/-0
    • View Profile
    • James V's TI-Calculator page
Re: TI-85 Programming: Getting Started
« Reply #1 on: March 28, 2014, 06:09:01 pm »
Although I do own a TI-85, I've not tried coding on it. If you really wanted to be old school though, I'd suggest ZShell, as it was the original. I have done a selection of TI-86 coding, which is to the TI-85 what the TI-83 is to the TI-82, so I might be able to help somewhat.

As for the keyhandler issue that you're having, feel free to send me a copy and I'll see if I can spot anything obvious that might be causing a problem :)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TI-85 Programming: Getting Started
« Reply #2 on: March 28, 2014, 06:36:59 pm »
Usgard and Zshell were the popular shells for the TI-85 If memory serves correctly. Ticalc.org probably has a decent amount of documentation, so I'd start your search there. And yes, the TI-85 will be most similar to the TI-86. The TI-86 was based on the TI-85.

Offline utz

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 161
  • Rating: +28/-0
    • View Profile
    • official hp - music, demos, and more
Re: TI-85 Programming: Getting Started
« Reply #3 on: March 28, 2014, 07:13:03 pm »
Oh, thanks for the quick reply, guys.

@Art_of_camelot: Haha, I have nearly all doc files from ticalc backed up on my computer, but unfortunately they don't seem to have an 85-ports.txt :(

@JamesV: Ok, I'm just gonna dump the code here, it's not really a secret ;) And actually the keyhandler barely qualifies as such. Not sure if it's actually the part causing problems. If I comment it out the program still doesn't run, but it doesn't give me the "ERROR 20 GRAPH RANGE".

Code: [Select]

#include "usgard.h"

.org 0

.DB "HUBY TI 0.1", 0
#define db .byte
#define dw .word

;Huby beeper music engine by Shiru 04'11
;Two channels of tone, no volume, global speed
;One drum, replaces note on the first channel
;The main feature of this engine is the size, just 100 bytes
;Feel free to do whatever you want with the code, it is PD
;modified for Z80 TI calcs  by utz, Akareyon, and calc84maniac
;well, unfortunately it's more than 100 bytes now :(

di
call &begin
ex ei
ret

begin
ld hl,&musicData
call &play
ret

play
ld e,(hl) ;read speed word
inc hl
ld d,(hl)
inc hl
ld (&speed),de ;store it
ld e,(hl) ;read patterns offset
inc hl
ld d,(hl) ;it will be always in DE, and HL is order list pointer now

readPos
inc hl
ld a,(hl) ;read first byte of order list
or a
ret z ;if it is zero, it is end of the song
inc hl
push hl ;store order list pointer
push de ;store patterns offset
ld l,(hl) ;read second byte of order list
ld bc,2*256 ;calculate addresses of two patterns
read
ld h,c ;pattern number*8
add hl,hl
add hl,hl
add hl,hl
add hl,de ;add patterns offset
push hl ;store pattern address
ld l,a ;now second address
djnz &read
exx
pop hl ;restore pattern addressed in alternative set
pop de

ld b,8 ;play 8 rows
readRow
ld a,(hl) ;read first note
inc hl ;increase first pattern pointer
ex af,af'
ld a,(de) ;read second note
inc de ;increase second pattern pointer
exx
ld h,a
ex af,af'
ld l,a
cp $2c ;if first note is $2c, it is drum sound
jr z,$+3
xor a
ld (&slide),a
speed .EQU $+1
ld bc,0
;di

soundLoop
xor a ;clear carry and set A to zero
dec e ;counter of first channel
jr nz,&l1
ld e,l ;reload if overflow
sub l ;and set carry if note is not zero (mute)
slide .EQU $
nop ;slide for drum
l1
dec d ;counter of second channel
jr nz,&l2
ld d,h ;reload if overflow
sub h ;and set carry if note is not zero (mute)
l2
sbc a,a ;if carry, A=255, otherwise A=0

xor %11111100 ;+ a=$ff -> a=$c0, a=0 -> a=$fc
and %00111100
add a,$c0


out (7),a ;11  27
out (7),a
out (7),a
out (7),a ;+ 4x to compensate higher cpu speed

xor a ;+ new keyhandler
out (1),a
in a,(1) ;read keyboard
cpl
bit 6,a
jr nz,&l3 ;if any key is pressed, exit loop

dec bc
ld a,b
or c
jr nz,&soundLoop ;113/123t + not anymore

l3
exx

jr nz,$+4 ;if any key was pressed, break loop
djnz &readRow

pop de
pop hl
jr z,&readPos ;if no key was pressed, continue

ret


musicData
#include "ti1bit/huby/music.asm"

.end


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-85 Programming: Getting Started
« Reply #4 on: March 28, 2014, 11:15:20 pm »
Imagine a TI-85 ZShell port of Wacky Fun Random Numbar Generator v1.0000069 *.*

Kidding aside, it would be fun to see another game come out for that calc. After all, a new TI-81 game came out 11 years after that calc got discontinued :P and there are still new Sega Megadrive games coming out from time to time too.

Offline JamesV

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 276
  • Rating: +77/-0
    • View Profile
    • James V's TI-Calculator page
Re: TI-85 Programming: Getting Started
« Reply #5 on: March 29, 2014, 02:35:47 am »
Oh, thanks for the quick reply, guys.

@Art_of_camelot: Haha, I have nearly all doc files from ticalc backed up on my computer, but unfortunately they don't seem to have an 85-ports.txt :(

@JamesV: Ok, I'm just gonna dump the code here, it's not really a secret ;) And actually the keyhandler barely qualifies as such. Not sure if it's actually the part causing problems. If I comment it out the program still doesn't run, but it doesn't give me the "ERROR 20 GRAPH RANGE".
From what I can see, I don't think the keyhandler is causing your problem - I think you'll find that if you took out all the other code but left the keyhandler looping, you wouldn't have any problems (aside from the keyhandler only detecting the GRAPH, STAT, PRGM, CUSTOM, CLEAR & EXIT keys, but I assume this is intended).

I'm not very familiar with sending sound data out of the link port, so I can't debug that part. I'd suggest stripping back the program to do nothing but wait for a keypress, and then (assuming that works as intended), slowly add bits of code back in, and see where it goes wrong.

Offline utz

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 161
  • Rating: +28/-0
    • View Profile
    • official hp - music, demos, and more
Re: TI-85 Programming: Getting Started
« Reply #6 on: March 29, 2014, 05:01:20 am »
@JamesV: Yep, I guess that's what I have to do. It'd be nice to know the actual start address of the user code, so I could use a debugger to trace the error. But Usgard's docs don't say anything about that. Guess it depends on the ROM used. And yes, the "keyhandler" part is supposed to just wait for any of those keys.

@DJ_O: Don't get too exited, I just want to port my 1-bit sound routines to the 85 and 86. Actual games will have to be coded by somebody else...

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: TI-85 Programming: Getting Started
« Reply #7 on: March 29, 2014, 05:24:14 am »
WHOA, PEOPLE STILL CODE ON THAT THING?

i do not own a ti85, but isn't it just like ti84 basic?
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TI-85 Programming: Getting Started
« Reply #8 on: March 29, 2014, 09:02:25 am »
The BASIC and asm on both machines is similar yes, but not exactly the same.
@Utz: Ah, I see. :) You might be able to poke Brandon Wilson or Patrick Davidson. Both have been around for forever. Patrick has coded for the TI-85. Brandon W probably has too, but I don't know of the top of my head.
« Last Edit: March 29, 2014, 09:04:08 am by Art_of_camelot »

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: TI-85 Programming: Getting Started
« Reply #9 on: March 30, 2014, 09:59:55 am »
As always, the 85 version of Phoenix comes with the source code (i'm sure it's the same source that's included in all the other z80 versions). You might be able to find something interesting there. I believe Usgard is the most common shell, but ZShell is of course a classic. I think Usgard (the non- "lite" version, at least) can run ZShell games.

I also found a couple interesting things at ticalc, here's a ports guide for the 85:
http://www.ticalc.org/pub/text/calcinfo/ti-ports.txt

And here are two link port guides:
http://www.ticalc.org/pub/text/calcinfo/port_7.txt
http://www.ticalc.org/pub/text/calcinfo/linkprot.txt

EDIT: Also, some sound routines that supposedly work for the 85 (under ZShell):
http://www.ticalc.org/archives/files/fileinfo/309/30987.html
« Last Edit: March 30, 2014, 10:01:50 am by chickendude »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-85 Programming: Getting Started
« Reply #10 on: April 05, 2014, 02:23:36 am »
WHOA, PEOPLE STILL CODE ON THAT THING?

i do not own a ti85, but isn't it just like ti84 basic?
TI-85 BASIC is identical to TI-86 BASIC, but (almost) twice faster. It also has similarities with 84+ BASIC. I didn't have much troubles porting Illusiat 81, for example (find/replace did the trick).

Offline CVSoft

  • LV3 Member (Next: 100)
  • ***
  • Posts: 65
  • Rating: +5/-0
    • View Profile
    • CVSoft Homepage (work in progress)
Re: TI-85 Programming: Getting Started
« Reply #11 on: April 05, 2014, 02:38:34 am »
TI-85 BASIC is identical to TI-86 BASIC, but (almost) twice faster. It also has similarities with 84+ BASIC.
I don't think it's twice faster (more like 33% or so) but yeah, 82 BASIC is its closest relative given the order-of-operations change that the TI-83 introduced.

Relative to TI-86 BASIC, TI-85 BASIC lacks a few nonessential commands like DelVar and LCust(, and menus are limited to 5 items instead of 15. Get( and Send( are Input "CBLGET", and Output("CBLSEND", respectively, but they only work on TI-85s marked with "CBL" next to the serial number (and thus ROM 9.0 or 10.0). Everything runs noticeably faster.

Relative to TI-83 BASIC, there's some key differences. First and foremost, tokenization. Command names aren't tokenized until first execution, so the commands can be typed out on the keypad. In addition, lowercase is allowed in variable names too (which can be anything 8 characters and isn't taken by the system). The screen is 21 characters wide, and pixels are non-square. As I mentioned slightly earlier, the names of any variable aren't limited to fixed options, and everything uses the same 8-character variable name space. There's a few new variable types like constants, but these don't matter to programmers as everything we're used to having is present. The capitalization of system variables is a bit different. All OS-defined function names are limited to 8 characters too. y-equations can't be evaluated like y1(A), you have to use EvalF(y1,x,A), annoyingly. The OS treats that as implied multiplication, and the TI-86 resolved this. Most single-argument functions use a space after the name rather than an opening parenthesis (such as int x vs. int(x)), like the TI-81 and TI-82. Other than these, most code can be pretty easily ported over.
Current projects:
Sunθ v4.0 (Solar Position Calculator) (on hold)
CBLLight/CBLTherm (TI-Z80 only)
CBLM (68k only)
--KJ6PSG

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-85 Programming: Getting Started
« Reply #12 on: April 05, 2014, 03:07:32 am »
Yeah, although I noticed that certain things seemed close to twice faster. Just the overall is a much lower percentage. I think it has to do with how the larger 86 RAM is structured, causing slowdowns.

As for similarities with the 83 I mainly meant the overall language. For example, to make Illusiat 81 run on the 85, all I did was use Notepad's bulk Find/Replace tools to change ClrHome to ClLCD or things like that. I didn't even need to edit a single byte of code manually. I had to use VirtualBox, though, because TI-Graph Link didn't run on my Windows 7 install.

Also I think 85 and/or 86 code is much larger even after running it once, so if someone decided to port Illusiat series I don't think Illusiat 12 nor 13 would be even close to feasible.