From 2ae35b34d933edd6d76ee4de77f80ef0559a958c Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Mon, 7 Jul 2014 20:56:21 +0200
Subject: [PATCH] Replaced custom zeropage variables with cc65 default zeropage
variables.
---
drivers/Makefile | 3 --
drivers/a2input.s | 5 ++-
drivers/a2zeropage.s | 36 --------------------
drivers/c64input.s | 6 ++--
drivers/c64zeropage.s | 36 --------------------
drivers/vic20input.s | 6 ++--
drivers/vic20zeropage.s | 36 --------------------
inc/commonprint.i | 4 +--
ip65/arithmetic.s | 15 +++------
ip65/arp.s | 5 ++-
ip65/cifs.s | 75 +++++++++++++++++++++--------------------
ip65/copymem.s | 6 ++--
ip65/debug.s | 6 ++--
ip65/dns.s | 5 +--
ip65/http.s | 8 ++---
ip65/httpd.s | 3 +-
ip65/ip.s | 13 +++----
ip65/parser.s | 9 +++--
ip65/string_utils.s | 7 ++--
ip65/tcp.s | 7 ++--
ip65/telnet.s | 3 +-
ip65/tftp.s | 3 +-
ip65/url.s | 37 ++++++++++----------
23 files changed, 108 insertions(+), 226 deletions(-)
delete mode 100644 drivers/a2zeropage.s
delete mode 100644 drivers/c64zeropage.s
delete mode 100644 drivers/vic20zeropage.s
diff --git a/drivers/Makefile b/drivers/Makefile
index 0daab44..c2a23aa 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -20,7 +20,6 @@ all: $(DRIVERS)
C64OBJS=\
contiki.o \
- c64zeropage.o \
c64print.o \
c64timer.o \
c64kernal.o \
@@ -29,7 +28,6 @@ C64OBJS=\
A2OBJS=\
contiki.o \
- a2zeropage.o \
a2print.o \
a2timer.o \
a2kernal.o \
@@ -38,7 +36,6 @@ A2OBJS=\
VIC20OBJS=\
contiki.o \
- vic20zeropage.o \
vic20print.o \
vic20timer.o \
vic20kernal.o \
diff --git a/drivers/a2input.s b/drivers/a2input.s
index cabc6a2..3289754 100644
--- a/drivers/a2input.s
+++ b/drivers/a2input.s
@@ -12,11 +12,10 @@
.import print_a
.import print_hex
-.importzp copy_src
-
+.include "zeropage.inc"
.include "../inc/common.i"
-allowed_ptr = copy_src ; reuse zero page
+allowed_ptr = ptr1
.code
diff --git a/drivers/a2zeropage.s b/drivers/a2zeropage.s
deleted file mode 100644
index 43149ea..0000000
--- a/drivers/a2zeropage.s
+++ /dev/null
@@ -1,36 +0,0 @@
-; zero page definitions
-
-.exportzp copy_src
-.exportzp copy_dest
-.exportzp dns_hostname
-.exportzp tftp_filename
-.exportzp buffer_ptr
-.exportzp eth_packet
-
-copy_src = $06 ; also $07 - source pointer
-copy_dest = $08 ; also $09 - destination pointer
-dns_hostname = $18 ; also $19
-tftp_filename = $1D ; also $1E - name of file to d/l or filemask to get directory listing for
-buffer_ptr = $EB ; also $EC - source pointer
-eth_packet = $ED ; also $EE
-
-
-
-; -- LICENSE --
-; The contents of this file are subject to the Mozilla Public License
-; Version 1.1 (the "License"); you may not use this file except in
-; compliance with the License. You may obtain a copy of the License at
-; http://www.mozilla.org/MPL/
-;
-; Software distributed under the License is distributed on an "AS IS"
-; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-; License for the specific language governing rights and limitations
-; under the License.
-;
-; The Original Code is ip65.
-;
-; The Initial Developer of the Original Code is Jonno Downes,
-; jonno@jamtronix.com.
-; Portions created by the Initial Developer are Copyright (C) 2013
-; Jonno Downes. All Rights Reserved.
-; -- LICENSE END --
diff --git a/drivers/c64input.s b/drivers/c64input.s
index 8329b4f..29e1e41 100644
--- a/drivers/c64input.s
+++ b/drivers/c64input.s
@@ -8,17 +8,17 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
-.importzp copy_src
.import ip65_process
+.include "zeropage.inc"
.include "../inc/common.i"
+allowed_ptr = ptr1
+
.code
-allowed_ptr = copy_src ; reuse zero page
-
; use C64 Kernel ROM function to read a key
; inputs: none
; outputs: A contains ASCII value of key just pressed
diff --git a/drivers/c64zeropage.s b/drivers/c64zeropage.s
deleted file mode 100644
index af40c2e..0000000
--- a/drivers/c64zeropage.s
+++ /dev/null
@@ -1,36 +0,0 @@
-; zero page definitions
-
-.exportzp copy_src
-.exportzp copy_dest
-.exportzp dns_hostname
-.exportzp tftp_filename
-.exportzp buffer_ptr
-.exportzp eth_packet
-
-copy_src = $5F ; also $60 - source pointer
-copy_dest = $61 ; also $62 - destination pointer
-dns_hostname = $63 ; also $64
-tftp_filename = $65 ; also $66 - name of file to d/l or filemask to get directory listing for
-buffer_ptr = $67 ; also $68 - source pointer
-eth_packet = $69 ; also $6A
-
-
-
-; -- LICENSE --
-; The contents of this file are subject to the Mozilla Public License
-; Version 1.1 (the "License"); you may not use this file except in
-; compliance with the License. You may obtain a copy of the License at
-; http://www.mozilla.org/MPL/
-;
-; Software distributed under the License is distributed on an "AS IS"
-; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-; License for the specific language governing rights and limitations
-; under the License.
-;
-; The Original Code is ip65.
-;
-; The Initial Developer of the Original Code is Jonno Downes,
-; jonno@jamtronix.com.
-; Portions created by the Initial Developer are Copyright (C) 2013
-; Jonno Downes. All Rights Reserved.
-; -- LICENSE END --
diff --git a/drivers/vic20input.s b/drivers/vic20input.s
index 291ab9f..aa57d4e 100644
--- a/drivers/vic20input.s
+++ b/drivers/vic20input.s
@@ -8,17 +8,17 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
-.importzp copy_src
.import ip65_process
+.include "zeropage.inc"
.include "../inc/common.i"
+allowed_ptr = ptr1
+
.code
-allowed_ptr = copy_src ; reuse zero page
-
; use Vic 20 Kernel ROM function to read a key
; inputs: none
; outputs: A contains ASCII value of key just pressed
diff --git a/drivers/vic20zeropage.s b/drivers/vic20zeropage.s
deleted file mode 100644
index af40c2e..0000000
--- a/drivers/vic20zeropage.s
+++ /dev/null
@@ -1,36 +0,0 @@
-; zero page definitions
-
-.exportzp copy_src
-.exportzp copy_dest
-.exportzp dns_hostname
-.exportzp tftp_filename
-.exportzp buffer_ptr
-.exportzp eth_packet
-
-copy_src = $5F ; also $60 - source pointer
-copy_dest = $61 ; also $62 - destination pointer
-dns_hostname = $63 ; also $64
-tftp_filename = $65 ; also $66 - name of file to d/l or filemask to get directory listing for
-buffer_ptr = $67 ; also $68 - source pointer
-eth_packet = $69 ; also $6A
-
-
-
-; -- LICENSE --
-; The contents of this file are subject to the Mozilla Public License
-; Version 1.1 (the "License"); you may not use this file except in
-; compliance with the License. You may obtain a copy of the License at
-; http://www.mozilla.org/MPL/
-;
-; Software distributed under the License is distributed on an "AS IS"
-; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-; License for the specific language governing rights and limitations
-; under the License.
-;
-; The Original Code is ip65.
-;
-; The Initial Developer of the Original Code is Jonno Downes,
-; jonno@jamtronix.com.
-; Portions created by the Initial Developer are Copyright (C) 2013
-; Jonno Downes. All Rights Reserved.
-; -- LICENSE END --
diff --git a/inc/commonprint.i b/inc/commonprint.i
index 8fda383..6b8d70f 100644
--- a/inc/commonprint.i
+++ b/inc/commonprint.i
@@ -4,6 +4,7 @@
.ifndef KPR_API_VERSION_NUMBER
.define EQU =
+ .include "zeropage.inc"
.include "../inc/kipper_constants.i"
.endif
@@ -34,8 +35,7 @@
.importzp copy_src
.import cfg_tftp_server
-; reuse the copy_src zero page var
-pptr = copy_src
+pptr = ptr1
.bss
diff --git a/ip65/arithmetic.s b/ip65/arithmetic.s
index 34379b7..63c2d5b 100644
--- a/ip65/arithmetic.s
+++ b/ip65/arithmetic.s
@@ -1,15 +1,8 @@
; helper routines for arithmetic on 32 bit numbers
+.include "zeropage.inc"
.include "../inc/common.i"
-; reuse the copy_* zero page locations as pointers for 32bit addition
-.importzp copy_src
-.importzp copy_dest
-
-acc32 = copy_src ; 32bit accumulater (pointer)
-op32 = copy_dest ; 32 bit operand (pointer)
-acc16 = acc32 ; 16bit accumulater (value, NOT pointer)
-
.bss
@@ -19,9 +12,9 @@ temp_ax: .res 2
.code
; no 16bit operand as can just use AX
-.exportzp acc32
-.exportzp op32
-.exportzp acc16
+.exportzp acc32 = ptr1 ; 32bit accumulater (pointer)
+.exportzp op32 = ptr2 ; 32 bit operand (pointer)
+.exportzp acc16 = acc32 ; 16bit accumulater (value, NOT pointer)
.export add_32_32
.export add_16_32
diff --git a/ip65/arp.s b/ip65/arp.s
index 2c59b5a..23b4121 100644
--- a/ip65/arp.s
+++ b/ip65/arp.s
@@ -1,5 +1,6 @@
; ARP address resolution
+.include "zeropage.inc"
.include "../inc/common.i"
.export arp_init
@@ -30,9 +31,7 @@
.import timer_read
.import timer_timeout
-.importzp copy_src
-
-ap = copy_src
+ap = ptr1
ARP_TIMEOUT_MS = 100
diff --git a/ip65/cifs.s b/ip65/cifs.s
index a38054e..d655ab9 100644
--- a/ip65/cifs.s
+++ b/ip65/cifs.s
@@ -3,6 +3,7 @@
;
; refs: RFC1001, RFC1002, "Implementing CIFS" - http://ubiqx.org/cifs/
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -69,7 +70,7 @@ nbns_registration_message_length = 68
; outputs:
; AX: pointer to decoded hostname
cifs_l1_encode:
- stax copy_src
+ stax ptr1
lda #0
tax
sta hostname_buffer+32
@@ -85,7 +86,7 @@ cifs_l1_encode:
ldy #0
ldx #0
@copy_loop:
- lda (copy_src),y
+ lda (ptr1),y
beq @done
lsr
lsr
@@ -95,7 +96,7 @@ cifs_l1_encode:
adc #$41
sta hostname_buffer,x
inx
- lda (copy_src),y
+ lda (ptr1),y
and #$0F
clc
adc #$41
@@ -115,11 +116,11 @@ cifs_l1_encode:
; outputs:
; AX: pointer to decoded hostname (will be 16 byte hostname, right padded with spaces, nul terminated)
cifs_l1_decode:
- stax copy_src
+ stax ptr1
ldy #0
ldx #0
@decode_loop:
- lda (copy_src),y
+ lda (ptr1),y
sec
sbc #$41
asl
@@ -128,7 +129,7 @@ cifs_l1_decode:
asl
sta hi_nibble
iny
- lda (copy_src),y
+ lda (ptr1),y
sec
sbc #$41
clc
@@ -306,10 +307,10 @@ nbns_callback:
@not_unicast:
; is it looking for our local hostname?
ldax #udp_inp+udp_data+nbns_question_name+1
- stax copy_src
+ stax ptr1
ldy #0
@cmp_loop:
- lda (copy_src),y
+ lda (ptr1),y
cmp local_hostname,y
bne @not_us
iny
@@ -396,19 +397,19 @@ nb_session_callback:
; have we got a complete message?
ldax cifs_cmd_buffer
- stax copy_src
+ stax ptr1
ldy #3
- lda (copy_src),y
+ lda (ptr1),y
cmp cifs_cmd_length
bne @not_got_full_message
dey
- lda (copy_src),y
+ lda (ptr1),y
cmp cifs_cmd_length+1
bne @not_got_full_message
; we have a complete message!
ldy #0
- lda (copy_src),y ; get the message type
+ lda (ptr1),y ; get the message type
cmp #$81 ; is it a session request?
bne @not_session_request
ldax #positive_session_response_packet_length
@@ -423,11 +424,11 @@ nb_session_callback:
; this SHOULD be a SMB - best check the header
ldy #4
- lda (copy_src),y ; get the message data
+ lda (ptr1),y ; get the message data
cmp #$FF ; start of SMB header
bne @not_smb
iny
- lda (copy_src),y ; get the message data
+ lda (ptr1),y ; get the message data
cmp #'S' ; start of SMB header
bne @not_smb
@@ -453,17 +454,17 @@ nb_session_callback:
rts
smb_handler:
- ; at this point, copy_src points to an SMB block encapsulated in an NBT session header
+ ; at this point, ptr1 points to an SMB block encapsulated in an NBT session header
clc
- lda copy_src
+ lda ptr1
adc #4
sta smb_ptr ; skip past the NBT header
- lda copy_src+1
+ lda ptr1+1
adc #00
sta smb_ptr+1
ldy #8
- lda (copy_src),y ; get the SMB type
+ lda (ptr1),y ; get the SMB type
cmp #$72
bne @not_negotiate_protocol
jmp @negotiate_protocol
@@ -484,7 +485,7 @@ smb_handler:
@parse_andx_block:
ldax andx_ptr
- stax copy_src
+ stax ptr1
lda andx_opcode
cmp #$ff
@@ -513,16 +514,16 @@ smb_handler:
@go_to_next_andx_block:
ldy #3
- lda (copy_src),y ; get the AndX offset low byte
+ lda (ptr1),y ; get the AndX offset low byte
clc
adc smb_ptr
sta andx_ptr
iny
- lda (copy_src),y ; get the AndX offset high byte
+ lda (ptr1),y ; get the AndX offset high byte
adc smb_ptr+1
sta andx_ptr+1
ldy #1
- lda (copy_src),y ; get the subsequent AndX opcode
+ lda (ptr1),y ; get the subsequent AndX opcode
sta andx_opcode
jmp @parse_andx_block
@@ -539,7 +540,7 @@ smb_handler:
; copy the request TID,PID,UID,MID into the response
ldy #28 ; offset of TID from start of message
ldx #0
-: lda (copy_src),y
+: lda (ptr1),y
sta negotiate_protocol_response_tid,x
inx
iny
@@ -552,10 +553,10 @@ smb_handler:
clc
lda cifs_cmd_buffer
adc #$26
- sta copy_src
+ sta ptr1
lda cifs_cmd_buffer+1
adc #$00
- sta copy_src+1
+ sta ptr1+1
ldy #$0
@dialect_scan_loop:
@@ -564,7 +565,7 @@ smb_handler:
lda dialect_index
cmp #$10 ; if we've scanned more than $10 dialects, something is wrong
beq @end_of_dialects
- lda (copy_src),y
+ lda (ptr1),y
cmp #$02
bne @test_dialect
inc dialect_index
@@ -572,14 +573,14 @@ smb_handler:
@test_dialect:
tya
clc
- adc copy_src
- sta copy_src
+ adc ptr1
+ sta ptr1
bcc :+
- inc copy_src+1
+ inc ptr1+1
: ldy #0
@test_dialect_loop:
- lda (copy_src),y
+ lda (ptr1),y
cmp preferred_dialect_id,y
bne @dialect_scan_loop
iny
@@ -601,11 +602,11 @@ smb_handler:
start_smb_response:
ldax smb_response_buffer
- stax copy_dest
+ stax ptr2
ldy #0
@copy_header_loop:
- lda (copy_src),y ; copy_src should be the SMB request - cloning this will set PID / MID etc
- sta (copy_dest),y
+ lda (ptr1),y ; copy_src should be the SMB request - cloning this will set PID / MID etc
+ sta (ptr2),y
iny
cpy #smb_response_header_length
bne @copy_header_loop
@@ -614,18 +615,18 @@ start_smb_response:
lda #smb_response_header_length
sta smb_response_length
ldy #3
- sta (copy_dest),y
+ sta (ptr2),y
; set the flags correctly
ldy #smb_response_flags_offset
lda #$82 ; FLAGS byte
- sta (copy_dest),y
+ sta (ptr2),y
iny
lda #$01 ; FLAGS2 low byte
- sta (copy_dest),y
+ sta (ptr2),y
iny
lda #$00 ; FLAGS2 hi byte
- sta (copy_dest),y
+ sta (ptr2),y
rts
add_andx_response:
diff --git a/ip65/copymem.s b/ip65/copymem.s
index 761db9d..8f85da8 100644
--- a/ip65/copymem.s
+++ b/ip65/copymem.s
@@ -1,8 +1,10 @@
; utility routine to copy memory
+.include "zeropage.inc"
+
.export copymem
-.importzp copy_src
-.importzp copy_dest
+.exportzp copy_src = ptr1
+.exportzp copy_dest = ptr2
.bss
diff --git a/ip65/debug.s b/ip65/debug.s
index f3866ad..9f0c17f 100644
--- a/ip65/debug.s
+++ b/ip65/debug.s
@@ -1,5 +1,6 @@
; routines for dumping debug information
+.include "zeropage.inc"
.include "../inc/common.i"
.include "../inc/printf.i"
@@ -14,7 +15,6 @@
.import eth_outp, eth_outp_len
.import ip_outp
.import udp_outp
-.importzp copy_src
.code
@@ -105,7 +105,7 @@ console_out = $ffd2
; inputs: AX = address of (null terminated) string to print
; outputs: none
console_strout:
- stax copy_src
+ stax ptr1
pha
txa
@@ -113,7 +113,7 @@ console_strout:
tya
pha
ldy #0
-: lda (copy_src),y
+: lda (ptr1),y
beq @done
jsr console_out
iny
diff --git a/ip65/dns.s b/ip65/dns.s
index 93a21c0..16b8931 100644
--- a/ip65/dns.s
+++ b/ip65/dns.s
@@ -1,7 +1,8 @@
; minimal dns implementation - requires a DNS server that supports recursion
- MAX_DNS_MESSAGES_SENT = 8 ; timeout after sending 8 messages will be about 7 seconds (1+2+3+4+5+6+7+8)/4
+MAX_DNS_MESSAGES_SENT = 8 ; timeout after sending 8 messages will be about 7 seconds (1+2+3+4+5+6+7+8)/4
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -38,7 +39,7 @@
.import check_for_abort_key
.import timer_read
-.importzp dns_hostname
+dns_hostname = ptr1
.bss
diff --git a/ip65/http.s b/ip65/http.s
index 4045b61..60624b9 100644
--- a/ip65/http.s
+++ b/ip65/http.s
@@ -3,6 +3,7 @@
; NB - this routine uses the same buffer space and zero page locations as many other ip65 routines. so do not call
; other ip65 routines between the http_parse_request & http_get_value else odd things will happen.
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -13,14 +14,11 @@
.export http_parse_request
.export http_get_value
-.importzp copy_src
-.importzp copy_dest
.import output_buffer
.import parse_hex_digits
-; reuse the copy_src zero page var
-string_ptr = copy_src
-table_ptr = copy_dest
+string_ptr = ptr1
+table_ptr = ptr2
.bss
diff --git a/ip65/httpd.s b/ip65/httpd.s
index d84b6ab..a124479 100644
--- a/ip65/httpd.s
+++ b/ip65/httpd.s
@@ -1,6 +1,7 @@
; a simple HTTP server
; to use - call httpd_start with AX pointing at routine to call for each inbound page
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -33,7 +34,7 @@ HTTPD_TIMEOUT_SECONDS = 5 ; what's the maximum time we let 1 connection be
.import native_to_ascii
.import timer_seconds
-temp_ptr = copy_src
+temp_ptr = ptr1
.bss
diff --git a/ip65/ip.s b/ip65/ip.s
index c912a6c..b4749fa 100644
--- a/ip65/ip.s
+++ b/ip65/ip.s
@@ -1,3 +1,4 @@
+.include "zeropage.inc"
.include "../inc/common.i"
.export ip_init
@@ -56,11 +57,7 @@
.import tcp_process
.endif
-.importzp copy_src
-.importzp copy_dest
-.exportzp ip_cksum_ptr
-
-ip_cksum_ptr=copy_dest
+.exportzp ip_cksum_ptr = ptr2
.bss
@@ -347,13 +344,13 @@ ip_send:
rol ; pad with 0
; clc
adc #ip_outp
- sta copy_src + 1
+ sta ptr1 + 1
ldy #0
tya
- sta (copy_src),y
+ sta (ptr1),y
sec ; round up to even number
@dontpad:
lda ip_outp + ip_len + 1
diff --git a/ip65/parser.s b/ip65/parser.s
index c75bed2..f11abaf 100644
--- a/ip65/parser.s
+++ b/ip65/parser.s
@@ -4,12 +4,8 @@
.export parser_init
.export parser_skip_next
-.importzp copy_src
-.importzp copy_dest
-
-target_string = copy_src
-search_string = copy_dest
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -17,6 +13,9 @@ search_string = copy_dest
.include "../inc/kipper_constants.i"
.endif
+target_string = ptr1
+search_string = ptr2
+
.bss
diff --git a/ip65/string_utils.s b/ip65/string_utils.s
index 3af7cee..9853fa8 100644
--- a/ip65/string_utils.s
+++ b/ip65/string_utils.s
@@ -3,15 +3,14 @@
.export parse_integer
.export parse_hex_digits
-.importzp copy_dest
-
.import mul_8_16
.importzp acc16
-target_string = copy_dest
-
+.include "zeropage.inc"
.include "../inc/common.i"
+target_string = ptr2
+
.bss
diff --git a/ip65/tcp.s b/ip65/tcp.s
index 4e1f103..89b2d5e 100644
--- a/ip65/tcp.s
+++ b/ip65/tcp.s
@@ -7,6 +7,7 @@
MAX_TCP_PACKETS_SENT = 8 ; timeout after sending 8 messages will be about 7 seconds (1+2+3+4+5+6+7+8)/4
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -378,16 +379,16 @@ tcp_close:
; carry flag is set if an error occured, clear otherwise
tcp_send_string:
stax tcp_send_data_ptr
- stax copy_src
+ stax ptr1
lda #0
tay
sta tcp_send_data_len
sta tcp_send_data_len+1
- lda (copy_src),y
+ lda (ptr1),y
bne @find_end_of_string
rts ; if the string is empty, don't send anything!
@find_end_of_string:
- lda (copy_src),y
+ lda (ptr1),y
beq @done
inc tcp_send_data_len
iny
diff --git a/ip65/telnet.s b/ip65/telnet.s
index e576c07..522c983 100644
--- a/ip65/telnet.s
+++ b/ip65/telnet.s
@@ -6,6 +6,7 @@
; telnet_menu - called whenever the F1 key is pressed.
; telnet_on_connection - called after succesful connection
+.include "zeropage.inc"
.include "../inc/common.i"
.import tcp_connect
@@ -45,7 +46,7 @@
.import telnet_menu
.import telnet_on_connection
-.importzp buffer_ptr
+buffer_ptr = ptr4
.code
diff --git a/ip65/tftp.s b/ip65/tftp.s
index ea2d89f..2b1fe9c 100644
--- a/ip65/tftp.s
+++ b/ip65/tftp.s
@@ -4,6 +4,7 @@
TFTP_MAX_RESENDS = 10
TFTP_TIMER_MASK = $F8 ; mask lower two bits, means we wait for 8 x1/4 seconds
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -48,7 +49,7 @@ TFTP_TIMER_MASK = $F8 ; mask lower two bits, means we wait for 8 x1/4
.import timer_read
-.importzp tftp_filename
+.exportzp tftp_filename = ptr3
.bss
diff --git a/ip65/url.s b/ip65/url.s
index 2d24f55..4933ae5 100644
--- a/ip65/url.s
+++ b/ip65/url.s
@@ -1,5 +1,6 @@
; routines for parsing a URL, and downloading an URL
+.include "zeropage.inc"
.include "../inc/common.i"
.ifndef KPR_API_VERSION_NUMBER
@@ -41,8 +42,8 @@ TIMEOUT_SECONDS = 15
.export url_download_buffer_length
.export resource_download
-target_string = copy_src
-search_string = copy_dest
+target_string = ptr1
+search_string = ptr2
selector_buffer = output_buffer
@@ -155,9 +156,9 @@ lda #url_type_gopher
ldax #slash
jsr parser_skip_next
; AX now pointing at selector
- stax copy_src
+ stax ptr1
ldax #selector_buffer
- stax copy_dest
+ stax ptr2
lda #0
sta src_ptr
sta dest_ptr
@@ -167,7 +168,7 @@ lda #url_type_gopher
bne @not_gopher
; first byte after / in a gopher url is the resource type
ldy src_ptr
- lda (copy_src),y
+ lda (ptr1),y
beq @start_of_selector
sta url_resource_type
inc src_ptr
@@ -180,7 +181,7 @@ lda #url_type_gopher
ldy #get_length-1
sty dest_ptr
: lda get,y
- sta (copy_dest),y
+ sta (ptr2),y
dey
bpl :-
@@ -190,13 +191,13 @@ lda #url_type_gopher
jmp @save_first_byte_of_selector
@copy_one_byte:
ldy src_ptr
- lda (copy_src),y
+ lda (ptr1),y
cmp #$20
bcc @end_of_selector ; any control char (including CR,LF, and $00) should be treated as end of URL
inc src_ptr
@save_first_byte_of_selector:
ldy dest_ptr
- sta (copy_dest),y
+ sta (ptr2),y
inc dest_ptr
bne @copy_one_byte
@end_of_selector:
@@ -212,22 +213,22 @@ lda #url_type_gopher
beq :+
ldy dest_ptr
inc dest_ptr
- sta (copy_dest),y
+ sta (ptr2),y
inx
bne :-
: ; now copy the host field
jsr skip_to_hostname
; AX now pointing at hostname
- stax copy_src
+ stax ptr1
ldax #selector_buffer
- stax copy_dest
+ stax ptr2
lda #0
sta src_ptr
@copy_one_byte_of_hostname:
ldy src_ptr
- lda (copy_src),y
+ lda (ptr1),y
beq @end_of_hostname
cmp #':'
beq @end_of_hostname
@@ -235,7 +236,7 @@ lda #url_type_gopher
beq @end_of_hostname
inc src_ptr
ldy dest_ptr
- sta (copy_dest),y
+ sta (ptr2),y
inc dest_ptr
bne @copy_one_byte_of_hostname
@end_of_hostname:
@@ -244,10 +245,10 @@ lda #url_type_gopher
@final_crlf:
ldy dest_ptr
lda #$0d
- sta (copy_dest),y
+ sta (ptr2),y
iny
lda #$0a
- sta (copy_dest),y
+ sta (ptr2),y
iny
sty dest_ptr
dex
@@ -255,7 +256,7 @@ lda #url_type_gopher
@done:
lda #$00
- sta (copy_dest),y
+ sta (ptr2),y
ldax #selector_buffer
stax url_selector
clc
@@ -351,10 +352,10 @@ resource_download:
put_zero_at_end_of_dl_buffer:
; put a zero byte at the end of the file
ldax temp_buffer
- stax copy_dest
+ stax ptr2
lda #0
tay
- sta (copy_dest),y
+ sta (ptr2),y
rts
not_end_of_file: