ld hl, act_pos_y
add hl, de
; hl = pos y
+
+ ; y position scroll
ld a, [hl+]
+
+ ; max y
+ cp a, 0x10
+ jr c, @not_max_y REL
+ ld a, 0x10
+@not_max_y:
+
+ ; min y
+ cp a, 0x07
+ jr nc, @not_min_y REL
+ ld a, 0x07
+@not_min_y:
+ ; adjust scroll
sub a, (MAP_H - 10) / 2
mul8 a
ld [scroll_y], a
+ ; x position scroll
ld a, [hl]
+
+ BREAK
+ ; max x
+ cp a, 0x16
+ jr c, @not_max_x REL
+ ld a, 0x16
+@not_max_x:
+
+ ; min x
+ cp a, 0x0A
+ jr nc, @not_min_x REL
+ ld a, 0x0A
+@not_min_x:
+
sub a, (MAP_W - 12) / 2
+
mul8 a
ld [scroll_x], a