Awesome.
By the way, the same routine running with the loop J3 2-3 (no connection to other serial device) you can measure those voltages at ACIA-2 . They are just reversed ie Tx lo will Rx lo.
Question regarding RS-232 interface for C1P
-
- Posts: 356
- Joined: Wed Mar 16, 2011 1:49 am
- Location: New Zealand
Re: Question regarding RS-232 interface for C1P
600RevB:16K,2MHz,64x32,470,CEGMON
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
-
- Posts: 63
- Joined: Mon Oct 27, 2014 10:23 pm
- Location: Germany
Re: Question regarding RS-232 interface for C1P
I did first tests to upload programs over the serial port. I uploaded a BASIC program via the LOAD command, and a program compiled with cc65 into the machine monitor.
The surprising result is that loading the BASIC program does not work, while the uploading via the machine monitor works reliably. In both cases I sent the binary data of the file from my Windows 10 laptop with Powershell using the System.IO.Ports.SerialPort class over an USB to RS-232 adapter.
The strange thing is that I always get the same errors in the uploaded BASIC program, e.g. always the same line numbers are corrupted so that for example line number 210 is truncated to 10. The rest of the line is ok then.
Do BASIC programs need any special formatting for reliable upload over RS-232?
The surprising result is that loading the BASIC program does not work, while the uploading via the machine monitor works reliably. In both cases I sent the binary data of the file from my Windows 10 laptop with Powershell using the System.IO.Ports.SerialPort class over an USB to RS-232 adapter.
The strange thing is that I always get the same errors in the uploaded BASIC program, e.g. always the same line numbers are corrupted so that for example line number 210 is truncated to 10. The rest of the line is ok then.
Do BASIC programs need any special formatting for reliable upload over RS-232?
C1P Model 600 CPU 1978 REV B, 40K (8K original and 32K BillO memory expansion), RS-232
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
-
- Site Admin
- Posts: 726
- Joined: Tue Sep 09, 2008 5:24 am
Re: Question regarding RS-232 interface for C1P
Nice!
Try entering some NULLs (0x00 = ^@) at the start of each line.
BASIC actually has a command (NULL x, where x=1 to 8) to add some NULL bytes automatically at the beginning of each line when listing programs to cassette, for exactly that reason.
Dave
Yes, especially when you increase the speed over 300 baud. The C1/2/4 machines don't by default use interrupt driven I/O, so there's no buffering of the serial stream. BASIC has to scroll the screen and digest the line before it's ready for the next one. That takes a few msec. You will need to add some padding at the beginning of each line to soak up those few msec, and the paddiing will increase proportionate to the baud rate.stm wrote:Do BASIC programs need any special formatting for reliable upload over RS-232?
Try entering some NULLs (0x00 = ^@) at the start of each line.
BASIC actually has a command (NULL x, where x=1 to 8) to add some NULL bytes automatically at the beginning of each line when listing programs to cassette, for exactly that reason.
Dave
-
- Posts: 356
- Joined: Wed Mar 16, 2011 1:49 am
- Location: New Zealand
Re: Question regarding RS-232 interface for C1P
A9 03
8D 00 F0
A9 B0
8D 00 F0
60
Will give you 16X your board rate for MC loads.(Reset will return to normal)
Cegmon allows you to set your screen window to 1 line for fast scrolling. Screen Edit of BASIC and Assembler source, breakpoints etc...
Your file transfer program (eg TeraTermPro ) may allow you to set a line delay. 500ms works well for BASIC at 300 baud if your file has no NULLS.
8D 00 F0
A9 B0
8D 00 F0
60
Will give you 16X your board rate for MC loads.(Reset will return to normal)
Cegmon allows you to set your screen window to 1 line for fast scrolling. Screen Edit of BASIC and Assembler source, breakpoints etc...
Your file transfer program (eg TeraTermPro ) may allow you to set a line delay. 500ms works well for BASIC at 300 baud if your file has no NULLS.
600RevB:16K,2MHz,64x32,470,CEGMON
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
-
- Posts: 63
- Joined: Mon Oct 27, 2014 10:23 pm
- Location: Germany
Re: Question regarding RS-232 interface for C1P
Ah, the NULL command rings a bell now, thanks. So if I send the program from my laptop from a plain ASCII file, I need to modify my PowerShell script to add the NULL bytes before each line. I will try that next.dave wrote:Nice!
Yes, especially when you increase the speed over 300 baud. The C1/2/4 machines don't by default use interrupt driven I/O, so there's no buffering of the serial stream. BASIC has to scroll the screen and digest the line before it's ready for the next one. That takes a few msec. You will need to add some padding at the beginning of each line to soak up those few msec, and the paddiing will increase proportionate to the baud rate.stm wrote:Do BASIC programs need any special formatting for reliable upload over RS-232?
Try entering some NULLs (0x00 = ^@) at the start of each line.
BASIC actually has a command (NULL x, where x=1 to 8) to add some NULL bytes automatically at the beginning of each line when listing programs to cassette, for exactly that reason.
Dave
C1P Model 600 CPU 1978 REV B, 40K (8K original and 32K BillO memory expansion), RS-232
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
-
- Posts: 63
- Joined: Mon Oct 27, 2014 10:23 pm
- Location: Germany
Re: Question regarding RS-232 interface for C1P
After adding the feature to send three NULLs before each line, uploading BASIC programs from text files now works perfectly.
C1P Model 600 CPU 1978 REV B, 40K (8K original and 32K BillO memory expansion), RS-232
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
-
- Posts: 356
- Joined: Wed Mar 16, 2011 1:49 am
- Location: New Zealand
Re: Question regarding RS-232 interface for C1P
Could you show us how you did this in your script please Stephan.
600RevB:16K,2MHz,64x32,470,CEGMON
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
SuperKit:502,540B,542B,CEGMON, 8" and 5" FDDs
Cards:PE IO,6522 D-A-D, AY3-8910,ProgramGraphics,Color,UK101
WIP:HexDOS,FDD Emulator
-
- Posts: 63
- Joined: Mon Oct 27, 2014 10:23 pm
- Location: Germany
Re: Question regarding RS-232 interface for C1P
Sure. This is the script that uploads a BASIC file:MK14HAK wrote:Could you show us how you did this in your script please Stephan.
Code: Select all
<#
.SYNOPSIS
Upload BASIC file over the RS-232 port to a Challenger 1P
.DESCRIPTION
This script uploads BASIC files over the RS-232 interface of an
Ohio Scientific Challenger 1P. The computer must have been put into
load mode with the LOAD command. The script sends a configurable
number of NULL bytes before each line.
.PARAMETER baudrate
Baud rate of the serial port
.PARAMETER nullbytes
Number of NULL bytes to send before each line
.PARAMETER comport
Windows COM port
.PARAMETER infile
BASIC file to upload
#>
param (
[string]$baudrate = 300,
[string]$nullbytes = 3,
[Parameter(Mandatory=$true)][string]$comport,
[Parameter(Mandatory=$true)][string]$infile
)
$infilepath = Resolve-Path $infile
$nulls = [Byte[]] (,0 * $nullbytes)
$port = new-Object System.IO.Ports.SerialPort $comport, $baudrate, None, 8, one
$port.NewLine = "`r"
$port.Open()
$reader = [System.IO.File]::OpenText($infilepath)
try {
for() {
$line = $reader.ReadLine()
if ($line -eq $null) { break }
# Write the NULL bytes before each line
$port.Write($nulls, 0, $nulls.Count)
# process the line
$port.WriteLine($line)
# echo the line to the shell
$line
}
}
finally {
$reader.Close()
$port.Close()
}
Code: Select all
<#
.SYNOPSIS
Upload a file over the RS-232 port to a Challenger 1P into the PROM monitor
.DESCRIPTION
This script uploads a file over the RS-232 port into the Challenger 1P
PROM monitor. The file must consist of a sequence of commands and hex digits
that could be typed in in PROM monitor mode.
Example file contents (switch to address mode, enter address 0x200,
switch to data mode, enter bytes A2, FF, 9A, D8):
.0200/A2
FF
9A
D8
<etc.>
.PARAMETER baudrate
Baud rate of the serial port
.PARAMETER comport
Windows COM port
.PARAMETER infile
File to upload
#>
param (
[string]$baudrate = 300,
[Parameter(Mandatory=$true)][string]$comport,
[Parameter(Mandatory=$true)][string]$infile
)
$port = new-Object System.IO.Ports.SerialPort $comport, $baudrate, None, 8, one
$content = [IO.File]::ReadAllBytes($infile)
$port.Open()
$port.Write($content, 0, $content.Count)
$port.Close()
C1P Model 600 CPU 1978 REV B, 40K (8K original and 32K BillO memory expansion), RS-232
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target
Maintainer of cc65 OSI target and llvm-mos-sdk C1P target