This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 22 Aug 2008 10:30:18 pm    Post subject:

BTW: Z80 assembly for a TI-84+

So, I'm trying to learn assembly. I spend all day fetching sources and reading them. Copying source code. Learning to make a batch file (actually quite fun!). Figuring out how to get it to compile. Try the Flash debugger and get a syntax error, which I of course know not what to do about. Trying a new source and restarting. Trying a new method, SDK, whatever and restarting.

Every time, I get a syntax error. Sometimes, the program just wouldn't load into the debugger for whatever reason.

I'd usually, when I make a post like this, give all the relevant info, and info that I don't know whether is relevant or not do to my ignorance. I won't here because there's so much of it, and I understand only so much of it, I'd rather you asked. But, believe me, I've tried almost everything. Even a C-to-Z80 compiler--which is one of them that just wouldn't load.


Last edited by Guest on 22 Aug 2008 10:31:05 pm; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 22 Aug 2008 11:03:40 pm    Post subject:

Flash debugger is crappy from what I heard... I'm pretty sure there's a few IDEs available for assembling, but I would reccomend using SPASM.. best assembler from what I heard.

forgot where you can download it. =\
Back to top
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 22 Aug 2008 11:38:27 pm    Post subject:

Google quickly lead me to this page: http://www.ticalc.org/archives/files/fileinfo/390/39009.html

But it says it's for Linux and I didn't see any exes in the file, so I'm inclined to believe it. Is there a Windows version somewhere else?

Google also lead me to a page that looked like it should have had something...but I got confused and left.

So, if the Flash Debugger is not good, how shall I test my program without risking my calculator?
Back to top
tr1p1ea


Elite


Joined: 03 Aug 2003
Posts: 870

Posted: 23 Aug 2008 12:09:30 am    Post subject:

There are two really good emulators about. One is PindurTI which can be found here: http://users.hszk.bme.hu/~pg429/pindurti/ the other is WabbitEmu which might be more to your liking since it has a nice GUI: http://www.revsoft.org/wabbitemu.zip

The FlashDebugger is pretty terrible at emulating the calc reliably.
Back to top
Cryzbl


Newbie


Joined: 20 Jun 2008
Posts: 46

Posted: 23 Aug 2008 07:55:22 am    Post subject:

Hmm, wasn't wabbitemu's debugger still in development?

I find PTI better suited for debugging and wabbitemu for playing other games :)


And for assembler, I do vote for Brass 3! ... And I can't give you a link since benryves' website is down... Sad


Last edited by Guest on 23 Aug 2008 08:00:29 am; edited 1 time in total
Back to top
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 23 Aug 2008 06:02:00 pm    Post subject:

PTI didn't work for me...or I didn't realize how to use it.

Wabbit actually worked! Although, I still got those weird syntax errors, and for some reason when I hit goto, I saw BASIC code! Z88dk actually had no syntax errors, but I couldn't print "Hello World", which kind of makes since TI has no printf function and z88dk has no disp function :s.

Has anyone worked z88dk and can verify it's sufficient? Although, I'd honestly like to use assembly (I was excited to learn a new language), but I'll use this if nothing else.

Brass 3...I'll keep that in mind and Google it when the site might be up.

It's interesting that there are so many people out there doing stuff like this, and TI hasn't decided to make it easy.


Last edited by Guest on 23 Aug 2008 06:02:57 pm; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 23 Aug 2008 10:45:12 pm    Post subject:

Tr1p1ea showed me how to use the z88dk compiler sometime back and infact i just used it yesterday.

What troubles are you having with the z88dk compiler? Error, etc?


Code:
//example, thx to tr1p
/*
#pragma string name Hello World
#pragma data icon 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;

#include <stdio.h>
*/
main() {
/*
   // print string
   printf("Hello World!");

   // wait for keypress
   while( getk() == 0 ) {
   }
*/
}


Erm, don't give up on assembly. The C compiler is extremely inefficient no jokes. If you want the most basic assembler use TASM.
Ti-83 asm in 28 days will explain all the crap.
http://www.ticalc.org/archives/files/fileinfo/364/36479.html

If you ever use the C compiler, only use it for complex parts of a game, etc.


Last edited by Guest on 23 Aug 2008 10:46:20 pm; edited 1 time in total
Back to top
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 24 Aug 2008 04:11:28 am    Post subject:

Yeah, the 28 day was one of the tuts I tried.


Code:
C:\asm\tasm>compile hello
==== Now assembling hello.z80 for the TI-83 Plus ====
TASM Z80 Assembler.       Version 3.2 September, 2001.
 Copyright (C) 2001 Squak Valley Software
tasm: source file open error on ti83plus.inc
==== Errors!!! ====
==== Done ====

