Squeeze Monitor into top 1K, use common function names for UART for compatibility
This commit is contained in:
10
16c550.asm
10
16c550.asm
@@ -25,18 +25,17 @@ uart_reg5 = $c0c5
|
||||
uart_reg6 = $c0c6
|
||||
uart_reg7 = $c0c7
|
||||
uart_xmit = uart_reg0 ; Used by upload.asm
|
||||
;uart_recv = $c040
|
||||
;uart_status = $c041
|
||||
|
||||
;
|
||||
;***********************************************************************
|
||||
; UART I/O Support Routines
|
||||
|
||||
; We'll use Daryl's routine names for compatibility with his software/code
|
||||
; Otherwise, we'll use UART-agnostic nomemclature
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;
|
||||
|
||||
|
||||
ACIA1_init
|
||||
uart_init
|
||||
lda #$80 ; Line control register, Set DLAB=1
|
||||
sta uart_reg3
|
||||
@@ -58,6 +57,7 @@ uart_init
|
||||
;---------------------------------------------------------------------
|
||||
; Input char from UART (blocking)
|
||||
; Exit: character in A
|
||||
ACIA1_Input
|
||||
uart_input
|
||||
lda uart_reg5 ; Serial port status
|
||||
and #$01 ; is recvr full
|
||||
@@ -68,6 +68,7 @@ uart_input
|
||||
;---------------------------------------------------------------------
|
||||
; Non-waiting get character routine
|
||||
; Scan for input (no wait), C=1 char, C=0 no character
|
||||
ACIA1_Scan
|
||||
uart_scan
|
||||
clc
|
||||
lda uart_reg5 ; Serial port status
|
||||
@@ -81,6 +82,7 @@ uart_scan2 rts
|
||||
; output to OutPut Port
|
||||
; Entry: character in A
|
||||
; Exit: character in A
|
||||
ACIA1_Output
|
||||
uart_output
|
||||
pha ; save registers
|
||||
uart_out1
|
||||
|
||||
@@ -21,10 +21,12 @@ uart_status = $c041
|
||||
;
|
||||
;***********************************************************************
|
||||
; UART I/O Support Routines
|
||||
|
||||
; We'll use Daryl's routine names for compatibility with his software/code
|
||||
; Otherwise, we'll use UART-agnostic nomemclature
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;
|
||||
ACIA1_init
|
||||
uart_init
|
||||
; Nothing to init
|
||||
ldx #4
|
||||
@@ -40,6 +42,7 @@ ui_loop
|
||||
;---------------------------------------------------------------------
|
||||
; Input char from UART (blocking)
|
||||
; Exit: character in A
|
||||
ACIA1_Input
|
||||
uart_input
|
||||
lda uart_status ; Serial port status
|
||||
and #$01 ; is recvr full
|
||||
@@ -50,6 +53,7 @@ uart_input
|
||||
;---------------------------------------------------------------------
|
||||
; Non-waiting get character routine
|
||||
; Scan for input (no wait), C=1 char, C=0 no character
|
||||
ACIA1_Scan
|
||||
uart_scan
|
||||
clc
|
||||
lda uart_status ; Serial port status
|
||||
@@ -63,6 +67,7 @@ uart_scan2 rts
|
||||
; output to OutPut Port
|
||||
; Entry: character in A
|
||||
; Exit: character in A
|
||||
ACIA1_Output
|
||||
uart_output
|
||||
pha ; save registers
|
||||
uart_out1
|
||||
|
||||
39
sbcmon.asm
39
sbcmon.asm
@@ -10,29 +10,20 @@
|
||||
;
|
||||
;*********************************************************************
|
||||
; local Zero-page variables
|
||||
;
|
||||
xsav = $30 ; 1 byte
|
||||
ysav = $31 ; 1 byte
|
||||
rowcount = $32
|
||||
;Prompt = $32 ; 1 byte
|
||||
;linecnt = $33 ; 1 byte
|
||||
;Modejmp = $34 ; 1 byte
|
||||
;Hexdigcnt = $35 ; 1 byte
|
||||
;OPCtxtptr = $36 ; 1 byte
|
||||
;Memchr = $37 ; 1 byte
|
||||
Startaddr = $38 ; 2 bytes
|
||||
Startaddr_H = $39
|
||||
;Addrptr = $3a ; 2 bytes
|
||||
;Addrptr_H = $3b
|
||||
Hexdigits = $3c ; 2 bytes
|
||||
Hexdigits_H = $3d
|
||||
;Memptr = $3e ; 2 bytes
|
||||
;Memptr_H = $3f
|
||||
strptr = $40
|
||||
strptrh = $41 ; temporary string pointer (not preserved across calls)
|
||||
;
|
||||
; Modified from Daryl's code so that we overlap with EhBASIC as little
|
||||
; as possible. This was needed to debug EhBASIC during the porting process
|
||||
|
||||
ysav = $e0 ; 1 byte
|
||||
rowcount = $e1 ; 1 byte
|
||||
Startaddr = $e2 ; 2 bytes
|
||||
Startaddr_H = $e3
|
||||
Hexdigits = $e4 ; 2 bytes
|
||||
Hexdigits_H = $e5
|
||||
strptr = $e6
|
||||
strptrh = $e7 ; temporary string pointer (not preserved across calls)
|
||||
|
||||
; Local Non-Zero Page Variables
|
||||
;
|
||||
; Unchange from Daryl's code except for addition of the interrupt vectors
|
||||
buffer = $0300 ; keybd input buffer (127 chrs max)
|
||||
PCH = $03e0 ; hold program counter (need PCH next to PCL for Printreg routine)
|
||||
PCL = $03e1 ; ""
|
||||
@@ -60,7 +51,6 @@ nmi_vector = $03ea ; NMI vector
|
||||
; Print2SP - prints 2 spaces
|
||||
; Print1SP - prints 1 space
|
||||
; Input_Char - get one byte from input port, waits for input
|
||||
; check_Input - Checks for an input character (no waiting)
|
||||
; Output_char - send one byte to the console
|
||||
; *************************************************************************
|
||||
;
|
||||
@@ -551,9 +541,6 @@ Version jsr Print_CR ;
|
||||
jsr PrintStrAX
|
||||
rts ;
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;
|
||||
|
||||
;
|
||||
;-----------DATA TABLES ------------------------------------------------
|
||||
;
|
||||
|
||||
103
upload.asm
103
upload.asm
@@ -5,102 +5,17 @@
|
||||
; upload.asm
|
||||
; By Daryl Rictor & Ross Archer Aug 2002
|
||||
;
|
||||
; 21st century code for 20th century CPUs (tm?)
|
||||
;
|
||||
; A simple file transfer program to allow upload from a serial
|
||||
; port to the SBC. It integrates both x-modem/CRC transfer protocol
|
||||
; and Intel Hex formatted files. Primary is XMODEM-CRC, due to its
|
||||
; superior reliability. Fallback to Intel Hex is automagical following
|
||||
; receipt of the first Hexfile d/l character, so the selection is
|
||||
; transparent to the user.
|
||||
;
|
||||
; Files uploaded via XMODEM-CRC must be
|
||||
; in .o64 format -- the first two bytes are the load address in
|
||||
; little-endian format:
|
||||
; FIRST BLOCK
|
||||
; offset(0) = lo(load start address),
|
||||
; offset(1) = hi(load start address)
|
||||
; offset(2) = data byte (0)
|
||||
; offset(n) = data byte (n-2)
|
||||
;
|
||||
; Subsequent blocks
|
||||
; offset(n) = data byte (n)
|
||||
;
|
||||
; The TASS assembler and most Commodore 64-based tools generate this
|
||||
; data format automatically and you can transfer their .obj/.o64 output
|
||||
; file directly.
|
||||
;
|
||||
; The only time you need to do anything special is if you have
|
||||
; a raw memory image file (say you want to load a data
|
||||
; table into memory). For XMODEM you'll have to
|
||||
; "insert" the start address bytes to the front of the file.
|
||||
; Otherwise, XMODEM would have no idea where to start putting
|
||||
; the data.
|
||||
;
|
||||
; The "fallback" format is Intel Hex. As address information is included
|
||||
; at the start of each line of an Intel Hex file, there is no need for a special
|
||||
; "first block". As soon as the receiver sees an Intel Hex
|
||||
; character ':' coming in, it aborts the XMODEM-CRC upload attempt and
|
||||
; tries to accept Intel Hex instead. This is the format used natively
|
||||
; by a lot of generic tools such as TASM.
|
||||
; Note there is no "fallback fallback." Once it quits CRC and
|
||||
; thinks you're sending it Intel Hex, you either have to finish the download
|
||||
; or press CTRL-C to abort.
|
||||
;
|
||||
; By having support for both formats under the same "U"pload command,
|
||||
; it enables seamless switching between either kind of toolchain with
|
||||
; no special user intervention. This seemed like a Good Thing (tm).
|
||||
;
|
||||
; Note: testing shows that no end-of-line delay is required for Intel Hex
|
||||
; uploads, but in case your circumstances differ and you encounter
|
||||
; error indications from a download (especially if you decided to run the
|
||||
; controller under 1 Mhz), adding a 10-50 mS delay after each line is
|
||||
; harmless and will ensure no problems even at low clock speeds
|
||||
;
|
||||
;
|
||||
; Style conventions being tried on this file for possible future adoption:
|
||||
; 1. Constants known at assembly time are ALL CAPS
|
||||
; 2. Variables are all lower-case, with underscores used as the word separator
|
||||
; 3. Labels are PascalStyleLikeThis to distinguish from constants and variables
|
||||
; 4. Old labels from external modules are left alone. We may want
|
||||
; to adopt these conventions and retrofit old source later.
|
||||
; 5. Op-codes are lower-case
|
||||
; 6. Comments are free-style but ought to line up with similar adjacent comments
|
||||
|
||||
; zero page variables (Its ok to stomp on the monitor's zp vars)
|
||||
;
|
||||
;
|
||||
;crc = $38 ; CRC lo byte
|
||||
;crch = $39 ; CRC hi byte
|
||||
;ptr = $3a ; data pointer
|
||||
;ptrh = $3b ; " "
|
||||
;blkno = $3c ; block number
|
||||
;retry = $3d ; retry counter
|
||||
;retry2 = $3e ; 2nd counter
|
||||
;bflag = $3f ; block flag
|
||||
temp = $e0 ; save hex value
|
||||
chksum = $e8 ; record checksum accumulator
|
||||
reclen = $ea ; record length in bytes
|
||||
start_lo = $ec
|
||||
start_hi = $ed
|
||||
rectype = $ee
|
||||
dlfail = $ef ; flag for upload failure
|
||||
bytecount_l = $f0
|
||||
bytecount_h = $f1
|
||||
|
||||
bytecount_l = $36
|
||||
bytecount_h = $37
|
||||
chksum = $38 ; record checksum accumulator
|
||||
reclen = $39 ; record length in bytes
|
||||
start_lo = $3b
|
||||
start_hi = $3c
|
||||
rectype = $3d
|
||||
dlfail = $3e ; flag for upload failure
|
||||
temp = $3f ; save hex value
|
||||
|
||||
;
|
||||
; tables and constants
|
||||
;
|
||||
;crclo = $7a00 ; Two 256-byte tables for quick lookup
|
||||
;crchi = $7b00 ; (should be page-aligned for speed)
|
||||
;Rbuff = $0300 ; temp 128 byte receive buffer
|
||||
; (uses the Monitor's input buffer)
|
||||
SOH = $01 ; start block
|
||||
EOT = $04 ; end of text marker
|
||||
ACK = $06 ; good block acknowleged
|
||||
NAK = $15 ; bad block acknowleged
|
||||
CAN = $18 ; cancel (not standard, not supported)
|
||||
CR = 13
|
||||
LF = 10
|
||||
ESC = 27 ; ESC to exit
|
||||
|
||||
Reference in New Issue
Block a user