Advertisement
Oldbitcollector

Custom Characters

Feb 4th, 2022
1,692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Adapted from a posted Lemon64 Example
  2. ; Works best if program is placed at $1000
  3.  
  4. ; *********************************
  5. ; *** Character Change Routines ***
  6. ; *********************************
  7.  
  8. changechar
  9.     ; Turn off Keyscan Interrupt
  10.     lda $dc0e
  11.     and #$fe
  12.     sta $dc0e
  13.    
  14.     ;Make ROM Visible
  15.     lda $01
  16.     and #$fb
  17.     sta $01
  18.    
  19. charchangeloop
  20. charfrom
  21.     lda $d800   ;$d800/55295 low/gr
  22.                 ;$d000/53248 upp/gr
  23. charto
  24.     sta $3800   ;14336
  25.    
  26.     lda charfrom+2
  27.     sta $040a
  28.     lda charfrom+1
  29.     sta $040b
  30.     lda charto+2
  31.     sta $0432
  32.     lda charto+1
  33.     sta $0433
  34.    
  35.     ldx charto+1
  36.     cpx #$f8
  37.     bne scharcheckend
  38.                    
  39. charcheckend
  40.     lda charto+2
  41.     cmp #$3f
  42.     beq charchangeend
  43.    
  44. scharcheckend
  45.     cpx #$ff
  46.     beq charroll
  47.     inx
  48.     stx charto+1
  49.     inc charfrom+1
  50.     jmp charchangeloop
  51.    
  52. charroll
  53.     ldx #$00
  54.     stx charfrom+1
  55.     stx charto+1
  56.     ldx charfrom+2
  57.     inx
  58.     stx charfrom+2
  59.     ldx charto+2
  60.     inx
  61.     stx charto+2
  62.     jmp charchangeloop
  63.    
  64. charchangeend
  65.  
  66.     ; Important! for Keyset Set ROM hidden again.
  67.     lda $01
  68.     ora #$04
  69.     sta $01
  70.    
  71.     ;Keyscan interrupt back on
  72.     lda $dc0e
  73.     ora #$01
  74.     sta $dc0e
  75.    
  76.     ;Switch charset pointer to here
  77.     ;$3000 is set by last 3 buts to %110
  78.     ;12288 - 14335
  79.     lda #%00011110
  80.     sta $d018
  81.    
  82.     ;Put Custom Chars in Memory
  83.     ldx #$00
  84. charb
  85.     lda roadchar,x
  86.     sta $3810,x ; 3808=a, 3810=b
  87.     inx
  88.     cpx #$08
  89.     bne charb
  90.    
  91.    
  92. roadchar
  93. !byte %00000000
  94. !byte %11111111
  95. !byte %10000001
  96. !byte %10000001
  97. !byte %10000001
  98. !byte %10000001
  99. !byte %10000001
  100. !byte %11111111
  101. !byte $00    
  102.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement