Author Topic: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion  (Read 125875 times)

0 Members and 2 Guests are viewing this topic.

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: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #75 on: May 11, 2010, 06:44:10 pm »
The Nspire's z80 emulation isn't complete
And it isn't guaranteed it will ever be complete. I wouldn't even be surprised if in future TI-Nspire OS updates, it actually became worse.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #76 on: May 11, 2010, 08:05:49 pm »
I'm quite certain TI won't change the emulation. If they do, it will be, well, worse for us, as you said. But I doubt it will change. It will probably just be more inefficient if it does.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #77 on: May 11, 2010, 10:13:46 pm »
you don't see sph and spl.
Thanks for answering. :)
Are spl and sph the low and high bytes of sp?  Could these be used if I do enough stuff?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #78 on: May 11, 2010, 11:35:38 pm »
That's not something you would ever want to use unless you're seriously abusing the consequences of its normal use, which I only did once when I tried grayscale double buffering.  The sp register is the location of the stack.  If you change it, you will no longer be able to call or return from subroutines, push or pop variables, and some other nasty things.  Not to mention there's a lot of roundabout code you would have to use to even load stuff to or from it.
« Last Edit: May 11, 2010, 11:36:08 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #79 on: May 11, 2010, 11:44:07 pm »
that sounds bad x.x

Offline Hot_Dog

  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #80 on: May 12, 2010, 12:46:58 am »
It is bad  :o

For debugging purposes there are times I wished the Z80 had better methods of accessing the stack pointer

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #81 on: May 12, 2010, 09:12:59 pm »
Nah, it's not bad, it's just cumbersome, hard, and slow-ish (nothing's really slow in asm).  I think I'll use this method if I need yet another 8 bit register, but I probably will not. ;D
Thanks for the info! :D
« Last Edit: May 12, 2010, 09:13:12 pm by ztrumpet »

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #82 on: May 12, 2010, 09:30:18 pm »
If you run out of room, you just use some free ram location.  You have to save the current stack pointer somewhere anyway before you can use it, otherwise the calc will crash becasue it can never return back to the operating system.  If you're not taking advantage of the automated push/pop features that are inherent to the stack pointer, then just use a ram location becasue its smaller and faster in ever way.  Trust me, you'll NEVER use the sp register until you get into the really advanced tricks, and even then you're not using it to store numbers, you're using it as a fast way to read or write to ram.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #83 on: May 12, 2010, 09:37:51 pm »
Good point.  I think I'm not going to use sph and spl anywhere. :) Thanks for the tips! ;D

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #84 on: May 13, 2010, 02:38:16 pm »
I don't think being able to access the high/low bytes of SP directly is even possible. If you are going to be using SP like some "normal" register, you'd have to keep a few things in mind, some of which was already stated in this thread:
1. You need to save SP somewhere since it's usually important for the stability of the system. Use instructions like "LD (xxxx),SP" (where xxxx is an address) to save SP, and "LD SP,(xxxx)" to recall it again.
2. Interrupts need to be disabled while you're messing with SP. The instruction "DI" is great for that. Interrupts randomly make CALLs. See point # 4 as to why this is bad.
3. There are a few other instructions you can use to mess with SP or deal with it. That's where it starts getting cumbersome. Just let me know if you want to know, either in this thread or via PM.
4. The stack is no longer available (unless you're creating your own miniature stack for some reason). This means that you cannot use PUSH/POP without destroying whatever it is you're working on. Same goes for CALL/RET.

Now... with respect to IXh/IXl ; IYh/IYl. A simple way to remember where you can use them is... wherever using H or L is a valid option, you can use the combination above. Except when the instruction calls for the use of HL or IX/IY as well. As stated in an earlier part of the thread, none of these combinations will work on the Nspire since these uses are "unsupported" instructions. Also, the OS uses IY for its own purposes and expects that register to be the same when the program exits. So be sure to save IY as well. Or if you happen to know what's loaded to IY (it is some constant), load that value instead (saves time).

And as stated (somewhere) above, only use these combinations if you absolutely know what you're doing. Their use is more like a last resort than anything else.
« Last Edit: May 13, 2010, 02:41:14 pm by Iambian »
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline Hot_Dog

  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #85 on: May 13, 2010, 02:43:05 pm »
Lol, ztrumpet, you're getting too far ahead of yourself.

ASM Gorillas will probably use ix and MAYBE iy, but not ixh ixl iyh iyl, and certainly not SP directly.  I'm leaving some of that stuff (including interrupts) for people who want to read ASM in 28 days for more info.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #86 on: May 13, 2010, 04:12:09 pm »
Yeah, when I said you never see sph and spl, I meant that literally. You cannot access the individual bytes.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #87 on: May 13, 2010, 05:25:31 pm »
Lol, ztrumpet, you're getting too far ahead of yourself.
Lol, I know.  It's fun to learn, right.  In fact, I thought of everything in Iambian's post except for #3.

It's basically impossible, then, right.  Still, it's fun to know that I can almost understand what Asm might be able to do. :)
Thanks for this!  I'm learning a lot just about how to approach problems!  ;D

Offline Hot_Dog

  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #88 on: May 13, 2010, 06:53:34 pm »
*DRUM ROLL*

Lesson 9 is up in all three formats.  Also, lesson 8 .html is up.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Hot Dog's TI-83+ Z80 ASM for the Absolute Beginner--Discussion
« Reply #89 on: May 13, 2010, 08:11:31 pm »
in lesson 9, i noticed that in your first example using _PutS, you left out the underscore.
Hurray for typos...
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.