mirror of
https://github.com/bradgrantham/apple2a.git
synced 2025-02-20 09:28:59 +00:00
Add REM and semicolon at end of PRINT.
This commit is contained in:
parent
f7f58ded19
commit
11721a4e58
@ -6,12 +6,12 @@ Runs between 5 and 30 times faster.
|
|||||||
|
|
||||||
Supported features: The classic way to enter programs with
|
Supported features: The classic way to enter programs with
|
||||||
line numbers, 16-bit integer variables, `HOME`, `PRINT`, `IF/THEN`,
|
line numbers, 16-bit integer variables, `HOME`, `PRINT`, `IF/THEN`,
|
||||||
`FOR/NEXT`, `GOTO`, low-res graphics (`GR`, `PLOT`, `COLOR=`, `TEXT`),
|
`FOR/NEXT`, `GOTO`, low-res graphics (`GR`, `PLOT`, `COLOR=`, `TEXT`), `REM`,
|
||||||
`DIM` (single-dimensional arrays), `POKE`, and integer and boolean arithmetic.
|
`DIM` (single-dimensional arrays), `POKE`, and integer and boolean arithmetic.
|
||||||
|
|
||||||
Not supported: Floating point, strings,
|
Not supported: Floating point, strings,
|
||||||
high-res graphics, `DATA/READ/RESUME`, `GOSUB/RETURN/POP`,
|
high-res graphics, `DATA/READ/RESUME`, `GOSUB/RETURN/POP`,
|
||||||
`REM`, multi-dimensional arrays, keyboard input, exponentiation (`A^B`), and cassette I/O.
|
multi-dimensional arrays, keyboard input, exponentiation (`A^B`), and cassette I/O.
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
|
27
main.c
27
main.c
@ -63,6 +63,7 @@ uint8_t title_length = 9;
|
|||||||
#define T_NEXT 0x9A
|
#define T_NEXT 0x9A
|
||||||
#define T_NOT 0x9B
|
#define T_NOT 0x9B
|
||||||
#define T_DIM 0x9C
|
#define T_DIM 0x9C
|
||||||
|
#define T_REM 0x9D
|
||||||
|
|
||||||
// Operators. These encode both the operator (high nybble) and the precedence
|
// Operators. These encode both the operator (high nybble) and the precedence
|
||||||
// (low nybble). Lower precedence has a lower low nybble value. For example,
|
// (low nybble). Lower precedence has a lower low nybble value. For example,
|
||||||
@ -162,6 +163,7 @@ static uint8_t *TOKEN[] = {
|
|||||||
"NEXT",
|
"NEXT",
|
||||||
"NOT",
|
"NOT",
|
||||||
"DIM",
|
"DIM",
|
||||||
|
"REM",
|
||||||
};
|
};
|
||||||
static int16_t TOKEN_COUNT = sizeof(TOKEN)/sizeof(TOKEN[0]);
|
static int16_t TOKEN_COUNT = sizeof(TOKEN)/sizeof(TOKEN[0]);
|
||||||
|
|
||||||
@ -1053,7 +1055,12 @@ static void compile_buffer(uint8_t *buffer, uint16_t line_number) {
|
|||||||
add_call(print_int);
|
add_call(print_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*s == ';') {
|
||||||
|
// Ends with a semicolon, don't print newline.
|
||||||
|
s += 1;
|
||||||
|
} else {
|
||||||
add_call(print_newline);
|
add_call(print_newline);
|
||||||
|
}
|
||||||
} else if (*s == T_LIST) {
|
} else if (*s == T_LIST) {
|
||||||
s += 1;
|
s += 1;
|
||||||
add_call(list_statement);
|
add_call(list_statement);
|
||||||
@ -1327,6 +1334,9 @@ static void compile_buffer(uint8_t *buffer, uint16_t line_number) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (*s == T_REM) {
|
||||||
|
// Done with line.
|
||||||
|
break;
|
||||||
} else if (*s == T_GR) {
|
} else if (*s == T_GR) {
|
||||||
s += 1;
|
s += 1;
|
||||||
add_call(gr_statement);
|
add_call(gr_statement);
|
||||||
@ -1595,23 +1605,6 @@ int16_t main(void)
|
|||||||
// Initialize UI.
|
// Initialize UI.
|
||||||
home();
|
home();
|
||||||
|
|
||||||
// Display the character set.
|
|
||||||
/*
|
|
||||||
if (1) {
|
|
||||||
int16_t i;
|
|
||||||
for (i = 0; i < 256; i++) {
|
|
||||||
uint8_t *loc;
|
|
||||||
// Fails with: unhandled instruction B2
|
|
||||||
move_cursor(i % 16, i >> 4);
|
|
||||||
// Works.
|
|
||||||
// move_cursor(i & 0x0F, i >> 4);
|
|
||||||
loc = cursor_pos();
|
|
||||||
*loc = i;
|
|
||||||
}
|
|
||||||
while(1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Print title.
|
// Print title.
|
||||||
move_cursor((40 - title_length) / 2, 0);
|
move_cursor((40 - title_length) / 2, 0);
|
||||||
print(title);
|
print(title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user