Author Topic: Something is wrong...  (Read 7623 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Something is wrong...
« on: November 13, 2010, 12:11:04 pm »
In my latest program I am having a problem with this code:
Code: [Select]
Call ConvRStr        ;Converts a decimal string into hex and stores it to BC
ld a,c
ld (curRow),a
Call ConvRStr
ld a,c
ld (curCol),a
ret
ConvRStr converts a string of decimal digits into hex in BC. So "123" would make BC=7Bh. ConvRStr works properly, but the code isn't setting the cursor position correctly. Any ideas why?


EDIT: Okay, never mind. I have no idea why, but I decided to add the code to actually display text and it worked. I am still confused about why it didn't work before, but it works now. My problem is fixed now.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Something is wrong...
« Reply #1 on: November 14, 2010, 11:11:08 am »
We probably should figure out why it wasn't working ;) (Mainly so that it doesn't happen again.)
How does ConvRStr take its arguments? Does it take a pointer in hl to a series of characters, or something different?
From how you are using it, it looks like it does. It also seems to advance hl, so you could have something like .db "64",0,"39",0 and convert two strings to hex. (Technically they aren't being converted to hex, but I can't think of a better description.)
Your problem might be that you're using curRow and curCol (for the homescreen) when you should be using penRow and penCol (for the graphscreen).
Anything I missed or got incorrect? ;D (Your code is pretty vague, so I had to assume a lot.)
"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 Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Something is wrong...
« Reply #2 on: November 14, 2010, 11:36:49 am »
Well, the problem isn't there anymore, but I am still curious about what happened and I did actually want curCol and CurRow, but the penCol and penRow might be fun to play with. Any who, here is what ConvRStr does:
Code: [Select]
This is used in my BASIC ReCode project to convert real number strings into hex
Inputs:
     HL is the pointer to the real string (or the byte before)
Output:
     (86ECh) has the converted value --This will likely change, but for now it is this
     BC contains the converted value
     HL points to the byte after the string
So when I was making the "Disp " command, I would do something like Disp 1,2,HELLO and it would need to convert that 1 and put it in curCol, convert the 2 and store it it curRow, and then display HELLO. Again, it works now and before, the values were converted correctly, but before I actually added the displaying portion, it wasn't setting the cursor where I wanted it.

I am pretty sure it was because after the ReCode section (so in the BASIC part of the program), I used "Pause Ans" to check where the cursor was.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Something is wrong...
« Reply #3 on: November 14, 2010, 01:31:11 pm »
Pause does change the cursor location, so I guess that might be it.
I didn't realize this was for ReCode. Good luck! :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 Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Something is wrong...
« Reply #4 on: November 14, 2010, 03:35:55 pm »
Okay, thanks! I think that I will post any other problems I run into, here.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Something is wrong...
« Reply #5 on: November 14, 2010, 03:43:18 pm »
Okay, thanks! I think that I will post any other problems I run into, here.

Why don't you post them in Recode Thread, just asking :s

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Something is wrong...
« Reply #6 on: November 14, 2010, 03:48:09 pm »
Okay, thanks! I think that I will post any other problems I run into, here.

Why don't you post them in Recode Thread, just asking :s

Good point... Sounds a little more intelligent :D

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: Something is wrong...
« Reply #7 on: November 15, 2010, 12:39:13 am »
Questions posted outside the help forums tend to be ignored more, so it's generally best to ask them in help section, because most helpers will not expect them to be asked elsewhere, thus, they will miss them.