I've just started trying to learn Z80 Assembly today so I can make assembly programs for my TI-84PSE, but I have yet to get a functioning program that I can work with. After many attempts at getting a working assembler, I settled with using Latenite and Wabbitemu to debug.

I found the follow code on this board and pasted it into my Program.asm file which was generated with the project:


Code:
; ===============================================================
; Hello World
; ===============================================================

.nolist
   #include "ti83plus.inc"
.list

Main:
   b_call(_ClrLCDFull)
   b_call(_HomeUp)
   ld hl,Hello
   b_call(_PutS)
   b_call(_NewLine)
   ret
Hello:
   .db "Hello, world.",0
.end
.end


I had to change a few things in the Header.asm file (also generated with the project) to get it to build (specifically I had to change "Program.Main" to "Main") and put ti83plus.inc into the include directory (is using this file necessary? it builds either way). I open the file in Wabbitemu and run it with Asm(), but nothing happens. It just says "Done". What is the problem here? Sorry about the simple question, but there isn't exactly a vast amount of updated Z80 resources online Sad
I don't know how Latenight works, i just use spasm. You can find spasm here: http://wabbit.codeplex.com/

With spasm you can create a .bat file with "spasm Program.asm Program.8xp" and it will assemble your .asm file into a .8xp file. You could even add a line that loads Wabbitemu and sends Program.8xp so that you can immediately test your program. It sounds like the file that's getting assembled is either the wrong file or assembling incorrectly. I'm not sure why you'd need a Header.asm file, generally you just assemble the main file (here Program.asm) which will contain #includes pointing to other files it needs (like ti83plus.inc), but i don't see any reference to Header.asm in your code...

There's also an IDE that's part of WabbitStudio that is really nice, though it's a bit buggy.
Alternatively, I use the Doors CS 7 SDK, in which you simply "compile program" or "compile.bat program". If you want some more suggestions for emulators, IDEs, editors, etc, check out this topic:
Getting Started Programming z80 Assembly

Anyway, I suspect the problem with your program is two lines missing at the beginning. One tells your calculator that this is an ASM program, and the other tells your assembler what address your calculator will put the program at:


Code:
; ===============================================================
; Hello World
; ===============================================================

.nolist
   #include "ti83plus.inc"
.list

  .org $9D95-2
  .db $BB,6D
Main:
   b_call(_ClrLCDFull)
   ...etc...
Ah, true, i missed that. But it should give an error in that case when run from the homescreen and if run should spit some gibberish text, whatever HL points to, probably somewhere around $0013.

Yeah, on the 83/4+/SE (but not the regular TI-83), all assembly programs are copied to the memory address $9D95 (that's the hex address). People commonly write .org (this sets the starting address of your program, really only used for labels) $9D93 (or .org $9D95-2) because immediately after you have .db $BB,$6D. This puts two bytes at the start of your program that equate to the AsmPrgm token. If you put the AsmPrgm token into a program on-calc you'll see that it does indeed take up two bytes. That's why we use .org $9D93, because the first byte of actual code of your program should start at $9D95. Another option would be to reverse them:
.db $BB,$6D
.org $9D95
This way you don't need to subtract two.

I've never used the DoorsCS SDK, check it out and see how you like it. Really, the hardest part about assembly is getting your first program to assemble correctly (or at least that's how it used to be "back in the day" Razz).
chickendude wrote:
Ah, true, i missed that. But it should give an error in that case when run from the homescreen and if run should spit some gibberish text, whatever HL points to, probably somewhere around $0013.
I'm pretty sure the OS will refuse to run programs that don't start with those two bytes, although I always thought it would trigger an ERR:INVALID.

Quote:
I've never used the DoorsCS SDK, check it out and see how you like it. Really, the hardest part about assembly is getting your first program to assemble correctly (or at least that's how it used to be "back in the day" Razz).
I promote it because it was designed to be easy to use: (1) unzip (2) assemble programs. I spent far too long trying to find things that worked across different platforms when I started ASM, so I wanted to build something that worked on 32 and 64-bit Windows, Linux, and Mac OS. Smile
chickendude:

Ok, I'll check out Spasm. I was annoyed by the fact that Latenite offers PindurTI as the emulator, and PindurTI does not supported the TI-84+ SE! Quickly looking at the link you provided there appears to be some nice documentation.

KermMartain:

I think the reason that the program does not crash is according to a topic I had read on here (I can't seem to find the link in my history, sorry!) Latenite adds those two lines automatically. I had originally had them, but removing them showed no visible change in the programs behavior.

Additionally, I will check out the the Doors CS 7 SDK and the link you provided. Thank you Smile

Update: So I've downloaded SPASM, and adding the two lines you guys mentioned, was able to compile the program and get it to run on Wabbitemu. Thanks for the help, I've even whipped up a quick batch script to test my programs super quickly Smile
Great, Smoth! I hope you'll stick around and ask any more technical ASM-programming questions that you might have. Good luck in your endeavors!
Another thing you can try for super-quick testing is using a calculator save-state. I don't know if WabbitEmu supports macros or not, if not it's not a huge deal. Essentially, what you do is make a save state of your calculator with Asm(prgmNAME typed into the homescreen. Then you can just press enter when your batch file loads up WabbitEmu without having to search Catalog for the Asm( token and going through the programs list. If you use something like DoorsCS's or zStart's run from homescreen feature, you won't even need the Asm( token and can quickly and easily test shell (ie not nostub) programs, too! Really, i can't believe how easy it's become to test and debug programs. I still remember sending things through the Graphlink cable trying to test if my code worked or not, at least until i found VTI (and even then, i remember releasing "VTI" versions and on-calc versions) Very Happy
  
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