For fun I'm implementing brainfuck compilers translating bf to e.g. x86 assembly. Currently I'm working on bf to mainframe assembly. Dialect is "HLASM" and mainframe is one of IBM with a 370.
Sofar most of it works only emitting a character to the console of the operator fails: I only get spaces and it looks like an implicit linefeed is added (which I don't want).
Can anyone find my mistake?
* get a character to display
LLGC R6,0(R7)
* get a pointer to the buffer which will contain the char to displa
LA R5,BUFFER
* store character in buffer
STC R6,0(R5)
* get a pointer to the memory area describing the data to display
LA R1,MSGAREA
* invoke display char
SVC 35
MSGAREA EQU *
DC AL2(5)
DC XL2'00'
BUFFER DC C'!'
I would suggest writing to the SYSOUT
DD
to give you the flexibility to run either in batch (allocating SYSOUT
in your JCL
) or interactively (allocating SYSOUT
to the terminal session which I believe is the default in TSO
).
[entry logic, initialization and so forth]
OPEN (SYSOUT,OUTPUT)
PUT SYSOUT,RECORD
CLOSE SYSOUT
[exit logic]
RECORD DC CL80' '
SYSOUT DCB DDNAME=SYSOUT, X
DSORG=PS, X
MACRF=PM, X
RECFM=FB, X
LRECL=80
You might want to also look at the TPUT, TGET, and TPG macros for terminal I/O if you're okay with tying your program to running in TSO exclusively. Terminal I/O is kind of odd in a 3270 environment if you're used to streaming I/O as in Unix.
DCB
is documented here. OPEN
is documented here. PUT
is documented here. CLOSE
is documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With