Re: A86: ld HL call
[Prev][Next][Index][Thread]
Re: A86: ld HL call
At 12:11 AM 9/14/98 EDT, you wrote:
>
>ok,
>
>I saw in an example prog the folowing code:
>
>
> call _clrLCD ; clear the screen
> ld hl, $0000 ; stores $00 in h, $00 in l
> ld (_curRow),hl ; stores 0 in _curRow, 0 in _curCol
> ld hl, Hello ; hl points to string Hello
> call _puts ; print the string
> ld a, '!' ; load ! character in A
> call _putc ; print '!'
> call _newline ; go to next line
> ret ; return from program
>
>
>The seconline of that reads:
> ld hl, $0000
>is that making sure that 'hl' has nothing in it so that the next command:
> ld hl, Hello
>can make hl be whatever 'hello' is?
No, it's making sure hl is zero so the next command:
ld (_curRow), hl
will put the cursor at the top left of the screen
>also, what does this mean:?
> call _putc
>is that putCHARACTER?
>and putS is putSTRING?
Yes that's it.
>but how does 'putc' know to read the character in 'A'?
Putc is a piece of code in the rom that was programed to take whatever's in
the A register and put it on the screen. The same way puts knows to use
hl, it was programmed that way.
--
Andy Johnson <prjohnson@utahlinx.com>
References: