Displaying text

From NeoGeo Development Wiki
Revision as of 11:18, 12 February 2011 by Furrtek (talk | contribs) (Created page with "Displaying text with a 8x8 pixel font: <pre> ;Displays text pointed by A0 at the VRAM address in D1. $FF:Next line, $00:End of text. ;Uses A0, D0 and REG_VRAMMOD Write8Text: …")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Displaying text with a 8x8 pixel font:

;Displays text pointed by A0 at the VRAM address in D1. $FF:Next line, $00:End of text.
;Uses A0, D0 and REG_VRAMMOD
Write8Text:
    move.w  d1,VRAM_ADDR
    move.w  #$20,VRAM_MOD
    clr.w   d0
textmaplp:
    move.b  (a0)+,d0
    tst.b   d0
    beq     textmapend
    cmp.b   #$FF,d0
    bne     nolinejump
    addq.w  #1,d1
    move.w  d1,VRAM_ADDR
    bra     textmaplp
nolinejump:
    addq.w  ASCIISTART,d0
    move.w  d0,VRAM_RW
    bra     textmaplp
textmapend:
    rts

"ASCIISTART" should be the fix tile number corresponding to ASCII value 0. This depends on what tileset you are using. The onboard tilesets have a full 8x8 font starting at tile #0.


The VRAM address is calculated from the wanted text position: D1=#FIXMAP+(Y+2+((X+1)*32)),d1
"FIXMAP" being #$7000.