cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

set_win_tile_submap.s (1208B)


      1        .include        "global.s"
      2
      3        .globl .image_tile_width, .set_xy_win_submap
      4
      5        .area   _HOME
      6
      7_set_win_submap::
      8        ldhl    sp, #2
      9        ld      a, (hl+)        ; b = x
     10        ld      b, a
     11        ld      c, (hl)         ; c = y
     12        
     13        ldhl    sp, #8
     14        ld      a, (hl)
     15        ldhl    sp, #4
     16        sub     (hl)
     17        ld      (.image_tile_width), a ; .image_tile_width contains corrected width map width
     18        add     (hl)
     19
     20        ld      d, #0
     21        ld      e, a
     22        ld      a, c
     23        MUL_DE_BY_A_RET_HL
     24        ld      a, b
     25        ADD_A_REG16 h, l
     26        ld      d, h
     27        ld      e, l
     28
     29        ldhl    sp, #6
     30        ld      a,(hl+)         
     31        ld      h,(hl)          
     32        ld      l,a             
     33        add     hl, de
     34        ld      b, h
     35        ld      c, l
     36
     37        ldhl    sp, #2
     38        ld      a, (hl+)        ; d = x
     39        and     #0x1f
     40        ld      d, a
     41        ld      a, (hl)         ; e = y
     42        and     #0x1f
     43        ld      e, a
     44
     45        ldhl    sp, #5
     46        ld      a,(hl-)         ; a = h
     47        ld      h,(hl)          ; h = w
     48        ld      l,a             ; l = h
     49
     50        jp      .set_xy_win_submap