Jump to content
  • 0

Does GRAPH_put_char work?


Sean
 Share

Question

Does the GRAPH_put_char kernal call work right?  I tried writing out a string and ended up with only a single row of pixels with content in it.  Several consecutive calls, for each character in the string, only made the row contain more letters.  Adding enough letters eventually did cause it to wrap and the next row ended up with some white pixels.  It looks more like Morse code than text.  The printString subroutine I wrote to use GRAPH_put_char is below, and a screenshot is attached.  I'm not sure if I'm doing something wrong, if this hasn't been fully implemented yet, if the default font is somehow wrong, or perhaps if there is a bug in the emulator.

 

; Prints a null-terminated string while in graphics mode
;    r0 is x, r1 is y, r2 is address of string
printString:
    ; GRAPH_put_char uses r0=x, r1=y for position char, and updates after you print a char        
    LDY #$00            ; index for our string position, max length is 255 chars
@loopStart:
    LDA (r2),Y
    BEQ @endOfString
    PHY    
    JSR GRAPH_put_char
    PLY
    INY
    JMP @loopStart
@endOfString:
    RTS
    

CX16_GRAPH_put_char.jpg

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

It definitely works as I have used it.  I am sorry I can't be more helpful right now and assuming you have r0, r1 and r2 set up, I don't see anything clearly wrong (I don't know if r2 is safe to use as your own index when calling GRAPH_put_char but I assume you checked that already).  All I can say is it does work.

Link to comment
Share on other sites

  • 0
30 minutes ago, Getafix said:

It definitely works as I have used it.  I am sorry I can't be more helpful right now and assuming you have r0, r1 and r2 set up, I don't see anything clearly wrong (I don't know if r2 is safe to use as your own index when calling GRAPH_put_char but I assume you checked that already).  All I can say is it does work.

Thanks.  Just hearing that it works, I took yet another stab at it.  I tried a bunch of different things.  Finally, I found that it worked fine once pseudo-register r1, used for the Y-coordinate argument, was at least $0006.  When r1=$0000, it was outputting what looked like Morse code in the approximate vertical center.  With r1=$0010 it was outputting text about 16 pixels down from the top.  Much better.  At $0005 or less, but more than $0000, you get what are clearly parts of letters, but with oddities.

 

Edited by Sean
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use