mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-03-10 21:36:17 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@175 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
313c930a09
commit
2318c68cf2
@ -15,11 +15,12 @@
|
||||
|
||||
; convert a string representing a dotted quad (IP address, netmask) into 4 octets
|
||||
; inputs:
|
||||
; AX= pointer to null-terminated string containing dotted quad
|
||||
; AX= pointer to null-terminated (*) string containing dotted quad
|
||||
; e.g. "192.168.1.0",0
|
||||
; outputs:
|
||||
; carry flag is set if there was an error, clear otherwise
|
||||
; dotted_quad_value: will be set to (32 bit) ip address (if no error)
|
||||
; (*) NB to assist with url parsing, a ':' or '/' can also terminate the string
|
||||
parse_dotted_quad:
|
||||
stax dotted_quad_ptr+1
|
||||
|
||||
@ -38,6 +39,10 @@ parse_dotted_quad:
|
||||
and #$7F ;turn off bit 7
|
||||
cmp #'.'
|
||||
beq @got_dot
|
||||
cmp #':'
|
||||
beq @done
|
||||
cmp #'/'
|
||||
beq @done
|
||||
sec
|
||||
sbc #'0'
|
||||
bcc @error
|
||||
|
@ -20,7 +20,7 @@ search_string=copy_dest
|
||||
|
||||
.bss
|
||||
int_value: .res 2
|
||||
|
||||
temp_ptr: .res 2
|
||||
.data
|
||||
get_next_byte:
|
||||
current_string_ptr=get_next_byte+1
|
||||
@ -48,8 +48,11 @@ parser_init:
|
||||
;inputs: AX= pointer to (null terminated) string to search for
|
||||
;outputs: sec if search string not found
|
||||
; if clc, AX = pointer to first byte after string specified
|
||||
; if sec (i.e. no match found), pointer stays in same place
|
||||
parser_skip_next:
|
||||
stax search_string
|
||||
ldax current_string_ptr
|
||||
stax temp_ptr
|
||||
@check_string:
|
||||
ldy #0
|
||||
ldax current_string_ptr
|
||||
@ -75,6 +78,7 @@ parser_skip_next:
|
||||
@not_matched:
|
||||
jsr get_next_byte
|
||||
bne @check_string
|
||||
ldax search_string
|
||||
ldax temp_ptr
|
||||
stax current_string_ptr
|
||||
sec
|
||||
rts
|
||||
|
@ -21,7 +21,7 @@
|
||||
.export url_ip
|
||||
.export url_port
|
||||
.export url_selector
|
||||
|
||||
.export url_resource_type
|
||||
|
||||
target_string=copy_src
|
||||
search_string=copy_dest
|
||||
@ -33,7 +33,7 @@ selector_buffer=output_buffer
|
||||
url_port: .res 2 ;will be set with port number of url
|
||||
url_selector: .res 2 ;will be set with address of selector part of URL
|
||||
url_type: .res 1
|
||||
|
||||
url_resource_type: .res 1
|
||||
url_type_unknown=0
|
||||
url_type_gopher=1
|
||||
url_type_http=2
|
||||
@ -57,7 +57,7 @@ url_parse:
|
||||
sty url_type
|
||||
sty url_port
|
||||
sty url_port+1
|
||||
|
||||
sty url_resource_type
|
||||
|
||||
jsr skip_to_hostname
|
||||
bcc :+
|
||||
@ -111,11 +111,6 @@ lda #url_type_gopher
|
||||
bpl :-
|
||||
|
||||
jsr skip_to_hostname
|
||||
bcc :+
|
||||
ldax url_string
|
||||
jsr parser_init
|
||||
:
|
||||
|
||||
|
||||
;skip over next colon
|
||||
ldax #colon
|
||||
@ -136,21 +131,28 @@ lda #url_type_gopher
|
||||
sta src_ptr
|
||||
sta dest_ptr
|
||||
lda url_type
|
||||
cmp #url_type_unknown
|
||||
beq @done
|
||||
|
||||
cmp #url_type_gopher
|
||||
bne @not_gopher
|
||||
;first byte after / in a gopher url is the resource type
|
||||
ldy src_ptr
|
||||
lda (copy_src),y
|
||||
sta url_resource_type
|
||||
inc src_ptr
|
||||
jmp @start_of_selector
|
||||
@not_gopher:
|
||||
cmp #url_type_http
|
||||
bne @no_get_at_start_of_selector
|
||||
bne @done ; if it's not gopher or http, we don't know how to build a selector
|
||||
ldy #3
|
||||
sty dest_ptr
|
||||
:
|
||||
lda get,y
|
||||
sta (copy_dest),y
|
||||
dey
|
||||
bpl :-
|
||||
|
||||
@no_get_at_start_of_selector:
|
||||
inc dest_ptr
|
||||
bpl :-
|
||||
@start_of_selector:
|
||||
lda #'/'
|
||||
inc dest_ptr
|
||||
jmp @save_first_byte_of_selector
|
||||
@copy_one_byte:
|
||||
ldy src_ptr
|
||||
@ -159,8 +161,7 @@ lda #url_type_gopher
|
||||
inc src_ptr
|
||||
@save_first_byte_of_selector:
|
||||
ldy dest_ptr
|
||||
sta (copy_dest),y
|
||||
|
||||
sta (copy_dest),y
|
||||
inc dest_ptr
|
||||
bne @copy_one_byte
|
||||
@end_of_selector:
|
||||
|
@ -53,14 +53,16 @@ init:
|
||||
jsr test_url_parse
|
||||
ldax #url_4
|
||||
jsr test_url_parse
|
||||
jsr wait_key
|
||||
ldax #url_5
|
||||
jsr test_url_parse
|
||||
ldax #url_6
|
||||
jsr test_url_parse
|
||||
ldax #url_7
|
||||
jsr test_url_parse
|
||||
ldax #url_8
|
||||
ldax #url_8
|
||||
jsr test_url_parse
|
||||
jsr wait_key
|
||||
ldax #url_9
|
||||
jsr test_url_parse
|
||||
ldax #url_a
|
||||
@ -135,6 +137,10 @@ print_parsed_url:
|
||||
jsr print_hex
|
||||
lda url_port
|
||||
jsr print_hex
|
||||
ldax #type
|
||||
jsr print
|
||||
lda url_resource_type
|
||||
jsr print_a
|
||||
jsr print_cr
|
||||
ldax #selector
|
||||
jsr print
|
||||
@ -142,6 +148,11 @@ print_parsed_url:
|
||||
jsr print
|
||||
jmp print_cr
|
||||
|
||||
wait_key:
|
||||
ldax #press_a_key
|
||||
jsr print
|
||||
jmp get_key
|
||||
|
||||
.data
|
||||
|
||||
entry:
|
||||
@ -162,10 +173,10 @@ url_4:
|
||||
.byte "gopher://gopher.floodgap.com/",0
|
||||
|
||||
url_5:
|
||||
.byte "gopher://gopher.floodgap.com/goober",0
|
||||
.byte "gopher://10.5.1.164/0goober",0
|
||||
|
||||
url_6:
|
||||
.byte "gopher://gopher.floodgap.com:7070/goober",0
|
||||
.byte "gopher://gopher.floodgap.com:7070/7/goober",0
|
||||
|
||||
url_7:
|
||||
.byte "www.jamtronix.com",0
|
||||
@ -177,7 +188,7 @@ url_9:
|
||||
.byte "gopher.floodgap.com",0
|
||||
|
||||
url_a:
|
||||
.byte "gopher.floodgap.com:70",0
|
||||
.byte "10.5.1.123:70",0
|
||||
|
||||
url_b:
|
||||
.byte "gopher.floodgap.com:80",0
|
||||
@ -189,7 +200,9 @@ url_c:
|
||||
parsing: .asciiz "PARSING "
|
||||
ip: .asciiz "IP: "
|
||||
port: .asciiz " PORT: $"
|
||||
type: .asciiz " TYPE:"
|
||||
selector: .asciiz "SELECTOR: "
|
||||
press_a_key: .asciiz "PRESS ANY KEY TO CONTINUE"
|
||||
|
||||
atom_file:
|
||||
;.incbin "atom_test.xml"
|
||||
|
Loading…
x
Reference in New Issue
Block a user