Skip to content

Commit

Permalink
Check for underflow (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Jul 8, 2024
1 parent a68c5e0 commit 0c16ba5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions data_stack.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ data_stack_push:

data_stack_pop:
mov rsi, [_data_stack.here]
cmp rsi, [_data_stack.base]
jle .underflow
std
lodsq
mov [_data_stack.here], rsi
lodsq
cld
ret
.underflow:
die ERR_UNDERFLOW

data_stack_depth:
mov rax, [_data_stack.here]
Expand Down
1 change: 1 addition & 0 deletions defs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ERR_BAD_BASE = 167
ERR_BAD_PAD = 168
ERR_NO_WORD = 169
ERR_BAD_SE = 170
ERR_UNDERFLOW = 171

TYPE_OFFSET = 0x00

Expand Down

0 comments on commit 0c16ba5

Please sign in to comment.