C:\asm\tasm>


Seems to have a problem with a very essential line. Wait...haven't I seen that file on my computer somewhere... Yes!

(Look out for the line break.)

Code:
C:\asm\tasm>compile hello
==== Now assembling hello.z80 for the TI-83 Plus ====
TASM Z80 Assembler.       Version 3.2 September, 2001.
 Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
c:\asm\source\hello.z80 line 0007: unrecognized instruction.          (B_CALL(_C
LRLCDFULL))
c:\asm\source\hello.z80 line 0011: unrecognized instruction.          (B_CALL(_P
UTS))
c:\asm\source\hello.z80 line 0012: unrecognized instruction.          (B_CALL(_N
EWLINE))
tasm: pass 2 complete.
tasm: Number of errors = 3
==== Errors!!! ====
==== Done ====

C:\asm\tasm>p


:s arg.

Although, thanks to 28 Days, I know how to make a batch file! (Seeing as the one supplied is minimal, I had fun learning to make my own--not that I used my own for the above...)

"Erm, don't give up on assembly. " -- Don't worry. Never had.
"The C compiler is extremely inefficient no jokes." Really? In this modern day of optimizing compilers? Oi. I'm too used to GCC's ingeniousness.


Last edited by Guest on 24 Aug 2008 04:12:15 am; edited 1 time in total
Back to top
Spencer


Advanced Newbie


Joined: 06 Nov 2005
Posts: 99

Posted: 24 Aug 2008 04:53:09 am    Post subject:

Add this to the top of hello.z80
Code:
#define b_call(zz) bcall(zz)
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 24 Aug 2008 09:02:21 am    Post subject:

Don't use C because the publicly available ones for z80 are just not that good. Although iirc, I think the Ti-OS (at least the math portions) was written in C. Still, anything graphical will need the speed and efficiency of ASM. besides, ASM is more fun! though w/o syntax highlighting, it's painful to look at. Has anyone suggested Notepad++ or crimson editor?
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 24 Aug 2008 12:26:27 pm    Post subject:

Z88dk is a free source compiler. They aren't spending as much time on it as if they were getting payed.

Try Spencer's suggestion. It might work.


Oh yea, it took me about 6 months to make the assembler work. Razz
Back to top
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 25 Aug 2008 01:33:40 am    Post subject:

Six months? I'm going to be starting school this week, so I was hoping to be able to convert my, for example, quadratic formula program by then... Also, seeing as I ask for help when needed, I'm hoping I don't keep this thread going for six month!

Anyway, Spencer was right and after some more trouble with the include file, I got this:

Code:
C:\asm\tasm>compile helloz
==== Now assembling helloz.z80 for the TI-83 Plus ====
TASM Z80 Assembler.       Version 3.2 September, 2001.
 Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
c:\asm\source\helloz.z80 line 0006: Label not found: (ProgStart)
c:\asm\source\helloz.z80 line 0013: Unused data in MS byte of argument. (2)
tasm: pass 2 complete.
tasm: Number of errors = 2

Decpac8x v1.0 - Converts bin to TI-83 8xp
Syntax: devpac8x <binfile> (no extension)
   Coded by Hannes Edfelt aka movax (1998) movax@algonet.se
   Updated by Scott Dial aka wrath (2000) wrath@calc.org
   Once again, greetings to everyone on the TI-83(+) asm scene

File too large! Binary file may not be larger than bytes.
==== Job finished. Program saved as helloz.8xp ====
==== Done ====

C:\asm\tasm>


That's with the default Hello World in 28 Days. Recognizing the problem, I changed my source file:


Code:
.nolist
#include "ti83plus.inc"
#define b_call(zz) bcall(zz)
.list

; ERROR HERE: .org    ProgStart - 2

ProgStart:
    .db    t2ByteTok, tAsmCmp
    b_call(_ClrLCDFull)
    ld    hl, 0
    ld    (PenCol), hl
    ld    hl, msg
    b_call(_PutS)          ; Display the text
    b_call(_NewLine)
    ret

msg:
    .db "Hello world!", 0
.end
.end


What SHOULD ".org ProgStart - 2" have done, that was so easily replaced by a simple label? And what's with the TWO .ends? (Maybe I'll learn that one later.)

Also, going along with the six months plan, trying to run any programs on PIT says my programs are the wrong whatever. Wabbit lets them run, but gives an error, which it won't let me goto. But, when I quit, I see this:
Cool

It appears that TI assembly's pension for not working right is wholesome and what keeps our universe in balance.

EDIT

I figured I'd read ahead in 28 Days, even if I couldn't really do anything, and it says I need to use the ASM command in the catologue, which Wabbit doesn't seem to have--must have the wrong ROM and I don't have the link cable yet... Well, despite the hate of the Flash Debugger, it worked:

