Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for underflow #78

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading