Advertisement
Guest User

--oo00oo--

a guest
May 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. build_songs_big_map:
  2.     ; zero entire songs map
  3. ;   ld hl,songs_map
  4. ;   ld bc,$1000 ; 4096 = 64 * 64
  5. ;   xor a
  6. ;   call mem_set
  7.  
  8.     ; enable ram access to read/write
  9.     xor a
  10.     ld e,a
  11.     ld d,a
  12.     ld a,$0a
  13.     ld [de],a ; $0000 = $0a
  14.  
  15.     ; Loop over all songs
  16.     ld hl,$a000
  17.     ld a,[hl]
  18.     ld [reg_r],a
  19.    
  20.     ld d,a
  21.  
  22.     ld bc,$a001
  23.  
  24. .curr_song_loop:
  25.     ld a,d
  26.     and a
  27.     jp z,.curr_song_loop_done
  28.  
  29.     ld h,b
  30.     ld l,c
  31.     ld a,[hli] ; get row
  32.     ld [reg_r],a
  33.     ld a,[hli] ; get col
  34.     ld [reg_q],a
  35.  
  36.     push bc
  37.  
  38.     ; set songs big map position to 1
  39.  
  40.     ; calculate row * 64 => hl
  41.     ld a,[reg_r]
  42.     ld l,a
  43.     ld h,0 ; hl = [reg_r]
  44.  
  45. REPT    6
  46.     add hl,hl ; hl = hl * 64
  47. ENDR
  48.  
  49.     ; add col to hl
  50.     ld a,[reg_q]
  51.     ld c,a
  52.     ld b,0
  53.     add hl,bc
  54.  
  55.     ; add songs_map to hl
  56.     ld h,b
  57.     ld l,c
  58.     ld hl,songs_map
  59.     add hl,bc
  60.  
  61.     ; set songs_map value to having a song
  62.     ld [hl],1
  63.  
  64.     pop bc
  65.  
  66.     ; move to next song
  67.     add_8bit_to_16bit 64,c,b
  68.     dec d
  69.     jp .curr_song_loop
  70.  
  71. .curr_song_loop_done:
  72.  
  73.     ; For each song, get its row/col coordinates
  74.  
  75.     ; Go to proper position for row/col coordinates in map and put 1 there
  76.     ld hl,songs_map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement