Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 83 users online: 6 members, 52 guests and 25 bots. Members: Ashbad, flyingfisch. Bots: Magpie Crawler (3), VoilaBot (2), Googlebot (6), Googlebot (13), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 11 Nov 2011 11:36:42 pm Post subject: Rascherite's z80 ASM Question Thread |
|
|
Hey everybody,
On Kerm's advice, I decided to post a thread here where I can ask this very knowledgeable community a few random questions about z80. I hope I'm not being rude...
well, anyways, I'm trying to debug this particular snippet of code, and it seems that I can't jump exactly where I want to, when I want to:
Code:
ld a, 15 ;set curcol and currow
ld (CurCol), a
ld a, 4
ld (CurRow), a
ld hl, (AppBackUpScreen+5) ;loads 3 into hl register
while:
ld a, 'u' ;loads 'u' char for printing
push hl ;preserve hl
b_call(_PutC) ;print 'u' char
pop hl
ld a, 15 ;load 15 into curcol,( currow should be auto-incremented by _PutC)
ld (CurCol), a
dec hl ;see if we are ready to leave this while loop
jr nz, while
jp waitkey ;if no jump to while, go back to the getkey loop
I've stepped through this loop several times with wabbitemu and even if the hl register is 0 after the dec hl instruction, the
jr nz, while still jumps to the while label, even though the zero flag should clearly be set. Is the zero flag not triggered by 16 bit registers?
(this snippet should print 3 u's on the far right side of the screen)
Thanks for any help =) |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 11 Nov 2011 11:43:13 pm Post subject: |
|
|
I don't think the zero flag is affected by 16bit Inc/dec, you can verify this in WabbitEmu's debugger.
Meh, ninja'd. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 11 Nov 2011 11:44:40 pm Post subject: |
|
|
Thank you for the information, kind sirs =) In the 28 days tut McLaughlin never really specified whether or not the 16-bit registers affect the flags.
Kerm: where can I find the z80 family cpu user manual online?
souvik1997: ninja'd you may have been, I still appreciate your help =) |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 11 Nov 2011 11:49:01 pm Post subject: |
|
|
| awesome! thank you!! |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 12 Nov 2011 12:17:43 am Post subject: |
|
|
Great advice Kerm. The only reason I'm not is because I usually only work with 4 or 5 variables in one program because my beginning programs are so tiny, but that's not a good excuse at all. Just because I'm making small programs doesn't mean that I can have poor programming practices. _________________ "If you don't live it, it won't come out of your horn."
-Charlie Parker
TI BASIC Sudoku - optimizing random puzzle generator, making number of preset squares more even and reliable
asm metronome - trying to figure out how to dougie with the interrupts |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
Posted: 12 Nov 2011 12:20:36 am Post subject: |
|
|
| Rascherite wrote: | | Great advice Kerm. The only reason I'm not is because I usually only work with 4 or 5 variables in one program because my beginning programs are so tiny, but that's not a good excuse at all. Just because I'm making small programs doesn't mean that I can have poor programming practices. | You anticipated my objection perfectly and answered it yourself; I continue to be impressed. That's exactly right: the sooner you start setting good programming practices, no matter how trivial the program, the more likely you'll be to succeed in keeping your bigger projects sane and organized. _________________
 |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 12 Nov 2011 08:49:27 am Post subject: |
|
|
If your code does this to some effect:
Code:
while:
ld a, 15
ld (CurCol), a
ld a, 7
ld (CurRow), a
ld a, 'x'
b_call(_PutC)
jr while
Then the character you try to display will sometimes display one character space above where it is supposed to. Why? Is it because _PutC automatically increments (CurCol) and (CurRow) after it writes the character?? Is there any way to prevent this? |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 23 Nov 2011 11:28:08 am Post subject: |
|
|
wabbitemu question about breakpoints. (Not sure if this is the right board. Feel free to move it if need be)
I'm trying to debug a program in wabbitemu, and I was under the impression that the
Code: .org $9d93
at the beginning of each program caused the program to be loaded into memory at the address $9d95 when it is executed.
Understandably, before the program is executed, the memory address $9d95 is filled with nops (I think I know why this is, but can someone explain?), so I just stick a breakpoint at the address $9d95 (and sometimes at the next 2 instructions just to be safe), thinking that the program will be loaded into memory at $9d95 and as soon as it starts executing, it will encounter the breakpoint, however, the breakpoints are totally ignored.
IS this an issue with wabbitemu, or am I wrong about where the program is loaded into memory at execution time? |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
Posted: 23 Nov 2011 11:44:52 am Post subject: |
|
|
I'm assuming that you're running your ASM programs from Doors CS in this case. If so, you should know that it (and similar shells) (and the TI-OS) all start executing programs at $9D95. However, I've found that Wabbitemu gets unhappy if you set a breakpoint at a particular address and the breakpoint gets passed with a different instruction at that address. You could try PindurTI, and I would also post a bug report in the WabbitEmu thread here on Cemetech to see if Buckeye has any ideas. _________________
 |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 23 Nov 2011 12:19:46 pm Post subject: |
