From 74de206058f21e59b9ae730ea11bd2942a0f1b5c Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 12 Feb 2023 18:57:56 -0600 Subject: [PATCH] Add library function for null pointer checking. This is used by the new ORCA/C debugging option to check for illegal use of null pointers. It is similar to an existing routine in PasLib used by ORCA/Pascal's similar checks. --- cc.asm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cc.asm b/cc.asm index 89f3da5..5b9bf44 100644 --- a/cc.asm +++ b/cc.asm @@ -433,6 +433,24 @@ ret tya store return value in result space rtl return to original caller end +**************************************************************** +* +* ~CheckPtrC - check a pointer to insure it is not null +* +* Inputs: +* 1,S - return address +* 4,S - pointer +* +**************************************************************** +* +~CheckPtrC start + lda 4,S + ora 5,S + bne lb1 + error #1 subrange exceeded +lb1 rtl + end + **************************************************************** * * ~CUMul2 - unsigned multiply