summaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/subeditor.s65
1 files changed, 32 insertions, 33 deletions
diff --git a/programs/subeditor.s b/programs/subeditor.s
index 1842b5a..d16915d 100644
--- a/programs/subeditor.s
+++ b/programs/subeditor.s
@@ -300,7 +300,7 @@ getchar:
stb b ; Enable insert mode.
pha #1 ; Save the character.
phy #2 ; Save the cursor index.
- cmp #10 ; Was the character that was typed, a newline?
+ cmp #'\n' ; Was the character that was typed, a newline?
bne getchar_pnt ; No, so just print the character.
jsl cmd_cpy ; Yes, so start copying the line to the command buffer.
getchar_pnt:
@@ -311,7 +311,7 @@ getchar_pnt:
getchar_pt1:
jsl print_char ; No, so print the character.
lda a ; Get the return value.
- cmp #10 ; Is the return value, a newline?
+ cmp #'\n' ; Is the return value, a newline?
beq getchar_ln ; Yes, so return 0.
jmp getchar_chr ; No, so return 1.
reset_row:
@@ -449,7 +449,7 @@ print_char:
lda a ; Get back the character.
cmp #$1B ; Did the user type an escape character?
beq esc ; Yes, so go check the escape code.
- cmp #10 ; No, but did the user type a newline?
+ cmp #'\n' ; No, but did the user type a newline?
beq nl ; Yes, so handle the newline.
cmp #$C ; No, but did the user type Ctrl+L?
beq clr_scr ; Yes, so clear the screen.
@@ -457,7 +457,7 @@ print_char:
beq en_step ; Yes, so enable clock/instruction stepping.
cmp #18 ; No, but did the user type Ctrl+R?
beq dis_step ; Yes, so disable clock/instruction stepping.
- cmp #8 ; No, but did the user type a backspace?
+ cmp #'\b' ; No, but did the user type a backspace?
beq bs ; Yes, so handle the backspace.
cmp #$7F ; No, but did they type Delete?
beq bs ; Yes, so treat it as a backspace.
@@ -571,13 +571,12 @@ nl1:
cmp #maxrow ;
bcc nl_inc ;
jsl scrl_down ;
- lda #10 ;
- sta a ;
- jmp printc_end ;
+ jmp nl_end ;
nl_inc:
inc scr_row ;
jsl update_pos ;
- lda #10 ;
+nl_end:
+ lda #'\n' ;
sta a ;
jmp printc_end ;
@@ -826,14 +825,14 @@ shftesc_end:
jmp printc_end ; We are done.
isup:
- lda c ; No, so load the escape code back into the accumulator.
- cmp #$41 ; Did the user press the up arrow key?
+ lda c ; Load the escape code into the accumulator.
+ cmp #'A' ; Did the user press the up arrow key?
bne isup_done ; No, so we're done.
lda scr_row ; Yes, but is the cursor at the top of the screen?
beq isup_scrl ; Yes, so check if we need to scroll.
isup_2:
lda c ; No, so load the escape code back into the accumulator.
- cmp #$41 ; Did the user press the up arrow key?
+ cmp #'A' ; Did the user press the up arrow key?
beq up ; Yes, so move the cursor up.
jmp isup_done ; No, so we're done
isup_scrl:
@@ -846,14 +845,14 @@ isup_done:
rtl ; End of isup.
isdown:
- lda c ; No, so load the escape code back into the accumulator.
- cmp #$42 ; Did the user press the down arrow key?
+ lda c ; Load the escape code into the accumulator.
+ cmp #'B' ; Did the user press the down arrow key?
bne isdown_done ; No, so we're done.
lda scr_row ; Yes, so start checking the y coordinate of the cursor.
cmp #maxrow ; Is the cursor at the bottom of the screen?
beq isdown_scrl ; Yes, so scroll down.
lda c ; No, so load the escape code back into the accumulator.
- cmp #$42 ; Did the user press the down arrow key?
+ cmp #'B' ; Did the user press the down arrow key?
beq down ; Yes, so move the cursor down.
jmp isdown_done
isdown_scrl:
@@ -872,8 +871,8 @@ isdown_done:
rtl ; End of isdown.
isright:
- lda c ; No, so load the escape code back into the accumulator.
- cmp #$43 ; Did the user press the right arrow key?
+ lda c ; Load the escape code into the accumulator.
+ cmp #'C' ; Did the user press the right arrow key?
bne isright_dne ; No, so we're done.
lda scr_col ; Yes, so start checking the x coordinate of the cursor.
cmp #maxcol ; Is the cursor at the far right of the screen?
@@ -910,13 +909,13 @@ isright_dne:
rtl ; End of isright.
isleft:
- lda c ; Get the saved character.
- cmp #$43 ; Did the user press right?
+ lda c ; Load the escape code into the accumulator.
+ cmp #'C' ; Did the user press right?
beq isleft_done ; Yes, so we're done
lda scr_col ; No, but is the cursor at the far left of the screen?
beq isleft_wrp ; Yes, so start checking if this is a wrapped line.
lda c ; No, so load the escape code back into the accumulator.
- cmp #$44 ; Did the user press the left arrow key?
+ cmp #'D' ; Did the user press the left arrow key?
beq left ; Yes, so move the cursor left.
jmp isleft_done ; No, so we're done.
isleft_wrp:
@@ -976,7 +975,7 @@ left:
isshftup:
lda c ; Load the escape code back into the accumulator.
- cmp #$41 ; Did the user press the up arrow key?
+ cmp #'A' ; Did the user press the up arrow key?
bne shftup_done ;
lda #1 ;
sta d ;
@@ -988,7 +987,7 @@ shftup_done:
isshftdown:
lda c ; Load the escape code back into the accumulator.
- cmp #$42 ; Did the user press the down arrow key?
+ cmp #'B' ; Did the user press the down arrow key?
bne shftdn_done ;
lda #1 ;
sta d ;
@@ -1023,35 +1022,35 @@ update_pos:
tay ; Place the index into the Y register.
lda #$1B ; Print an escape character
sta scr ; to the screen.
- lda #$5B ; Print '['
+ lda #'[' ; Print '['
sta scr ; to the screen, and start the escape sequence.
jsl getrow ; Start printing the row number to the screen.
jsl getcol ; Start printing the column number to the screen.
- lda #$48 ; Print 'H'
+ lda #'H' ; Print 'H'
sta scr ; to the screen.
rtl ; End of update_pos.
getrow:
lda scr_row ; Get the cursor's y coordinate.
div #10 ; Divide A by 10.
- adc #$30 ; Convert it to ascii, and
+ adc #'0' ; Convert it to ascii, and
sta scr ; print to the screen.
tba ; Get the remainder.
- adc #$30 ; Convert it to ascii, and
+ adc #'0' ; Convert it to ascii, and
sta scr ; print to the screen.
rtl ; End of getrow.
getcol:
- lda #$3B ; Print ';'
+ lda #';' ; Print ';'
sta scr ; to the screen.
lda scr_col ; Get the cursor's x coordinate.
div #10 ; Divide A by 10.
clc
- adc #$30 ; Convert it to ascii, and
+ adc #'0' ; Convert it to ascii, and
sta scr ; print to the screen.
tba ; Get the remainder.
clc
- adc #$30 ; Convert it to ascii, and
+ adc #'0' ; Convert it to ascii, and
sta scr ; print to the screen.
rtl ; End of getrow.
@@ -1060,9 +1059,9 @@ scrl_down:
inc scr_end ; Increment the ending line of the screen.
lda #$1B ; Print an escape character
sta scr ; to the screen.
- lda #$5B ; Print '['
+ lda #'[' ; Print '['
sta scr ; to the screen, and start the escape sequence.
- lda #$54 ; Print 'T'
+ lda #'T' ; Print 'T'
sta scr ; to the screen, and end the escape sequence.
lda scr_row ; Get the cursor's line number.
pha #1 ; Save it in the stack.
@@ -1094,9 +1093,9 @@ scrl_up:
dec scr_end ;
lda #$1B ; Print an escape character
sta scr ; to the screen.
- lda #$5B ; Print '['
+ lda #'[' ; Print '['
sta scr ; to the screen, and start the escape sequence.
- lda #$53 ; Print 'S'
+ lda #'S' ; Print 'S'
sta scr ; to the screen, and end the escape sequence.
lda scr_row ;
pha #1 ;
@@ -1133,7 +1132,7 @@ rdrow_inc2:
bcs rdrow_end ;
jmp rdrow_st ;
rdrow_skip:
- lda #$20 ;
+ lda #' ' ;
sta scr ; to the screen.
jmp rdrow_inc1 ;
rdrow_end: