; write top left y
ld a, [de] ; a = heigth
- sub a, b ; height - y
- add a, 16 + OBJ_OFF_Y ; off by one obj height so it won't end up off-screen
+
+ push bc
+ ld c, a
+ ld a, b
+ sub a, c ; height - y
+ pop bc
+
ld [hl+], a
; write top left x
; write top right y
ld a, [de] ; a = height
- sub a, b ; height - y
- add a, 16 + OBJ_OFF_Y ; off by one obj height so it won't end up off-screen
+
+ push bc
+ ld c, a
+ ld a, b
+ sub a, c ; height - y
+ pop bc
+
ld [hl+], a
; write top left x