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

Added NOT <term> #613

Merged
merged 1 commit into from
Sep 16, 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
2 changes: 1 addition & 1 deletion basic/scripts/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 56 additions & 0 deletions basic/sources/arithmetic/unary/base/not.asm
Original file line number Diff line number Diff line change
@@ -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
; ==== =====
;
; ************************************************************************************************

2 changes: 1 addition & 1 deletion basic/test.bsc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
print "98765";
print not 0, not 1, not -1
Loading