mirror of
https://github.com/irmen/prog8.git
synced 2025-01-11 13:29:45 +00:00
fix conditional expression parse
This commit is contained in:
parent
e1ef9ff611
commit
ff39d15a01
@ -108,7 +108,7 @@ def parse_expr_as_comparison(text: str, sourceref: SourceRef) -> Tuple[str, str,
|
||||
}[node.body.ops[0].__class__.__name__]
|
||||
if not operator:
|
||||
raise src.to_error("unsupported comparison operator")
|
||||
left = text[node.body.left.col_offset:node.body.comparators[0].col_offset-len(operator)]
|
||||
left = text[node.body.left.col_offset:node.body.comparators[0].col_offset].rstrip()[:-len(operator)]
|
||||
right = text[node.body.comparators[0].col_offset:]
|
||||
return left.strip(), operator, right.strip()
|
||||
left = astnode_to_repr(node.body)
|
||||
|
@ -219,7 +219,7 @@ sub IOBASE () -> (X, Y) = $FFF3 ; read base address of I/O devices
|
||||
|
||||
~ c64util {
|
||||
|
||||
sub init_state () -> (A?, X?, Y?) {
|
||||
sub init_system () -> (A?, X?, Y?) {
|
||||
; ---- initializes the machine to a sane starting state
|
||||
; This means that the BASIC, KERNAL and CHARGEN ROMs are banked in,
|
||||
; the VIC, SID and CIA chips are reset, screen is cleared, and the default IRQ is set.
|
||||
|
@ -1,4 +1,7 @@
|
||||
output raw
|
||||
output prg,sys
|
||||
|
||||
import "c64lib"
|
||||
|
||||
|
||||
~ main {
|
||||
var .text name = "?"*80
|
||||
@ -8,20 +11,26 @@ output raw
|
||||
|
||||
|
||||
start
|
||||
A = 44
|
||||
X = ~22+44
|
||||
A= ~-1
|
||||
Y = ~-2
|
||||
c64util.init_system()
|
||||
|
||||
A = 0
|
||||
printloop
|
||||
c64util.print_byte_decimal(A)
|
||||
c64.CHROUT('\n')
|
||||
A++
|
||||
if A <20 goto printloop
|
||||
return
|
||||
|
||||
label1
|
||||
if_true A==0 goto label1
|
||||
if_true A==123 goto label1
|
||||
if_true A == 123 goto label1
|
||||
if_true A!=0 goto label1
|
||||
if_not X!=0 goto label1
|
||||
|
||||
if_true A<=1 goto label1
|
||||
if_true A <= 1 goto label1
|
||||
if_true A==1 goto label1
|
||||
if_true A!=1 goto label1
|
||||
if_not X<1 goto label1
|
||||
if_not X < 1 goto label1
|
||||
if_not Y>1 goto label1
|
||||
if_not X!=1 goto label1
|
||||
|
||||
@ -31,7 +40,8 @@ label1
|
||||
if_true X>Y goto label1
|
||||
if_true X>A goto label1
|
||||
if A<=22 goto label1
|
||||
if_cc A goto label1
|
||||
if A <= 22 goto label1
|
||||
if_cc A goto label1
|
||||
if_vc X goto label1
|
||||
if_pos Y goto label1
|
||||
if_true XY goto label1
|
||||
|
@ -6,7 +6,7 @@ import "c64lib"
|
||||
var .text name = "?"*80
|
||||
|
||||
start
|
||||
c64util.init_state()
|
||||
c64util.init_system()
|
||||
|
||||
XY = c64.CINV
|
||||
SI = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user