diff --git a/bin/FSHa.8xp b/bin/FSHa.8xp index d815cde..deacd08 100644 Binary files a/bin/FSHa.8xp and b/bin/FSHa.8xp differ diff --git a/includes/FshVar.asm b/includes/FshVar.asm index 8c5fb42..a7d7077 100644 --- a/includes/FshVar.asm +++ b/includes/FshVar.asm @@ -7,6 +7,9 @@ fshvarset: push bc push de push hl + ld bc, FshVarsSize / 2 + 1 + call cpBCDE + jr nc, fshvarsetOOBException ld bc, FshVars ex de, hl add hl, hl @@ -14,6 +17,7 @@ fshvarset: ld (hl), e inc hl ld (hl), d +fshvarsetOOBException: pop hl pop de pop bc @@ -28,6 +32,10 @@ fshvarset: fshvarget: push bc push de + ld hl, 0 + ld bc, FshVarsSize / 2 + 1 + call cpBCDE + jr nc, fshvargetOOBException ld bc, FshVars ex de, hl add hl, hl @@ -36,6 +44,7 @@ fshvarget: inc hl ld d, (hl) ex de, hl +fshvargetOOBException: pop de pop bc ret @@ -49,6 +58,9 @@ fshvarcpy: push bc push de push hl + ld bc, FshVarsSize / 2 + 1 + call cpBCDE + jr nc, fshvarcpyOOBException ld bc, FshVars add hl, hl add hl, bc @@ -61,6 +73,7 @@ fshvarcpy: inc hl ld a, (de) ld (hl), a +fshvarcpyOOBException: pop hl pop de pop bc