diff --git a/client/inc/char_conv.i b/client/inc/char_conv.i index eba59e6..6879fba 100644 --- a/client/inc/char_conv.i +++ b/client/inc/char_conv.i @@ -32,7 +32,7 @@ petscii_to_ascii_table: .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df .byte $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8a,$8b,$8c,$8d,$8e,$8f .byte $90,$91,$92,$0c,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f -.byte $a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af +.byte $20,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af .byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf .byte $60,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f .byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$7b,$7c,$7d,$7e,$7f diff --git a/client/inc/telnet.i b/client/inc/telnet.i index 5a87d6e..0df6890 100644 --- a/client/inc/telnet.i +++ b/client/inc/telnet.i @@ -66,6 +66,12 @@ telnet_main_entry: beq @petscii_mode cmp #'p' beq @petscii_mode + + cmp #'l' + beq @line_mode + cmp #'L' + beq @line_mode + jmp @char_mode_input @ascii_mode: lda #0 @@ -82,7 +88,13 @@ telnet_main_entry: lda #0 sta local_echo sta line_mode - + jmp @after_mode_set +@line_mode: + lda #0 + sta character_set + lda #1 + sta local_echo + sta line_mode @after_mode_set: @@ -94,12 +106,16 @@ telnet_main_entry: lda character_set beq @a_mode ldax #petscii - jsr print jmp @c_mode @a_mode: - ldax #ascii - jsr print + lda line_mode + bne @l_mode + ldax #ascii + jmp @c_mode +@l_mode: + ldax #line @c_mode: + jsr print ldax #mode jsr print @@ -159,7 +175,7 @@ telnet_connect: sty nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH lda #0 sta nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH+1 - + jsr print_cr jmp @no_more_input @not_line_mode: @@ -248,6 +264,8 @@ telnet_callback: sta buffer_length lda nb65_param_buffer+NB65_PAYLOAD_LENGTH+1 sta buffer_length+1 + + ;since we don't check the buffer length till the end of the loop, set 'buffer length' to be 1 less than the actual number of bytes dec buffer_length bpl :+ dec buffer_length+1 @@ -262,6 +280,11 @@ telnet_callback: jmp @no_conversion_req : + lda line_mode + beq :+ + jmp@convert_to_petscii +: +;if we get here, we are in ASCII 'char at a time' mode, so look for (and process) Telnet style IAC bytes lda telnet_state cmp #telnet_state_got_command beq @waiting_for_option @@ -350,6 +373,7 @@ telnet_callback: jmp @add_iac_response @not_iac: +@convert_to_petscii: lda ascii_to_petscii_table,x tax @@ -362,16 +386,18 @@ telnet_callback: tay @byte_processed: iny + bne :+ + inc buffer_ptr+1 +: dec buffer_length lda #$ff cmp buffer_length beq :+ jmp @next_byte : - inc buffer_ptr+1 + dec buffer_length+1 bmi @finished - ldy #0 jmp @next_byte @finished: @@ -392,11 +418,12 @@ connecting_in: .byte "CONNECTING IN ",0 ascii: .byte "ASCII",0 petscii: .byte "PETSCII",0 +line: .byte "LINE",0 mode: .byte " MODE",13,0 disconnected: .byte 13,"CONNECTION CLOSED",13,0 remote_host: .byte "HOSTNAME (LEAVE BLANK TO QUIT)",13,": ",0 remote_port: .byte "PORT # (LEAVE BLANK FOR DEFAULT)",13,": ",0 -char_mode_prompt: .byte "CHARACTER MODE - A=ASCII, P=PETSCII",13,0 +char_mode_prompt: .byte "MODE - A=ASCII, P=PETSCII, L=LINE",13,0 transmission_error: .byte "ERROR WHILE SENDING ",0 ;variables