mirror of
https://github.com/prirun/p50em.git
synced 2026-03-23 16:42:17 +00:00
Compare commits
19 Commits
spamxonkil
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74aa7fe23e | ||
|
|
1819fed512 | ||
|
|
64c5970e97 | ||
|
|
c6c0344004 | ||
|
|
0466b4b603 | ||
|
|
256c72ca64 | ||
|
|
975cc951f8 | ||
|
|
29fbc31df6 | ||
|
|
f72b67b876 | ||
|
|
df6529c505 | ||
|
|
8782e6a63e | ||
|
|
88a43363e1 | ||
|
|
9fa1c77bad | ||
|
|
2d8397d1a4 | ||
|
|
244f2f49a2 | ||
|
|
af2b015383 | ||
|
|
902f535120 | ||
|
|
25febc3947 | ||
|
|
84afd8da7b |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# .editorconfig, Boone, 02/11/21
|
||||||
|
# Editor behavior settings
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[makefile]
|
||||||
|
indent_style = tab
|
||||||
26
.github/workflows/freebsdbuild.yml
vendored
Normal file
26
.github/workflows/freebsdbuild.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: freebsdbuild
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: "actions/checkout@v2"
|
||||||
|
- uses: "vmactions/freebsd-vm@v0.1.3"
|
||||||
|
with:
|
||||||
|
usesh: true
|
||||||
|
prepare: pkg install -y curl git
|
||||||
|
run: |
|
||||||
|
make
|
||||||
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
automatic_release_tag: "latest"
|
||||||
|
prerelease: false
|
||||||
|
title: "Bleeding Edge Binary - FreeBSD"
|
||||||
|
files: |
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
em.1
|
||||||
|
em
|
||||||
22
.github/workflows/linuxbuild.yml
vendored
Normal file
22
.github/workflows/linuxbuild.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: linuxbuild
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: "actions/checkout@v2"
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
automatic_release_tag: "latest"
|
||||||
|
prerelease: false
|
||||||
|
title: "Bleeding Edge Binary - Ubuntu"
|
||||||
|
files: |
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
em.1
|
||||||
|
em
|
||||||
22
.github/workflows/macbuild.yml
vendored
Normal file
22
.github/workflows/macbuild.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: macbuild
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: "actions/checkout@v2"
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
automatic_release_tag: "latest"
|
||||||
|
prerelease: false
|
||||||
|
title: "Bleeding Edge Binary - MacOS"
|
||||||
|
files: |
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
|
em.1
|
||||||
|
em
|
||||||
@@ -55,7 +55,7 @@ business unit ceased to exist. A reformatted copy is available
|
|||||||
A growing collection of Prime and related documentation is available
|
A growing collection of Prime and related documentation is available
|
||||||
at [sysovl.info](https://sysovl.info/reference_prime.html).
|
at [sysovl.info](https://sysovl.info/reference_prime.html).
|
||||||
A howto on installing PRIMOS in the emulator is
|
A howto on installing PRIMOS in the emulator is
|
||||||
[here](https://sysovl.info/reference_prime_drb_installing_primos.html).
|
[here](https://sysovl.info/reference_prime_drb_installoview.html).
|
||||||
Discussion of adapting these instructions to
|
Discussion of adapting these instructions to
|
||||||
22.1.4 has been occurring on the [cctalk mailing
|
22.1.4 has been occurring on the [cctalk mailing
|
||||||
list](http://classiccmp.org/pipermail/cctalk/2020-March/052126.html).
|
list](http://classiccmp.org/pipermail/cctalk/2020-March/052126.html).
|
||||||
|
|||||||
40
devamlc.h
40
devamlc.h
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Implements the AMLC subsystem for Primos. In earlier versions
|
Implements the AMLC subsystem for Primos. In earlier versions
|
||||||
(r186), a more hardware-centric implementation was used that closely
|
(r186), a more hardware-centric implementation was used that closely
|
||||||
followed the design of Prime's real AMLC board. For example, every
|
followed the design of Prime's real AMLC board. For example, every
|
||||||
@@ -52,9 +52,9 @@
|
|||||||
NOTE: varying the AMLC poll rates dynamically is the default, but
|
NOTE: varying the AMLC poll rates dynamically is the default, but
|
||||||
this can lead to unpredictable performance. If consistent,
|
this can lead to unpredictable performance. If consistent,
|
||||||
predictable performance is more important than absolute
|
predictable performance is more important than absolute
|
||||||
performance, MAXAMLCSPEEDUP can be set to 1. Then this
|
performance, MAXAMLCSPEEDUP can be set to 1. Then this
|
||||||
implementation will function more or less like a real Prime.
|
implementation will function more or less like a real Prime.
|
||||||
|
|
||||||
|
|
||||||
AMLC I/O operations:
|
AMLC I/O operations:
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
AMLC status word (from AMLCT5):
|
AMLC status word (from AMLCT5):
|
||||||
|
|
||||||
BITS DESCRIPTION
|
BITS DESCRIPTION
|
||||||
|
|
||||||
1 END OF RANGE INTERRUPT
|
1 END OF RANGE INTERRUPT
|
||||||
2 CLOCK RUNNING
|
2 CLOCK RUNNING
|
||||||
3-6 LINE # OF LINE WHOSE DATA SET STATUS HAS CHANGED
|
3-6 LINE # OF LINE WHOSE DATA SET STATUS HAS CHANGED
|
||||||
@@ -150,6 +150,8 @@ AMLC status word (from AMLCT5):
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <termio.h>
|
||||||
|
|
||||||
/* this macro closes an AMLC connection - used in several places
|
/* this macro closes an AMLC connection - used in several places
|
||||||
|
|
||||||
NOTE: don't print disconnect message on dedicated lines */
|
NOTE: don't print disconnect message on dedicated lines */
|
||||||
@@ -202,11 +204,11 @@ int devamlc (int class, int func, int device) {
|
|||||||
#define DSSCOUNTDOWN 25
|
#define DSSCOUNTDOWN 25
|
||||||
|
|
||||||
/* connection types for each line. This _doesn't_ imply the line is
|
/* connection types for each line. This _doesn't_ imply the line is
|
||||||
actually connected, ie, an AMLC line may be tied to a specific
|
actually connected, ie, an AMLC line may be tied to a specific
|
||||||
serial device (like a USB->serial gizmo), but the USB device may
|
serial device (like a USB->serial gizmo), but the USB device may
|
||||||
not be plugged in. The connection type would be CT_SERIAL but
|
not be plugged in. The connection type would be CT_SERIAL but
|
||||||
the line's fd would be -1 and the "connected" bit would be 0 */
|
the line's fd would be -1 and the "connected" bit would be 0 */
|
||||||
|
|
||||||
#define CT_SOCKET 1
|
#define CT_SOCKET 1
|
||||||
#define CT_SERIAL 2
|
#define CT_SERIAL 2
|
||||||
#define CT_DEDIP 3
|
#define CT_DEDIP 3
|
||||||
@@ -324,7 +326,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
int tempport;
|
int tempport;
|
||||||
struct hostent* host;
|
struct hostent* host;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
/* initially, we don't know about any AMLC boards */
|
/* initially, we don't know about any AMLC boards */
|
||||||
|
|
||||||
for (dx=0; dx<MAXBOARDS; dx++) {
|
for (dx=0; dx<MAXBOARDS; dx++) {
|
||||||
@@ -346,7 +348,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
/* read the amlc.cfg file. This file has 3 uses:
|
/* read the amlc.cfg file. This file has 3 uses:
|
||||||
|
|
||||||
1. maps Prime async lines to real serial devices, like host
|
1. maps Prime async lines to real serial devices, like host
|
||||||
serial ports or USB serial boxes.
|
serial ports or USB serial boxes.
|
||||||
|
|
||||||
Format: <line #> /dev/<Unix usb device name>
|
Format: <line #> /dev/<Unix usb device name>
|
||||||
|
|
||||||
@@ -418,7 +420,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
fprintf(stderr,"Line %d of amlc.cfg ignored: IP address too long\n", lc);
|
fprintf(stderr,"Line %d of amlc.cfg ignored: IP address too long\n", lc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* break out host and port number; no port means this is
|
/* break out host and port number; no port means this is
|
||||||
an incoming dedicated line: no connects out. With a
|
an incoming dedicated line: no connects out. With a
|
||||||
port means we need to connect to it. */
|
port means we need to connect to it. */
|
||||||
@@ -553,13 +555,13 @@ int devamlc (int class, int func, int device) {
|
|||||||
/* XXX: this constant is redefined because of a bug in the
|
/* XXX: this constant is redefined because of a bug in the
|
||||||
OSX Prolific USB serial driver at version 1.2.1r2. They should be
|
OSX Prolific USB serial driver at version 1.2.1r2. They should be
|
||||||
turning on bit 0100, but are turning on 0x0100. */
|
turning on bit 0100, but are turning on 0x0100. */
|
||||||
#define TIOCM_CD 0x0100
|
#define TIOCM_CD 0x0100
|
||||||
|
|
||||||
if (func == 00) { /* input Data Set Sense (carrier) */
|
if (func == 00) { /* input Data Set Sense (carrier) */
|
||||||
if (dc[dx].serial) { /* any serial connections? */
|
if (dc[dx].serial) { /* any serial connections? */
|
||||||
if (--dc[dx].dsstime == 0) {
|
if (--dc[dx].dsstime == 0) {
|
||||||
dc[dx].dsstime = DSSCOUNTDOWN;
|
dc[dx].dsstime = DSSCOUNTDOWN;
|
||||||
#ifdef __APPLE__
|
/* #ifdef __APPLE__ */
|
||||||
for (lx = 0; lx < 16; lx++) { /* yes, poll them */
|
for (lx = 0; lx < 16; lx++) { /* yes, poll them */
|
||||||
if (dc[dx].ctype[lx] == CT_SERIAL) {
|
if (dc[dx].ctype[lx] == CT_SERIAL) {
|
||||||
int modemstate;
|
int modemstate;
|
||||||
@@ -575,7 +577,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
/* #endif */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("devamlc: dss for device '%o = 0x%x\n", device, dc[dx].dss);
|
//printf("devamlc: dss for device '%o = 0x%x\n", device, dc[dx].dss);
|
||||||
@@ -634,10 +636,10 @@ int devamlc (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case CT_SERIAL: {
|
case CT_SERIAL: {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* setup line characteristics if they have changed (check for
|
/* setup line characteristics if they have changed (check for
|
||||||
something other than DTR changing) */
|
something other than DTR changing) */
|
||||||
|
|
||||||
@@ -707,7 +709,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
1_0 - cts/rts flow control (2413 becomes 6413)
|
1_0 - cts/rts flow control (2413 becomes 6413)
|
||||||
1_1 - dsr/dtr flow control (2413 becomes 7413)
|
1_1 - dsr/dtr flow control (2413 becomes 7413)
|
||||||
|
|
||||||
NOTE: bit 11 also appears to be free, but Primos doesn't
|
NOTE: bit 11 also appears to be free, but Primos doesn't
|
||||||
let it flow through to the AMLC controller. :(
|
let it flow through to the AMLC controller. :(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -758,7 +760,6 @@ int devamlc (int class, int func, int device) {
|
|||||||
|
|
||||||
/* set DTR high (02000) or low if it has changed */
|
/* set DTR high (02000) or low if it has changed */
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
if ((getcrs16(A) ^ dc[dx].lconf[lx]) & 02000) {
|
if ((getcrs16(A) ^ dc[dx].lconf[lx]) & 02000) {
|
||||||
int modemstate;
|
int modemstate;
|
||||||
//printf("devamlc: DTR state changed\n");
|
//printf("devamlc: DTR state changed\n");
|
||||||
@@ -771,7 +772,6 @@ int devamlc (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
ioctl(fd, TIOCMSET, &modemstate);
|
ioctl(fd, TIOCMSET, &modemstate);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,7 +841,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
double ts;
|
double ts;
|
||||||
int neweor, activelines;
|
int neweor, activelines;
|
||||||
//printf("poll device '%o, speedup=%5.2f, cti=%x, xmit=%x, recv=%x, dss=%x\n", device, pollspeedup, dc[dx].ctinterrupt, dc[dx].xmitenabled, dc[dx].recvenabled, dc[dx].dss);
|
//printf("poll device '%o, speedup=%5.2f, cti=%x, xmit=%x, recv=%x, dss=%x\n", device, pollspeedup, dc[dx].ctinterrupt, dc[dx].xmitenabled, dc[dx].recvenabled, dc[dx].dss);
|
||||||
|
|
||||||
/* check for 1 new telnet connection every AMLCACCEPTSECS seconds
|
/* check for 1 new telnet connection every AMLCACCEPTSECS seconds
|
||||||
(10 times per second) */
|
(10 times per second) */
|
||||||
|
|
||||||
@@ -1036,7 +1036,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
|
|
||||||
int fd, sockflags;
|
int fd, sockflags;
|
||||||
struct sockaddr_in raddr;
|
struct sockaddr_in raddr;
|
||||||
|
|
||||||
dc[dx].obtimer[lx] = tv.tv_sec + AMLCCONNECT;
|
dc[dx].obtimer[lx] = tv.tv_sec + AMLCCONNECT;
|
||||||
//printf("em: trying to connect to 0x%08x:%d\n", dc[dx].obhost[lx], dc[dx].obport[lx]); /***/
|
//printf("em: trying to connect to 0x%08x:%d\n", dc[dx].obhost[lx], dc[dx].obport[lx]); /***/
|
||||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
@@ -1121,7 +1121,7 @@ int devamlc (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* process input, but only as much as will fit into the DMC
|
/* process input, but only as much as will fit into the DMC
|
||||||
buffer.
|
buffer.
|
||||||
|
|
||||||
Because the size of the AMLC tumble tables is limited, this
|
Because the size of the AMLC tumble tables is limited, this
|
||||||
could pose a denial of service issue. Input is processed in a
|
could pose a denial of service issue. Input is processed in a
|
||||||
|
|||||||
204
em.c
204
em.c
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
$ time ./em -tport 8000 -cpuid 5 -boot 14714 -map MFD.2462/PRIRUN/RING0.MAP MFD.2462/PRIRUN/RING3.MAP 2>err
|
$ time ./em -tport 8000 -cpuid 5 -boot 14714 -map MFD.2462/PRIRUN/RING0.MAP MFD.2462/PRIRUN/RING3.MAP 2>err
|
||||||
|
|
||||||
Disk boot device is 14uc4, tape is 10005,
|
Disk boot device is 14uc4, tape is 10005,
|
||||||
where u=1/3/5/7 for units 0/1/2/3
|
where u=1/3/5/7 for units 0/1/2/3
|
||||||
and c=1/3/5/7 for controller 26/27/...
|
and c=1/3/5/7 for controller 26/27/...
|
||||||
(See complete boot table below)
|
(See complete boot table below)
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
NOTE: the -map command is optional, but is needed to set the
|
NOTE: the -map command is optional, but is needed to set the
|
||||||
real-time clock automatically for older models (cpuid < 15). If
|
real-time clock automatically for older models (cpuid < 15). If
|
||||||
maps are not available, use the Primos SE command to set the clock
|
maps are not available, use the Primos SE command to set the clock
|
||||||
manually after the system boots:
|
manually after the system boots:
|
||||||
SE -MMDDYY HHMM
|
SE -MMDDYY HHMM
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
@@ -40,11 +40,11 @@ $ time ./em -cpuid 5 -boot SAM.SAVE 14114 2>err
|
|||||||
|
|
||||||
Enter physical device = 2466
|
Enter physical device = 2466
|
||||||
|
|
||||||
QUICK VERIFY MODE Enabled; Enter 'RESET QVFY' for normal operation.
|
QUICK VERIFY MODE Enabled; Enter 'RESET QVFY' for normal operation.
|
||||||
Enter 'SET DCM' to display CASE messages.
|
Enter 'SET DCM' to display CASE messages.
|
||||||
Enter 'LOAD;RUN' for Default Execution
|
Enter 'LOAD;RUN' for Default Execution
|
||||||
|
|
||||||
SAM>
|
SAM>
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
Usage: to load initial boot from tape, then prompt for disk pdev
|
Usage: to load initial boot from tape, then prompt for disk pdev
|
||||||
@@ -56,7 +56,7 @@ Sense switches set to 1005 <--- these cause pdev prompt
|
|||||||
|
|
||||||
PHYSICAL DEVICE=2466
|
PHYSICAL DEVICE=2466
|
||||||
|
|
||||||
DISK ERROR, STATUS: 000001
|
DISK ERROR, STATUS: 000001
|
||||||
PHYSICAL DEVICE=
|
PHYSICAL DEVICE=
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
@@ -70,12 +70,12 @@ RUN FILE TREENAME=MFD>DOS>DOS.SAVE
|
|||||||
BOOTING FROM MT0 MFD>DOS>DOS.SAVE
|
BOOTING FROM MT0 MFD>DOS>DOS.SAVE
|
||||||
|
|
||||||
|
|
||||||
PRIMOS II REV 20.0 03/15/85 (AT 170000)
|
PRIMOS II REV 20.0 03/15/85 (AT 170000)
|
||||||
Copyright (c) Prime Computer, Inc. 1985.
|
Copyright (c) Prime Computer, Inc. 1985.
|
||||||
PRIMOS II is being phased out. To boot PRIMOS return to CP mode.
|
PRIMOS II is being phased out. To boot PRIMOS return to CP mode.
|
||||||
("BOOT 14xxx" will autoboot PRIMOS.)
|
("BOOT 14xxx" will autoboot PRIMOS.)
|
||||||
|
|
||||||
OK:
|
OK:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
TRACING:
|
TRACING:
|
||||||
@@ -138,7 +138,7 @@ gv.tracetriggered = 1; this simulates the Ctrl-t.
|
|||||||
|
|
||||||
Locations '40-'57 are reserved for 8 DMC channels, 2 words each.
|
Locations '40-'57 are reserved for 8 DMC channels, 2 words each.
|
||||||
Locations '60-'77 are interrupt vectors
|
Locations '60-'77 are interrupt vectors
|
||||||
Locations '100-'177 are for external device interrupts
|
Locations '100-'177 are for external device interrupts
|
||||||
see p. A-8 of Sys Arch
|
see p. A-8 of Sys Arch
|
||||||
|
|
||||||
In VI mode, locations 0-'17 are trapped and map to the live
|
In VI mode, locations 0-'17 are trapped and map to the live
|
||||||
@@ -191,7 +191,7 @@ static void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int
|
|||||||
|
|
||||||
/* set condition codes based on V-mode FP accumulator
|
/* set condition codes based on V-mode FP accumulator
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
||||||
-Prime considers anything with a zero fraction to be zero,
|
-Prime considers anything with a zero fraction to be zero,
|
||||||
even if the exponent is non-zero (this is a "dirty zero")
|
even if the exponent is non-zero (this is a "dirty zero")
|
||||||
@@ -202,7 +202,7 @@ static void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int
|
|||||||
|
|
||||||
XXX: #define SETCC_F SETCC_32(getcrs32(FLTH))
|
XXX: #define SETCC_F SETCC_32(getcrs32(FLTH))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SETCC_F \
|
#define SETCC_F \
|
||||||
CLEARCC; \
|
CLEARCC; \
|
||||||
if (getcrs32s(FLTH) < 0) \
|
if (getcrs32s(FLTH) < 0) \
|
||||||
@@ -274,6 +274,7 @@ static void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int
|
|||||||
T_EAV trace V-mode effective address calculation
|
T_EAV trace V-mode effective address calculation
|
||||||
T_EAI trace I-mode effective address calculation
|
T_EAI trace I-mode effective address calculation
|
||||||
T_FLOW instruction summary
|
T_FLOW instruction summary
|
||||||
|
T_FP floating point
|
||||||
T_INST detailed instruction trace
|
T_INST detailed instruction trace
|
||||||
T_MODE trace CPU mode changes
|
T_MODE trace CPU mode changes
|
||||||
T_EAAP AP effective address calculation
|
T_EAAP AP effective address calculation
|
||||||
@@ -311,6 +312,7 @@ static void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int
|
|||||||
#define T_EAS 0x00040000
|
#define T_EAS 0x00040000
|
||||||
#define T_TLB 0x00080000
|
#define T_TLB 0x00080000
|
||||||
#define T_SMLC 0x00100000
|
#define T_SMLC 0x00100000
|
||||||
|
#define T_FP 0x00200000
|
||||||
|
|
||||||
#define BITMASK16(b) (0x8000 >> ((b)-1))
|
#define BITMASK16(b) (0x8000 >> ((b)-1))
|
||||||
#define BITMASK32(b) ((unsigned int)(0x80000000) >> ((b)-1))
|
#define BITMASK32(b) ((unsigned int)(0x80000000) >> ((b)-1))
|
||||||
@@ -435,7 +437,7 @@ typedef struct {
|
|||||||
|
|
||||||
The special cache can also be used for write references. Bits 2-4
|
The special cache can also be used for write references. Bits 2-4
|
||||||
of the cache entry vpn are the access bits from mapva, so bit 4
|
of the cache entry vpn are the access bits from mapva, so bit 4
|
||||||
being 1 means that writes are allowed.
|
being 1 means that writes are allowed.
|
||||||
|
|
||||||
IMPORTANT NOTE: bit 4 MUST BE CHECKED before all write references!
|
IMPORTANT NOTE: bit 4 MUST BE CHECKED before all write references!
|
||||||
*/
|
*/
|
||||||
@@ -657,6 +659,7 @@ static unsigned short *physmem = NULL; /* system's physical memory */
|
|||||||
#define LASTFAULT 077
|
#define LASTFAULT 077
|
||||||
|
|
||||||
//static ea_t tnoua_ea=0, tnou_ea=0, tsrc_ea=0;
|
//static ea_t tnoua_ea=0, tnou_ea=0, tsrc_ea=0;
|
||||||
|
static int noclock; /* -noclock arg */
|
||||||
static int domemdump; /* -memdump arg */
|
static int domemdump; /* -memdump arg */
|
||||||
static int dolinecleararg; /* -dolineclear arg */
|
static int dolinecleararg; /* -dolineclear arg */
|
||||||
|
|
||||||
@@ -714,7 +717,7 @@ char *brp_name() {
|
|||||||
match; if the address isn't found exactly, the index returned
|
match; if the address isn't found exactly, the index returned
|
||||||
will be the address lower than the requested address, or -1
|
will be the address lower than the requested address, or -1
|
||||||
if the symbol table is empty or the requested address is
|
if the symbol table is empty or the requested address is
|
||||||
lower than any in the symbol table
|
lower than any in the symbol table
|
||||||
|
|
||||||
Symbol types:
|
Symbol types:
|
||||||
e = address of ecb
|
e = address of ecb
|
||||||
@@ -851,7 +854,7 @@ char *searchloadmap(int addr, char type) {
|
|||||||
return buf[bufix];
|
return buf[bufix];
|
||||||
} else
|
} else
|
||||||
return mapsym[ix].symname;
|
return mapsym[ix].symname;
|
||||||
} else
|
} else
|
||||||
return ␣
|
return ␣
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,11 +1073,11 @@ static unsigned int mapio(ea_t ea) {
|
|||||||
#define put64(value, ea) (put64r((value),(ea),RP))
|
#define put64(value, ea) (put64r((value),(ea),RP))
|
||||||
#define put64r0(value, ea) (put64r((value),(ea),0))
|
#define put64r0(value, ea) (put64r((value),(ea),0))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
get16 handles 16-bit fetches that CANNOT cause address traps.
|
get16 handles 16-bit fetches that CANNOT cause address traps.
|
||||||
|
|
||||||
get16t handles 16-bit fetches that MIGHT cause address traps,
|
get16t handles 16-bit fetches that MIGHT cause address traps,
|
||||||
indicated by the sign bit set in EA.
|
indicated by the sign bit set in EA.
|
||||||
Address traps can occur:
|
Address traps can occur:
|
||||||
- fetching S/R mode instructions
|
- fetching S/R mode instructions
|
||||||
- fetching V-mode instructions when RPL < 010 or 040 (seg enabled/not)
|
- fetching V-mode instructions when RPL < 010 or 040 (seg enabled/not)
|
||||||
@@ -1090,7 +1093,7 @@ static unsigned int mapio(ea_t ea) {
|
|||||||
get16r handles 16-bit fetches that used a passed-in virtual address;
|
get16r handles 16-bit fetches that used a passed-in virtual address;
|
||||||
(only the ring part is used from this address).
|
(only the ring part is used from this address).
|
||||||
|
|
||||||
VERY IMPORTANT: get16r _cannot_ use the supercache! You don't want to
|
VERY IMPORTANT: get16r _cannot_ use the supercache! You don't want to
|
||||||
cache Ring 0 accesses to data, then let Ring 3 use the cache! It could
|
cache Ring 0 accesses to data, then let Ring 3 use the cache! It could
|
||||||
be changed to use a special R0 brp cache entry, but probably not much
|
be changed to use a special R0 brp cache entry, but probably not much
|
||||||
gain performance-wise. Might speed up process exchange...
|
gain performance-wise. Might speed up process exchange...
|
||||||
@@ -1490,7 +1493,7 @@ static void put64r(long long value, ea_t ea, ea_t rpring) {
|
|||||||
disk buffers and shutdown gracefully.
|
disk buffers and shutdown gracefully.
|
||||||
|
|
||||||
NOTE: it may take up to 1 minute for Primos to see the sensor
|
NOTE: it may take up to 1 minute for Primos to see the sensor
|
||||||
check. User 1 will usually be at the OK, prompt, waiting on
|
check. User 1 will usually be at the OK, prompt, waiting on
|
||||||
input, and the check will occur when the 1-minute abort occurs.
|
input, and the check will occur when the 1-minute abort occurs.
|
||||||
|
|
||||||
NOTE: these are inactive if the emulator is using dedicated
|
NOTE: these are inactive if the emulator is using dedicated
|
||||||
@@ -1545,7 +1548,7 @@ void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int dswsta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* queue instructions
|
/* queue instructions
|
||||||
|
|
||||||
NOTE: ABQ is typically used in software to add an item to a
|
NOTE: ABQ is typically used in software to add an item to a
|
||||||
hardware (physical) queue and RTQ is used by DMQ hardware to fetch
|
hardware (physical) queue and RTQ is used by DMQ hardware to fetch
|
||||||
@@ -1553,7 +1556,7 @@ void macheck (unsigned short p300vec, unsigned short chkvec, unsigned int dswsta
|
|||||||
support physical queues, but only ABQ and RTQ currently support
|
support physical queues, but only ABQ and RTQ currently support
|
||||||
them (they're needed for AMLC boards). If ICS support is added,
|
them (they're needed for AMLC boards). If ICS support is added,
|
||||||
the other queue instructions will probably need to support physical
|
the other queue instructions will probably need to support physical
|
||||||
queues.
|
queues.
|
||||||
|
|
||||||
The CPU KEYS are not set here because this would not happen on a
|
The CPU KEYS are not set here because this would not happen on a
|
||||||
DMQ request - only when the instruction is executed by software.
|
DMQ request - only when the instruction is executed by software.
|
||||||
@@ -1739,7 +1742,7 @@ static int (*devmap[64])(int, int, int) = {
|
|||||||
static void warn(char *msg) {
|
static void warn(char *msg) {
|
||||||
printf("emulator warning:\n instruction #%u at %o/%o: %o %o keys=%o, modals=%o\n %s\n", gv.instcount, gv.prevpc >> 16, gv.prevpc & 0xFFFF, get16t(gv.prevpc), get16t(gv.prevpc+1),getcrs16(KEYS), getcrs16(MODALS), msg);
|
printf("emulator warning:\n instruction #%u at %o/%o: %o %o keys=%o, modals=%o\n %s\n", gv.instcount, gv.prevpc >> 16, gv.prevpc & 0xFFFF, get16t(gv.prevpc), get16t(gv.prevpc+1),getcrs16(KEYS), getcrs16(MODALS), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* return a string for the keys
|
/* return a string for the keys
|
||||||
C = C bit set
|
C = C bit set
|
||||||
@@ -1792,7 +1795,7 @@ char *keystring(unsigned short keys) {
|
|||||||
/* return a string for the modals
|
/* return a string for the modals
|
||||||
I = interrupts inhibited, bit 1 = 0
|
I = interrupts inhibited, bit 1 = 0
|
||||||
E = interrupts enabled, bit 1 = 1
|
E = interrupts enabled, bit 1 = 1
|
||||||
|
|
||||||
V = vectored interrupt mode, bit 2 = 1
|
V = vectored interrupt mode, bit 2 = 1
|
||||||
|
|
||||||
0-7 = CRS, bits 9-11
|
0-7 = CRS, bits 9-11
|
||||||
@@ -1857,7 +1860,7 @@ static void fatal(char *msg) {
|
|||||||
if (msg)
|
if (msg)
|
||||||
printf(": %s", msg);
|
printf(": %s", msg);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (physmem != NULL) {
|
if (physmem != NULL) {
|
||||||
printf("instruction #%u at %o/%o %s ^%06o^\nA='%o/%d B='%o/%d L='%o/%d X='%o/%d K=%o [%s]\nowner=%o %s, modals=%o [%s]\n", gv.instcount, gv.prevpc >> 16, gv.prevpc & 0xFFFF, searchloadmap(gv.prevpc,' '), lights, getcrs16(A), getcrs16s(A), getcrs16(B), getcrs16s(B), getcrs32(A), getcrs32s(A), getcrs16(X), getcrs16s(X), getcrs16(KEYS), keystring(getcrs16(KEYS)), getcrs16(OWNERL), searchloadmap(getcrs32(OWNER),' '), getcrs16(MODALS), modstring(getcrs16(MODALS)));
|
printf("instruction #%u at %o/%o %s ^%06o^\nA='%o/%d B='%o/%d L='%o/%d X='%o/%d K=%o [%s]\nowner=%o %s, modals=%o [%s]\n", gv.instcount, gv.prevpc >> 16, gv.prevpc & 0xFFFF, searchloadmap(gv.prevpc,' '), lights, getcrs16(A), getcrs16s(A), getcrs16(B), getcrs16s(B), getcrs32(A), getcrs32s(A), getcrs16(X), getcrs16s(X), getcrs16(KEYS), keystring(getcrs16(KEYS)), getcrs16(OWNERL), searchloadmap(getcrs32(OWNER),' '), getcrs16(MODALS), modstring(getcrs16(MODALS)));
|
||||||
|
|
||||||
@@ -1899,7 +1902,7 @@ static void fatal(char *msg) {
|
|||||||
for (i=0; i<64; i++)
|
for (i=0; i<64; i++)
|
||||||
devmap[i](-2, 0, i);
|
devmap[i](-2, 0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOTRACE
|
#ifndef NOTRACE
|
||||||
fclose(gv.tracefile);
|
fclose(gv.tracefile);
|
||||||
#endif
|
#endif
|
||||||
@@ -1948,7 +1951,7 @@ static void newkeys (unsigned short new) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void fault(unsigned short fvec, unsigned short fcode, ea_t faddr) {
|
static void fault(unsigned short fvec, unsigned short fcode, ea_t faddr) {
|
||||||
static unsigned char faultname[LASTFAULT-FIRSTFAULT+2][4] =
|
static unsigned char faultname[LASTFAULT-FIRSTFAULT+2][4] =
|
||||||
{"RXM", "PRC", "PAG", "SVC", "UII", "SEM", "MCK", "MM", "ILL", "ACC", "ARI", "STK", "SEG", "PTR", "-?-"};
|
{"RXM", "PRC", "PAG", "SVC", "UII", "SEM", "MCK", "MM", "ILL", "ACC", "ARI", "STK", "SEG", "PTR", "-?-"};
|
||||||
unsigned char *faultnamep;
|
unsigned char *faultnamep;
|
||||||
ea_t pcbp, pxfvec, csea, ea;
|
ea_t pcbp, pxfvec, csea, ea;
|
||||||
@@ -1981,7 +1984,7 @@ static void fault(unsigned short fvec, unsigned short fcode, ea_t faddr) {
|
|||||||
regs.sym.pswkeys = crs[KEYS]; /* Prime->Prime: no swap! */
|
regs.sym.pswkeys = crs[KEYS]; /* Prime->Prime: no swap! */
|
||||||
putcrs16(FCODE, fcode);
|
putcrs16(FCODE, fcode);
|
||||||
putcrs32(FADDR, faddr);
|
putcrs32(FADDR, faddr);
|
||||||
|
|
||||||
if (FIRSTFAULT <= fvec && fvec <= LASTFAULT)
|
if (FIRSTFAULT <= fvec && fvec <= LASTFAULT)
|
||||||
faultnamep = faultname[fvec-FIRSTFAULT];
|
faultnamep = faultname[fvec-FIRSTFAULT];
|
||||||
else
|
else
|
||||||
@@ -2073,7 +2076,7 @@ static void fault(unsigned short fvec, unsigned short fcode, ea_t faddr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 16S Addressing Mode
|
/* 16S Addressing Mode
|
||||||
|
|
||||||
NOTE: when fetching indirect words via address traps, ie, the word
|
NOTE: when fetching indirect words via address traps, ie, the word
|
||||||
is in a register, the segment and ring bits are unimportant. But
|
is in a register, the segment and ring bits are unimportant. But
|
||||||
@@ -2085,7 +2088,7 @@ static void fault(unsigned short fvec, unsigned short fcode, ea_t faddr) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static ea_t ea16s (unsigned short inst) {
|
static ea_t ea16s (unsigned short inst) {
|
||||||
|
|
||||||
unsigned short rpl, amask, i, x;
|
unsigned short rpl, amask, i, x;
|
||||||
int indlevel;
|
int indlevel;
|
||||||
ea_t ea, va;
|
ea_t ea, va;
|
||||||
@@ -2124,7 +2127,7 @@ static ea_t ea16s (unsigned short inst) {
|
|||||||
/* 32S Addressing Mode */
|
/* 32S Addressing Mode */
|
||||||
|
|
||||||
static ea_t ea32s (unsigned short inst) {
|
static ea_t ea32s (unsigned short inst) {
|
||||||
|
|
||||||
unsigned short rpl, amask, i, x;
|
unsigned short rpl, amask, i, x;
|
||||||
int indlevel;
|
int indlevel;
|
||||||
ea_t ea, va;
|
ea_t ea, va;
|
||||||
@@ -2191,7 +2194,7 @@ static inline ea_t ea32r64r (ea_t earp, unsigned short inst) {
|
|||||||
TRACE(T_EAR, " PC relative, P=%o, new ea=%o\n", rpl, ea);
|
TRACE(T_EAR, " PC relative, P=%o, new ea=%o\n", rpl, ea);
|
||||||
eap = &gv.brp[RPBR];
|
eap = &gv.brp[RPBR];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto special; /* special cases */
|
goto special; /* special cases */
|
||||||
else {
|
else {
|
||||||
eap = &gv.brp[S0BR];
|
eap = &gv.brp[S0BR];
|
||||||
@@ -2352,7 +2355,7 @@ special:
|
|||||||
static ea_t apea(unsigned short *bitarg) {
|
static ea_t apea(unsigned short *bitarg) {
|
||||||
unsigned short ibr, ea_s, ea_w, bit, br, a;
|
unsigned short ibr, ea_s, ea_w, bit, br, a;
|
||||||
unsigned int utempl;
|
unsigned int utempl;
|
||||||
ea_t ea, ip;
|
ea_t ea, ip, iwea;
|
||||||
|
|
||||||
eap = &gv.brp[RPBR];
|
eap = &gv.brp[RPBR];
|
||||||
utempl = get32(RP);
|
utempl = get32(RP);
|
||||||
@@ -2378,8 +2381,11 @@ static ea_t apea(unsigned short *bitarg) {
|
|||||||
bit = get16(INCVA(ea,2)) >> 12;
|
bit = get16(INCVA(ea,2)) >> 12;
|
||||||
else
|
else
|
||||||
bit = 0;
|
bit = 0;
|
||||||
|
iwea = ea;
|
||||||
ea = ip;
|
ea = ip;
|
||||||
TRACE(T_EAAP, " After indirect, AP ea = %o/%o, bit=%d %s\n", ea>>16, ea & 0xFFFF, bit, searchloadmap(ea,' '));
|
TRACE(T_EAAP, " After indirect, AP ea = %o/%o, bit=%d %s\n", ea>>16, ea & 0xFFFF, bit, searchloadmap(ea,' '));
|
||||||
|
if (ea & 0x80000000)
|
||||||
|
fault(POINTERFAULT, ea>>16, iwea);
|
||||||
}
|
}
|
||||||
if (bitarg != NULL)
|
if (bitarg != NULL)
|
||||||
*bitarg = bit;
|
*bitarg = bit;
|
||||||
@@ -2419,7 +2425,7 @@ static inline void mathexception(unsigned char extype, unsigned short fcode, ea_
|
|||||||
putcrs16(KEYS, getcrs16(KEYS) | 0x8000);
|
putcrs16(KEYS, getcrs16(KEYS) | 0x8000);
|
||||||
switch (extype) {
|
switch (extype) {
|
||||||
case 'i':
|
case 'i':
|
||||||
if (getcrs16(KEYS) & 0400)
|
if (getcrs16(KEYS) & 0400)
|
||||||
fault(ARITHFAULT, fcode, faddr);
|
fault(ARITHFAULT, fcode, faddr);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -2713,7 +2719,7 @@ static void argt() {
|
|||||||
rp = get32(stackfp+2);
|
rp = get32(stackfp+2);
|
||||||
|
|
||||||
/* reload the caller's base registers for EA calculations */
|
/* reload the caller's base registers for EA calculations */
|
||||||
|
|
||||||
brsave[0] = rp >> 16; brsave[1] = 0;
|
brsave[0] = rp >> 16; brsave[1] = 0;
|
||||||
/* set ring bits on LB and SB to get correct ring on args */
|
/* set ring bits on LB and SB to get correct ring on args */
|
||||||
brsave[2] = get16(stackfp+4) | ((rp >> 16) & RINGMASK16);
|
brsave[2] = get16(stackfp+4) | ((rp >> 16) & RINGMASK16);
|
||||||
@@ -2840,7 +2846,7 @@ static void pcl (ea_t ecbea) {
|
|||||||
/* get a copy of the ecb. gates must be aligned on a 16-word
|
/* get a copy of the ecb. gates must be aligned on a 16-word
|
||||||
boundary, therefore can't cross a page boundary, and mapva has
|
boundary, therefore can't cross a page boundary, and mapva has
|
||||||
already ensured that the ecb page is resident. For a non-gate
|
already ensured that the ecb page is resident. For a non-gate
|
||||||
ecb, check to see if it crosses a page boundary. If not, a
|
ecb, check to see if it crosses a page boundary. If not, a
|
||||||
memcpy is okay; if it does, do fetches */
|
memcpy is okay; if it does, do fetches */
|
||||||
|
|
||||||
if (access == 1 && (ecbea & 0xF) != 0)
|
if (access == 1 && (ecbea & 0xF) != 0)
|
||||||
@@ -2961,7 +2967,7 @@ static void pcl (ea_t ecbea) {
|
|||||||
Y(low) = number of arguments left to transfer (JW hack!) */
|
Y(low) = number of arguments left to transfer (JW hack!) */
|
||||||
|
|
||||||
|
|
||||||
/* if a page fault occurs during argument transfer, we need to
|
/* if a page fault occurs during argument transfer, we need to
|
||||||
make sure to use the current RP, which points to the ARGT
|
make sure to use the current RP, which points to the ARGT
|
||||||
instruction. Otherwise, the return from the page fault
|
instruction. Otherwise, the return from the page fault
|
||||||
is to the PCL instruction, which has already completed at
|
is to the PCL instruction, which has already completed at
|
||||||
@@ -3043,7 +3049,7 @@ static void pcl (ea_t ecbea) {
|
|||||||
utempa = get16(get32(ea)); /* 1st arg: key */
|
utempa = get16(get32(ea)); /* 1st arg: key */
|
||||||
TRACEA(" TSRC$$: key = %d\n", utempa);
|
TRACEA(" TSRC$$: key = %d\n", utempa);
|
||||||
eatemp = get32(ea+9); /* 4th arg: CP(1..2) */
|
eatemp = get32(ea+9); /* 4th arg: CP(1..2) */
|
||||||
utempl = get32(eatemp);
|
utempl = get32(eatemp);
|
||||||
utempa1 = utempl>>16; /* starting cp */
|
utempa1 = utempl>>16; /* starting cp */
|
||||||
utempa2 = utempl&0xffff; /* # chars */
|
utempa2 = utempl&0xffff; /* # chars */
|
||||||
TRACEA(" cp(0)=%d, cp(1)=%d, loc(cp)=%o/%o\n", utempa1, utempa2, eatemp>>16, eatemp&0xffff);
|
TRACEA(" cp(0)=%d, cp(1)=%d, loc(cp)=%o/%o\n", utempa1, utempa2, eatemp>>16, eatemp&0xffff);
|
||||||
@@ -3121,7 +3127,7 @@ static void calf(ea_t ea) {
|
|||||||
for (i=0; i<6; i++)
|
for (i=0; i<6; i++)
|
||||||
cs[i] = get16r0(csea+i);
|
cs[i] = get16r0(csea+i);
|
||||||
|
|
||||||
/* pop the concealed stack
|
/* pop the concealed stack
|
||||||
XXX: this was after code below. Does it matter? */
|
XXX: this was after code below. Does it matter? */
|
||||||
|
|
||||||
put16r0(this, pcbp+PCBCSNEXT);
|
put16r0(this, pcbp+PCBCSNEXT);
|
||||||
@@ -3141,7 +3147,7 @@ static void calf(ea_t ea) {
|
|||||||
|
|
||||||
|
|
||||||
/* process exchange register save: saves the current register
|
/* process exchange register save: saves the current register
|
||||||
set to the process pcb.
|
set to the process pcb.
|
||||||
NOTES:
|
NOTES:
|
||||||
- adding "wait" arg and only saving base registers fixed Case 63
|
- adding "wait" arg and only saving base registers fixed Case 63
|
||||||
*/
|
*/
|
||||||
@@ -3163,7 +3169,7 @@ static void pxregsave(unsigned short wait) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TRACE(T_PX, "pxregsave: saving registers owned by %o (wait=%d)\n", getcrs16(OWNERL), wait);
|
TRACE(T_PX, "pxregsave: saving registers owned by %o (wait=%d)\n", getcrs16(OWNERL), wait);
|
||||||
|
|
||||||
/* NB: I think hardware might save the base registers in a predictable
|
/* NB: I think hardware might save the base registers in a predictable
|
||||||
location in the PCB register save area, rather than compressed in a
|
location in the PCB register save area, rather than compressed in a
|
||||||
random order, because IIRC, Primos sometimes looks at a waiting
|
random order, because IIRC, Primos sometimes looks at a waiting
|
||||||
@@ -3248,7 +3254,7 @@ static void ors(unsigned short pcbw) {
|
|||||||
debug, I wanted to make sure a process never owns 2 register sets */
|
debug, I wanted to make sure a process never owns 2 register sets */
|
||||||
|
|
||||||
if (ownerl == pcbw) {
|
if (ownerl == pcbw) {
|
||||||
if (ownedx >= 0)
|
if (ownedx >= 0)
|
||||||
fatal("Process owns more than 1 register set!");
|
fatal("Process owns more than 1 register set!");
|
||||||
ownedx = rx;
|
ownedx = rx;
|
||||||
} else if (ownerl == 0)
|
} else if (ownerl == 0)
|
||||||
@@ -3369,7 +3375,7 @@ static void dispatcher() {
|
|||||||
fatal(NULL);
|
fatal(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* pcbp now points to the process we're going to run (pcbw is the
|
/* pcbp now points to the process we're going to run (pcbw is the
|
||||||
16-bit word number that will go in OWNERL). By definition, this
|
16-bit word number that will go in OWNERL). By definition, this
|
||||||
process should not be on any wait lists, so pcb.waitlist(seg)
|
process should not be on any wait lists, so pcb.waitlist(seg)
|
||||||
@@ -3474,7 +3480,7 @@ static void dispatcher() {
|
|||||||
TRACE(T_PX, "dispatch: abort flags for %o are %o\n", getcrs16(OWNERL), utempa);
|
TRACE(T_PX, "dispatch: abort flags for %o are %o\n", getcrs16(OWNERL), utempa);
|
||||||
put16r0(0, pcbp+PCBABT);
|
put16r0(0, pcbp+PCBABT);
|
||||||
fault(PROCESSFAULT, utempa, 0);
|
fault(PROCESSFAULT, utempa, 0);
|
||||||
fatal("fault returned after process fault");
|
fatal("fault returned after process fault");
|
||||||
}
|
}
|
||||||
|
|
||||||
firstbdx = 1;
|
firstbdx = 1;
|
||||||
@@ -3582,8 +3588,8 @@ static unsigned short ready (ea_t pcbp, unsigned short begend) {
|
|||||||
|
|
||||||
resched = 0;
|
resched = 0;
|
||||||
if (level < getar16(PLA16) || (level == getar16(PLA16) && begend)) {
|
if (level < getar16(PLA16) || (level == getar16(PLA16) && begend)) {
|
||||||
regs.sym.plb = regs.sym.pla; /* Prime->Prime: no byte swap */
|
regs.sym.plb = regs.sym.pla; /* Prime->Prime: no byte swap */
|
||||||
regs.sym.pcbb = regs.sym.pcba; /* Prime->Prime: no byte swap */
|
regs.sym.pcbb = regs.sym.pcba; /* Prime->Prime: no byte swap */
|
||||||
putar16(PLA16, level);
|
putar16(PLA16, level);
|
||||||
putar16(PCBA16, pcbw);
|
putar16(PCBA16, pcbw);
|
||||||
resched = 1;
|
resched = 1;
|
||||||
@@ -3783,7 +3789,7 @@ static void lpsw() {
|
|||||||
if (getcrs16(MODALS) & 4) {
|
if (getcrs16(MODALS) & 4) {
|
||||||
TRACE(T_PX, "Segmentation enabled\n");
|
TRACE(T_PX, "Segmentation enabled\n");
|
||||||
gv.livereglim = 010;
|
gv.livereglim = 010;
|
||||||
} else
|
} else
|
||||||
gv.livereglim = 040;
|
gv.livereglim = 040;
|
||||||
if (getcrs16(MODALS) & 010) {
|
if (getcrs16(MODALS) & 010) {
|
||||||
TRACE(T_PX, "Process exchange enabled:\n");
|
TRACE(T_PX, "Process exchange enabled:\n");
|
||||||
@@ -3826,7 +3832,7 @@ static void sssn() {
|
|||||||
put16(0, ea+i);
|
put16(0, ea+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if SSSN is from segment 14, it's probably the rev 23.4.Y2K
|
/* if SSSN is from segment 14, it's probably the rev 23.4.Y2K
|
||||||
system serial number check. Bypass the check loop. */
|
system serial number check. Bypass the check loop. */
|
||||||
|
|
||||||
if (RPH == 014)
|
if (RPH == 014)
|
||||||
@@ -4166,9 +4172,9 @@ static int add32(unsigned int a1, unsigned int a2, unsigned int a3, ea_t ea) {
|
|||||||
uresult = utemp; /* truncate result to result size */
|
uresult = utemp; /* truncate result to result size */
|
||||||
retval = uresult;
|
retval = uresult;
|
||||||
if (utemp & 0x100000000LL) /* set L-bit if carry occurred */
|
if (utemp & 0x100000000LL) /* set L-bit if carry occurred */
|
||||||
link = 020000;
|
link = 020000;
|
||||||
if (uresult == 0) /* set EQ? */
|
if (uresult == 0) /* set EQ? */
|
||||||
eq = 0100;
|
eq = 0100;
|
||||||
if (((~a1 ^ a2) & (a1 ^ uresult) & 0x80000000) == 0) {
|
if (((~a1 ^ a2) & (a1 ^ uresult) & 0x80000000) == 0) {
|
||||||
if (*(int *)&uresult < 0)
|
if (*(int *)&uresult < 0)
|
||||||
lt = 0200;
|
lt = 0200;
|
||||||
@@ -4191,11 +4197,11 @@ static int add16(unsigned short a1, unsigned short a2, unsigned short a3, ea_t e
|
|||||||
uresult = a1; /* expand to higher precision */
|
uresult = a1; /* expand to higher precision */
|
||||||
uresult += a2; /* double-precision add */
|
uresult += a2; /* double-precision add */
|
||||||
uresult += a3; /* again, for subtract */
|
uresult += a3; /* again, for subtract */
|
||||||
keybits = (uresult & 0x10000) >> 3; /* set L-bit if carry occurred */
|
keybits = (uresult & 0x10000) >> 3; /* set L-bit if carry occurred */
|
||||||
uresult &= 0xFFFF; /* truncate result */
|
uresult &= 0xFFFF; /* truncate result */
|
||||||
retval = uresult; /* save result */
|
retval = uresult; /* save result */
|
||||||
if (uresult == 0) /* set EQ? */
|
if (uresult == 0) /* set EQ? */
|
||||||
keybits |= 0100;
|
keybits |= 0100;
|
||||||
oflow = (((~a1 ^ a2) & (a1 ^ uresult) & 0x8000) != 0); /* overflow! */
|
oflow = (((~a1 ^ a2) & (a1 ^ uresult) & 0x8000) != 0); /* overflow! */
|
||||||
if (oflow)
|
if (oflow)
|
||||||
uresult = ~uresult;
|
uresult = ~uresult;
|
||||||
@@ -4451,6 +4457,7 @@ int main (int argc, char **argv) {
|
|||||||
|
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
|
|
||||||
|
noclock = 0;
|
||||||
domemdump = 0;
|
domemdump = 0;
|
||||||
dolinecleararg = 0;
|
dolinecleararg = 0;
|
||||||
bootarg = NULL;
|
bootarg = NULL;
|
||||||
@@ -4469,6 +4476,9 @@ int main (int argc, char **argv) {
|
|||||||
while (i+1 < argc && argv[i+1][0] != '-')
|
while (i+1 < argc && argv[i+1][0] != '-')
|
||||||
readloadmap(argv[++i], 1);
|
readloadmap(argv[++i], 1);
|
||||||
|
|
||||||
|
} else if (strcmp(argv[i],"-noclock") == 0) {
|
||||||
|
noclock = 1;
|
||||||
|
|
||||||
} else if (strcmp(argv[i],"-memdump") == 0) {
|
} else if (strcmp(argv[i],"-memdump") == 0) {
|
||||||
domemdump = 1;
|
domemdump = 1;
|
||||||
|
|
||||||
@@ -4615,6 +4625,8 @@ int main (int argc, char **argv) {
|
|||||||
gv.traceflags |= T_TLB;
|
gv.traceflags |= T_TLB;
|
||||||
else if (strcmp(argv[i],"smlc") == 0)
|
else if (strcmp(argv[i],"smlc") == 0)
|
||||||
gv.traceflags |= T_SMLC;
|
gv.traceflags |= T_SMLC;
|
||||||
|
else if (strcmp(argv[i],"fp") == 0)
|
||||||
|
gv.traceflags |= T_FP;
|
||||||
else if (isdigit(argv[i][0]) && strlen(argv[i]) <= 3 && sscanf(argv[i],"%d", &templ) == 1)
|
else if (isdigit(argv[i][0]) && strlen(argv[i]) <= 3 && sscanf(argv[i],"%d", &templ) == 1)
|
||||||
gv.traceuser = 0100000 | (templ<<6); /* form OWNERL for user # */
|
gv.traceuser = 0100000 | (templ<<6); /* form OWNERL for user # */
|
||||||
else if (strlen(argv[i]) == 6 && sscanf(argv[i],"%o", &templ) == 1)
|
else if (strlen(argv[i]) == 6 && sscanf(argv[i],"%o", &templ) == 1)
|
||||||
@@ -4685,7 +4697,7 @@ int main (int argc, char **argv) {
|
|||||||
regs.u32[i] = 0;
|
regs.u32[i] = 0;
|
||||||
|
|
||||||
crsl = (void *)regs.sym.userregs[0]; /* first user register set */
|
crsl = (void *)regs.sym.userregs[0]; /* first user register set */
|
||||||
|
|
||||||
putcrs16(MODALS, 0); /* interrupts inhibited */
|
putcrs16(MODALS, 0); /* interrupts inhibited */
|
||||||
newkeys(0);
|
newkeys(0);
|
||||||
RP = 01000;
|
RP = 01000;
|
||||||
@@ -4701,8 +4713,8 @@ int main (int argc, char **argv) {
|
|||||||
fatal("Can't allocate Prime memory block");
|
fatal("Can't allocate Prime memory block");
|
||||||
}
|
}
|
||||||
bzero(MEM, 64*1024*2); /* zero first 64K words */
|
bzero(MEM, 64*1024*2); /* zero first 64K words */
|
||||||
|
|
||||||
/* if no maps were specified on the command line, look for ring0.map and
|
/* if no maps were specified on the command line, look for ring0.map and
|
||||||
ring3.map in the current directory and read them */
|
ring3.map in the current directory and read them */
|
||||||
|
|
||||||
if (numsyms == 0) {
|
if (numsyms == 0) {
|
||||||
@@ -4903,7 +4915,7 @@ a filename, CPU registers and keys are loaded from the runfile header.\n\
|
|||||||
close(bootfd);
|
close(bootfd);
|
||||||
|
|
||||||
/* check we got it all */
|
/* check we got it all */
|
||||||
|
|
||||||
if (nw2 != nw*2) {
|
if (nw2 != nw*2) {
|
||||||
printf("rvec[0]=%d, rvec[1]=%d, nw2=%d, nw=%d, nw*2=%d\n", rvec[0], rvec[1], nw2, nw, nw*2);
|
printf("rvec[0]=%d, rvec[1]=%d, nw2=%d, nw=%d, nw*2=%d\n", rvec[0], rvec[1], nw2, nw, nw*2);
|
||||||
fatal("Didn't read entire boot program");
|
fatal("Didn't read entire boot program");
|
||||||
@@ -4914,7 +4926,7 @@ a filename, CPU registers and keys are loaded from the runfile header.\n\
|
|||||||
#if 1
|
#if 1
|
||||||
/* do a partial sysclr... move it here later if it fixes rev 19
|
/* do a partial sysclr... move it here later if it fixes rev 19
|
||||||
reboot from tape (ctrl-b) */
|
reboot from tape (ctrl-b) */
|
||||||
|
|
||||||
putcrs16(MODALS, 0); /* interrupts inhibited */
|
putcrs16(MODALS, 0); /* interrupts inhibited */
|
||||||
for (i=0; i < STLBENTS; i++)
|
for (i=0; i < STLBENTS; i++)
|
||||||
gv.stlb[i].seg = 0xFFFF; /* marker for invalid STLB entry */
|
gv.stlb[i].seg = 0xFFFF; /* marker for invalid STLB entry */
|
||||||
@@ -5140,7 +5152,7 @@ fetch:
|
|||||||
/* NOTE: Rev 21 Sys Arch Guide, 2nd Ed, pg 3-32 says:
|
/* NOTE: Rev 21 Sys Arch Guide, 2nd Ed, pg 3-32 says:
|
||||||
|
|
||||||
"When bits 17 to 32 of the program counter contain a value within
|
"When bits 17 to 32 of the program counter contain a value within
|
||||||
the ATR (address trap range) and the processor is reading an
|
the ATR (address trap range) and the processor is reading an
|
||||||
instruction, an address trap always occurs. The only exception
|
instruction, an address trap always occurs. The only exception
|
||||||
to this is if the machine is operating in 32I mode."
|
to this is if the machine is operating in 32I mode."
|
||||||
|
|
||||||
@@ -5154,7 +5166,7 @@ fetch:
|
|||||||
NOTE 10/9/2007 (JW):
|
NOTE 10/9/2007 (JW):
|
||||||
iget16 has checks for RP < 0 to indicate an address trap, and all
|
iget16 has checks for RP < 0 to indicate an address trap, and all
|
||||||
of the EA calculations can generate traps (and set the high-order
|
of the EA calculations can generate traps (and set the high-order
|
||||||
bit) except 32I.
|
bit) except 32I.
|
||||||
|
|
||||||
If it's a bad idea for RP to have the high-order bit set, then
|
If it's a bad idea for RP to have the high-order bit set, then
|
||||||
this code can be enabled, along with special handling in JMP,
|
this code can be enabled, along with special handling in JMP,
|
||||||
@@ -5253,7 +5265,7 @@ xec:
|
|||||||
|
|
||||||
} else if ((getcrs16(KEYS) & 0016000) == 010000) { /* E32I */
|
} else if ((getcrs16(KEYS) & 0016000) == 010000) { /* E32I */
|
||||||
goto imode;
|
goto imode;
|
||||||
|
|
||||||
} else if ((inst & 036000) == 030000) { /* check for pio in S/R modes, */
|
} else if ((inst & 036000) == 030000) { /* check for pio in S/R modes, */
|
||||||
pio(inst); /* before calculating EA */
|
pio(inst); /* before calculating EA */
|
||||||
goto fetch;
|
goto fetch;
|
||||||
@@ -5525,7 +5537,7 @@ d_stac: /* 001200 */
|
|||||||
if (get16(ea) == getcrs16(B)) {
|
if (get16(ea) == getcrs16(B)) {
|
||||||
put16(getcrs16(A), ea);
|
put16(getcrs16(A), ea);
|
||||||
SETEQ;
|
SETEQ;
|
||||||
} else
|
} else
|
||||||
CLEAREQ;
|
CLEAREQ;
|
||||||
goto fetch;
|
goto fetch;
|
||||||
|
|
||||||
@@ -5535,7 +5547,7 @@ d_stlc: /* 001204 */
|
|||||||
if (get32(ea) == getcrs32(E)){
|
if (get32(ea) == getcrs32(E)){
|
||||||
put32(getcrs32(L), ea);
|
put32(getcrs32(L), ea);
|
||||||
SETEQ;
|
SETEQ;
|
||||||
} else
|
} else
|
||||||
CLEAREQ;
|
CLEAREQ;
|
||||||
goto fetch;
|
goto fetch;
|
||||||
|
|
||||||
@@ -5665,7 +5677,7 @@ d_zmvd: /* 001115 */
|
|||||||
while (utempa--)
|
while (utempa--)
|
||||||
*zcp2++ = *zcp1++;
|
*zcp2++ = *zcp1++;
|
||||||
#else
|
#else
|
||||||
/* this causes error:
|
/* this causes error:
|
||||||
Coldstarting PRIMOS, Please wait...
|
Coldstarting PRIMOS, Please wait...
|
||||||
Unable to initialize gate segment. (GATE_INIT) */
|
Unable to initialize gate segment. (GATE_INIT) */
|
||||||
memcpy(zcp2, zcp1, utempa);
|
memcpy(zcp2, zcp1, utempa);
|
||||||
@@ -6063,7 +6075,7 @@ d_wait: /* 000315 */
|
|||||||
pwait();
|
pwait();
|
||||||
goto fetch;
|
goto fetch;
|
||||||
|
|
||||||
d_nfy: /* 1210 (nfye), 1211 (nfyb),
|
d_nfy: /* 1210 (nfye), 1211 (nfyb),
|
||||||
1214 (inen), 1215 (inbn), 1216 (inec), 1217 (inbc) */
|
1214 (inen), 1215 (inbn), 1216 (inec), 1217 (inbc) */
|
||||||
TRACE(T_FLOW, " NFY\n", inst);
|
TRACE(T_FLOW, " NFY\n", inst);
|
||||||
RESTRICT();
|
RESTRICT();
|
||||||
@@ -6263,7 +6275,7 @@ d_svc: /* 000505 */
|
|||||||
TRACE(T_FLOW, " SVC\n");
|
TRACE(T_FLOW, " SVC\n");
|
||||||
fault(SVCFAULT, 0, 0);
|
fault(SVCFAULT, 0, 0);
|
||||||
fatal("Returned from SVC fault");
|
fatal("Returned from SVC fault");
|
||||||
|
|
||||||
d_cea: /* 000111 */
|
d_cea: /* 000111 */
|
||||||
TRACE(T_FLOW, " CEA\n");
|
TRACE(T_FLOW, " CEA\n");
|
||||||
switch ((getcrs16(KEYS) & 016000) >> 10) {
|
switch ((getcrs16(KEYS) & 016000) >> 10) {
|
||||||
@@ -6598,7 +6610,7 @@ d_bfgt: /* 0141611 */
|
|||||||
d_bix: /* 0141334 */
|
d_bix: /* 0141334 */
|
||||||
TRACE(T_FLOW, " BIX\n");
|
TRACE(T_FLOW, " BIX\n");
|
||||||
putcrs16(X, getcrs16(X) + 1);
|
putcrs16(X, getcrs16(X) + 1);
|
||||||
if (getcrs16(X) != 0)
|
if (getcrs16(X) != 0)
|
||||||
RPL = iget16(RP);
|
RPL = iget16(RP);
|
||||||
else
|
else
|
||||||
INCRP;
|
INCRP;
|
||||||
@@ -6607,7 +6619,7 @@ d_bix: /* 0141334 */
|
|||||||
d_biy: /* 0141324 */
|
d_biy: /* 0141324 */
|
||||||
TRACE(T_FLOW, " BIY\n");
|
TRACE(T_FLOW, " BIY\n");
|
||||||
putcrs16(Y, getcrs16(Y) + 1);
|
putcrs16(Y, getcrs16(Y) + 1);
|
||||||
if (getcrs16(Y) != 0)
|
if (getcrs16(Y) != 0)
|
||||||
RPL = iget16(RP);
|
RPL = iget16(RP);
|
||||||
else
|
else
|
||||||
INCRP;
|
INCRP;
|
||||||
@@ -6616,7 +6628,7 @@ d_biy: /* 0141324 */
|
|||||||
d_bdy: /* 0140724 */
|
d_bdy: /* 0140724 */
|
||||||
TRACE(T_FLOW, " BDY\n");
|
TRACE(T_FLOW, " BDY\n");
|
||||||
putcrs16(Y, getcrs16(Y) - 1);
|
putcrs16(Y, getcrs16(Y) - 1);
|
||||||
if (getcrs16(Y) != 0)
|
if (getcrs16(Y) != 0)
|
||||||
RPL = iget16(RP);
|
RPL = iget16(RP);
|
||||||
else
|
else
|
||||||
INCRP;
|
INCRP;
|
||||||
@@ -6625,7 +6637,7 @@ d_bdy: /* 0140724 */
|
|||||||
d_bdx: /* 0140734 */
|
d_bdx: /* 0140734 */
|
||||||
TRACE(T_FLOW, " BDX\n");
|
TRACE(T_FLOW, " BDX\n");
|
||||||
putcrs16(X, getcrs16(X) - 1);
|
putcrs16(X, getcrs16(X) - 1);
|
||||||
if (getcrs16(X) == 0)
|
if (getcrs16(X) == 0)
|
||||||
INCRP;
|
INCRP;
|
||||||
else {
|
else {
|
||||||
m = iget16(RP);
|
m = iget16(RP);
|
||||||
@@ -6635,7 +6647,7 @@ d_bdx: /* 0140734 */
|
|||||||
long delayusec, actualmsec;
|
long delayusec, actualmsec;
|
||||||
|
|
||||||
/* for BDX * loop (backstop process mainly), we want to change
|
/* for BDX * loop (backstop process mainly), we want to change
|
||||||
this to a long sleep so that the emulation host's CPU isn't
|
this to a long sleep so that the emulation host's CPU isn't
|
||||||
pegged the whole time the emulator is running.
|
pegged the whole time the emulator is running.
|
||||||
|
|
||||||
So first, check to see if any device times expire sooner than
|
So first, check to see if any device times expire sooner than
|
||||||
@@ -6676,7 +6688,7 @@ d_bdx: /* 0140734 */
|
|||||||
if (delayusec > 1000) {
|
if (delayusec > 1000) {
|
||||||
if (gettimeofday(&tv0, NULL) != 0)
|
if (gettimeofday(&tv0, NULL) != 0)
|
||||||
fatal("em: gettimeofday 0 failed");
|
fatal("em: gettimeofday 0 failed");
|
||||||
|
|
||||||
/* for some reason, the SIGTERM signal handler gets reset
|
/* for some reason, the SIGTERM signal handler gets reset
|
||||||
during emulator initialization; this re-installs it */
|
during emulator initialization; this re-installs it */
|
||||||
|
|
||||||
@@ -6699,7 +6711,7 @@ d_bdx: /* 0140734 */
|
|||||||
TRACEA(" BDX loop at %o/%o, owner=%o, utempl=%d, wanted %d ms, got %d ms\n", gv.prevpc>>16, gv.prevpc&0xffff, getcrs16(OWNERL), utempl, delayusec/1000, actualmsec);
|
TRACEA(" BDX loop at %o/%o, owner=%o, utempl=%d, wanted %d ms, got %d ms\n", gv.prevpc>>16, gv.prevpc&0xffff, getcrs16(OWNERL), utempl, delayusec/1000, actualmsec);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* do timer bookkeeping that would have occurred if we had
|
/* do timer bookkeeping that would have occurred if we had
|
||||||
actually looped on BDX utempl times */
|
actually looped on BDX utempl times */
|
||||||
|
|
||||||
for (i=0; i<64; i++)
|
for (i=0; i<64; i++)
|
||||||
@@ -6815,14 +6827,14 @@ d_caz: /* 0140214 */
|
|||||||
d_irx: /* 0140114 */
|
d_irx: /* 0140114 */
|
||||||
TRACE(T_FLOW, " IRX\n");
|
TRACE(T_FLOW, " IRX\n");
|
||||||
putcrs16(X, getcrs16(X) + 1);
|
putcrs16(X, getcrs16(X) + 1);
|
||||||
if (getcrs16(X) == 0)
|
if (getcrs16(X) == 0)
|
||||||
INCRP;
|
INCRP;
|
||||||
goto fetch;
|
goto fetch;
|
||||||
|
|
||||||
d_drx: /* 0140210 */
|
d_drx: /* 0140210 */
|
||||||
TRACE(T_FLOW, " DRX\n");
|
TRACE(T_FLOW, " DRX\n");
|
||||||
putcrs16(X, getcrs16(X) - 1);
|
putcrs16(X, getcrs16(X) - 1);
|
||||||
if (getcrs16(X) == 0)
|
if (getcrs16(X) == 0)
|
||||||
INCRP;
|
INCRP;
|
||||||
goto fetch;
|
goto fetch;
|
||||||
|
|
||||||
@@ -7293,7 +7305,7 @@ d_tstq: /* 0141757 */
|
|||||||
|
|
||||||
/* XXX: hack for CPU.FAULT; not sure how to determine
|
/* XXX: hack for CPU.FAULT; not sure how to determine
|
||||||
whether an instruction is illegal or unimplemented */
|
whether an instruction is illegal or unimplemented */
|
||||||
|
|
||||||
fault(ILLINSTFAULT, RPL, RP);
|
fault(ILLINSTFAULT, RPL, RP);
|
||||||
fatal("Return from 0141700 fault");
|
fatal("Return from 0141700 fault");
|
||||||
|
|
||||||
@@ -8430,7 +8442,7 @@ dfcmdr:
|
|||||||
if (get32(ea) == getgr32(dr+1)) {
|
if (get32(ea) == getgr32(dr+1)) {
|
||||||
put32(getgr32(dr), ea);
|
put32(getgr32(dr), ea);
|
||||||
SETEQ;
|
SETEQ;
|
||||||
} else
|
} else
|
||||||
CLEAREQ;
|
CLEAREQ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -8440,7 +8452,7 @@ dfcmdr:
|
|||||||
if (get16(ea) == (getcrs16(dr*2+1))) {
|
if (get16(ea) == (getcrs16(dr*2+1))) {
|
||||||
put16(getgr16(dr), ea);
|
put16(getgr16(dr), ea);
|
||||||
SETEQ;
|
SETEQ;
|
||||||
} else
|
} else
|
||||||
CLEAREQ;
|
CLEAREQ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -8729,7 +8741,7 @@ dfcmdr:
|
|||||||
tempa1 = getgr32(FAC0+dr+1) & 0xffff;
|
tempa1 = getgr32(FAC0+dr+1) & 0xffff;
|
||||||
tempa2 = immu64 & 0xffff;
|
tempa2 = immu64 & 0xffff;
|
||||||
if (abs(tempa1-tempa2) < 48)
|
if (abs(tempa1-tempa2) < 48)
|
||||||
if (prieee8(getfr64(dr), &tempd1)
|
if (prieee8(getfr64(dr), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8751,7 +8763,7 @@ dfcmdr:
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC0+dr))
|
if (getgr32s(FAC0+dr))
|
||||||
if (prieee8(getfr64(dr), &tempd1)
|
if (prieee8(getfr64(dr), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8843,7 +8855,7 @@ dfcmdr:
|
|||||||
tempa1 = getgr32(FAC0+dr+1) & 0xffff;
|
tempa1 = getgr32(FAC0+dr+1) & 0xffff;
|
||||||
tempa2 = immu64 & 0xffff;
|
tempa2 = immu64 & 0xffff;
|
||||||
if (abs(tempa1-tempa2) < 48)
|
if (abs(tempa1-tempa2) < 48)
|
||||||
if (prieee8(getfr64(dr), &tempd1)
|
if (prieee8(getfr64(dr), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8869,7 +8881,7 @@ dfcmdr:
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC0+dr))
|
if (getgr32s(FAC0+dr))
|
||||||
if (prieee8(getfr64(dr), &tempd1)
|
if (prieee8(getfr64(dr), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8893,7 +8905,7 @@ dfcmdr:
|
|||||||
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
||||||
}
|
}
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(dr), &tempd1)
|
&& prieee8(getfr64(dr), &tempd1)
|
||||||
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8913,7 +8925,7 @@ dfcmdr:
|
|||||||
if (*(int *)&ea >= 0)
|
if (*(int *)&ea >= 0)
|
||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(dr), &tempd1)
|
&& prieee8(getfr64(dr), &tempd1)
|
||||||
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC0+dr), 0))
|
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC0+dr), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -8991,7 +9003,7 @@ dfcmdr:
|
|||||||
}
|
}
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC0+dr))
|
if (getgr32s(FAC0+dr))
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(dr), &tempd1)
|
&& prieee8(getfr64(dr), &tempd1)
|
||||||
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC0+dr), 1))
|
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC0+dr), 1))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -9011,7 +9023,7 @@ dfcmdr:
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC0+dr))
|
if (getgr32s(FAC0+dr))
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(dr), &tempd1)
|
&& prieee8(getfr64(dr), &tempd1)
|
||||||
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC0+dr), 1))
|
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC0+dr), 1))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -9555,7 +9567,7 @@ d_adddad: /* 00600 (R-mode) */
|
|||||||
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
||||||
/* NOTE: this EQ test prevents reusing the ADD code :( */
|
/* NOTE: this EQ test prevents reusing the ADD code :( */
|
||||||
if (getcrs32s(L) == 0) /* set EQ? */
|
if (getcrs32s(L) == 0) /* set EQ? */
|
||||||
SETEQ;
|
SETEQ;
|
||||||
if (((~utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
if (((~utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
||||||
if (getcrs32s(L) >= 0)
|
if (getcrs32s(L) >= 0)
|
||||||
SETLT;
|
SETLT;
|
||||||
@@ -9590,7 +9602,7 @@ d_subdsb: /* 00700 */
|
|||||||
if (utempl & 0x10000) /* set L-bit if carry */
|
if (utempl & 0x10000) /* set L-bit if carry */
|
||||||
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
||||||
if (getcrs32s(L) == 0) /* set EQ? */
|
if (getcrs32s(L) == 0) /* set EQ? */
|
||||||
SETEQ;
|
SETEQ;
|
||||||
if (((utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
if (((utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
||||||
if (getcrs32s(L) >= 0)
|
if (getcrs32s(L) >= 0)
|
||||||
SETLT;
|
SETLT;
|
||||||
@@ -9642,9 +9654,9 @@ d_cas: /* 01100 */
|
|||||||
utempl += 1;
|
utempl += 1;
|
||||||
putcrs16(A, utempl); /* truncate results */
|
putcrs16(A, utempl); /* truncate results */
|
||||||
if (utempl & 0x10000) /* set L-bit if carry */
|
if (utempl & 0x10000) /* set L-bit if carry */
|
||||||
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
putcrs16(KEYS, getcrs16(KEYS) | 020000);
|
||||||
if (getcrs16(A) == 0) /* set EQ? */
|
if (getcrs16(A) == 0) /* set EQ? */
|
||||||
SETEQ;
|
SETEQ;
|
||||||
if (((utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
if (((utempa ^ m) & (utempa ^ getcrs16(A))) & 0x8000) {
|
||||||
if (getcrs16s(A) >= 0)
|
if (getcrs16s(A) >= 0)
|
||||||
SETLT;
|
SETLT;
|
||||||
@@ -9941,7 +9953,7 @@ d_fad: /* 00601 */
|
|||||||
tempa1 = getcrs16(FEXP);
|
tempa1 = getcrs16(FEXP);
|
||||||
tempa2 = immu64 & 0xffff;
|
tempa2 = immu64 & 0xffff;
|
||||||
if (abs(tempa1-tempa2) < 48)
|
if (abs(tempa1-tempa2) < 48)
|
||||||
if (prieee8(getfr64(2), &tempd1)
|
if (prieee8(getfr64(2), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC1), 0))
|
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC1), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -9969,7 +9981,7 @@ d_fdv: /* 01701 */
|
|||||||
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC1))
|
if (getgr32s(FAC1))
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(2), &tempd1)
|
&& prieee8(getfr64(2), &tempd1)
|
||||||
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC1), 1))
|
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC1), 1))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -9994,7 +10006,7 @@ d_fmp: /* 01601 */
|
|||||||
immu64 = get32(ea);
|
immu64 = get32(ea);
|
||||||
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
immu64 = ((immu64 << 32) & 0xffffff0000000000LL) | (immu64 & 0xff);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(2), &tempd1)
|
&& prieee8(getfr64(2), &tempd1)
|
||||||
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC1), 0))
|
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC1), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -10015,7 +10027,7 @@ d_fsb: /* 00701 */
|
|||||||
tempa1 = getcrs16(FEXP);
|
tempa1 = getcrs16(FEXP);
|
||||||
tempa2 = immu64 & 0xffff;
|
tempa2 = immu64 & 0xffff;
|
||||||
if (abs(tempa1-tempa2) < 48)
|
if (abs(tempa1-tempa2) < 48)
|
||||||
if (prieee8(getfr64(2), &tempd1)
|
if (prieee8(getfr64(2), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC1), 0))
|
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC1), 0))
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -10054,7 +10066,7 @@ d_dfad: /* 0602 */
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC1))
|
if (getgr32s(FAC1))
|
||||||
if (prieee8(getfr64(2), &tempd1)
|
if (prieee8(getfr64(2), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC1), 0)) {
|
&& ieeepr8(tempd1+tempd2, (long long *)(crsl+FAC1), 0)) {
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -10080,7 +10092,7 @@ d_dfdv: /* 01702 */
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC1))
|
if (getgr32s(FAC1))
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(2), &tempd1)
|
&& prieee8(getfr64(2), &tempd1)
|
||||||
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC1), 1)) {
|
&& ieeepr8(tempd1/tempd2, (long long *)(crsl+FAC1), 1)) {
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -10109,7 +10121,7 @@ d_dfmp: /* 01602 */
|
|||||||
if (getgr32s(FAC1)) {
|
if (getgr32s(FAC1)) {
|
||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (prieee8(immu64, &tempd2)
|
if (prieee8(immu64, &tempd2)
|
||||||
&& prieee8(getfr64(2), &tempd1)
|
&& prieee8(getfr64(2), &tempd1)
|
||||||
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC1), 0)) {
|
&& ieeepr8(tempd1*tempd2, (long long *)(crsl+FAC1), 0)) {
|
||||||
CLEARC;
|
CLEARC;
|
||||||
@@ -10128,7 +10140,7 @@ d_dfsb: /* 0702 */
|
|||||||
immu64 = get64(ea);
|
immu64 = get64(ea);
|
||||||
if (immu64 & 0xFFFFFFFF00000000LL)
|
if (immu64 & 0xFFFFFFFF00000000LL)
|
||||||
if (getgr32s(FAC1))
|
if (getgr32s(FAC1))
|
||||||
if (prieee8(getfr64(2), &tempd1)
|
if (prieee8(getfr64(2), &tempd1)
|
||||||
&& prieee8(immu64, &tempd2)
|
&& prieee8(immu64, &tempd2)
|
||||||
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC1), 0)) {
|
&& ieeepr8(tempd1-tempd2, (long long *)(crsl+FAC1), 0)) {
|
||||||
CLEARC;
|
CLEARC;
|
||||||
|
|||||||
44
emdev.h
44
emdev.h
@@ -51,7 +51,7 @@
|
|||||||
'50 = #1 HSSMLC/MDLC (synchronous comm)
|
'50 = #1 HSSMLC/MDLC (synchronous comm)
|
||||||
'51 = #2 HSSMLC/MDLC
|
'51 = #2 HSSMLC/MDLC
|
||||||
* '52 = #3 AMLC or ICS1
|
* '52 = #3 AMLC or ICS1
|
||||||
* '53 = #2 AMLC
|
* '53 = #2 AMLC
|
||||||
* '54 = #1 AMLC
|
* '54 = #1 AMLC
|
||||||
'55 = MACI autocall unit
|
'55 = MACI autocall unit
|
||||||
'56 = old SMLC (RTOS User Guide, A-1 & Hacker's Guide)
|
'56 = old SMLC (RTOS User Guide, A-1 & Hacker's Guide)
|
||||||
@@ -229,7 +229,7 @@ int devnone (int class, int func, int device) {
|
|||||||
OCP '0604 = enable transmit DMA/C
|
OCP '0604 = enable transmit DMA/C
|
||||||
OCP '0704 = reset transmit interrupt mask and DMA/C enable
|
OCP '0704 = reset transmit interrupt mask and DMA/C enable
|
||||||
OCP '1004 = Full duplex; software must echo
|
OCP '1004 = Full duplex; software must echo
|
||||||
OCP '1104 = output a sync pulse (diagnostics)
|
OCP '1104 = output a sync pulse (diagnostics)
|
||||||
OCP '1204 = Prime normal, independent xmit and recv w/echoplex
|
OCP '1204 = Prime normal, independent xmit and recv w/echoplex
|
||||||
OCP '1304 = Self test mode (internally connects transmitter to receiver)
|
OCP '1304 = Self test mode (internally connects transmitter to receiver)
|
||||||
OCP '1504 = Set both xmit & rcv interrupt masks
|
OCP '1504 = Set both xmit & rcv interrupt masks
|
||||||
@@ -302,7 +302,7 @@ int devasr (int class, int func, int device) {
|
|||||||
int doblock;
|
int doblock;
|
||||||
time_t unixtime;
|
time_t unixtime;
|
||||||
struct tm *tms;
|
struct tm *tms;
|
||||||
|
|
||||||
doblock = BLOCKIO;
|
doblock = BLOCKIO;
|
||||||
|
|
||||||
switch (class) {
|
switch (class) {
|
||||||
@@ -330,7 +330,7 @@ int devasr (int class, int func, int device) {
|
|||||||
perror(" unable to get tty attributes");
|
perror(" unable to get tty attributes");
|
||||||
fatal(NULL);
|
fatal(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save initial terminal setup to restore when exiting */
|
/* save initial terminal setup to restore when exiting */
|
||||||
|
|
||||||
origterminfo = terminfo;
|
origterminfo = terminfo;
|
||||||
@@ -497,7 +497,7 @@ readasr:
|
|||||||
goto readasr;
|
goto readasr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if doing local echo, do xon/xoff processing here. If Unix
|
/* if doing local echo, do xon/xoff processing here. If Unix
|
||||||
does it, the emulator might block on a console write. If
|
does it, the emulator might block on a console write. If
|
||||||
the console is running full-duplex (no local echo), we can
|
the console is running full-duplex (no local echo), we can
|
||||||
@@ -650,7 +650,7 @@ readasr:
|
|||||||
|
|
||||||
/* Device '14 - magtape controller #1
|
/* Device '14 - magtape controller #1
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
||||||
This code only supports 1 tape controller (4 units), but could be
|
This code only supports 1 tape controller (4 units), but could be
|
||||||
extended to support 2 controllers (eg, see disk controller code)
|
extended to support 2 controllers (eg, see disk controller code)
|
||||||
@@ -863,7 +863,7 @@ fmterr:
|
|||||||
*mtstat |= 0x100; /* set filemark status */
|
*mtstat |= 0x100; /* set filemark status */
|
||||||
goto repo;
|
goto repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore attempts to backspace over error records. This will
|
/* ignore attempts to backspace over error records. This will
|
||||||
cause Magsav to read the next record instead, and it may
|
cause Magsav to read the next record instead, and it may
|
||||||
recover. Re-reading the error record 10 times won't help! */
|
recover. Re-reading the error record 10 times won't help! */
|
||||||
@@ -881,7 +881,7 @@ fmterr:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read leading reclen again to make sure we're positioned correctly */
|
/* read leading reclen again to make sure we're positioned correctly */
|
||||||
|
|
||||||
n = read(fd, buf, 4);
|
n = read(fd, buf, 4);
|
||||||
if (n == -1) goto readerr;
|
if (n == -1) goto readerr;
|
||||||
if (n != 4) {
|
if (n != 4) {
|
||||||
@@ -974,7 +974,7 @@ int devmt (int class, int func, int device) {
|
|||||||
enabled = 1;
|
enabled = 1;
|
||||||
if (interrupting == 1) /* if interrupt is pending */
|
if (interrupting == 1) /* if interrupt is pending */
|
||||||
devpoll[device] = 10; /* try to interrupt soon */
|
devpoll[device] = 10; /* try to interrupt soon */
|
||||||
|
|
||||||
} else if (func == 016) { /* reset interrupt mask */
|
} else if (func == 016) { /* reset interrupt mask */
|
||||||
enabled = 0;
|
enabled = 0;
|
||||||
|
|
||||||
@@ -1092,7 +1092,7 @@ int devmt (int class, int func, int device) {
|
|||||||
} else
|
} else
|
||||||
unit[u].mtstat = 0x00C8; /* Ready, Online, BOT */
|
unit[u].mtstat = 0x00C8; /* Ready, Online, BOT */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "select only" is ignored. On a real tape controller, this
|
/* "select only" is ignored. On a real tape controller, this
|
||||||
blocks (I think) if the previous tape operation is in progress */
|
blocks (I think) if the previous tape operation is in progress */
|
||||||
|
|
||||||
@@ -1276,12 +1276,12 @@ int devmt (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
IOSKIP;
|
IOSKIP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else if (func == 02) {
|
} else if (func == 02) {
|
||||||
ready = 1;
|
ready = 1;
|
||||||
if (getcrs16(A) & 0x8000) { /* status word 1 */
|
if (getcrs16(A) & 0x8000) { /* status word 1 */
|
||||||
datareg = unit[usel].mtstat;
|
datareg = unit[usel].mtstat;
|
||||||
|
|
||||||
/* if the tape was rewinding, return rewinding status once, then
|
/* if the tape was rewinding, return rewinding status once, then
|
||||||
change it to BOT */
|
change it to BOT */
|
||||||
|
|
||||||
@@ -1413,7 +1413,9 @@ void initclock(ea_t datnowea) {
|
|||||||
unixtime = time(NULL);
|
unixtime = time(NULL);
|
||||||
tms = localtime(&unixtime);
|
tms = localtime(&unixtime);
|
||||||
datnow = tms->tm_year<<25 | (tms->tm_mon+1)<<21 | tms->tm_mday<<16 | ((tms->tm_hour*3600 + tms->tm_min*60 + tms->tm_sec)/4);
|
datnow = tms->tm_year<<25 | (tms->tm_mon+1)<<21 | tms->tm_mday<<16 | ((tms->tm_hour*3600 + tms->tm_min*60 + tms->tm_sec)/4);
|
||||||
put32r0(datnow, datnowea);
|
if (! noclock) {
|
||||||
|
put32r0(datnow, datnowea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1438,7 +1440,7 @@ int devcp (int class, int func, int device) {
|
|||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
|
|
||||||
/* if -map is used, lookup DATNOW symbol and set the 32-bit
|
/* if -map is used, lookup DATNOW symbol and set the 32-bit
|
||||||
Primos time value (DATNOW+TIMNOW) */
|
Primos time value (DATNOW+TIMNOW) */
|
||||||
|
|
||||||
datnowea = 0;
|
datnowea = 0;
|
||||||
@@ -1455,10 +1457,10 @@ int devcp (int class, int func, int device) {
|
|||||||
;
|
;
|
||||||
|
|
||||||
} else if (func == 01) { /* ack PIC interrupt */
|
} else if (func == 01) { /* ack PIC interrupt */
|
||||||
;
|
;
|
||||||
|
|
||||||
} else if (func == 02) { /* stop LFC (IO.PNC DIAG) */
|
} else if (func == 02) { /* stop LFC (IO.PNC DIAG) */
|
||||||
;
|
;
|
||||||
|
|
||||||
} else if (func == 04) { /* does something on VCP during boot */
|
} else if (func == 04) { /* does something on VCP during boot */
|
||||||
;
|
;
|
||||||
@@ -1581,7 +1583,7 @@ int devcp (int class, int func, int device) {
|
|||||||
previnstcount = gv.instcount;
|
previnstcount = gv.instcount;
|
||||||
if (datnowea != 0)
|
if (datnowea != 0)
|
||||||
initclock(datnowea);
|
initclock(datnowea);
|
||||||
}
|
}
|
||||||
elapsedms = (tv.tv_sec-start_tv.tv_sec)*1000.0 + (tv.tv_usec-start_tv.tv_usec)/1000.0;
|
elapsedms = (tv.tv_sec-start_tv.tv_sec)*1000.0 + (tv.tv_usec-start_tv.tv_usec)/1000.0;
|
||||||
targetticks = elapsedms/(-clkpic*clkrate/1000);
|
targetticks = elapsedms/(-clkpic*clkrate/1000);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1595,7 +1597,7 @@ int devcp (int class, int func, int device) {
|
|||||||
available (no Primos maps), then we have to tick our way to
|
available (no Primos maps), then we have to tick our way to
|
||||||
the correct time. In addition to lowering overhead, slower
|
the correct time. In addition to lowering overhead, slower
|
||||||
clock tick rates make catching up much faster.
|
clock tick rates make catching up much faster.
|
||||||
|
|
||||||
When ticking faster, we need to be careful not to tick too
|
When ticking faster, we need to be careful not to tick too
|
||||||
fast, because that will cause timed events like disk I/O to
|
fast, because that will cause timed events like disk I/O to
|
||||||
timeout prematurely. With rev 20 Primos, setting the
|
timeout prematurely. With rev 20 Primos, setting the
|
||||||
@@ -1812,7 +1814,7 @@ int devdisk (int class, int func, int device) {
|
|||||||
dc[dx].unit[u].modrecs = NULL;
|
dc[dx].unit[u].modrecs = NULL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
TRACE(T_INST|T_DIO, " OCP '%2o%2o\n", func, device);
|
TRACE(T_INST|T_DIO, " OCP '%2o%2o\n", func, device);
|
||||||
if (func == 016) { /* reset interrupt */
|
if (func == 016) { /* reset interrupt */
|
||||||
@@ -2017,7 +2019,7 @@ int devdisk (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
dmaaddr = ((getar16(REGDMX16+dmareg) & 3)<<16) | getar16(REGDMX16+dmareg+1);
|
dmaaddr = ((getar16(REGDMX16+dmareg) & 3)<<16) | getar16(REGDMX16+dmareg+1);
|
||||||
TRACE(T_INST|T_DIO, " DMA channels: nch-1=%d, ['%o]='%o, ['%o]='%o, nwords=%d\n", dc[dx].dmanch, dc[dx].dmachan, swap16(regs.sym.regdmx[dmareg]), dc[dx].dmachan+1, dmaaddr, dmanw);
|
TRACE(T_INST|T_DIO, " DMA channels: nch-1=%d, ['%o]='%o, ['%o]='%o, nwords=%d\n", dc[dx].dmanch, dc[dx].dmachan, swap16(regs.sym.regdmx[dmareg]), dc[dx].dmachan+1, dmaaddr, dmanw);
|
||||||
|
|
||||||
if (order == 5) { /* read */
|
if (order == 5) { /* read */
|
||||||
if (getcrs16(MODALS) & 020) /* mapped read */
|
if (getcrs16(MODALS) & 020) /* mapped read */
|
||||||
if ((dmaaddr & 01777) || dmanw > 1024)
|
if ((dmaaddr & 01777) || dmanw > 1024)
|
||||||
@@ -2078,7 +2080,7 @@ int devdisk (int class, int func, int device) {
|
|||||||
}
|
}
|
||||||
TRACE(T_INST|T_DIO, " seek track %d, restore=%d, clear=%d\n", track, (m1 & 0100000) != 0, (m1 & 040000) != 0);
|
TRACE(T_INST|T_DIO, " seek track %d, restore=%d, clear=%d\n", track, (m1 & 0100000) != 0, (m1 & 040000) != 0);
|
||||||
#if 0
|
#if 0
|
||||||
/* this has been disabled because SCSI drives sometimes seek to
|
/* this has been disabled because SCSI drives sometimes seek to
|
||||||
track 512 (special meaning in controller?) */
|
track 512 (special meaning in controller?) */
|
||||||
|
|
||||||
if (track > dc[dx].unit[u].maxtrack) {
|
if (track > dc[dx].unit[u].maxtrack) {
|
||||||
|
|||||||
84
fp.h
84
fp.h
@@ -40,6 +40,7 @@ http://tima-cmp.imag.fr/~guyot/Cours/Oparithm/english/Op_Ar2.htm
|
|||||||
|
|
||||||
inline void getdp (unsigned long long p, long long *frac64, int *exp32) {
|
inline void getdp (unsigned long long p, long long *frac64, int *exp32) {
|
||||||
|
|
||||||
|
TRACE(T_FP, " getdp(%016llx)\n", p);
|
||||||
*frac64 = p & 0xFFFFFFFFFFFF0000LL; /* unpack fraction */
|
*frac64 = p & 0xFFFFFFFFFFFF0000LL; /* unpack fraction */
|
||||||
*exp32 = (short) (p & 0xFFFFLL); /* unpack SIGNED exponent */
|
*exp32 = (short) (p & 0xFFFFLL); /* unpack SIGNED exponent */
|
||||||
}
|
}
|
||||||
@@ -59,22 +60,29 @@ int prieee8(unsigned long long dp, double *d) {
|
|||||||
/* unpack Prime DPFP */
|
/* unpack Prime DPFP */
|
||||||
|
|
||||||
getdp (dp, &frac64, &exp32);
|
getdp (dp, &frac64, &exp32);
|
||||||
|
TRACE(T_FP, " prieee8: unpacked frac %016llx exp %08x\n", frac64, exp32);
|
||||||
|
|
||||||
/* if negative, change to sign-magnitude */
|
/* if negative, change to sign-magnitude */
|
||||||
|
|
||||||
sign = 0;
|
sign = 0;
|
||||||
if (frac64 < 0) {
|
if (frac64 < 0) {
|
||||||
|
TRACE(T_FP, " prieee8: changing to sign-magnitude\n");
|
||||||
|
|
||||||
/* special case: negative power of 2 */
|
/* special case: negative power of 2 */
|
||||||
|
|
||||||
if (frac64 == 0x8000000000000000LL) {
|
if (frac64 == 0x8000000000000000LL) {
|
||||||
|
TRACE(T_FP, " prieee8: frac is negative power of 2\n");
|
||||||
exp32 += (1023-128);
|
exp32 += (1023-128);
|
||||||
if (exp32 < 0 || exp32 > 0x7fe)
|
if (exp32 < 0 || exp32 > 0x7fe)
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " prieee8: exp %x out of range\n", exp32);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
frac64 |= ((long long)exp32 << 52);
|
frac64 |= ((long long)exp32 << 52);
|
||||||
*d = *(double *)&frac64;
|
*d = *(double *)&frac64;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
TRACE(T_FP, " prieee8: frac is just negative\n");
|
||||||
sign = 0x8000000000000000LL;
|
sign = 0x8000000000000000LL;
|
||||||
frac64 = -frac64;
|
frac64 = -frac64;
|
||||||
}
|
}
|
||||||
@@ -82,13 +90,15 @@ int prieee8(unsigned long long dp, double *d) {
|
|||||||
/* special case: zero */
|
/* special case: zero */
|
||||||
|
|
||||||
} else if (frac64 == 0) {
|
} else if (frac64 == 0) {
|
||||||
|
TRACE(T_FP, " prieee8: frac is 0\n");
|
||||||
*d = 0.0;
|
*d = 0.0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* normalize positive fraction until bit 2 is 1 */
|
/* normalize positive fraction until bit 2 is 1 */
|
||||||
|
|
||||||
while ((frac64 & 0x4000000000000000LL) == 0) {
|
while ((frac64 & 0x4000000000000000LL) == 0) {
|
||||||
|
TRACE(T_FP, " prieee8: normalizing positive fraction\n");
|
||||||
frac64 = frac64 << 1;
|
frac64 = frac64 << 1;
|
||||||
exp32--;
|
exp32--;
|
||||||
}
|
}
|
||||||
@@ -98,7 +108,10 @@ int prieee8(unsigned long long dp, double *d) {
|
|||||||
exp32 += (1023-128) - 1;
|
exp32 += (1023-128) - 1;
|
||||||
#if 1
|
#if 1
|
||||||
if (exp32 < 0 || exp32 > 0x7fe)
|
if (exp32 < 0 || exp32 > 0x7fe)
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " prieee8: exponent %x out of range\n", exp32);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (exp32 < 0) {
|
if (exp32 < 0) {
|
||||||
*d = 0.0;
|
*d = 0.0;
|
||||||
@@ -113,6 +126,7 @@ int prieee8(unsigned long long dp, double *d) {
|
|||||||
/* pack into an IEEE DPFP, losing the leading 1 bit in the process */
|
/* pack into an IEEE DPFP, losing the leading 1 bit in the process */
|
||||||
|
|
||||||
frac64 = sign | ((long long)exp32 << 52) | ((frac64 >> 10) & 0xfffffffffffffLL);
|
frac64 = sign | ((long long)exp32 << 52) | ((frac64 >> 10) & 0xfffffffffffffLL);
|
||||||
|
TRACE(T_FP, " prieee8: packed ieee dpfp %016llx\n", frac64);
|
||||||
*d = *(double *)&frac64;
|
*d = *(double *)&frac64;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -134,7 +148,7 @@ retry:
|
|||||||
neg = frac64 < 0;
|
neg = frac64 < 0;
|
||||||
exp32 = (frac64 >> 52) & 0x7ff;
|
exp32 = (frac64 >> 52) & 0x7ff;
|
||||||
frac64 &= 0xfffffffffffffLL;
|
frac64 &= 0xfffffffffffffLL;
|
||||||
//printf("dp=%llx, neg=%d, frac64=%llx, exp32=%d, \n", *(long long *)dp, neg, frac64, exp32);
|
TRACE(T_FP, "d=%016llx, neg=%x, frac64=%016llx, exp32=%08x, \n", (long long)d, neg, frac64, exp32);
|
||||||
|
|
||||||
/* special case: NaN & +-infinity */
|
/* special case: NaN & +-infinity */
|
||||||
|
|
||||||
@@ -159,12 +173,21 @@ retry:
|
|||||||
and subnormal */
|
and subnormal */
|
||||||
|
|
||||||
if (exp32 != 0) /* typical IEEE normalized */
|
if (exp32 != 0) /* typical IEEE normalized */
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " ieeepr8: is normalized\n");
|
||||||
frac64 |= 0x10000000000000LL;
|
frac64 |= 0x10000000000000LL;
|
||||||
else if (frac64 == 0) { /* IEEE +-0.0 (zero exp+frac) */
|
}
|
||||||
|
else if (frac64 == 0) /* IEEE +-0.0 (zero exp+frac) */
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " ieeepr8: zero exp and frac\n");
|
||||||
*p = 0; /* IEEE and Prime zero are the same */
|
*p = 0; /* IEEE and Prime zero are the same */
|
||||||
return okay;
|
return okay;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " ieeepr8: subnormal value\n");
|
||||||
; /* subnormal: no hidden 1 bit */
|
; /* subnormal: no hidden 1 bit */
|
||||||
|
}
|
||||||
|
|
||||||
/* adjust exponent, change sign-magnitude to 2's complement,
|
/* adjust exponent, change sign-magnitude to 2's complement,
|
||||||
and shift fraction into Prime placement (high 48 bits) */
|
and shift fraction into Prime placement (high 48 bits) */
|
||||||
@@ -173,12 +196,14 @@ retry:
|
|||||||
if (neg)
|
if (neg)
|
||||||
frac64 = -frac64;
|
frac64 = -frac64;
|
||||||
frac64 <<= 10;
|
frac64 <<= 10;
|
||||||
|
TRACE(T_FP, " ieeepr8: de-biased prime-ised frac %016llx exp %08x\n", frac64, exp32);
|
||||||
|
|
||||||
/* normalize Prime DPFP */
|
/* normalize Prime DPFP */
|
||||||
|
|
||||||
while ((frac64 ^ (frac64 << 1)) >= 0) {
|
while ((frac64 ^ (frac64 << 1)) >= 0) {
|
||||||
frac64 = frac64 << 1;
|
frac64 = frac64 << 1;
|
||||||
exp32--;
|
exp32--;
|
||||||
|
TRACE(T_FP, " ieeepr8: normalized prime frac %016llx exp %08x\n", frac64, exp32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -204,8 +229,11 @@ retry:
|
|||||||
|
|
||||||
if (round)
|
if (round)
|
||||||
if ((frac64 & 0x8000) && ((frac64 & 0x7fffffffffff0000LL) != 0x7fffffffffff0000LL))
|
if ((frac64 & 0x8000) && ((frac64 & 0x7fffffffffff0000LL) != 0x7fffffffffff0000LL))
|
||||||
|
{
|
||||||
/* XXX: should this be a subtract for negative numbers? */
|
/* XXX: should this be a subtract for negative numbers? */
|
||||||
frac64 += 0x10000;
|
frac64 += 0x10000;
|
||||||
|
TRACE(T_FP, " ieeepr8: rounded frac %016llx\n", frac64);
|
||||||
|
}
|
||||||
|
|
||||||
*p = swap64((frac64 & 0xffffffffffff0000LL) | (exp32 & 0xffff));
|
*p = swap64((frac64 & 0xffffffffffff0000LL) | (exp32 & 0xffff));
|
||||||
return okay;
|
return okay;
|
||||||
@@ -260,6 +288,7 @@ unsigned long long dfcm (unsigned long long dp, int *oflow) {
|
|||||||
CLEARC;
|
CLEARC;
|
||||||
*oflow = 0;
|
*oflow = 0;
|
||||||
getdp(dp, &frac64, &exp32);
|
getdp(dp, &frac64, &exp32);
|
||||||
|
TRACE(T_FP, " dfcm: unpacked frac %016llx exp %08x\n", frac64, exp32);
|
||||||
if (frac64 != 0) { /* can't normalize zero */
|
if (frac64 != 0) { /* can't normalize zero */
|
||||||
if (frac64 == 0x8000000000000000LL) { /* overflow case? */
|
if (frac64 == 0x8000000000000000LL) { /* overflow case? */
|
||||||
frac64 = 0x4000000000000000LL; /* complement power of 2 */
|
frac64 = 0x4000000000000000LL; /* complement power of 2 */
|
||||||
@@ -290,6 +319,7 @@ unsigned long long norm(unsigned long long dp, int *oflow) {
|
|||||||
|
|
||||||
*oflow = 0;
|
*oflow = 0;
|
||||||
getdp(dp, &frac64, &exp32);
|
getdp(dp, &frac64, &exp32);
|
||||||
|
TRACE(T_FP, " norm: unpacked frac %016llx exp %08x\n", frac64, exp32);
|
||||||
while ((frac64 ^ (frac64 << 1)) >= 0) {
|
while ((frac64 ^ (frac64 << 1)) >= 0) {
|
||||||
frac64 = frac64 << 1;
|
frac64 = frac64 << 1;
|
||||||
exp32--;
|
exp32--;
|
||||||
@@ -314,11 +344,16 @@ unsigned long long frn(unsigned long long dp, int *oflow) {
|
|||||||
|
|
||||||
*oflow = 0;
|
*oflow = 0;
|
||||||
getdp(dp, &frac64, &exp32);
|
getdp(dp, &frac64, &exp32);
|
||||||
|
TRACE(T_FP, " frn: unpacked frac %016llx exp %08x\n", frac64, exp32);
|
||||||
if (frac64 == 0)
|
if (frac64 == 0)
|
||||||
|
{
|
||||||
|
TRACE(T_FP, " frn: returning 0\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
doround1 = ((frac64 & 0x18000000000LL) != 0);
|
doround1 = ((frac64 & 0x18000000000LL) != 0);
|
||||||
doround2 = ((frac64 & 0x8000000000LL) != 0) && ((frac64 & 0x7FFFFF0000LL) != 0);
|
doround2 = ((frac64 & 0x8000000000LL) != 0) && ((frac64 & 0x7FFFFF0000LL) != 0);
|
||||||
|
TRACE(T_FP, " frn: doround1 %x doround2 %x\n", doround1, doround2);
|
||||||
if (doround1 || doround2) {
|
if (doround1 || doround2) {
|
||||||
frac64 &= 0xFFFFFF0000000000LL;
|
frac64 &= 0xFFFFFF0000000000LL;
|
||||||
if (frac64 != 0x7FFFFF0000000000LL)
|
if (frac64 != 0x7FFFFF0000000000LL)
|
||||||
@@ -329,8 +364,10 @@ unsigned long long frn(unsigned long long dp, int *oflow) {
|
|||||||
}
|
}
|
||||||
frac64 |= (exp32 & 0xFFFF);
|
frac64 |= (exp32 & 0xFFFF);
|
||||||
frac64 = norm(frac64, oflow);
|
frac64 = norm(frac64, oflow);
|
||||||
|
TRACE(T_FP, " frn: rounded frac %016llx\n", frac64);
|
||||||
return frac64;
|
return frac64;
|
||||||
}
|
}
|
||||||
|
TRACE(T_FP, " frn: dp %016llx\n", dp);
|
||||||
return dp;
|
return dp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,26 +393,37 @@ int fcs (unsigned long long fac, int fop) {
|
|||||||
fop = fop & 0xffffff00;
|
fop = fop & 0xffffff00;
|
||||||
if (fop == 0) /* fix dirty zero */
|
if (fop == 0) /* fix dirty zero */
|
||||||
fopexp = 0;
|
fopexp = 0;
|
||||||
|
TRACE(T_FP, " fcs: FAC: %016llx %04x; op: %016llx %04x\n", templ, facexp, fop, fopexp);
|
||||||
if ((templ & 0x80000000) == (fop & 0x80000000)) { /* compare signs */
|
if ((templ & 0x80000000) == (fop & 0x80000000)) { /* compare signs */
|
||||||
if (facexp == fopexp) /* compare exponents */
|
if (facexp == fopexp) /* compare exponents */
|
||||||
if (templ == fop) { /* compare fractions */
|
if (templ == fop) { /* compare fractions */
|
||||||
|
TRACE(T_FP, " fcs: frac cmp returning eq / skip 1\n");
|
||||||
SETEQ;
|
SETEQ;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (templ < fop) { /* compare fractions */
|
} else if (templ < fop) { /* compare fractions */
|
||||||
|
TRACE(T_FP, " fcs: frac cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " fcs: frac cmp returning gt / skip 0\n");
|
||||||
return 0; /* FAC > operand */
|
return 0; /* FAC > operand */
|
||||||
|
}
|
||||||
else if (facexp < fopexp) { /* compare exponents */
|
else if (facexp < fopexp) { /* compare exponents */
|
||||||
|
TRACE(T_FP, " fcs: exp cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " fcs: exp cmp returning gt / skip 0\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
} else if (templ & 0x80000000) {
|
} else if (templ & 0x80000000) {
|
||||||
|
TRACE(T_FP, " fcs: sign cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " fcs: sign cmp returning gt / skip 0\n");
|
||||||
return 0; /* FAC > operand */
|
return 0; /* FAC > operand */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -386,7 +434,7 @@ int fcs (unsigned long long fac, int fop) {
|
|||||||
|
|
||||||
NOTE: This code doesn't pass Prime diagnostics for higher model
|
NOTE: This code doesn't pass Prime diagnostics for higher model
|
||||||
CPU's, I'm guessing because comparison is implemented as subtract,
|
CPU's, I'm guessing because comparison is implemented as subtract,
|
||||||
and we can't do that because numbers with huge exponents (and
|
and we can't do that because numbers with huge exponents (and
|
||||||
Prime ASCII characters in the DAC) won't convert to IEEE.
|
Prime ASCII characters in the DAC) won't convert to IEEE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -404,27 +452,35 @@ int dfcs (unsigned long long fac, long long fop) {
|
|||||||
fop = fop & 0xffffffffffff0000LL;
|
fop = fop & 0xffffffffffff0000LL;
|
||||||
if (fop == 0) /* fix dirty zero */
|
if (fop == 0) /* fix dirty zero */
|
||||||
fopexp = 0;
|
fopexp = 0;
|
||||||
#if 0
|
TRACE(T_FP, " dfcs: FAC: %016llx %04x; op: %016llx %04x\n", templl, facexp, fop, fopexp);
|
||||||
printf("dfcs: FAC: %016llx %04x; op: %016llx %04x\n", templl, facexp, fop, fopexp);
|
|
||||||
#endif
|
|
||||||
if ((templl & 0x8000000000000000LL) == (fop & 0x8000000000000000LL)) { /* compare signs */
|
if ((templl & 0x8000000000000000LL) == (fop & 0x8000000000000000LL)) { /* compare signs */
|
||||||
if (facexp == fopexp) /* compare exponents */
|
if (facexp == fopexp) /* compare exponents */
|
||||||
if (templl == fop) { /* compare fractions */
|
if (templl == fop) { /* compare fractions */
|
||||||
|
TRACE(T_FP, " dfcs: frac cmp returning eq / skip 1\n");
|
||||||
SETEQ;
|
SETEQ;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (templl < fop) { /* compare fractions */
|
} else if (templl < fop) { /* compare fractions */
|
||||||
|
TRACE(T_FP, " dfcs: frac cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " dfcs: frac cmp returning gt / skip 0\n");
|
||||||
return 0; /* FAC > operand */
|
return 0; /* FAC > operand */
|
||||||
|
}
|
||||||
else if (facexp < fopexp) { /* compare exponents */
|
else if (facexp < fopexp) { /* compare exponents */
|
||||||
|
TRACE(T_FP, " dfcs: exp cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " dfcs: exp cmp returning eq / skip 1\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
} else if (templl & 0x8000000000000000LL) {
|
} else if (templl & 0x8000000000000000LL) {
|
||||||
|
TRACE(T_FP, " dfcs: sign cmp returning lt / skip 2\n");
|
||||||
SETLT; /* FAC < operand */
|
SETLT; /* FAC < operand */
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else {
|
||||||
|
TRACE(T_FP, " dfcs: sign cmp returning gt / skip 0\n");
|
||||||
return 0; /* FAC > operand */
|
return 0; /* FAC > operand */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* utextp.c, Jim Wilcoxson, March 16, 2005
|
/* utextp.c, Jim Wilcoxson, March 16, 2005
|
||||||
Reads a Unix text file and converts it to a compressed Prime text file.
|
Reads a Unix text file and converts it to a compressed Prime text file.
|
||||||
This means:
|
This means:
|
||||||
- turn high bit on
|
- turn high bit on
|
||||||
- expand Unix tabs to spaces
|
- expand Unix tabs to spaces
|
||||||
@@ -29,7 +29,7 @@ main () {
|
|||||||
else { /* not a space character */
|
else { /* not a space character */
|
||||||
while (space) { /* dump held-back spaces first */
|
while (space) { /* dump held-back spaces first */
|
||||||
if (space < 3) { /* write regular spaces */
|
if (space < 3) { /* write regular spaces */
|
||||||
putchar(' ');
|
putchar(0240);
|
||||||
space--;
|
space--;
|
||||||
n++;
|
n++;
|
||||||
} else { /* write compressed spaces */
|
} else { /* write compressed spaces */
|
||||||
|
|||||||
Reference in New Issue
Block a user