Program+2 +Hello+World+- +Telnet

=Program #2 - Hello World - Telnet= test

It's time for the traditional "Hello World" program, in this case written in 370 assembler.

The output of the program will be displayed on an IBM '3215' device" (which can be emulated by a telnet client).

After starting up Hercules, start a telnet client program, e.g. :


 * telnet localhost 3270.**

("localhost" is a "built in" network name / synonym meaning "this computer")

Your telnet client should start up and then display a message similar to the following.

Hercules version 3.07 built on Mar 23 2010 01:41:03 running on
 * Connected to device 0:0009** <<<<<<<<<<<<<<<<< This is the important line

Also on the Hercules console, you should see :

HHCTE009I Client 127.0.0.1 connected to 3215 device 0:0009

Next, using either the Hercules "r" command or the Hercules script command, enter the following program.:

code format="perl" r 2000= 05 C0      #       BALR 12,0 r 2002= 41 20 C0 1E #      LA 2,CCW1 load CCW address r 2006= 50 20 00 48 #      ST 2,72(0,0) Store it at CAW r 200A= 9C 00 00 09 # LOOP1 SIO 9(0) Start io for device #9 r 200E= 47 F0 C0 08 #      B LOOP1 Loop forever # or change the above code to 47 00 00 00  (NOP), and fall through to the LPSW # r 2012=82 00 C0 3E # LPSW MYWAITPSW code code format="perl" # LENMSG EQU X'0B' # WRITECR EQU 9       Write to 3215 with carriage return

code code format="perl" r 2020= 09 00 20 30 # CCW1 CCW WRITECR,MSG,0,LENMSG r 2024= 00 00 00 0B r 2030= C8 C5 D3 D3 # MSG  DC C'HELLO WORLD' r 2034= D6 40 E6 D6 r 2038= D9 D3 C4

code code format="perl" r 2040=00 0A 00 00 00 12 34 56   # MYWAITPSW         # a disabled wait state PSW code

code format="perl" It is not necessary to enter the "#" (comment) or anything after it, only the hex bytes are the actual executable instructions.

code If you are using the Hercules.rc file ,then issuing a 'restart' command from the Hercules console should now run the program, and you should see 'HELLO WORLD' on the telnet display.

Otherwise, before entering the **restart** command, enter the following commands to set up the emulator :

r 0=00 08 00 00 00 00 20 00 # set restart PSW,

This creates a EC mode restart PSW, with an instruction address of X'2000'