|
|
| KermMartian wrote: | | I'm assuming that you're running your ASM programs from Doors CS in this case. If so, you should know that it (and similar shells) (and the TI-OS) all start executing programs at $9D95. |
I am not using a shell. Like I said, I like reinventing the wheel. Before I use a shell in my asm adventures, I want to understand the inner workings of most of the shell's routines. Gives me more practice and makes me more knowledgeable.
That's beside the point however, because, of course, I'm using ti-os, so it all ends up at $9D95 anyways
| KermMartian wrote: | | However, I've found that Wabbitemu gets unhappy if you set a breakpoint at a particular address and the breakpoint gets passed with a different instruction at that address. |
sooo... could I just jenk it up and write the first instruction of my source code directly into the ram at $9D95 before setting a breakpoint?
e.g., the first instruction of my source code is:
Code: ld hl, $001F
so could I just use wabbit's memory editor to put
$211F00
at $9D95, thus making the instructions there the same as my code before I run the program, and set the breakpoint and then run the program? That way, the breakpoint gets passed with the same instruction at the same address.
EDIT: This method actually works (albeit with a success rate of about 50%). It's just a pain to look up the opcodes and wabbitemu randomly decides whether to crash or not. Sometimes it does, sometimes it doesn't. Looking for patterns as to when it crashes and when it doesn't.
| KermMartian wrote: | | You could try PindurTI |
I've tried almost every emulator out there, and wabbit was the only one that worked on my computer. Pindurti just showed up as a blue box. Am I doing something wrong?
Last edited by Rascherite on 23 Nov 2011 12:33:11 pm; edited 2 times in total |
|
| Back to top |
|
|
Iambian
New Member

Joined: 31 Jul 2010 Posts: 90
|
Posted: 23 Nov 2011 12:23:24 pm Post subject: |
|
|
| Rascherite wrote: |
[...]
| KermMartian wrote: | | You could try PindurTI |
I've tried almost every emulator out there, and wabbit was the only one that worked on my computer. Pindurti just showed up as a blue box. Am I doing something wrong? |
You need to drag and drop the ROM image into the blue box before it will show up with anything. |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 23 Nov 2011 12:24:39 pm Post subject: |
|
|
Thanks a million, Iambian. It would be nice if the blue box had a "drag and drop ram here" watermark or something  |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55729 Location: Earth, Sol, Milky Way
|
Posted: 23 Nov 2011 12:40:45 pm Post subject: |
|
|
[quote="Rascherite"]I've tried almost every emulator out there, and wabbit was the only one that worked on my computer. Pindurti just showed up as a blue box. Am I doing something wrong?] Well, it's actually four separate calculators. Just drag a ROM image from your calculator onto one of the four screens and it should start. Left-clicking on one of the four turns it on. _________________
 |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 23 Nov 2011 12:50:37 pm Post subject: |
|
|
| any type of skin for pindurti? |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 23 Nov 2011 12:54:45 pm Post subject: |
|
|
As far as I know, PindurTI relies exclusively on the keyboard to control the calculator. I could be wrong, though. This contains the PC key to calculator key mappings for your perusal. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
Rascherite

New Member

Joined: 09 Nov 2011 Posts: 93 Location: Under a heaping pile of saxophones
|
Posted: 23 Nov 2011 01:10:59 pm Post subject: |
|
|
can't say that I really fancy pindurti, I know this is a really noobish way of looking at it, but wabbit's fuller gui controls in the debugger make the learning curve shorter. How can I run the debugger while at the same time running the calculator? each time I open the debugger, the calc stops.
and thanks for the table, sovik. |
|
| Back to top |
|
|
|
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
|
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
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.041297 seconds.
|