fixed DOS wedge operating on tokenized string
This commit is contained in:
1 parent
4595543227
commit
1ef37c2a8c
3 files changed
+42
-32
No files matched your search
@@ -112,26 +112,6 @@ not_a_token:
|
|||||||
cmp #$3a
|
cmp #$3a
|
||||||
beq basic_skip_char
|
beq basic_skip_char
|
||||||
|
|
||||||
#if CONFIG_DOS_WEDGE
|
|
||||||
|
|
||||||
// Are we in direct mode?
|
|
||||||
// DOS Wedge is a hacky solution (inelegant, but convenient),
|
|
||||||
// BASIC programmers should implement communication with drives
|
|
||||||
// the standard way, handling channels properly. Besides,
|
|
||||||
// current implementation does not support characters under ROM
|
|
||||||
ldx CURLIN+1
|
|
||||||
cpx #$ff
|
|
||||||
bne !+
|
|
||||||
// We are in direct mode, allow wedge to handle '@' sign
|
|
||||||
// XXX Maybe it should be allowed only as the first command?
|
|
||||||
cmp #$40
|
|
||||||
bne !+
|
|
||||||
jsr basic_consume_character
|
|
||||||
jmp wedge_dos
|
|
||||||
!:
|
|
||||||
|
|
||||||
#endif // CONFIG_DOS_WEDGE
|
|
||||||
|
|
||||||
// If all else fails, it's a syntax error
|
// If all else fails, it's a syntax error
|
||||||
jmp do_SYNTAX_error
|
jmp do_SYNTAX_error
|
||||||
|
|
||||||
|
|||||||
+24
-11
@@ -39,12 +39,13 @@ got_line_of_input:
|
|||||||
|
|
||||||
// Strip leading spaces from the line
|
// Strip leading spaces from the line
|
||||||
remove_leading_spaces:
|
remove_leading_spaces:
|
||||||
lda $0200
|
lda BUF
|
||||||
cmp #$20
|
cmp #$20
|
||||||
bne !+
|
bne !+
|
||||||
ldx #1
|
ldx #1
|
||||||
rsl_l1: lda $0200,x
|
rsl_l1:
|
||||||
sta $01ff,x
|
lda BUF,x
|
||||||
|
sta BUF-1,x
|
||||||
inx
|
inx
|
||||||
cpx __tokenise_work1
|
cpx __tokenise_work1
|
||||||
bne rsl_l1
|
bne rsl_l1
|
||||||
@@ -61,11 +62,23 @@ rsl_l1: lda $0200,x
|
|||||||
lda __tokenise_work1
|
lda __tokenise_work1
|
||||||
beq basic_read_next_line
|
beq basic_read_next_line
|
||||||
|
|
||||||
|
#if CONFIG_DOS_WEDGE
|
||||||
|
|
||||||
|
// Check if DOS wedge should take over
|
||||||
|
lda BUF
|
||||||
|
cmp #$40 // '@'
|
||||||
|
bne !+
|
||||||
|
ldx __tokenise_work1 // here is the size of input
|
||||||
|
jmp wedge_dos
|
||||||
|
!:
|
||||||
|
|
||||||
|
#endif // CONFIG_DOS_WEDGE
|
||||||
|
|
||||||
// Else, tokenise the line
|
// Else, tokenise the line
|
||||||
jsr tokenise_line
|
jsr tokenise_line
|
||||||
|
|
||||||
// Has the user entered a line of BASIC beginning with a number?
|
// Has the user entered a line of BASIC beginning with a number?
|
||||||
lda $0200
|
lda BUF
|
||||||
cmp #$30
|
cmp #$30
|
||||||
bcc not_a_line
|
bcc not_a_line
|
||||||
cmp #$39
|
cmp #$39
|
||||||
@@ -82,9 +95,9 @@ rsl_l1: lda $0200,x
|
|||||||
sta __tokenise_work1
|
sta __tokenise_work1
|
||||||
|
|
||||||
// Try to read line number
|
// Try to read line number
|
||||||
lda #<$0200
|
lda #<BUF
|
||||||
sta TXTPTR+0
|
sta TXTPTR+0
|
||||||
lda #>$0200
|
lda #>BUF
|
||||||
sta TXTPTR+1
|
sta TXTPTR+1
|
||||||
|
|
||||||
jsr basic_parse_line_number
|
jsr basic_parse_line_number
|
||||||
@@ -98,13 +111,13 @@ rsl_l1: lda $0200,x
|
|||||||
// Skip any spaces after the line number
|
// Skip any spaces after the line number
|
||||||
ldx __tokenise_work1
|
ldx __tokenise_work1
|
||||||
skip_spaces:
|
skip_spaces:
|
||||||
lda $0200,x
|
lda BUF,x
|
||||||
cmp #$20
|
cmp #$20
|
||||||
bne !+
|
bne !+
|
||||||
inx
|
inx
|
||||||
bne skip_spaces
|
bne skip_spaces
|
||||||
!: stx __tokenise_work1
|
!: stx __tokenise_work1
|
||||||
|
|
||||||
// First, clear all variables, so that we only have to shove BASIC text around.
|
// First, clear all variables, so that we only have to shove BASIC text around.
|
||||||
// (We could later remove this requirement, and the only effect should be
|
// (We could later remove this requirement, and the only effect should be
|
||||||
// to slow things down, and that you might have to either CLR if there is no
|
// to slow things down, and that you might have to either CLR if there is no
|
||||||
@@ -135,9 +148,9 @@ not_a_line:
|
|||||||
// Actually interpret the line
|
// Actually interpret the line
|
||||||
|
|
||||||
// Setup pointer to the statement
|
// Setup pointer to the statement
|
||||||
lda #<$0200
|
lda #<BUF
|
||||||
sta TXTPTR+0
|
sta TXTPTR+0
|
||||||
lda #>$0200
|
lda #>BUF
|
||||||
sta TXTPTR+1
|
sta TXTPTR+1
|
||||||
|
|
||||||
// There is no stored line, so zero that pointer out
|
// There is no stored line, so zero that pointer out
|
||||||
@@ -148,7 +161,7 @@ not_a_line:
|
|||||||
// Put invalid line number in current line number value,
|
// Put invalid line number in current line number value,
|
||||||
// so that we know we are in direct mode
|
// so that we know we are in direct mode
|
||||||
// (Compute's Mapping the 64 p19)
|
// (Compute's Mapping the 64 p19)
|
||||||
lda #$ff
|
lda #$FF
|
||||||
sta CURLIN+1
|
sta CURLIN+1
|
||||||
|
|
||||||
jmp basic_execute_statement
|
jmp basic_execute_statement
|
||||||
+18
-1
@@ -1,8 +1,15 @@
|
|||||||
|
|
||||||
#if CONFIG_DOS_WEDGE
|
#if CONFIG_DOS_WEDGE
|
||||||
|
|
||||||
|
// .X has to contain size of the buffer
|
||||||
|
|
||||||
wedge_dos:
|
wedge_dos:
|
||||||
|
|
||||||
|
// Prepare buffer - finish it with '0'
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta BUF,x
|
||||||
|
|
||||||
// Close all the channels, so that wedge has full control
|
// Close all the channels, so that wedge has full control
|
||||||
jsr JCLALL
|
jsr JCLALL
|
||||||
|
|
||||||
@@ -12,6 +19,16 @@ wedge_dos:
|
|||||||
ldy #$0F
|
ldy #$0F
|
||||||
jsr JSETFLS
|
jsr JSETFLS
|
||||||
|
|
||||||
|
// Setup necessary parts of BASIC
|
||||||
|
|
||||||
|
lda #<(BUF+1)
|
||||||
|
sta TXTPTR+0
|
||||||
|
lda #>(BUF+1)
|
||||||
|
sta TXTPTR+1
|
||||||
|
|
||||||
|
lda #$FF
|
||||||
|
sta CURLIN+1
|
||||||
|
|
||||||
// Now we have to check what the user wants us to do
|
// Now we have to check what the user wants us to do
|
||||||
|
|
||||||
// Check if user asked for a status
|
// Check if user asked for a status
|
||||||
@@ -210,7 +227,7 @@ wedge_dos_clean_exit:
|
|||||||
jsr JCLALL
|
jsr JCLALL
|
||||||
// Print new line
|
// Print new line
|
||||||
jsr print_return
|
jsr print_return
|
||||||
jmp basic_end_of_line
|
jmp basic_main_loop
|
||||||
|
|
||||||
wedge_dos_basic_error:
|
wedge_dos_basic_error:
|
||||||
pha
|
pha
|
||||||
|
|||||||
Reference in new issue
Block a user