1
0
mirror of https://github.com/pkimpel/retro-220.git synced 2026-02-11 02:31:01 +00:00

Commit support for paper-tape/TTY I/O in BALGOL and run-time.

1. Implement paper-tape/TTY versions of compiler INPUTMEDIA and
OUTPUTMEDIA routines, and the run-time REED and RITE routines.
2. Create Generator callout deck to make a compiler tape containing
paper-tape/TTY support.
3. Create a compiler tape containing paper-tape/TTY support.
4. Create a paper-tape compiler callout bootstrap program.
5. Correct address for NUMB in Generator source to match the address in
the compiler's Overlay module.
6. Create corrected Generator tape (must be used to create compilers
with paper-tape/TTY support).
7. Add option to produce Generator INPUTMEDIA/OUTPUTMEDIA object card
decks to BAC-Assembler and GEN-Assembler.
8. Create Xlate-Card-PT.wsf utility to convert card-image files to
retro-220 paper-tape image files.
9. Create paper-tape versions of example BALGOL programs.
This commit is contained in:
Paul Kimpel
2018-10-23 13:15:31 -07:00
parent a32815073a
commit 28eae3bfdd
35 changed files with 6046 additions and 698 deletions

View File

@@ -193,6 +193,7 @@ LABEL {
<option value="" >No Object
<option value=L SELECTED>Loadable Deck
<option value=M >BALGOL ML Deck
<option value=P >Gen MEDIA Deck
<option value=T >Object Tape
</select>
<td class=rj>
@@ -2638,6 +2639,47 @@ window.addEventListener("load", function() {
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
}
/**************************************/
function generateGeneratorMediaDeck(asmCode, outputChecksum, startAddress) {
/* Formats the assembled object code as a Generator INPUTMEDIA/OUTPUTMEDIA
deck in a temporary window. From there it can be save, copied, etc. */
var doc = null; // temp window document object
var deck = null; // temp window text area
var pval = p10[10]; // modulus for a word's absolute value
var psign = pval*2; // modulus for a word's sign bit
var title = "220 BAC-Assembler Generator MEDIA Deck";
var win = window.open("../../webUI/B220FramePaper.html", "BAC-Asm-MEDIA",
"scrollbars,resizable,width=600,height=500");
function writeCard(word, addr, seq) {
deck.appendChild(doc.createTextNode(
"600" + padLeft(seq, 7, "0") + padLeft(addr, 4, "0") +
padRight(" ", 22, " ") + padLeft(word, 11, "0") + "\n"));
}
function generateDeck(ev) {
var addr = 0; // assembled code address
var seq = 10; // card sequence number
var word = undefined; // object code word
win.removeEventListener("load", generateDeck, false);
doc = win.document;
doc.title = title;
deck = doc.getElementById("Paper");
while (addr < asmCode.length) {
word = asmCode[addr] || 0;
writeCard(word, addr, seq);
seq += 10;
++addr;
} // while addr
}
win.addEventListener("load", generateDeck, false);
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
}
/**************************************/
function generateObjectTape(asmCode, outputChecksum, startAddress) {
/* Formats the assembled object code as a 220 tape image in a temporary
@@ -2739,6 +2781,9 @@ window.addEventListener("load", function() {
case "M":
generateMachineLanguageDeck(asmCode, outputChecksum, startAddress);
break;
case "P":
generateGeneratorMediaDeck(asmCode, outputChecksum, startAddress);
break;
case "T":
generateObjectTape(asmCode, outputChecksum, startAddress);
break;

View File

@@ -192,6 +192,7 @@ LABEL {
<option value="" >No Object
<option value=L SELECTED>Loadable Deck
<option value=M >BALGOL ML Deck
<option value=P >Gen MEDIA Deck
<option value=T >Object Tape
</select>
<td class=rj>
@@ -3091,6 +3092,47 @@ window.addEventListener("load", function() {
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
}
/**************************************/
function generateGeneratorMediaDeck(asmCode, outputChecksum, startAddress) {
/* Formats the assembled object code as a Generator INPUTMEDIA/OUTPUTMEDIA
deck in a temporary window. From there it can be save, copied, etc. */
var doc = null; // temp window document object
var deck = null; // temp window text area
var pval = p10[10]; // modulus for a word's absolute value
var psign = pval*2; // modulus for a word's sign bit
var title = "220 GEN-Assembler Generator MEDIA Deck";
var win = window.open("../../webUI/B220FramePaper.html", "GEN-Asm-MEDIA",
"scrollbars,resizable,width=600,height=500");
function writeCard(word, addr, seq) {
deck.appendChild(doc.createTextNode(
"600" + padLeft(seq, 7, "0") + padLeft(addr, 4, "0") +
padRight(" ", 22, " ") + padLeft(word, 11, "0") + "\n"));
}
function generateDeck(ev) {
var addr = 0; // assembled code address
var seq = 10; // card sequence number
var word = undefined; // object code word
win.removeEventListener("load", generateDeck, false);
doc = win.document;
doc.title = title;
deck = doc.getElementById("Paper");
while (addr < asmCode.length) {
word = asmCode[addr] || 0;
writeCard(word, addr, seq);
seq += 10;
++addr;
} // while addr
}
win.addEventListener("load", generateDeck, false);
win.moveTo((screen.availWidth-win.outerWidth)/2, (screen.availHeight-win.outerHeight)/2);
}
/**************************************/
function generateObjectTape(asmCode, outputChecksum, startAddress) {
/* Formats the assembled object code as a 220 tape image in a temporary
@@ -3265,6 +3307,9 @@ window.addEventListener("load", function() {
case "M":
generateMachineLanguageDeck(asmCode, outputChecksum, startAddress);
break;
case "P":
generateGeneratorMediaDeck(asmCode, outputChecksum, startAddress);
break;
case "T":
generateObjectTape(asmCode, outputChecksum, startAddress);
break;

View File

@@ -39,8 +39,19 @@ Mahon-PT-Xlate.wsf
image format required by the retro-220 emulator.
See /software/SNAP-Assembler for more on that assembler.
Xlate-Card-PT.wsf
Windows VBScript utility to translate card image files to the paper
tape image format required by the retro-220 emulator. An optional
parameter specifies the number of words per paper-tape record. This
defaults to 14 for input to the paper-tape version of the BALGOL
compiler. It should be 16 for input to programs compiled by the
paper-tape version of BALGOL.
Paul Kimpel
January 2018
Original submission.
2018-06-10
Add BALGOL-Dumpanalyzer.
2018-10-22
Added Xlate-Card-PT.wsf

View File

@@ -0,0 +1,127 @@
<?XML version="1.0"?>
<package>
<job id="Xlate-Card-PT">
<reference object="Scripting.FileSystemObject" />
<script language="VBScript">
<![CDATA[
Option Explicit
'-----------------------------------------------------------------------
' retro-220 Xlate-Card-PT.wsf
' Copyright (c) 2018, Paul Kimpel,
' Licensed under the MIT License, see
' http://www.opensource.org/licenses/mit-license.php
'-----------------------------------------------------------------------
' VBScript to reformat card-image files to the paper-tape format used by
' the retro-220 emulator.
' Uses Scripting Runtime FileSystemObject.
' Parameters:
' Name of card-image file (required).
' Number of words per paper-tape record (5 char/word) (optional,
' defaults to 14).
' Name of resulting retro-220 file (optional, by defaults to the name
' of the card-image file with ".pt" replacing the orginal file
' name extension.
'-----------------------------------------------------------------------
' Modification Log.
' 2018-10-22 P.Kimpel
' Original version, cloned from retro-220 Mahon-PT-Xlate.wsf.
'-----------------------------------------------------------------------
Const charsPerWord = 5
Const defaultSuffix = ".pt"
Const defaultWordsPerRec = 14
Dim args
Dim cardFile
Dim cardName
Dim charsPerRec
Dim fso
Dim ptFile
Dim ptName
Dim wordsPerRec
'---------------------------------------
Sub ReformatPaperTape
'Creates the retro-220 paper-tape file from the card-image file.
Dim code
Dim count
Dim line
Dim word
Dim x
count = 0
word = ""
Do While Not cardFile.AtEndOfStream
line = cardFile.ReadLine
count = Len(line)
If count > charsPerRec Then
line = Left(line, charsPerRec)
Else
Do While count < charsPerRec
line = line + " "
count = count+1
Loop
End If
For x = 1 To charsPerRec Step charsPerWord
ptFile.WriteLine "2" & Mid(line, x, charsPerWord)
Next
Loop
End Sub
'---------------------------------------------------------------
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
wordsPerRec = defaultWordsPerRec
Set args = WScript.Arguments
If args.Count < 1 Then
MsgBox "Must supply at least the name of the assembler-encoded file."
WScript.Quit 9
Else
cardName = Trim(args.Item(0))
If args.Count > 1 Then
If IsNumeric(args.Item(1)) Then
wordsPerRec = CLng(args.Item(1))
Else
MsgBox "Second parameter must be number of words."
WScript.Quit 9
End If
End If
If args.Count > 2 Then
ptName = Trim(args.Item(2))
Else
ptName = fso.BuildPath(fso.GetParentFolderName(cardName), fso.GetBaseName(cardName)) & defaultSuffix
End If
End If
Set args = Nothing
charsPerRec = wordsPerRec*charsPerWord
'-- Main Line --
If Not fso.FileExists(cardName) Then
MsgBox "Card-image file does not exist: " & vbCrLf & cardName
Else
Set cardFile = fso.OpenTextFile(cardName, ForReading, False)
Set ptFile = fso.CreateTextFile(ptName, True, False)
ReformatPaperTape
ptFile.Close
Set ptFile = Nothing
cardFile.Close
Set cardFile = Nothing
MsgBox "retro-220 paper-tape file created: " & vbCrLf & ptName
End If
Set fso = Nothing
WScript.Quit 0
]]>
</script>
</job>
</package>