From c4db9d44206b7bf1788368fb8d9af4bb312a0dcc Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 8 Aug 2020 10:18:43 -0400 Subject: [PATCH] 8086: implement stack overflow error condition Also, remove RSP underflow check from next for the same reason as in the previous commit in z80. --- blk/283 | 3 ++- blk/805 | 8 ++++---- blk/808 | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/blk/283 b/blk/283 index 308e0c8..46a4447 100644 --- a/blk/283 +++ b/blk/283 @@ -2,7 +2,8 @@ H@ ORG ! ( STABLE ABI ) 0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT ) NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused ) 0 A, 0 JP, ( 0b, EXIT ) NOP, ( unused ) -0 JP, ( RST 10 ) NOP, NOP, NOP, NOP, NOP, NOP, NOP, ( unused ) +0 JP, ( RST 10 ) NOP, NOP, ( 13, oflw ) +NOP, NOP, NOP, NOP, NOP, ( unused ) 0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused ) 0 JP, ( RST 20 ) 0 A, 0 JP, ( 23, (n) ) NOP, ( unused ) 0 JP, ( RST 28 ) 0 A, 0 JP, ( 2b, (s) ) NOP, ( unused ) diff --git a/blk/805 b/blk/805 index 2349126..8153776 100644 --- a/blk/805 +++ b/blk/805 @@ -2,10 +2,10 @@ VARIABLE lblexec VARIABLE lblnext H@ ORG ! JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno ) 0 A,, ( 04, BOOT ) -0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A, ( unused ) -0 A, JMPn, 0 A,, ( unused ) -0 A,, ( unused ) JMPn, 0 A,, ( unused ) -JMPn, 0 A,, ( unused ) 0 A, 0 A,, ( unused ) +0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A,, ( unused ) +JMPn, 0 A,, ( 0b, EXIT ) +0 A,, 0 A,, ( unused ) 0 A,, ( 13, oflw ) +0 A,, 0 A,, 0 A, ( unused ) JMPn, 0 A,, ( 1a, next ) 0 A,, 0 A,, 0 A,, ( unused ) 0 A, JMPn, 0 A,, ( 23, (n) ) 0 A,, 0 A,, ( unused ) diff --git a/blk/808 b/blk/808 index 8cc605b..b047e62 100644 --- a/blk/808 +++ b/blk/808 @@ -1,8 +1,9 @@ lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next ) - ( RSP check ) - AX RS_ADDR MOVxI, BP AX CMPxx, - IFC, ( BP < RS_ADDR ) - DI 0x06 MOVxm, JMPs, L1 FWRs ( execute ) + ( ovfl check ) + BP SP CMPxx, + IFNC, ( BP >= SP ) + SP PS_ADDR MOVxI, BP RS_ADDR MOVxI, + DI 0x13 ( oflw ) MOVxm, JMPs, L1 FWRs ( execute ) THEN, DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx, DI [DI] MOVx[], ( wordref )