From 7722db0762ddf3214d865feb0f2519afdbf5a4e9 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 14 Nov 2020 20:28:44 -0500 Subject: [PATCH] Fix mis-documentation in 8086 boot code comments --- blk.fs | 21 ++++++++------------- doc/impl.txt | 4 ++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/blk.fs b/blk.fs index e6ba921..18bf55a 100644 --- a/blk.fs +++ b/blk.fs @@ -2533,19 +2533,14 @@ sure it goes back to its previous level before next is called. (cont.) ( ----- 441 ) -STABLE ABI: As a compatible binary, this binary follows the -same stable ABI as its z80 counterpart. - -PS CHECKS: Unlike z80 boot code, we don't check PS at each next -call (we do check RS though). It is the responsibility of every -native PSP-modifying word to call chkPS, . Also, chkPS, is a -bit different than in z80: it is parametrizable. The idea is -that we always call chkPS, before popping, telling the expected -size of stack. This allows for some interesting optimization. -For example, in SWAP, no need to pop, chkPS, then push, we can -chkPS and then proceed to optimized swapping in PS. - -To assemble, load blocks 445 through 461 +PS CHECKS: chkPS, is a bit different than in z80: it is para- +metrizable. The idea is that we always call chkPS, before pop- +ping, telling the expected size of stack. This allows for some +interesting optimization. For example, in SWAP, no need to pop, +chkPS, then push, we can chkPS and then proceed to optimized +swapping in PS. + +Load range: B445-B461 ( ----- 445 ) VARIABLE lblexec VARIABLE lblnext H@ ORG ! diff --git a/doc/impl.txt b/doc/impl.txt index a0a5b71..ac31e43 100644 --- a/doc/impl.txt +++ b/doc/impl.txt @@ -51,6 +51,10 @@ Stack underflow and overflow: In each native word involving PS popping, we check whether the stack is big enough. If it's not we go in "uflw" (underflow) error condition, then abort. +This means that if you implement a native word that involves +popping from PS, you are expected to call chkPS, for under- +flow situations. + We don't check RS for underflow because the cost of the check is significant and its usefulness is dubious: if RS isn't tightly in control, we're screwed anyways, and that, well