Well, sort of. At least it's a result! Wink Now, I just wish I knew why.


Last edited by Guest on 25 Aug 2008 02:06:02 am; edited 1 time in total
Back to top
asdf


Advanced Newbie


Joined: 17 Aug 2008
Posts: 73

Posted: 25 Aug 2008 02:23:17 am    Post subject:

Heh.. try adding the following at the top of your file (or, better, in ti83plus.inc, though only add it in one place! So if you add it at the top of your program, don't also add it into ti83plus.inc):
ProgStart .equ $9D95

That is for the 83+. The .org instruction tells the assembler what the beginning address of the program will be, and uses it to find the correct offset when you use labels, so you don't have to manually count out the exact address you want to jump to, load, or whatever.

EDIT: And to clarify, your program will be loaded into the RAM location $9D95, and the -2 is to account for the AsmPrgm token (which is two bytes) that is at the head of your program, but is not loaded as executable code into $9D95. This location is different on other calculators; for example, programs for the TI 83 are loaded into RAM location $9327. However, it is the same for all 83+/84+ series calculators.


Last edited by Guest on 25 Aug 2008 02:32:38 am; edited 1 time in total
Back to top
SplinterOfChaos


Newbie


Joined: 27 Sep 2007
Posts: 12

Posted: 25 Aug 2008 03:15:28 pm    Post subject:

And there we have it. I am programming in assembly. Thank you, everyone who offered help. The only thing I want help with understanding now is why the calc knows the program's an assembly one (I'm betting this is why I can't edit it) why can't it be smart enough to imply asm( ?
Back to top
TheStorm


Calc Guru


Joined: 17 Apr 2007
Posts: 1233

Posted: 25 Aug 2008 03:44:15 pm    Post subject:

The asmprog token at the start of the program is how it knows that its asm as to why it needs the asm( token you'd have to ask ti on that one.
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 25 Aug 2008 05:23:54 pm    Post subject:

SplinterOfChaos wrote:
And what's with the TWO .ends? (Maybe I'll learn that one later).
Quite a boring answer, really. Each command in the source file has to end with a newline sequence. A single .end followed by a newline will work fine, but if you end the file with just .end and no newline then TASM ignores that line and complains about a missing .end. Having two .end directives is the easiest way around this problem.

Historically, at least, text files were expected to end with a newline character. Some other operating systems, notably CP/M, didn't support exact file sizes (all CP/M files are multiples of 128 bytes in size) so if you open a CP/M file in Windows you'll see an ASCII SUB (Ctrl+Z) at the end of the file followed by junk (sometimes padded to the end with SUBs, sometimes whatever was in memory at the time).

I'm going out on a limb here, but as DOS inherited a lot of CP/M's traits I'd be willing to guess that's why SUB (Ctrl+Z) indicates end-of-transmission (try copy con test.txt on the command line - Ctrl+Z ends entry) instead of the usual EOT (Ctrl+D) as on Unix-based systems.

In a roundabout manner, therefore, even "plain" text files aren't really all that plain, and special care is required to placate some software.
Back to top
fourchanb


Advanced Newbie


Joined: 24 Sep 2006
Posts: 93

Posted: 26 Aug 2008 07:22:15 am    Post subject:

benryves wrote:
SplinterOfChaos wrote:
And what's with the TWO .ends? (Maybe I'll learn that one later).
Quite a boring answer, really. Each command in the source file has to end with a newline sequence. A single .end followed by a newline will work fine, but if you end the file with just .end and no newline then TASM ignores that line and complains about a missing .end. Having two .end directives is the easiest way around this problem.

Historically, at least, text files were expected to end with a newline character. Some other operating systems, notably CP/M, didn't support exact file sizes (all CP/M files are multiples of 128 bytes in size) so if you open a CP/M file in Windows you'll see an ASCII SUB (Ctrl+Z) at the end of the file followed by junk (sometimes padded to the end with SUBs, sometimes whatever was in memory at the time).

I'm going out on a limb here, but as DOS inherited a lot of CP/M's traits I'd be willing to guess that's why SUB (Ctrl+Z) indicates end-of-transmission (try copy con test.txt on the command line - Ctrl+Z ends entry) instead of the usual EOT (Ctrl+D) as on Unix-based systems.

In a roundabout manner, therefore, even "plain" text files aren't really all that plain, and special care is required to placate some software.
[post="126373"]<{POST_SNAPBACK}>[/post]
Thanks for that explanation ben. I always knew TASM ignores the last line (it caused a lot of strange bugs in include files for me) but I never knew why!
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement