Advertisement
Oldbitcollector

Loading Charpad Map Data

Feb 4th, 2022
1,923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; Example of loading a Charpad Map Fullscreen 1000 bytes
  3. ; Some code adapted from c64brain's example.
  4.  
  5.  
  6. ;Include custom characters file
  7. ;* = $3800
  8. ;chars
  9. ;!bin "./chars/blade_runner.bin",512
  10.  
  11.  
  12. ;Boot loader
  13. !source "./libs/loader.asm"
  14. +start_at $8000
  15.  
  16. ;       lda #%00011110  ; Point toward custom characters
  17. ;       sta $d018
  18.    
  19.        
  20.         lda #$00        ; Change Screen/Border Colors
  21.         sta $d020
  22.         sta $d021
  23.        
  24.         jsr drawmap
  25.         rts
  26.        
  27.  
  28. drawmap
  29.         lda   #$00
  30.         sta   $fb
  31.         lda   #$04
  32.         sta   $fc            ;0+4*256 = 1024
  33.         ldx   #$00      
  34.         lda   screenlo,x
  35.         sta   $fd
  36.         lda   screenhi,x
  37.         sta   $fe
  38.  
  39.         ldx   #$03
  40. sethi    
  41.         ldy     #$00  
  42. setlow    
  43.         lda   ($fd),y        ;map
  44.         sta   ($fb),y        ;1024,x
  45.         iny
  46.         cpy   #$ff
  47.         bne   setlow   
  48.         inc   $fc                            
  49.         inc   $fe
  50.         dex
  51.         bne   sethi  
  52.         rts
  53.  
  54.  
  55.      
  56. screenlo    !byte <map        
  57. screenhi    !byte >map
  58.  
  59. map
  60. !bin "map.raw"
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement