[Simh] Porting simh for IBM VM/CMS

Dave G4UGM dave.g4ugm at gmail.com
Fri Jul 31 08:09:19 EDT 2015


I am amazed, and very glad, it works, been ages since I wrote any “C” ….

.. and as for threads, well they are hidden in the headers, and should just pick up again. 

 

Dave Wade

G4UGM

 

From: rubhone at aol.com [mailto:rubhone at aol.com] 
Sent: 31 July 2015 13:01
To: dave.g4ugm at gmail.com
Subject: Re: [Simh] Porting simh for IBM VM/CMS

 

Your code does the trick, Thank You! 

I' m not sure how to post this back to the email list in the same thread?

 

Fritz



-----Original Message-----
From: Dave G4UGM < <mailto:dave.g4ugm at gmail.com> dave.g4ugm at gmail.com>
To: 'Jordi Guillaumes i Pons' < <mailto:jg at jordi.guillaumes.name> jg at jordi.guillaumes.name>; rubhone < <mailto:rubhone at aol.com> rubhone at aol.com>
Cc: simh < <mailto:simh at trailing-edge.com> simh at trailing-edge.com>
Sent: Wed, Jul 29, 2015 6:29 am
Subject: RE: [Simh] Porting simh for IBM VM/CMS

I assume it is this line in sim_defs.h that causes the issue…

 

#define SWMASK(x) (1u << (((int) (x)) - ((int) 'A')))

 

What a nasty piece of code (sorry folks)….

… So to make it really horrid we can use nested “?” operator. So we have 

 

{expr1} ? {expr2} :  {expr3}

 

So if “expr1” is true we execute “expr2”, otherwise “expr3”. 

 

Nesting this we have 

 

{expr1}  ? {expr2}  : ( {expr3} ? {expr4} : {expr5}),

 

If  “expr1” is “true” we do “expr2”, 

if “expr1” is false and “expr3” is true we do “expr4” 

if “expr1 and expr3 are both false we do “expr5”

 

Hacking the macro gives use something like this:-

 

#define SWMASK(x)  (1u << ( ((int)(x)<(int)('I')) ? (((int)(x)) - ((int)'A')) : ( ((int)(x)<(int)('S'))? (((int)(x))+9-((int)'J')) : (((int)(x))+20-((int)'S')) ) ))

 

Not sure the brackets match but basically use “?” to say 

 

1.       if its “A” to “I” then the old logic works, 

2.       if its “J” through “R” then you need to take off “J” and add “9”

3.       if its “S” thru “Z” then take off “S” and add   “18”

 

Truely noxious, needs surrounding by tests for VM, is that “__VM__”?

 

#if defined __VM__

#define SWMASK(x)  (1u << ( ((int)(x)<(int)('I')) ? (((int)(x)) - ((int)'A')) : ( ((int)(x)<(int)('S'))? (((int)(x))+9-((int)'J')) : (((int)(x))+20-((int)'S')) ) ))

#else

#define SWMASK(x) (1u << (((int) (x)) - ((int) 'A')))

#endif

 

I now need to lie down in a dark room with a nice COBOL manual..

 

Dave

G4UGM

Actually off to a Theater Organ Concert.

 <http://www.ltot.org.uk/> http://www.ltot.org.uk/

 

From: Simh [ <mailto:simh-bounces at trailing-edge.com> mailto:simh-bounces at trailing-edge.com] On Behalf Of Jordi Guillaumes i Pons
Sent: 29 July 2015 08:03
To:  <mailto:rubhone at aol.com> rubhone at aol.com
Cc:  <mailto:simh at trailing-edge.com> simh at trailing-edge.com
Subject: Re: [Simh] Porting simh for IBM VM/CMS

 

Sorry for top posting.

 

Write a remapping macro to convert from the array index to the EBCDIC encoding. Use conditional compilation so when the target OS is not VM or MVS it does nothing and returns the original index.

Jordi Guillaumes Pons

 


El 29/07/2015, a les 7:06,  <mailto:rubhone at aol.com> rubhone at aol.com va escriure:

I have made substantial progress in an attempt to run simh under IBM's VM/370 CMS environment. 

 

Difficulties include:

          lack of a proper "make" facility

          external reference and symbolic names limited to 8 characters

          no hierarchical file system

          OS dependencies for file I/O, timers, etc.

          file system preference for fixed length 80 byte record-oriented files

                      makes importing source code awkward

 

Despite all of this, I am currently able to compile, load and execute the simh scp for a

target ALTAIR system.   Console interactions (set/show) are fine, and the sim will run

"do" files upon startup and interactively.

 

I am currently trying to get the "attach <dev> <file>" code working.  This made me realize

that a compiler (gcc) warning regarding sim_switches and SWMASK is a real issue.

 

The EBCDIC character set used on IBM systems has gaps in the codes for "A" to "Z",

occupying an integer range of 41 values.  This causes the left shift in SWMASK to exceed

the defined size of int32 for sim_switches.

 

My broad range of old-school programming by no means makes me an expert in C.

Any ideas on a compact solution for this character set problem?

 

Regards,

Fritz

 

 

_______________________________________________
Simh mailing list
 <mailto:Simh at trailing-edge.com> Simh at trailing-edge.com
 <http://mailman.trailing-edge.com/mailman/listinfo/simh> http://mailman.trailing-edge.com/mailman/listinfo/simh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20150731/7a2ba3ca/attachment-0001.html>


More information about the Simh mailing list