diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index 4f26aefe..d0f29fad 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -47,8 +47,6 @@ // -#if !HAS_OPCODES_65C02 - .macro put_jumptable_lo(list) { .for (var i = 0; i < list.size(); i++) @@ -65,7 +63,7 @@ } } -#else // HAS_OPCODES_65C02 +#if HAS_OPCODES_65C02 .macro put_jumptable(list) { diff --git a/c64/basic/engine/ad9e.frmevl.s b/c64/basic/engine/ad9e.frmevl.s index 38a65a2c..b7594b1e 100644 --- a/c64/basic/engine/ad9e.frmevl.s +++ b/c64/basic/engine/ad9e.frmevl.s @@ -25,6 +25,15 @@ FRMEVL: + // XXX we neeed FRETOP for string concatenation + + // lda VARTAB+0 + // sta FRETOP+0 + // lda VARTAB+1 + // sta FRETOP+1 + + // XXX we also need TEMMPPT, LASTPT and TEMPST + // Put the sentinel to the stack lda #$00 @@ -50,7 +59,7 @@ FRMEVL_loop: bcc FRMEVL_fetch_float // Search for a value or unary operator, starting from the most probable - // XXX check for BASIC functions here, too + // XXX check all other operators cmp #$AB // check for unary minus beq_16 do_NOT_IMPLEMENTED_error // XXX @@ -129,7 +138,7 @@ FRMEVL_fetch_operator: bcc_16 do_FORMULA_TOO_COMPLEX_error // Now look for an operator - // XXX for now only plus operator is implemented + // XXX for now only addition operator is implemented jsr fetch_character cmp #$AA // check for a plus operator @@ -197,9 +206,9 @@ FRMEVL_push_operator_address: // XXX add support for other operators - lda #>(oper_plus - 1) + lda #>(oper_add - 1) pha - lda #<(oper_plus - 1) + lda #<(oper_add - 1) pha // Push operator priority diff --git a/c64/basic/operators/oper_plus.s b/c64/basic/operators/oper_add.s similarity index 87% rename from c64/basic/operators/oper_plus.s rename to c64/basic/operators/oper_add.s index 97822b14..5593ffab 100644 --- a/c64/basic/operators/oper_plus.s +++ b/c64/basic/operators/oper_add.s @@ -3,7 +3,7 @@ // #LAYOUT# * * #IGNORE -oper_plus: +oper_add: // This operator can be used either with two strings, or with two floats // First check whether arguments match and then choose the variant @@ -13,17 +13,17 @@ oper_plus: bne_16 do_TYPE_MISMATCH_error lda VALTYP - bmi oper_plus_strings + bmi oper_add_strings // FALLTROUGH -oper_plus_floats: +oper_add_floats: // XXX implement this jmp do_NOT_IMPLEMENTED_error -oper_plus_strings: +oper_add_strings: // Pull string length diff --git a/c64/basic/operators/oper_and.s b/c64/basic/operators/oper_and.s new file mode 100644 index 00000000..fac758dc --- /dev/null +++ b/c64/basic/operators/oper_and.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_and: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_eq.s b/c64/basic/operators/oper_cmp_eq.s new file mode 100644 index 00000000..4e739dd3 --- /dev/null +++ b/c64/basic/operators/oper_cmp_eq.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_eq: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_gt.s b/c64/basic/operators/oper_cmp_gt.s new file mode 100644 index 00000000..c8229e84 --- /dev/null +++ b/c64/basic/operators/oper_cmp_gt.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_gt: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_gteq.s b/c64/basic/operators/oper_cmp_gteq.s new file mode 100644 index 00000000..c57639cd --- /dev/null +++ b/c64/basic/operators/oper_cmp_gteq.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_gteq: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_lt.s b/c64/basic/operators/oper_cmp_lt.s new file mode 100644 index 00000000..d68fbf75 --- /dev/null +++ b/c64/basic/operators/oper_cmp_lt.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_lt: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_lteq.s b/c64/basic/operators/oper_cmp_lteq.s new file mode 100644 index 00000000..abf25b23 --- /dev/null +++ b/c64/basic/operators/oper_cmp_lteq.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_lteq: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_cmp_neq.s b/c64/basic/operators/oper_cmp_neq.s new file mode 100644 index 00000000..488dac41 --- /dev/null +++ b/c64/basic/operators/oper_cmp_neq.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_cmp_neq: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_div.s b/c64/basic/operators/oper_div.s new file mode 100644 index 00000000..a1d487bd --- /dev/null +++ b/c64/basic/operators/oper_div.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_div: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_mul.s b/c64/basic/operators/oper_mul.s new file mode 100644 index 00000000..cc94590c --- /dev/null +++ b/c64/basic/operators/oper_mul.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_mul: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_or.s b/c64/basic/operators/oper_or.s new file mode 100644 index 00000000..dfce2789 --- /dev/null +++ b/c64/basic/operators/oper_or.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_or: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_pow.s b/c64/basic/operators/oper_pow.s new file mode 100644 index 00000000..229b6427 --- /dev/null +++ b/c64/basic/operators/oper_pow.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_pow: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_sub.s b/c64/basic/operators/oper_sub.s new file mode 100644 index 00000000..4f503fde --- /dev/null +++ b/c64/basic/operators/oper_sub.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_sub: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_unary_minus.s b/c64/basic/operators/oper_unary_minus.s new file mode 100644 index 00000000..f39efbed --- /dev/null +++ b/c64/basic/operators/oper_unary_minus.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_unary_minus: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/oper_unary_not.s b/c64/basic/operators/oper_unary_not.s new file mode 100644 index 00000000..18238b09 --- /dev/null +++ b/c64/basic/operators/oper_unary_not.s @@ -0,0 +1,10 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +oper_unary_not: + + // XXX provide implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/operators/operators_jumptable.s b/c64/basic/operators/operators_jumptable.s new file mode 100644 index 00000000..8f4983a1 --- /dev/null +++ b/c64/basic/operators/operators_jumptable.s @@ -0,0 +1,74 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Jumptable and priority list for all BASIC operators +// + + +.const operator_list = List().add( + + // Tokens XXX + + oper_add, + oper_sub, + oper_mul, + oper_div, + + // Tokens XXX + + oper_and, + oper_or, + + // Tokens XXX + + oper_cmp_gt, + oper_cmp_eq, + oper_cmp_lt, + + // Combined two tokens + + oper_cmp_gteq, + oper_cmp_lteq, + oper_cmp_neq, + + // Not a token + + oper_pow, + + // Unary + + oper_unary_minus, + oper_unary_not +) + + +operator_priorities: // higher number = higher priority + + .byte $05 // oper_add + .byte $05 // oper_sub + .byte $06 // oper_mul + .byte $06 // oper_div + .byte $02 // oper_and + .byte $01 // oper_or + .byte $04 // oper_cmp_gt + .byte $04 // oper_cmp_eq + .byte $04 // oper_cmp_lt + .byte $04 // oper_cmp_gteq + .byte $04 // oper_cmp_lteq + .byte $04 // oper_cmp_neq + .byte $08 // oper_pow + .byte $07 // oper_unary_minus + .byte $03 // oper_unary_not + + + +operator_jumptable_lo: + + put_jumptable_lo(operator_list) + + +operator_jumptable_hi: + + put_jumptable_hi(operator_list)