Author Topic: Random Questions  (Read 15381 times)

0 Members and 1 Guest are viewing this topic.

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: Random Questions
« Reply #15 on: July 28, 2016, 05:11:31 pm »
If you don't particularly care about the state of regis
I'm kinda embarrassed but I can't figure out how to reset z
I've tried:
res  z
res  z,0
res  f,(somenumber)

And Spasm errored each time.
What am I doing wrong?

Is there a list of commands and BCALLs with what they affect? That would be really nice when programming.

Flags don't (re)set that way. They're often used to indicate additional effects of a prior operation (such as the particulars of an ADD or SUB operation, or a rotate/shift) but only the carry flag gets special treatment with "scf" and "ccf" instructions.

So in short, no there's no way to directly (and efficiently!) manipulate any flag other than the carry flag. To answer your question, however...

If you don't particularly care about efficiency, you can set the flags register to whatever you want by directly "loading" to it. This destroys all flags, register A, and whatever high byte of a pair you want to push. This uses 21+7 ccs at minimum on a z80:
Code: [Select]
ld c,%01000000 ;sets bits to load to the flags register
push bc
pop af
You can take a look at this page to learn the bit positions of the other flags in case you want to modify them too.

Now... if you don't particularly care about the contents of register A or the other flags you can do this to reset z:
Code: [Select]
SCF      ;Set carry flag
SBC A,A  ;A-A-1 = $FF. NZ.
Or the following code to set it:
Code: [Select]
OR A     ;Reset carry flag
SBC A,A  ;A-A-0 = $00. Z
Both of the above solutions use 8 ccs on a z80.

As a note (and important if you're exploring other ways to try to mess with just Z), typical shift/rotate instructions (RLC C, RR L, SRL A) will affect Z like you'd think, but their more efficient single-byte version for register A (RLA, RRA, RLCA, etc.) does NOT. Had to learn that the hard way

EDIT: I lied. The bit that started with SCF was to reset, and the one with OR A was to set (post changed to reflect that). Heh. I confuse my thoughts and wording despite the comments themselves being correct.
« Last Edit: July 28, 2016, 07:41:49 pm by Iambian »
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Random Questions
« Reply #16 on: July 28, 2016, 06:24:32 pm »
thanks!
Again with the command list thing... I don't actually know what SBC does...
I'm just using the 83plus in 28 days to learn. Is there any better way?
I'm still around... kind of.

Offline c4ooo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 252
  • Rating: +10/-1
  • The impossible chemical compound.
    • View Profile
Re: Random Questions
« Reply #17 on: August 03, 2016, 02:42:05 am »
Here is a good list of instructions: http://clrhome.org/table/ :)
(As well as what they do, how many memory they take up, how long they take to execute, and more :P )
-German Kuznetsov
The impossible chemical compound.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Random Questions
« Reply #18 on: August 08, 2016, 11:22:34 am »
Thanks!
Is there any way to combine two files that fit in ram individually, but together can't? I have 2 very large text files, and can't find a way to combine them.
I'm still around... kind of.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Random Questions
« Reply #19 on: August 12, 2016, 09:47:10 am »
Thanks!
Is there any way to combine two files that fit in ram individually, but together can't? I have 2 very large text files, and can't find a way to combine them.

You can combine them with a computer-side editor, as you don't have a RAM limitation there. The only limitation you'll still have is that it has to fit in a ROM sector, which means it can be at most about 65500 bytes.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Random Questions
« Reply #20 on: August 12, 2016, 05:46:30 pm »
Awesome, this would be useful (I was making an on-calc version of the Axe command list) if I hadn't broke my calc.
Here is what I have done:
After a crash I decided to reinstall my 84's OS since it wouldn't get past the ram cleared screen.
Now it will install the OS but fail the validation after 3 seconds and ask for it to be reinstalled again.
I've tried XXX times...
I have unsigned installed, and can't get past the "Waiting... Please install operating system now."

I have used the mode key on the install screen to erase all flash  - many times.
I have tried reinstalling ti connect.
I have replaced all the batteries. (including the backup)
And each time it does exactly the same thing: Successfully transfer the os, validate, then error and go back to waiting for an OS.
Any suggestions? (it has been a day now and no luck)
I'm still around... kind of.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Random Questions
« Reply #21 on: August 12, 2016, 05:53:22 pm »
Perhaps the boot code flash test may help by either revealing a problem or magically fixing one? Also, have you tried sending other OS files, even different versions? Perhaps the one you have is somehow invalid?

Beyond that, I'd wait a bit for the replies of those more knowledgeable about the boot code and hardware, but you may be approaching panic level 6.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Random Questions
« Reply #22 on: August 12, 2016, 05:56:20 pm »
Ill try that...
I've had the calc for 3 years. No hope of returning it.
Edit: which one? I've already used ON+mode to clear flash.



Update: Fixed it!
It turns out that instead of sending 2.55MP I was actually sending 2.22. No idea where that came from.
It worked fine with 2.55. I have a copy of 2.22 if anyone wants it. (PM me)
Thanks for all your help!



I have been working on an Axiom that emulates the assembly stack (letting the user pop and push 2 byte variables) but it doesn't seem to work. I've looked it over many times and can't seem to figure out what's wrong. (Y6t acts as (sp)) The command's arguments need a location (ex. Pop (angle)A). Is there a way to have the angle sign inserted automatically?
Spoiler For Spoiler:
#include "includes\ti83plus.inc"
#include "includes\Axe.inc"
#include "includes\tokenhook.inc"
stk   .EQU   AXV_Y6t
   .dw $C0DE
;Push:
   .dw    PushEnd
   .db    AXM_ALL
   .dw    tFMax
   .db    AXM_SUB
   .db    1
   .org    0   
   ld   e,(hl)
   inc    hl
   ld   d,(hl)
   ld    hl,(stk)
   ld    (hl),e
   inc    hl
   ld    (hl),d
   inc    hl
   ld    (stk),hl
   ret
PushEnd:

;Pop:
   .dw    PopEnd
   .db    AXM_ALL
   .dw    tFMin
   .db    AXM_SUB
   .db    1
   .org    0
   push    hl
   ld    hl,(stk)
   dec    hl
   ld    d,(hl)
   dec    hl
   ld    e,(hl)
   ld    (stk),hl
   pop   hl
   ld   (hl),e
   inc   hl
   ld   (hl),d
   ret
PopEnd:
   .dw    0
   .dw    hFMin
   .db    4,"Pop "
   .dw    hFMax
   .db    5,"Push "
Thanks for any help!
Edit: I fixed it. The value of the tokens in the Inc were different than the calc`s...



Is there any way to automatically insert the location sign to an argument in an axiom.
Right now my commands need to be called: COMMAND(oVAR), But I would like to just call them :COMMAND(VAR)
I assume this is possible because commands like the for loop uses a variable instead of a location.

Edit (Eeems): Merging quadruple post
« Last Edit: August 15, 2016, 02:59:24 pm by Eeems »
I'm still around... kind of.