diff --git a/basic/scripts/tokens.py b/basic/scripts/tokens.py index 11100b81..c0a5efaf 100644 --- a/basic/scripts/tokens.py +++ b/basic/scripts/tokens.py @@ -97,7 +97,7 @@ def create(self): !!STR $ ( RAND( RND( JOYPAD( INT( TIME( EVENT( INKEY$( ASC( CHR$( POINT( LEN( ABS( SGN( HIT( SPOINT( MID$( LEFT$( RIGHT$( TRUE FALSE INSTR( MOUSE( !!UN6 !!UN7 - KEY( PEEK( DEEK( ALLOC( MAX( MIN( + KEY( PEEK( DEEK( ALLOC( MAX( MIN( NOT """,48) # # Structure tokens diff --git a/basic/sources/arithmetic/unary/base/not.asm b/basic/sources/arithmetic/unary/base/not.asm new file mode 100644 index 00000000..9be4cdaa --- /dev/null +++ b/basic/sources/arithmetic/unary/base/not.asm @@ -0,0 +1,56 @@ +; ************************************************************************************************ +; ************************************************************************************************ +; +; Name: not.asm +; Purpose: Logical Not +; Created: 16th September 2024 +; Reviewed: No +; Author: Paul Robson (paul@robsons.org.uk) +; +; ************************************************************************************************ +; ************************************************************************************************ + +; ************************************************************************************************ +; +; Return logical NOT of parameter. +; +; ************************************************************************************************ + + .section code + +EXPUnaryNot: ;; [not] + jsr EvaluateTerm ; not takes one term because of precedence + bit XSControl,x ; fail if string + bmi _EXNType + bvc _EXNIsInteger + lda #17 ; if real make it integer + jsr DOMathCommand +_EXNIsInteger: + lda XSNumber3,x ; check if zero. + ora XSNumber2,x + ora XSNumber1,x + ora XSNumber0,x + beq _EXNIsZero ; make it 0 or $FF + lda #$FF +_EXNIsZero: + eor #$FF ; now zero will be $FF and anything else $00 + jmp ReturnBoolean + + +_EXNType: + .error_type + + .send code + + +; ************************************************************************************************ +; +; Changes and Updates +; +; ************************************************************************************************ +; +; Date Notes +; ==== ===== +; +; ************************************************************************************************ + diff --git a/basic/test.bsc b/basic/test.bsc index 9979a63f..3c19faaf 100644 --- a/basic/test.bsc +++ b/basic/test.bsc @@ -1 +1 @@ -print "98765"; \ No newline at end of file +print not 0, not 1, not -1 \ No newline at end of file