Author Topic: Some general Questions  (Read 12562 times)

0 Members and 1 Guest are viewing this topic.

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Some general Questions
« on: October 31, 2010, 06:32:48 am »
I thought I could learn Asm by disassembling single Axe Parser compiled commands,
but this idea was fail.  :-\ I read some tutorials and source codes, but there are still some issues:
1) How let I run my prog under 15Mhz processor speed?
2) How to randomize a word, like Axe Parser's rand^x?
3) I want to include Joe Wingbermuehles's fastcopy routine into my code, but I'm not sure what 'gbuf' has to be. I think it must be a constant pointed to the start of the Buffer, if yes, which adress is it on a TI84+? I dont use ion.inc, since this means to be unable to use ti83plus.inc at the same time.
Thats all for now. Thanks in advance!
Regards,
Aichi
« Last Edit: October 31, 2010, 09:31:30 am by Aichi »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Some general Questions
« Reply #1 on: October 31, 2010, 10:35:33 am »
1) Programs run at 6 MHz by default, and to start executing at 15 MHz, load 1 to A (it's 1 for 15 MHz and 0 for 6 MHz) and do a b_call(setExSpeed). The b_call doesn't exist on OS versions before 1.13, so you should check for that first:

Code: (TI-ASM) [Select]
    b_call(getBaseVer) ; OS version in A and B
    cp  2 ; test A for OS version > v2.00
    jr  nc,fast ; it's > v2.00, so it's good
    cp  1 ; test A for OS version > v1.00
    jr  nz,slow ; if not, quit
    ld  A,B ; test decimal in OS version
    cp  13 ; test if it's v1.13 or above
    jr  c,slow ; it's > v1.13, so it's good
fast:
    ld  A,1
    b_call(setExSpeed)
    ... ; continue with the program at 15 MHz
slow:
    ... ; continue with the program at 6 MHz

TI's official guide is at https://docs.google.com/viewer?url=http://education.ti.com/downloads/guidebooks/sdk/83p/ti83pseadn.pdf.

2) Well, there's no built-in rand thing, but you can use the memory refresh register R, which basically goes up every time "something happens", so it's pretty much random. It's a byte between 0 and 255.

I think Ion has a random integer function. Not sure how it works, though.
« Last Edit: October 31, 2010, 10:36:43 am by Deep Thought »




Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Some general Questions
« Reply #2 on: October 31, 2010, 12:43:42 pm »
1) Thank you! :)
2) Ok, I found a nice routine by Joe Wingbermuehle.
3) Perhaps gbuf is the same as the system pointer 'plotsscreen'.

4) http://wikiti.brandonw.net/index.php?title=Z80_Routines:Graphic:put8x8sprite I tried to copy the first routine into Mimas, but it seems like Mimas cannot handle the line LD  D, (IX) ôo. Does anyone know what the problem is?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Some general Questions
« Reply #3 on: October 31, 2010, 05:23:29 pm »
Oh, by the way:

3) Yes, they're the same. In ion.inc there's a line that says

Code: (TASM equate) [Select]
gbuf =plotsscreen




Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: Some general Questions
« Reply #4 on: October 31, 2010, 07:16:07 pm »
Easier than calling SetExSpeed, you can set the speed yourself:
Code: [Select]
 in a, (2)
  add a, a  ; check if on a TI-83+ BE
  jr nc, is_a_ti83p
  ld a, 1
  out (20h), a
is_a_ti83p:

or use MichaelV's method, which works because port 20h is the same as 0 on the 83+ BE (so this also resets the link port):
Code: [Select]
 in a, (2)
  rlca
  and 1
  out (20h), a

But if you're writing an Ion/MirageOS program, you need to be sure to set the speed back to 6 MHz (write zero to port 20h) before exiting, since otherwise the shell and other programs won't work correctly.  In particular, depending on the shell, the ionFastCopy routine may not work correctly at 15 MHz.

Oh, and:
4) http://wikiti.brandonw.net/index.php?title=Z80_Routines:Graphic:put8x8sprite I tried to copy the first routine into Mimas, but it seems like Mimas cannot handle the line LD  D, (IX) ôo. Does anyone know what the problem is?
Yeah, that's a known issue with Mimas.  You have to write "LD D, (IX+0)" instead.
« Last Edit: October 31, 2010, 07:20:22 pm by FloppusMaximus »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Some general Questions
« Reply #5 on: October 31, 2010, 07:19:00 pm »
The second one's the one Axe uses. Don't know how it works, though :(




Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: Some general Questions
« Reply #6 on: October 31, 2010, 07:23:41 pm »
Well, bit 7 of port 2 is zero on an 83+ BE, whereas it's one on an SE or 84+.  So after the 'and', A is 0 on an 83+ BE, or 1 on a newer model.  As I said, port 20h on an 83+ BE is the same as port 0, so writing 0 to port 20h resets the link port.  Whereas on an SE, writing 1 to port 20h sets 15 MHz mode.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Some general Questions
« Reply #7 on: October 31, 2010, 07:46:07 pm »
Oh, I see, thanks.




Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Some general Questions
« Reply #8 on: November 01, 2010, 12:25:44 pm »
Yeah, that's a known issue with Mimas.  You have to write "LD D, (IX+0)" instead.
Ah, thanks. I should develope on PC while Mimas' early Alpha phase.

5) How compare I the HL register by using something like CP?
« Last Edit: November 01, 2010, 12:29:03 pm by Aichi »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Some general Questions
« Reply #9 on: November 01, 2010, 01:34:16 pm »
Yeah, that's a known issue with Mimas.  You have to write "LD D, (IX+0)" instead.
Ah, thanks. I should develope on PC while Mimas' early Alpha phase.

5) How compare I the HL register by using something like CP?

This seems like the logical method to me:

Code: [Select]
or a
push hl
sbc hl,reg16
pop hl

EDIT: Don't do that, do this
« Last Edit: November 01, 2010, 10:48:59 pm by Runer112 »

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Some general Questions
« Reply #10 on: November 01, 2010, 02:11:25 pm »
And here is the best one: (I think by calc84?)
Code: [Select]
or a
sbc hl, de
add hl, de

The flags are affected exactly the same way as cp.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Some general Questions
« Reply #11 on: November 01, 2010, 08:37:51 pm »
That is indeed the method reported by WikiTI ;D
Sometimes the "logical" method isn't the best :P
"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 Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Some general Questions
« Reply #12 on: November 01, 2010, 09:12:51 pm »
And here is the best one: (I think by calc84?)
Code: [Select]
or a
sbc hl, de
add hl, de

The flags are affected exactly the same way as cp.

I debated posting that, but that addition will leave some flags (s, z, and n) with incorrect values.
« Last Edit: November 01, 2010, 09:16:07 pm by Runer112 »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Some general Questions
« Reply #13 on: November 01, 2010, 09:19:01 pm »
n is unimportant, and I'm not sure it's affected by 16-bit additions/subtractions.
As for s and z, I do agree that they are changed, but that's unimportant if you're dealing with c (and p, I believe)
It's better in some cases, I guess. ;D
"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 thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Some general Questions
« Reply #14 on: November 01, 2010, 09:55:44 pm »
Straight from the zilog manual for add hl, <register>:

Quote
Condition Bits Affected:
S is not affected
Z is not affected
H is set if carry out of bit 11; reset otherwise
P/V is not affected
N is reset
C is set if carry from bit 15; reset otherwise

To be honest, I actually forgot that S and Z were ignored. I bet somewhere in one of my programs I did that wrong.
« Last Edit: November 01, 2010, 09:56:23 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112