2009-04-04 05:14:06 +00:00
;this is some very quick and dirty glue to make the most useful IP65 functions available via a single entry point.
;this allows user applications to be developed that don't link ip65 in directly, rather they use an instance of ip65 that is preloaded (or in a cartridge/ROM)
;this whole file could (and should) be greatly optimised by making it all table driven, but since this file is probably only going to be used in a bankswitched ROM where
;space is not at such a premium, I'll go with the gross hack for now.
2009-04-10 04:07:27 +00:00
.ifndef NB65_API_VERSION_NUMBER
.define EQU =
.include " . . / inc/ n b65 _ c o n s t a n t s . i "
.endif
2009-03-28 09:59:53 +00:00
.include " . . / inc/ c o m m o n . i "
2009-04-05 10:10:53 +00:00
.include " . . / inc/ c o m m o n p r i n t . i "
2009-03-28 12:57:24 +00:00
.export nb65_dispatcher
2009-03-28 06:13:14 +00:00
.import ip65_init
.import dhcp_init
2009-03-28 09:59:53 +00:00
.import cfg_get_configuration_ptr
2009-03-28 12:57:24 +00:00
.import tftp_load_address
.importzp tftp_filename
.import tftp_ip
.import ip65_error
.import tftp_clear_callbacks
.import tftp_download
2009-04-16 23:40:10 +00:00
.import tftp_upload
2009-04-16 05:40:40 +00:00
.import tftp_set_callback_vector
2009-04-17 01:50:21 +00:00
.import tftp_filesize
2009-04-04 05:14:06 +00:00
.import dns_ip
.import dns_resolve
.import dns_set_hostname
2009-04-05 02:46:32 +00:00
.import udp_callback
.import udp_add_listener
2009-04-24 22:37:22 +00:00
.import udp_remove_listener
2009-04-05 02:46:32 +00:00
.import ip_inp
2009-04-05 11:34:20 +00:00
.import udp_inp
2009-04-06 07:31:45 +00:00
.import udp_send
.import udp_send_src
.import udp_send_src_port
.import udp_send_dest
.import udp_send_dest_port
.import udp_send_len
2009-07-17 02:53:46 +00:00
2009-04-05 10:10:53 +00:00
.import copymem
.import cfg_mac
2009-04-18 12:59:10 +00:00
.import cfg_tftp_server
2009-04-05 10:10:53 +00:00
.importzp copy_src
.importzp copy_dest
2009-04-12 12:45:25 +00:00
;reuse the copy_src zero page location
nb6 5 _ p a r a m s = c o p y _ s r c
2009-07-17 02:53:46 +00:00
buffer_ p t r = c o p y _ d e s t
2009-04-04 05:14:06 +00:00
.data
2009-04-12 12:45:25 +00:00
2009-04-17 01:50:21 +00:00
2009-04-04 05:14:06 +00:00
jmp_old_irq :
jmp $ 0 0 0 0
irq_handler_installed_flag :
.byte 0
2009-04-18 12:59:10 +00:00
ip_configured_flag :
.byte 0
2009-03-28 06:13:14 +00:00
.code
2009-04-04 05:14:06 +00:00
irq_handler :
jsr N B 6 5 _ V B L _ V E C T O R
jmp j m p _ o l d _ i r q
2009-03-28 12:57:24 +00:00
2009-04-18 12:59:10 +00:00
install_irq_handler :
ldax $ 3 1 4 ;previous IRQ handler
stax j m p _ o l d _ i r q + 1
sei ;don't want any interrupts while we fiddle with the vector
ldax #i r q _ h a n d l e r
stax $ 3 1 4 ;previous IRQ handler
sta i r q _ h a n d l e r _ i n s t a l l e d _ f l a g
cli
rts
2009-03-28 12:57:24 +00:00
set_tftp_params :
2009-04-18 12:59:10 +00:00
ldx #$ 03
:
lda c f g _ t f t p _ s e r v e r ,x
sta t f t p _ i p ,x
dex
bpl : -
2009-03-28 12:57:24 +00:00
ldy #N B 65 _ T F T P _ F I L E N A M E
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ f i l e n a m e
iny
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ f i l e n a m e + 1
ldy #N B 65 _ T F T P _ P O I N T E R
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ l o a d _ a d d r e s s
iny
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ l o a d _ a d d r e s s + 1
jsr t f t p _ c l e a r _ c a l l b a c k s
rts
2009-04-16 23:40:10 +00:00
set_tftp_callback_vector :
ldy #N B 65 _ T F T P _ P O I N T E R + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
lda ( n b65 _ p a r a m s ) ,y
jmp t f t p _ s e t _ c a l l b a c k _ v e c t o r
2009-03-28 12:57:24 +00:00
nb65_dispatcher :
2009-04-04 05:14:06 +00:00
stax n b65 _ p a r a m s
2009-04-05 10:10:53 +00:00
2009-03-28 09:59:53 +00:00
2009-04-10 01:19:42 +00:00
cpy #N B 65 _ I N I T I A L I Z E
2009-03-28 06:13:14 +00:00
bne : +
2009-04-18 12:59:10 +00:00
lda i p _ c o n f i g u r e d _ f l a g
bne i p _ c o n f i g u r e d
2009-04-17 10:59:03 +00:00
jsr i p65 _ i n i t
bcs i n i t _ f a i l e d
2009-04-18 12:59:10 +00:00
jsr i n s t a l l _ i r q _ h a n d l e r
2009-04-17 13:02:02 +00:00
jsr d h c p _ i n i t
bcc d h c p _ o k
2009-04-18 12:59:10 +00:00
jsr i p65 _ i n i t ;if DHCP failed, then reinit the IP stack (which will reset IP address etc that DHCP messed with to cartridge default values)
2009-07-17 02:53:46 +00:00
dhcp_ok :
2009-04-18 12:59:10 +00:00
lda #1
sta i p _ c o n f i g u r e d _ f l a g
2009-04-12 22:58:20 +00:00
irq_handler_installed :
clc
2009-04-17 10:59:03 +00:00
init_failed :
2009-04-12 22:58:20 +00:00
rts
2009-04-18 12:59:10 +00:00
ip_configured :
lda i r q _ h a n d l e r _ i n s t a l l e d _ f l a g
bne i r q _ h a n d l e r _ i n s t a l l e d
jsr i n s t a l l _ i r q _ h a n d l e r
2009-07-17 02:53:46 +00:00
clc
2009-04-18 12:59:10 +00:00
rts
2009-03-28 06:13:14 +00:00
:
2009-04-10 01:19:42 +00:00
cpy #N B 65 _ G E T _ I P _ C O N F I G
2009-03-28 06:13:14 +00:00
bne : +
2009-04-10 01:19:42 +00:00
ldax #c f g _ m a c
clc
rts
2009-03-28 06:13:14 +00:00
:
2009-04-10 01:19:42 +00:00
cpy #N B 65 _ D N S _ R E S O L V E
2009-04-04 05:14:06 +00:00
bne : +
2009-04-17 13:02:02 +00:00
phax
2009-04-04 05:14:06 +00:00
ldy #N B 65 _ D N S _ H O S T N A M E + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
lda ( n b65 _ p a r a m s ) ,y
2009-04-17 11:21:00 +00:00
jsr d n s _ s e t _ h o s t n a m e
bcs @dns_error
2009-04-04 05:14:06 +00:00
jsr d n s _ r e s o l v e
bcs @dns_error
2009-04-17 11:21:00 +00:00
2009-08-16 04:15:43 +00:00
ldy #N B 65 _ D N S _ H O S T N A M E _ I P
2009-04-17 13:02:02 +00:00
plax
stax n b65 _ p a r a m s
2009-08-16 04:15:43 +00:00
ldx #4
2009-04-04 05:14:06 +00:00
@copy_dns_ip:
lda d n s _ i p ,y
sta ( n b65 _ p a r a m s ) ,y
iny
dex
bne @copy_dns_ip
2009-04-17 13:02:02 +00:00
rts
2009-04-17 01:50:21 +00:00
@dns_error:
2009-04-17 13:02:02 +00:00
plax
2009-04-04 05:14:06 +00:00
rts
2009-04-17 01:50:21 +00:00
2009-04-04 05:14:06 +00:00
:
cpy #N B 65 _ U D P _ A D D _ L I S T E N E R
bne : +
ldy #N B 65 _ U D P _ L I S T E N E R _ C A L L B A C K
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ c a l l b a c k
iny
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ c a l l b a c k + 1
ldy #N B 65 _ U D P _ L I S T E N E R _ P O R T + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
2009-04-05 02:46:32 +00:00
lda ( n b65 _ p a r a m s ) ,y
2009-04-04 05:14:06 +00:00
jmp u d p _ a d d _ l i s t e n e r
:
2009-04-05 10:10:53 +00:00
cpy #N B 65 _ G E T _ I N P U T _ P A C K E T _ I N F O
2009-04-05 02:46:32 +00:00
bne : +
2009-04-05 11:34:20 +00:00
ldy #3
@copy_src_ip:
lda i p _ i n p + 1 2 ,y ;src IP
sta ( n b65 _ p a r a m s ) ,y
dey
bpl @copy_src_ip
ldy #N B 65 _ R E M O T E _ P O R T
lda u d p _ i n p + 1 ;src port (lo byte)
sta ( n b65 _ p a r a m s ) ,y
iny
lda u d p _ i n p + 0 ;src port (high byte)
sta ( n b65 _ p a r a m s ) ,y
iny
lda u d p _ i n p + 3 ;dest port (lo byte)
sta ( n b65 _ p a r a m s ) ,y
iny
lda u d p _ i n p + 2 ;dest port (high byte)
sta ( n b65 _ p a r a m s ) ,y
iny
sec
lda u d p _ i n p + 5 ;payload length (lo byte)
sbc #8 ;to remove length of header
sta ( n b65 _ p a r a m s ) ,y
iny
lda u d p _ i n p + 4 ;payload length (hi byte)
sbc #0 ;in case there was a carry from the lo byte
sta ( n b65 _ p a r a m s ) ,y
iny
2009-04-06 07:31:45 +00:00
lda #< ( u d p _ i n p + 8 ) ;payload ptr (lo byte)
2009-04-05 11:34:20 +00:00
sta ( n b65 _ p a r a m s ) ,y
iny
2009-04-06 07:31:45 +00:00
lda #> ( u d p _ i n p + 8 ) ;payload ptr (hi byte)
2009-04-05 11:34:20 +00:00
sta ( n b65 _ p a r a m s ) ,y
2009-07-17 05:31:54 +00:00
.ifdef API_VERSION
.if ( API_ V E R S I O N > 1 )
.import tcp_inbound_data_ptr
.import tcp_inbound_data_length
;for API V2+, we need to check if this is a TCP packet
lda i p _ i n p + 9 ;proto number
cmp #6 ;TCP
bne @not_tcp
ldy #N B 65 _ P A Y L O A D _ L E N G T H
lda t c p _ i n b o u n d _ d a t a _ l e n g t h
sta ( n b65 _ p a r a m s ) ,y
iny
lda t c p _ i n b o u n d _ d a t a _ l e n g t h + 1
sta ( n b65 _ p a r a m s ) ,y
ldy #N B 65 _ P A Y L O A D _ P O I N T E R
lda t c p _ i n b o u n d _ d a t a _ p t r
sta ( n b65 _ p a r a m s ) ,y
iny
lda t c p _ i n b o u n d _ d a t a _ p t r + 1
sta ( n b65 _ p a r a m s ) ,y
@not_tcp:
.endif
.endif
2009-04-05 02:46:32 +00:00
clc
rts
:
2009-04-06 07:31:45 +00:00
cpy #N B 65 _ S E N D _ U D P _ P A C K E T
bne : +
ldy #3
@copy_dest_ip:
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ d e s t ,y
dey
bpl @copy_dest_ip
ldy #N B 65 _ R E M O T E _ P O R T
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ d e s t _ p o r t
iny
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ d e s t _ p o r t + 1
iny
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ s r c _ p o r t
iny
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ s r c _ p o r t + 1
iny
2009-03-28 12:57:24 +00:00
2009-04-06 07:31:45 +00:00
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ l e n
iny
lda ( n b65 _ p a r a m s ) ,y
sta u d p _ s e n d _ l e n + 1
iny
;AX should point at data to send
lda ( n b65 _ p a r a m s ) ,y
pha
iny
lda ( n b65 _ p a r a m s ) ,y
tax
pla
jmp u d p _ s e n d
2009-04-24 22:37:22 +00:00
:
cpy #N B 65 _ U D P _ R E M O V E _ L I S T E N E R
bne : +
jmp u d p _ r e m o v e _ l i s t e n e r
2009-04-06 07:31:45 +00:00
:
2009-04-06 11:10:49 +00:00
2009-04-24 22:37:22 +00:00
2009-04-10 01:19:42 +00:00
cpy #N B 65 _ D E A C T I V A T E
2009-04-05 02:46:32 +00:00
bne : +
ldax j m p _ o l d _ i r q + 1
sei ;don't want any interrupts while we fiddle with the vector
stax $ 3 1 4 ;previous IRQ handler
2009-04-18 12:59:10 +00:00
lda #0
sta i r q _ h a n d l e r _ i n s t a l l e d _ f l a g
2009-04-05 02:46:32 +00:00
cli
clc
rts
:
2009-04-18 12:59:10 +00:00
cpy #N B 65 _ T F T P _ S E T _ S E R V E R
bne : +
ldy #3
@copy_tftp_server_ip:
lda ( n b65 _ p a r a m s ) ,y
sta c f g _ t f t p _ s e r v e r ,y
dey
bpl @copy_tftp_server_ip
clc
rts
:
2009-05-02 13:14:59 +00:00
cpy #N B 65 _ T F T P _ D O W N L O A D
2009-04-17 01:50:21 +00:00
bne : +
phax
jsr s e t _ t f t p _ p a r a m s
2009-05-02 13:14:59 +00:00
jsr t f t p _ d o w n l o a d
2009-04-17 01:50:21 +00:00
@after_tftp_call: ;write the current load address back to the param buffer (so if $0000 was passed in, the caller can find out the actual value used)
plax
bcs @tftp_error
stax n b65 _ p a r a m s
ldy #N B 65 _ T F T P _ P O I N T E R
lda t f t p _ l o a d _ a d d r e s s
sta ( n b65 _ p a r a m s ) ,y
iny
lda t f t p _ l o a d _ a d d r e s s + 1
sta ( n b65 _ p a r a m s ) ,y
ldy #N B 65 _ T F T P _ F I L E S I Z E
lda t f t p _ f i l e s i z e
sta ( n b65 _ p a r a m s ) ,y
iny
lda t f t p _ f i l e s i z e + 1
sta ( n b65 _ p a r a m s ) ,y
clc
@tftp_error:
rts
:
2009-04-15 21:39:33 +00:00
cpy #N B 65 _ T F T P _ C A L L B A C K _ D O W N L O A D
bne : +
2009-04-17 01:50:21 +00:00
phax
2009-04-15 21:39:33 +00:00
jsr s e t _ t f t p _ p a r a m s
2009-04-16 23:40:10 +00:00
jsr s e t _ t f t p _ c a l l b a c k _ v e c t o r
2009-04-17 01:50:21 +00:00
jsr t f t p _ d o w n l o a d
jmp @after_tftp_call
2009-04-15 21:39:33 +00:00
:
2009-04-17 15:48:31 +00:00
cpy #N B 65 _ T F T P _ U P L O A D
bne : +
phax
jsr s e t _ t f t p _ p a r a m s
ldy #N B 65 _ T F T P _ P O I N T E R
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ f i l e s i z e
iny
lda ( n b65 _ p a r a m s ) ,y
sta t f t p _ f i l e s i z e + 1
jsr t f t p _ d o w n l o a d
jmp @after_tftp_call
:
2009-04-16 23:40:10 +00:00
cpy #N B 65 _ T F T P _ C A L L B A C K _ U P L O A D
bne : +
jsr s e t _ t f t p _ p a r a m s
jsr s e t _ t f t p _ c a l l b a c k _ v e c t o r
jmp t f t p _ u p l o a d
:
2009-04-15 21:39:33 +00:00
2009-04-05 10:10:53 +00:00
cpy #N B 65 _ P R I N T _ A S C I I Z
bne : +
jsr p r i n t
clc
rts
:
2009-04-05 11:34:20 +00:00
cpy #N B 65 _ P R I N T _ H E X
2009-04-05 10:10:53 +00:00
bne : +
jsr p r i n t _ h e x
clc
rts
:
cpy #N B 65 _ P R I N T _ D O T T E D _ Q U A D
bne : +
jsr p r i n t _ d o t t e d _ q u a d
clc
rts
:
cpy #N B 65 _ P R I N T _ I P _ C O N F I G
bne : +
jsr p r i n t _ i p _ c o n f i g
clc
rts
:
2009-08-21 13:21:14 +00:00
cpy #N B 65 _ P R I N T _ I N T E G E R
bne : +
jsr p r i n t _ i n t e g e r
clc
rts
:
2009-07-17 02:53:46 +00:00
;these are the API "version 2" functions
.ifdef API_VERSION
.if ( API_ V E R S I O N > 1 )
.segment " TCP_ V A R S "
port_number : .res 2
2009-07-18 13:24:52 +00:00
nonzero_octets : .res 1
2009-07-17 02:53:46 +00:00
.code
2009-08-20 10:06:33 +00:00
cpy #N B 65 _ D O W N L O A D _ R E S O U R C E
bne : +
.import url_download
.import url_download_buffer
.import url_download_buffer_length
ldy #N B 65 _ U R L _ D O W N L O A D _ B U F F E R
lda ( n b65 _ p a r a m s ) ,y
sta u r l _ d o w n l o a d _ b u f f e r
iny
lda ( n b65 _ p a r a m s ) ,y
sta u r l _ d o w n l o a d _ b u f f e r + 1
ldy #N B 65 _ U R L _ D O W N L O A D _ B U F F E R _ L E N G T H
lda ( n b65 _ p a r a m s ) ,y
sta u r l _ d o w n l o a d _ b u f f e r _ l e n g t h
iny
lda ( n b65 _ p a r a m s ) ,y
sta u r l _ d o w n l o a d _ b u f f e r _ l e n g t h + 1
ldy #N B 65 _ U R L + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
lda ( n b65 _ p a r a m s ) ,y
jmp u r l _ d o w n l o a d
:
2009-08-21 13:21:14 +00:00
cpy #N B 65 _ P I N G _ H O S T
.import icmp_echo_ip
.import icmp_ping
bne : +
ldy #3
@copy_ping_ip_loop:
lda ( n b65 _ p a r a m s ) ,y
sta i c m p _ e c h o _ i p ,y
dey
bpl @copy_ping_ip_loop
jmp i c m p _ p i n g
:
2009-07-17 02:53:46 +00:00
cpy #N B 65 _ T C P _ C O N N E C T
2009-07-18 13:24:52 +00:00
bne : +
2009-07-17 02:53:46 +00:00
.import tcp_connect
.import tcp_callback
.import tcp_connect_ip
2009-07-18 13:24:52 +00:00
.import tcp_listen
2009-07-17 02:53:46 +00:00
ldy #3
2009-07-18 13:24:52 +00:00
lda #0
sta n o n z e r o _ o c t e t s
2009-07-17 02:53:46 +00:00
@copy_dest_ip:
lda ( n b65 _ p a r a m s ) ,y
2009-07-18 13:24:52 +00:00
beq @octet_was_zero
inc n o n z e r o _ o c t e t s
@octet_was_zero:
2009-07-17 02:53:46 +00:00
sta t c p _ c o n n e c t _ i p ,y
dey
bpl @copy_dest_ip
ldy #N B 65 _ T C P _ C A L L B A C K
lda ( n b65 _ p a r a m s ) ,y
sta t c p _ c a l l b a c k
iny
lda ( n b65 _ p a r a m s ) ,y
sta t c p _ c a l l b a c k + 1
ldy #N B 65 _ T C P _ P O R T + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
lda ( n b65 _ p a r a m s ) ,y
2009-07-18 13:24:52 +00:00
ldy n o n z e r o _ o c t e t s
bne @outbound_tcp_connection
jmp t c p _ l i s t e n
@outbound_tcp_connection:
2009-07-17 02:53:46 +00:00
jmp t c p _ c o n n e c t
:
2009-07-17 05:31:54 +00:00
.import tcp_send
.import tcp_send_data_len
cpy #N B 65 _ S E N D _ T C P _ P A C K E T
bne : +
ldy #N B 65 _ T C P _ P A Y L O A D _ L E N G T H
lda ( n b65 _ p a r a m s ) ,y
sta t c p _ s e n d _ d a t a _ l e n
iny
lda ( n b65 _ p a r a m s ) ,y
sta t c p _ s e n d _ d a t a _ l e n + 1
ldy #N B 65 _ T C P _ P A Y L O A D _ P O I N T E R + 1
lda ( n b65 _ p a r a m s ) ,y
tax
dey
lda ( n b65 _ p a r a m s ) ,y
jmp t c p _ s e n d
2009-07-17 02:53:46 +00:00
2009-07-17 05:31:54 +00:00
:
2009-07-17 02:53:46 +00:00
2009-07-17 13:10:44 +00:00
.import tcp_close
cpy #N B 65 _ T C P _ C L O S E _ C O N N E C T I O N
bne : +
jmp t c p _ c l o s e
:
2009-07-17 02:53:46 +00:00
.import filter_dns
.import get_filtered_input
.import filter_number
2009-07-24 00:17:41 +00:00
cpy #N B 65 _ I N P U T _ S T R I N G
bne : +
ldy #40 ;max chars
ldax #$ 0000
jmp g e t _ f i l t e r e d _ i n p u t
:
2009-07-17 02:53:46 +00:00
cpy #N B 65 _ I N P U T _ H O S T N A M E
bne : +
ldy #40 ;max chars
ldax #f i l t e r _ d n s
jmp g e t _ f i l t e r e d _ i n p u t
:
cpy #N B 65 _ I N P U T _ P O R T _ N U M B E R
bne : +
ldy #5 ;max chars
ldax #f i l t e r _ n u m b e r
jsr g e t _ f i l t e r e d _ i n p u t
bcs @no_port_entered
2009-08-11 11:32:06 +00:00
;AX now points a string containing port number
.import parse_integer
jmp p a r s e _ i n t e g e r
2009-07-17 02:53:46 +00:00
@no_port_entered:
rts
:
2009-07-19 10:57:28 +00:00
cpy #N B 65 _ B L O C K _ C O P Y
bne : +
;this is where we pay the price for trying to save a few 'zero page' pointers
;by reusing the 'copy_src' and 'copy_dest' addresses!
.segment " TCP_ V A R S "
tmp_copy_src : .res 2
tmp_copy_dest : .res 2
tmp_copy_length : .res 2
.code
ldy #N B 65 _ B L O C K _ S R C
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ s r c
iny
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ s r c + 1
ldy #N B 65 _ B L O C K _ D E S T
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ d e s t
iny
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ d e s t + 1
ldy #N B 65 _ B L O C K _ S I Z E
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ l e n g t h
iny
lda ( n b65 _ p a r a m s ) ,y
sta t m p _ c o p y _ l e n g t h + 1
ldax t m p _ c o p y _ s r c
stax c o p y _ s r c
ldax t m p _ c o p y _ d e s t
stax c o p y _ d e s t
ldax t m p _ c o p y _ l e n g t h
jmp c o p y m e m
:
2009-08-20 14:03:02 +00:00
cpy #N B 65 _ P A R S E R _ I N I T
bne : +
.import parser_init
jmp p a r s e r _ i n i t
:
cpy #N B 65 _ P A R S E R _ S K I P _ N E X T
bne : +
.import parser_skip_next
jmp p a r s e r _ s k i p _ n e x t
:
2009-07-17 02:53:46 +00:00
.endif
.endif
2009-04-05 10:10:53 +00:00
cpy #N B 65 _ G E T _ L A S T _ E R R O R
bne : +
lda i p65 _ e r r o r
clc
rts
:
2009-03-28 06:13:14 +00:00
;default function handler
2009-03-28 12:57:24 +00:00
lda #N B 65 _ E R R O R _ F U N C T I O N _ N O T _ S U P P O R T E D
sta i p65 _ e r r o r
2009-03-28 06:13:14 +00:00
sec ;carry flag set = error
rts