1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-10 02:09:46 +00:00

TOSBLK - convert PALX binaries to SBLK.

This commit is contained in:
Lars Brinkhoff
2019-03-08 13:04:25 +01:00
parent b7f50fb3ed
commit 8a5119bb54
3 changed files with 168 additions and 0 deletions

163
src/pdp11/tosblk.1 Normal file
View File

@@ -0,0 +1,163 @@
title Convert PALX binary to SBLK binary.
;Call with OUTPUT FILE_INPUT FILE. The input PALX binary is converted
;to SBLK format, one 16-bit PDP-11 word per 36-bit PDP-10 word. The
;symbol table is dropped.
a=1
b=2
c=3
d=4
e=5
f=6
g=6
p=17
dski==1
dsko==2
start: move p,[-pdlen,,pdl]
.break 12,[..rjcl,,jcl] ;Get JCL.
move a,jcl
caie a,0
camn a,[asciz /î/]
.value [asciz /:Output file missing./]
.break 12,[..rpfi,,defaults] ;Output file name defaults from DDT.
move a,ddev ? movem a,odev
move a,dsname ? movem a,osname
move a,dfn1 ? movem a,ofn1
move a,dfn2 ? movem a,ofn2
movei b,output ;Get output file name.
move d,[440700,,jcl]
pushj p,rfn"rfn
caie a,"_
.value [asciz /:Input file missing./]
move a,odev ? movem a,idev ;Input file name defaults from output.
move a,osname ? movem a,isname
move a,ofn1 ? movem a,ifn1
move a,ofn2 ? movem a,ifn2
movei b,input ;Get input file.
pushj p,rfn"rfn
.call [ setz
sixbit/open/
[.uii,,dski]
idev
ifn1
ifn2
setz isname ]
.lose %lsfil
.call [ setz
sixbit/open/
[.uio,,dsko]
odev
ofn1
ofn2
setz osname ]
.lose %lsfil
.iot dsko,[jrst 1] ;Write SBLK end of loader.
pushj p,convert
.iot dsko,[0] ;Write SBLK start instruction.
.iot dsko,[0] ;Duplicate start instruction.
.close dsko,
.close dski,
.logout 1,
convert:
.iot dski,a
jumpe a,convert ;Skip PALX zeroes between blocks.
caie a,1
jrst invalid ;Next, check input for a 1 and a 0.
.iot dski,a
jumpn invalid
pushj p,rword ;Get PALX byte count.
hrrei c,-6(a)
jumple c,[popj p,]
pushj p,rword ;Get PALX block address.
move d,a ;Convert to SBLK address.
trne d,1
.value [asciz /:Odd block address in PALX binary./]
lsh d,-1
trne c,1 ;Convert to SBLK word count.
.value [asciz /:Odd block size in PALX binary./]
movn e,c
lsh e,-1
movs f,e
hrr f,d
.iot dsko,f ;Write SBLK simple block header.
move g,f ;Initialize SBLK checksum.
loop: pushj p,rbyte ;Read PALX byte.
move b,a
subi c,1
pushj p,rbyte ;Read PALX byte.
lsh a,8
ior b,a
.iot dsko,b ;Write SBLK word.
rot g,1 ;Update SBLK checksum.
add g,b
sojg c,loop
.iot dski,a ;Read and ignore PALX checksum.
.iot dsko,g ;Write SBLK checksum.
jrst convert
invalid:
.value [asciz /:Invalid PALX binary file./]
.logout 1,
rbyte: .iot dski,a
tdne a,[-400]
jrst invalid
popj p,
rword: pushj p,rbyte
move b,a
pushj p,rbyte
lsh a,8
ior a,b
popj p,
rsixtp: cain a,"_
aos (p)
popj p,
rfn"$$rfn==:1
.insrt syseng; rfn >
defaults:
ddev: 0
dsname: 0
dfn1: 0
dfn2: 0
input:
idev: 0
ifn1: 0
ifn2: 0
isname: 0
output:
odev: 0
ofn1: 0
ofn2: 0
osname: 0
.vector pdl(pdlen==20)
.vector jcl(jclen==20)
end start