alright well i want to save memory and time typing with my new program.
when i do text output i type the following code Note:#include "begin.inc" is normal start that i did to save time.


Code:

#include "begin.inc"
.LIST
.org 9327h
 ld hl,0
 ld (pencol),hl
 ld (penrow),hl
 ld hl,str
 call _vputs
 ld hl,0
 ld (pencol),0
 ld hl,6
 ld (penrow),hl
 ld hl,str ;Just here for example even though same as above
 call _vputs
 ret
str:
 .db "Here is code",0
.end
END


throught i increment hl by six.
now my problem with hexadecimal is spacing i use the following code but when i get to the third line it puts a big space how could i fix it.

code example:


Code:

#include "begin.inc"
.LIST
.org 9327h
 call _clrLCDFull
 call _runIndicOff
 ld hl,0000h
 ld (pencol),hl
 ld hl,str
 call _vputs
 ld hl,0600h
 ld (pencol),hl
 ld hl,str ;Just used as example
 call _vputs
 ld hl,1200h ;this is where i start having spacing problems
 ld (pencol),hl
 ld hl,str ;just used as example
 call _vputs
 ret
str:
 .db "This is asm",0
.end
END


any help with fixing this would be helpful and well apreciated because it saves time and memory.
I read through your post 3 times, and I'm still confused on what your problem is exactly Confused Could you explain more in detail what you mean by "now my problem with hexadecimal is spacing I use the following code but when I get to the third line it puts a big space how could I fix it. "

Also, the first program you gave will not compile. I'll leave it up to you to find out why.
i know the first wont compile i just used as an example. and my problem with hexadecimal is: in the second program i use the hexadecimal numbers to place text because the two commands (pencol) and (penrow) are next to one another, but when i get to line 14 while program is being executed it is like there is another space for text but when i switch it to another number it just covers the other text.
I don't think your problem has anything to do with "hexdecimal" numbers at all. First off, you can load decimal numbers into hl, and at compile time it will be assembled into hexdecimal.

Anyways, the general rule of thumb that I have found with vputs is that you need a row spacing of at least 7 between lines or you will have overlap. I'm not sure that that is what you are trying to fix or not, but you should give it a shot. You should be more specifc because from this, "but when I get to line 14 while program is being executed it is like there is another space for text but when I switch it to another number it just covers the other text," it is very hard to decifer what you are trying to say.

Did trying that solve the problem at all?
i am typing code it should only be a minute.
Also, if you have something against hexdecimal numbers in general, you can always do:

Code:

  ld hl,256*Row + Column
  ld (pencol),hl

And it would work the same Wink
when you say row + column do you mean add them together or just put a plus sign.
Use order of operations.

OMG wait. I just figured out your problem, and it is hexdecimal!!!

0600h - 0000h =/= 1200h - 0600h

You see, this is not decimal, let's translate it into decimal for a minute and just look at the left two digits:

06 - 00 =/= 18 - 6
6 =/=12

See the problem?
no because hexadecimal math and stuff confuses me.
I see so many problems there it's not even funny. Firstly, you're trying to load a 16-bit register into 8 bits. All you need is:

xor a
ld (penrow),a
add a,6
ld (pencol),a
Alright. Here comes a patented Chipmaster Lesson.

Numberical systems have been around for millenia. In the beginning, number systems were made out of different bases, ranging from the Mayans' base 20, to the Arabic system (ours) base 10. In each, the digit is increased until it reaches a certain point by unique numbers. At this "radix," the number (normally to the) left of this digit is increased, and the other digit starts from zero again. The goal is to have a number system that is both usefull (by having a large radix) yet not overbearing such that people could miscount (if the radix was too high).

Decimal, our system, is base 10. Hexdecimal is base 16. This simply means that you have to increase the digit in the ones place 16 times before the next digit is increased, and so on. So these digits past 10 are A,B,C,D,E,F respectively.

Now, we can see that the number after $09 hex ($ denotes hex) is not $10 at all. It is instead $0A.

Relating this to your problem:

You have misinterpretted how the processor will read your code. You have made a "hex" number and expected it to act like a "decimal" number. 12 in hex is $0C. $12 in hex is really 18 in decimal (because 1*16 +2 = 18). Therefore, you have logically kept the increment value the same in decimal, but you are working with a hexdecimal number.

The hex values should be: $0000, $0600, $0C00 in that order.
Kerm, all he is doing is a shortcut. You CAN load hl into pencol, and it will load "l" into pencol and "h" into penrow. It's a perfectly legal shortcut. He's just a little confused on the hex is all Smile
so instead could i put like 0600d(or leave the d off).
No!! Definitely not! Leave it in hex or use the decimal trick I showed you Wink

Would you like to know why you can't do that? Or are you not interested?
i understood part of it but the part with the alphabet was confusing like where would c come from.
Hexdecimal has 16 digits. There are only 10 Arabic numbers. Therefore, we use the first 6 alphabet letters to denote numbers past 9, but below the radix.

Edit Here's the progression of the first 20 hex numbers:

1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
11
12
13
14
A little OT, but:

Chipmaster wrote:
Numberical systems have been around for millenia. In the beginning, number systems were made out of different bases, ranging from the Mayans' base 20, to the Arabic system (ours) base 10. In each, the digit is increased until it reaches a certain point by unique numbers. At this "radix," the number (normally to the) left of this digit is increased, and the other digit starts from zero again. The goal is to have a number system that is both usefull (by having a large radix) yet not overbearing such that people could miscount (if the radix was too high).


Unfortunately, no one used base 12 (and kept to it) so that we could all rejoice in the simplicity of the numerical expansion of fractions (instead of just 2 and 5 for base 10 making terminating expansions, 2, 3, 4, and 6 all terminate in base 12).

If only 6 were a Fibonacci number and not 5...
I've never thought of it that way, but that would be a great number system. Smile
Chipmaster wrote:
I don't think your problem has anything to do with "hexdecimal" numbers at all. First off, you can load decimal numbers into hl, and at compile time it will be assembled into hexdecimal.

Doesn't it compile into machine language which is binary?
Chipmaster wrote:
...to the Arabic system...

But it really is Indian. The Arabs just adopted it and brought it to the western world.
Chipmaster wrote:
Kerm, all he is doing is a shortcut. You CAN load hl into pencol, and it will load "l" into pencol and "h" into penrow. It's a perfectly legal shortcut. He's just a little confused on the hex is all Smile
Laughing I know that, but it looked to me like he was doing it wrong.
  
Page 1 of 2
» All times are UTC - 5 Hours
 
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

 

Advertisement