FshVar Functions now catch Out Of Bounds Exceptions

This commit is contained in:
Stephen Toth 2018-06-24 23:13:44 -04:00
parent 3e1451c007
commit 94ceaddf3b
2 changed files with 13 additions and 0 deletions

Binary file not shown.

View File

@ -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