Content-Length: 422388 | pFad | https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/sapsupa.asm#l720

400 PDOS / Git Code / [473316] /pdpclib/sapsupa.asm
Menu

[473316]: / pdpclib / sapsupa.asm  Maximize  Restore  History

Download this file

1217 lines (1216 with data), 38.9 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
***********************************************************************
*
* This program written by Paul Edwards.
* Released to the public domain
*
* Extensively modified by others
*
***********************************************************************
*
* SAPSUPA - Support routines for PDPCLIB to support standalone
* programs
*
* It is currently coded for GCC, but IBM C functionality is
* still there, it's just not being tested after any change.
*
***********************************************************************
*
* Note that the VBS support may not be properly implemented.
* Note that this code issues WTOs. It should be changed to just
* set a return code an exit gracefully instead. I'm not talking
* about that dummy WTO. But on the subject of that dummy WTO - it
* should be made consistent with the rest of PDPCLIB which doesn't
* use that to set the RMODE/AMODE. It should be consistent one way
* or the other.
*
* Here are some of the errors reported:
*
* OPEN input failed return code is: -37
* OPEN output failed return code is: -39
*
* FIND input member return codes are:
* Original, before the return and reason codes had
* negative translations added refer to copyrighted:
* DFSMS Macro Instructions for Data Sets
* RC = 0 Member was found.
* RC = -1024 Member not found.
* RC = -1028 RACF allows PDSE EXECUTE, not PDSE READ.
* RC = -1032 PDSE share not available.
* RC = -1036 PDSE is OPENed output to a different member.
* RC = -2048 Directory I/O error.
* RC = -2052 Out of virtual storage.
* RC = -2056 Invalid DEB or DEB not on TCB or TCBs DEB chain.
* RC = -2060 PDSE I/O error flushing system buffers.
* RC = -2064 Invalid FIND, no DCB address.
*
***********************************************************************
*
COPY PDPTOP
*
CSECT
PRINT NOGEN
YREGS
SUBPOOL EQU 0
*
AIF ('&XSYS' NE 'ZARCH').ZVAR64B
FLCEINPW EQU 496 A(X'1F0')
FLCEMNPW EQU 480 A(X'1E0')
FLCESNPW EQU 448 A(X'1C0')
FLCEPNPW EQU 464 A(X'1D0')
.ZVAR64B ANOP
*
EXTRN @@CONSDN
*
*
*
AIF ('&XSYS' EQ 'S370').AMB24A
AMBIT EQU X'80000000'
AGO .AMB24B
.AMB24A ANOP
AMBIT EQU X'00000000'
.AMB24B ANOP
*
AIF ('&ZAM64' NE 'YES').AMZB24A
AM64BIT EQU X'00000001'
AGO .AMZB24B
.AMZB24A ANOP
AM64BIT EQU X'00000000'
.AMZB24B ANOP
*
*
*
***********************************************************************
*
* AOPEN - Open a dataset
*
* Note that under MUSIC, RECFM=F is the only reliable thing. It is
* possible to use RECFM=V like this:
* /file myin tape osrecfm(v) lrecl(32756) vol(PCTOMF) old
* but it is being used outside the normal MVS interface. All this
* stuff really needs to be rewritten per normal MUSIC coding.
*
*
* Note - more documentation for this and other I/O functions can
* be found halfway through the stdio.c file in PDPCLIB.
*
***********************************************************************
**********************************************************************
* *
* AOPEN - Open a file *
* *
* Parameters are: *
* DDNAME - space-padded, 8 character DDNAME to be opened *
* MODE - 0 = READ, 1 = WRITE, 2 = UPDATE (update not supported) *
* RECFM - 0 = F, 1 = V, 2 = U. This is an output from this function *
* LRECL - This function will determine the LRECL *
* BLKSIZE - This function will determine the block size *
* ASMBUF - pointer to a 32K area which can be written to (only *
* needs to be set in move mode) *
* MEMBER - *pointer* to space-padded, 8 character member name. *
* If pointer is 0 (NULL), no member is requested *
* *
* Return value: *
* An internal "handle" that allows the assembler routines to *
* keep track of what's what when READ etc are subsequently *
* called. *
* *
* *
* Note - more documentation for this and other I/O functions can *
* be found halfway through the stdio.c file in PDPCLIB. *
* *
**********************************************************************
PUSH USING
DROP ,
ENTRY @@AOPEN
@@AOPEN DS 0H
SAVE (14,12),,@@AOPEN
LR R12,R15
USING @@AOPEN,R12
LR R11,R1
* GETMAIN R,LV=WORKLEN,SP=SUBPOOL
LA R1,WORKAREA
ST R13,4(R1)
ST R1,8(R13)
LR R13,R1
LR R1,R11
USING WORKAREA,R13
*
L R3,0(R1) R3 POINTS TO DDNAME
L R4,4(R1) R4 POINTS TO MODE
L R4,0(R4) R4 now has value of mode
* 08(,R1) has RECFM
* Note that R5 is used as a scratch register
L R8,12(,R1) R8 POINTS TO LRECL
* 16(,R1) has BLKSIZE
* 20(,R1) has ASMBUF pointer
*
L R9,24(,R1) R9 POINTS TO MEMBER NAME (OF PDS)
LA R9,0(,R9) Strip off high-order bit or byte
*
* Point directly to ZDCBAREA
LA R1,ZDCBAREA
LR R2,R1
LR R0,R2 Load output DCB area address
LA R1,ZDCBLEN Load output length of DCB area
LR R5,R11 Preserve parameter list
LA R11,0 Pad of X'00' and no input length
MVCL R0,R10 Clear DCB area to binary zeroes
LR R11,R5 Restore parameter list
* R5 free again
* THIS LINE IS FOR GCC
LR R6,R4
* THIS LINE IS FOR IBM C
* L R6,0(R4)
LTR R6,R6
LA R1,ABRDW point to RDW before ABUFFER
* LA R1,ABUFFER
ST R1,ASMBUF
L R5,20(,R11) R5 points to ASMBUF
ST R1,0(R5) save the pointer
* R5 now free again
*
DONEOPEN DS 0H
LR R7,R2
SR R6,R6
LH R6,=H'254' Hardcode to 250 bytes of data
ST R6,0(R8)
FIXED DS 0H
* L R6,=F'0'
* B DONESET
VARIABLE DS 0H
L R6,=F'1'
DONESET DS 0H
L R5,8(,R11) Point to RECFM
ST R6,0(R5)
* Finished with R5 now
LR R15,R7
B RETURNOP
BADOPEN DS 0H
* FREEMAIN RU,LV=ZDCBLEN,A=(R2),SP=SUBPOOL Free DCB area
L R15,=F'-1'
B RETURNOP Go return to caller with negative RC
*
ENDFILE LA R6,1
ST R6,RDEOF
BR R14
EOFRLEN EQU *-ENDFILE
*
RETURNOP DS 0H
LR R1,R13
L R13,SAVEAREA+4
LR R7,R15
* FREEMAIN RU,LV=WORKLEN,A=(R1),SP=SUBPOOL
LR R15,R7
RETURN (14,12),RC=(15)
LTORG
POP USING
* OPENMAC OPEN (,INPUT),MF=L,MODE=31
* CAN'T USE MODE=31 ON MVS 3.8
OPENMAC OPEN (,INPUT),MF=L,TYPE=J
OPENMLN EQU *-OPENMAC
* WOPENMAC OPEN (,OUTPUT),MF=L,MODE=31
* CAN'T USE MODE=31 ON MVS 3.8
WOPENMAC OPEN (,OUTPUT),MF=L
WOPENMLN EQU *-WOPENMAC
*INDCB DCB MACRF=GL,DSORG=PS,EODAD=ENDFILE,EXLST=JPTR
* LEAVE OUT EODAD AND EXLST, FILLED IN LATER
INDCB DCB MACRF=GL,DSORG=PS,EODAD=ENDFILE,EXLST=JPTR
INDCBLN EQU *-INDCB
JPTR DS F
*
* OUTDCB changes depending on whether we are in LOCATE mode or
* MOVE mode
AIF ('&OUTM' NE 'L').NLM1
OUTDCB DCB MACRF=PL,DSORG=PS
.NLM1 ANOP
AIF ('&OUTM' NE 'M').NMM1
OUTDCB DCB MACRF=PM,DSORG=PS
.NMM1 ANOP
OUTDCBLN EQU *-OUTDCB
*
*
*
**********************************************************************
* *
* AREAD - Read from file *
* *
**********************************************************************
PUSH USING
DROP ,
ENTRY @@AREAD
@@AREAD DS 0H
SAVE (14,12),,@@AREAD
LR R12,R15
USING @@AREAD,R12
LR R11,R1
AIF ('&XSYS' EQ 'S370' OR '&XSYS' EQ 'ZARCH').NOMOD1
CALL @@SETM24
.NOMOD1 ANOP
* AIF ('&XSYS' NE 'S370').BELOW1
* CAN'T USE "BELOW" ON MVS 3.8
* GETMAIN R,LV=WORKLEN,SP=SUBPOOL
* AGO .NOBEL1
*.BELOW1 ANOP
* GETMAIN R,LV=WORKLEN,SP=SUBPOOL,LOC=BELOW
*.NOBEL1 ANOP
L R2,0(R1) R2 CONTAINS HANDLE
USING ZDCBAREA,R2
LA R1,SAVEADCB
ST R13,4(R1)
ST R1,8(R13)
LR R13,R1
LR R1,R11
USING WORKAREA,R13
*
* L R2,0(R1) R2 CONTAINS HANDLE
L R3,4(R1) R3 POINTS TO BUF POINTER
L R4,8(R1) R4 point to a length
LA R6,0
ST R6,RDEOF
GET (R2)
ST R1,0(R3)
* LH R5,DCBLRECL
L R15,RDEOF
*
RETURNAR DS 0H
LR R1,R13
L R13,SAVEAREA+4
LR R7,R15
* FREEMAIN RU,LV=WORKLEN,A=(R1),SP=SUBPOOL
AIF ('&XSYS' EQ 'S370' OR '&XSYS' EQ 'ZARCH').NOMOD2
CALL @@SETM31
.NOMOD2 ANOP
ST R5,0(R4) Tell caller the length read
LR R15,R7
RETURN (14,12),RC=(15)
POP USING
*
*
*
***********************************************************************
*
* AWRITE - Write to an open dataset
*
***********************************************************************
PUSH USING
DROP ,
ENTRY @@AWRITE
@@AWRITE DS 0H
SAVE (14,12),,@@AWRITE
LR R12,R15
USING @@AWRITE,R12
L R2,0(,R1) R2 contains GETMAINed address
L R3,4(,R1) R3 points to the record address
L R4,8(,R1) R4 points to the length
L R4,0(,R4) R4 now has actual length
USING ZDCBAREA,R2
* GETMAIN RU,LV=WORKLEN,SP=SUBPOOL
LA R1,SAVEADCB
ST R13,4(,R1)
ST R1,8(,R13)
LR R13,R1
* USING WORKAREA,R13
*
AIF ('&XSYS' NE 'S380').N380WR1
* CALL @@SETM24
.N380WR1 ANOP
*
* STCM R4,B'0011',DCBLRECL
*
AIF ('&OUTM' NE 'L').NLM2
* PUT (R2)
.NLM2 ANOP
AIF ('&OUTM' NE 'M').NMM2
L R7,=V(@@CONSDN)
L R7,0(R7)
LTR R7,R7
BZ DODIAG
S R4,=F'4' assume RECFM=V
ST R4,PARM1
L R3,0(R3)
LA R3,4(R3) assume RECFM=V
ST R3,PARM2
LA R1,1
ST R1,PARM3 set PARM3 = 1 = carriage return wanted
LA R1,PARM1
CALL @@CONSWR
B DONEDIAG
DODIAG DS 0H
* Extra 6 bytes for the MSG *, minus 4 for RDW
LA R4,2(R4)
* Move in MSG * prefix
MVC ABMSG(6),MSGSTAR
LA R6,ABMSG
* DIAG 6,4,8(0)
DC X'83640008'
DONEDIAG DS 0H
LA R15,0
* PUT (R2),(R6)
.NMM2 ANOP
AIF ('&OUTM' NE 'L').NLM3
ST R1,0(R6)
.NLM3 ANOP
*
AIF ('&XSYS' NE 'S380').N380WR2
* CALL @@SETM31
.N380WR2 ANOP
*
* LR R1,R13
* L R13,SAVEAREA+4
L R13,SAVEADCB+4
* FREEMAIN RU,LV=WORKLEN,A=(1),SP=SUBPOOL
RETURN (14,12),RC=0
POP USING
*
**********************************************************************
* *
* ACLOSE - Close file *
* *
**********************************************************************
PUSH USING
DROP ,
ENTRY @@ACLOSE
@@ACLOSE DS 0H
SAVE (14,12),,@@ACLOSE
LR R12,R15
USING @@ACLOSE,R12
LR R11,R1
LA R1,WORKAREA
ST R13,4(R1)
ST R1,8(R13)
LR R13,R1
LR R1,R11
USING WORKAREA,R13
*
L R2,0(R1) R2 CONTAINS HANDLE
USING ZDCBAREA,R2
* If we are doing move mode, free internal assembler buffer
AIF ('&OUTM' NE 'M').NMM6
L R5,ASMBUF
LTR R5,R5
BZ NFRCL
L R6,=F'32768'
* FREEMAIN RU,LV=(R6),A=(R5),SP=SUBPOOL
NFRCL DS 0H
.NMM6 ANOP
* MVC CLOSEMB,CLOSEMAC
* CLOSE ((R2)),MF=(E,CLOSEMB),MODE=31
* CAN'T USE MODE=31 WITH MVS 3.8
* CLOSE ((R2)),MF=(E,CLOSEMB)
* FREEPOOL ((R2))
* FREEMAIN RU,LV=ZDCBLEN,A=(R2),SP=SUBPOOL
LA R15,0
*
RETURNAC DS 0H
LR R1,R13
L R13,SAVEAREA+4
LR R7,R15
* FREEMAIN RU,LV=WORKLEN,A=(R1),SP=SUBPOOL
LR R15,R7
RETURN (14,12),RC=(15)
LTORG
POP USING
* CLOSEMAC CLOSE (),MF=L,MODE=31
* CAN'T USE MODE=31 WITH MVS 3.8
CLOSEMAC CLOSE (),MF=L
CLOSEMLN EQU *-CLOSEMAC
*
*
*
***********************************************************************
*
* GETM - GET MEMORY
*
***********************************************************************
ENTRY @@GETM
@@GETM DS 0H
SAVE (14,12),,@@GETM
LR R12,R15
USING @@GETM,R12
*
L R2,0(,R1)
AIF ('&COMP' NE 'GCC').GETMC
* THIS LINE IS FOR GCC
LR R3,R2
AGO .GETMEND
.GETMC ANOP
* THIS LINE IS FOR IBM C
L R3,0(,R2)
.GETMEND ANOP
LR R4,R3
LA R3,8(,R3)
*
* To avoid fragmentation, round up size to 64 byte multiple
*
A R3,=A(64-1)
N R3,=X'FFFFFFC0'
*
* Assume heap location has been provided in global variable
* Note that this function will only work if the C library
* is compiled with MEMMGR option.
L R1,=V(@@HPLOC)
L R1,0(R1)
* WE STORE THE AMOUNT WE REQUESTED FROM MVS INTO THIS ADDRESS
ST R3,0(R1)
* AND JUST BELOW THE VALUE WE RETURN TO THE CALLER, WE SAVE
* THE AMOUNT THEY REQUESTED
ST R4,4(R1)
A R1,=F'8'
LR R15,R1
*
RETURNGM DS 0H
RETURN (14,12),RC=(15)
LTORG
*
***********************************************************************
*
* FREEM - FREE MEMORY
*
***********************************************************************
ENTRY @@FREEM
@@FREEM DS 0H
SAVE (14,12),,@@FREEM
LR R12,R15
USING @@FREEM,R12
*
L R2,0(,R1)
S R2,=F'8'
L R3,0(,R2)
*
* Do nothing
*
RETURNFM DS 0H
RETURN (14,12),RC=(15)
LTORG
***********************************************************************
*
* GETCLCK - GET THE VALUE OF THE MVS CLOCK TIMER AND MOVE IT TO AN
* 8-BYTE FIELD. THIS 8-BYTE FIELD DOES NOT NEED TO BE ALIGNED IN
* ANY PARTICULAR WAY.
*
* E.G. CALL 'GETCLCK' USING WS-CLOCK1
*
* THIS FUNCTION ALSO RETURNS THE NUMBER OF SECONDS SINCE 1970-01-01
* BY USING SOME EMPERICALLY-DERIVED MAGIC NUMBERS
*
***********************************************************************
ENTRY @@GETCLK
@@GETCLK DS 0H
SAVE (14,12),,@@GETCLK
LR R12,R15
USING @@GETCLK,R12
*
L R2,0(,R1)
STCK 0(R2)
L R4,0(,R2)
L R5,4(,R2)
SRDL R4,12
SL R4,=X'0007D910'
D R4,=F'1000000'
SL R5,=F'1220'
LR R15,R5
*
RETURNGC DS 0H
RETURN (14,12),RC=(15)
LTORG
***********************************************************************
* *
* GETTZ - Get the offset from UTC offset in 1.048576 seconds *
* *
***********************************************************************
ENTRY @@GETTZ
@@GETTZ DS 0H
SAVE (14,12),,@@GETTZ
LR R12,R15
USING @@GETTZ,R12
*
LA R15,0
*
RETURNGS DS 0H
RETURN (14,12),RC=(15)
LTORG ,
SPACE 2
***********************************************************************
*
* SYSTEM - execute another command
*
***********************************************************************
ENTRY @@SYSTEM
@@SYSTEM DS 0H
SAVE (14,12),,@@SYSTEM
LR R12,R15
USING @@SYSTEM,R12
LR R11,R1
*
GETMAIN RU,LV=SYSTEMLN,SP=SUBPOOL
ST R13,4(,R1)
ST R1,8(,R13)
LR R13,R1
LR R1,R11
USING SYSTMWRK,R13
*
LA R15,0
*
RETURNSY DS 0H
LR R1,R13
L R13,SYSTMWRK+4
FREEMAIN RU,LV=SYSTEMLN,A=(1),SP=SUBPOOL
*
LA R15,0
RETURN (14,12),RC=(15) Return to caller
LTORG
SYSTMWRK DSECT , MAP STORAGE
DS 18A OUR OS SAVE AREA
CMDPREF DS CL8 FIXED PREFIX
CMDLEN DS H LENGTH OF COMMAND
CMDTEXT DS CL200 COMMAND ITSELF
SYSTEMLN EQU *-SYSTMWRK LENGTH OF DYNAMIC STORAGE
CSECT ,
***********************************************************************
*
* IDCAMS - dummy function to keep MVS happy
*
***********************************************************************
ENTRY @@IDCAMS
@@IDCAMS DS 0H
SAVE (14,12),,@@IDCAMS
LR R12,R15
USING @@IDCAMS,R12
*
LA R15,0
*
RETURN (14,12),RC=(15)
LTORG
*
**********************************************************************
* *
* DIAG8 - do a diag 8 *
* *
**********************************************************************
ENTRY @@DIAG8
@@DIAG8 DS 0H
SAVE (14,12),,@@DIAG8
LR R12,R15
USING @@DIAG8,R12
*
L R6,0(R1)
L R4,4(R1)
* DIAG 4,6,8(0)
DC X'83460008'
LA R15,0
*
RETURN (14,12),RC=(15)
LTORG
*
**********************************************************************
* *
* @@CONSWR - write to console *
* *
* parameter 1 = buffer length *
* parameter 2 = buffer *
* *
**********************************************************************
ENTRY @@CONSWR
@@CONSWR DS 0H
SAVE (14,12),,@@CONSWR
LR R12,R15
USING @@CONSWR,R12
USING PSA,R0
*
L R10,=V(@@CONSDN) Device number
L R10,0(R10)
L R7,0(R1) Bytes to write
L R2,4(R1) Buffer to write
L R8,8(R1) Is CR required?
MVI CCHAIN,X'01' Assume no CR required
LTR R8,R8
BZ NOCRREQ
MVI CCHAIN,X'09' Need a CR
* For some reason the CCW doesn't like an empty line of 0 bytes.
* Need to find out why. Until then, assume that's the way that
* it's meant to be, and force a space
LTR R7,R7
BNZ NOSPACE
LA R2,=C' '
LA R7,1
NOSPACE DS 0H
NOCRREQ DS 0H
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CHN390G
STCM R2,B'0111',CCHAIN+1 This requires BTL buffer
STH R7,CCHAIN+6 Store length in WRITE CCW
AGO .CHN390H
.CHN390G ANOP
ST R2,CCHAIN+4
STH R7,CCHAIN+2
.CHN390H ANOP
*
* Interrupt needs to point to CCONT now. Again, I would hope for
* something more sophisticated in PDOS than this continual
* initialization.
*
AIF ('&XSYS' EQ 'ZARCH').ZNEWIOA
MVC FLCINPSW(8),CNEWIO
STOSM FLCINPSW,X'00' Work with DAT on or OFF
AGO .ZNEWIOB
.ZNEWIOA ANOP
MVC FLCEINPW(16),CNEWIO
STOSM FLCEINPW,X'00' Work with DAT on or OFF
.ZNEWIOB ANOP
* R3 points to CCW chain
LA R3,CCHAIN
ST R3,FLCCAW Store in CAW
*
*
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').SIO31M
SIO 0(R10)
* TIO 0(R10)
AGO .SIO24M
.SIO31M ANOP
LR R1,R10 R1 needs to contain subchannel
LA R9,CIRB
TSCH 0(R9) Clear pending interrupts
LA R10,CORB
MSCH 0(R10)
TSCH 0(R9) Clear pending interrupts
SSCH 0(R10)
.SIO24M ANOP
*
*
LPSW CWAITNER Wait for an interrupt
DC H'0'
CCONT DS 0H Interrupt will automatically come here
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').SIO31N
SH R7,FLCCSW+6 Subtract residual count to get bytes read
LR R15,R7
* After a successful CCW chain, CSW should be pointing to end
CLC FLCCSW(4),=A(CFINCHN)
BE CALLFIN
AGO .SIO24N
.SIO31N ANOP
TSCH 0(R9)
SH R7,10(R9)
LR R15,R7
CLC 4(4,R9),=A(CFINCHN)
BE CALLFIN
.SIO24N ANOP
L R15,=F'-1' error return
CALLFIN DS 0H
RETURN (14,12),RC=(15)
LTORG
*
*
AIF ('&XSYS' NE 'S390' AND '&XSYS' NE 'ZARCH').NOT390P
DS 0F
CIRB DS 24F
CORB DS 0F
DC F'0'
DC X'0080FF00' Logical-Path Mask (enable all?) + format-1
DC A(CCHAIN)
DC 5F'0'
.NOT390P ANOP
*
*
DS 0D
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CHN390I
* X'09' = write with automatic carriage return
CCHAIN CCW X'09',0,X'20',0 20 = ignore length issues
AGO .CHN390J
.CHN390I ANOP
CCHAIN CCW1 X'09',0,X'20',0 20 = ignore length issues
.CHN390J ANOP
CFINCHN EQU *
DS 0D
CWAITNER DC X'060E0000' I/O, machine check, EC, wait, DAT on
DC A(AMBIT) no error
AIF ('&XSYS' EQ 'ZARCH').ZNEWIOC
CNEWIO DC X'000C0000' machine check, EC, DAT off
DC A(AMBIT+CCONT) continuation after I/O request
AGO .ZNEWIOD
.ZNEWIOC ANOP
CNEWIO DC A(X'00040000'+AM64BIT)
DC A(AMBIT)
DC A(0)
DC A(CCONT) continuation after I/O request
.ZNEWIOD ANOP
*
DROP ,
*
*
*
*
*
**********************************************************************
* *
* @@CONSRD - read from console *
* *
* parameter 1 = buffer length *
* parameter 2 = buffer *
* *
**********************************************************************
ENTRY @@CONSRD
@@CONSRD DS 0H
SAVE (14,12),,@@CONSRD
LR R12,R15
USING @@CONSRD,R12
USING PSA,R0
*
L R10,=V(@@CONSDN) Device number
L R10,0(R10)
L R7,0(R1) Bytes to read
L R2,4(R1) Buffer to read into
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CRD390G
STCM R2,B'0111',CRDCHN+1 This requires BTL buffer
STH R7,CRDCHN+6 Store length in READ CCW
AGO .CRD390H
.CRD390G ANOP
ST R2,CRDCHN+4
STH R7,CRDCHN+2
.CRD390H ANOP
*
* Interrupt needs to point to CRCONT now. Again, I would hope for
* something more sophisticated in PDOS than this continual
* initialization.
*
AIF ('&XSYS' EQ 'ZARCH').ZNEWIOG
MVC FLCINPSW(8),CRNEWIO
STOSM FLCINPSW,X'00' Work with DAT on or OFF
AGO .ZNEWIOH
.ZNEWIOG ANOP
MVC FLCEINPW(16),CRNEWIO
STOSM FLCEINPW,X'00' Work with DAT on or OFF
.ZNEWIOH ANOP
* R3 points to CCW chain
LA R3,CRDCHN
ST R3,FLCCAW Store in CAW
*
*
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CRD31M
SIO 0(R10)
* TIO 0(R10)
AGO .CRD24M
.CRD31M ANOP
LR R1,R10 R1 needs to contain subchannel
LA R9,CRIRB
TSCH 0(R9) Clear pending interrupts
LA R10,CRORB
MSCH 0(R10)
TSCH 0(R9) Clear pending interrupts
SSCH 0(R10)
.CRD24M ANOP
*
*
LPSW CRWTNER Wait for an interrupt
DC H'0'
CRCONT DS 0H Interrupt will automatically come here
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CRD31N
SH R7,FLCCSW+6 Subtract residual count to get bytes read
LR R15,R7
* After a successful CCW chain, CSW should be pointing to end
CLC FLCCSW(4),=A(CRDFCHN)
BE CRALLFIN
AGO .CRD24N
.CRD31N ANOP
TSCH 0(R9)
SH R7,10(R9)
LR R15,R7
CLC 4(4,R9),=A(CRDFCHN)
BE CRALLFIN
.CRD24N ANOP
L R15,=F'-1' error return
CRALLFIN DS 0H
RETURN (14,12),RC=(15)
LTORG
*
*
AIF ('&XSYS' NE 'S390' AND '&XSYS' NE 'ZARCH').CRD390P
DS 0F
CRIRB DS 24F
CRORB DS 0F
DC F'0'
DC X'0080FF00' Logical-Path Mask (enable all?) + format-1
DC A(CRDCHN)
DC 5F'0'
.CRD390P ANOP
*
*
DS 0D
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').CRD390I
* X'0A' = read inquiry
CRDCHN CCW X'0A',0,X'20',0 20 = ignore length issues
AGO .CRD390J
.CRD390I ANOP
CRDCHN CCW1 X'0A',0,X'20',0 20 = ignore length issues
.CRD390J ANOP
CRDFCHN EQU *
DS 0D
AIF ('&XSYS' EQ 'ZARCH').ZNEWIOE
CRWTNER DC X'060E0000' I/O, machine check, EC, wait, DAT on
DC A(AMBIT) no error
CRNEWIO DC X'000C0000' machine check, EC, DAT off
DC A(AMBIT+CRCONT) continuation after I/O request
AGO .ZNEWIOF
.ZNEWIOE ANOP
CRWTNER DC A(X'060E0000'+AM64BIT)
DC A(AMBIT) no error
CRNEWIO DC A(X'00040000'+AM64BIT)
DC A(AMBIT)
DC A(0)
DC A(CRCONT) continuation after I/O request
.ZNEWIOF ANOP
*
DROP ,
*
*
*
*
*
**********************************************************************
* *
* @@C3270R - read from 3270 console *
* *
* parameter 1 = buffer length *
* parameter 2 = buffer *
* *
**********************************************************************
ENTRY @@C3270R
@@C3270R DS 0H
SAVE (14,12),,@@C3270R
LR R12,R15
USING @@C3270R,R12
USING PSA,R0
*
L R10,=V(@@CONSDN) Device number
L R10,0(R10)
L R7,0(R1) Bytes to read
L R2,4(R1) Buffer to read into
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').C3R390G
STCM R2,B'0111',C3RCHN+1 This requires BTL buffer
STH R7,C3RCHN+6 Store length in READ CCW
AGO .C3R390H
.C3R390G ANOP
ST R2,C3RCHN+4
STH R7,C3RCHN+2
.C3R390H ANOP
*
* Interrupt needs to point to CUCONT now, for an
* unsolicited interrupt.
*
AIF ('&XSYS' EQ 'ZARCH').ZCUA
MVC FLCINPSW(8),CUNEWIO
STOSM FLCINPSW,X'00' Work with DAT on or OFF
AGO .ZCUB
.ZCUA ANOP
MVC FLCEINPW(16),CUNEWIO
STOSM FLCEINPW,X'00' Work with DAT on or OFF
.ZCUB ANOP
*
LPSW C3RWTNER Wait for an interrupt
DC H'0'
CUCONT DS 0H Interrupt will automatically come here
*
* Interrupt needs to point to C3CONT now. Again, I would hope for
* something more sophisticated in PDOS than this continual
* initialization.
*
AIF ('&XSYS' EQ 'ZARCH').ZC3A
MVC FLCINPSW(8),C3NEWIO
STOSM FLCINPSW,X'00' Work with DAT on or OFF
AGO .ZC3B
.ZC3A ANOP
MVC FLCEINPW(16),C3NEWIO
STOSM FLCEINPW,X'00' Work with DAT on or OFF
.ZC3B ANOP
* R3 points to CCW chain
LA R3,C3RCHN
ST R3,FLCCAW Store in CAW
*
*
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').C3R31M
SIO 0(R10)
* TIO 0(R10)
AGO .C3R24M
.C3R31M ANOP
LR R1,R10 R1 needs to contain subchannel
LA R9,C3RIRB
TSCH 0(R9) Clear pending interrupts
LA R10,C3RORB
MSCH 0(R10)
TSCH 0(R9) Clear pending interrupts
SSCH 0(R10)
.C3R24M ANOP
*
*
LPSW C3RWTNER Wait for an interrupt
DC H'0'
C3RCONT DS 0H Interrupt will automatically come here
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').C3R31N
SH R7,FLCCSW+6 Subtract residual count to get bytes read
LR R15,R7
* After a successful CCW chain, CSW should be pointing to end
CLC FLCCSW(4),=A(C3RFCHN)
BE C3RALFIN
AGO .C3R24N
.C3R31N ANOP
TSCH 0(R9)
SH R7,10(R9)
LR R15,R7
CLC 4(4,R9),=A(C3RFCHN)
BE C3RALFIN
.C3R24N ANOP
L R15,=F'-1' error return
C3RALFIN DS 0H
RETURN (14,12),RC=(15)
LTORG
*
*
AIF ('&XSYS' NE 'S390' AND '&XSYS' NE 'ZARCH').C3R390P
DS 0F
C3RIRB DS 24F
C3RORB DS 0F
DC F'0'
DC X'0080FF00' Logical-Path Mask (enable all?) + format-1
DC A(C3RCHN)
DC 5F'0'
.C3R390P ANOP
*
*
DS 0D
AIF ('&XSYS' EQ 'S390' OR '&XSYS' EQ 'ZARCH').C3R390I
* X'06' = read modified
C3RCHN CCW X'06',0,X'20',0 20 = ignore length issues
AGO .C3R390J
.C3R390I ANOP
C3RCHN CCW1 X'06',0,X'20',0 20 = ignore length issues
.C3R390J ANOP
C3RFCHN EQU *
DS 0D
AIF ('&XSYS' EQ 'ZARCH').ZCCCA
C3RWTNER DC X'060E0000' I/O, machine check, EC, wait, DAT on
DC A(AMBIT) no error
C3NEWIO DC X'000C0000' machine check, EC, DAT off
DC A(AMBIT+C3RCONT) continuation after I/O request
CUNEWIO DC X'000C0000' machine check, EC, DAT off
DC A(AMBIT+CUCONT) continuation after I/O request
AGO .ZCCCB
.ZCCCA ANOP
C3RWTNER DC X'060E0001' I/O, machine check, EC, wait, DAT on
DC A(AMBIT) no error
C3NEWIO DC X'00040001' machine check, EC, DAT off
DC A(AMBIT)
DC A(0)
DC A(C3RCONT) continuation after I/O request
CUNEWIO DC X'00040001' machine check, EC, DAT off
DC A(AMBIT)
DC A(0)
DC A(CUCONT) continuation after I/O request
.ZCCCB ANOP
*
DROP ,
*
*
*
*
*
***********************************************************************
* *
* CALL @@DYNAL,(rb) *
* *
* Execute DYNALLOC (SVC 99) *
* *
* Caller must provide a request block, in conformance with the *
* MVS documentation for this (which is very complicated) *
* *
***********************************************************************
ENTRY @@SVC99
@@SVC99 DS 0H
ENTRY @@DYNAL
@@DYNAL DS 0H
SAVE (14,12),,@@DYNAL Save caller's regs.
LR R12,R15
USING @@DYNAL,R12
LR R11,R1
*
GETMAIN RU,LV=WORKLEN,SP=SUBPOOL
ST R13,4(,R1)
ST R1,8(,R13)
LR R13,R1
LR R1,R11
USING WORKAREA,R13
*
* Note that the SVC requires a pointer to the pointer to the RB.
* Because this function (not SVC) expects to receive a standard
* parameter list, where R1 so happens to be a pointer to the
* first parameter, which happens to be the address of the RB,
* then we already have in R1 exactly what SVC 99 needs.
*
* Except for one thing. Technically, you're meant to have the
* high bit of the pointer on. So we rely on the caller to have
* the parameter in writable storage so that we can ensure that
* we set that bit.
*
L R2,0(R1)
O R2,=X'80000000'
ST R2,0(R1)
SVC 99
LR R2,R15
*
RETURN99 DS 0H
LR R1,R13
L R13,SAVEAREA+4
FREEMAIN RU,LV=WORKLEN,A=(1),SP=SUBPOOL
*
LR R15,R2 Return success
RETURN (14,12),RC=(15) Return to caller
*
DROP R12
***********************************************************************
*
* SETJ - SAVE REGISTERS INTO ENV
*
***********************************************************************
ENTRY @@SETJ
USING @@SETJ,R15
@@SETJ L R15,0(R1) get the env variable
STM R0,R14,0(R15) save registers to be restored
LA R15,0 setjmp needs to return 0
BR R14 return to caller
LTORG ,
*
***********************************************************************
*
* LONGJ - RESTORE REGISTERS FROM ENV
*
***********************************************************************
ENTRY @@LONGJ
USING @@LONGJ,R15
@@LONGJ L R2,0(R1) get the env variable
L R15,60(R2) get the return code
LM R0,R14,0(R2) restore registers
BR R14 return to caller
LTORG ,
**********************************************************************
* *
* DOLOOP - dummy function *
* *
**********************************************************************
ENTRY @@DOLOOP
@@DOLOOP DS 0H
BR R14
*
*
*
***********************************************************************
*
* GETPFX - dummy function
*
***********************************************************************
ENTRY @@GETPFX
USING @@GETPFX,R15
LA R15,0
@@GETPFX BR R14
LTORG ,
*
*
*
***********************************************************************
*
* GETEPF - dummy function
*
***********************************************************************
ENTRY @@GETEPF
USING @@GETEPF,R15
LA R15,0
@@GETEPF BR R14
LTORG ,
*
*
*
* S/370 doesn't support switching modes so this code is useless,
* and won't compile anyway because "BSM" is not known.
*
AIF ('&XSYS' EQ 'S370').NOMODE If S/370 we can't switch mode
***********************************************************************
*
* SETM24 - Set AMODE to 24
*
***********************************************************************
ENTRY @@SETM24
USING @@SETM24,R15
@@SETM24 ICM R14,8,=X'00' Sure hope caller is below the line
BSM 0,R14 Return in amode 24
*
***********************************************************************
*
* SETM31 - Set AMODE to 31
*
***********************************************************************
ENTRY @@SETM31
USING @@SETM31,R15
@@SETM31 ICM R14,8,=X'80' Set to switch mode
BSM 0,R14 Return in amode 31
LTORG ,
*
.NOMODE ANOP , S/370 doesn't support MODE switching
*
*
*
DS 0H
MSGSTAR DC C'MSG * '
ABMSG DS 2C Extra characters for MSG * move
ABRDW DS 4C Storage for a RDW
ABUFFER DS CL250
WORKAREA DS 0F
SAVEAREA DS 18F
PARM1 DS F
PARM2 DS F
PARM3 DS F
WORKLEN EQU *-WORKAREA
*
ZDCBAREA DS 0H
DS CL(INDCBLN)
DS CL(OUTDCBLN)
SAVEADCB DS 18F Register save area for PUT
RDEOF DS 1F
ASMBUF DS A Pointer to an area for PUTing data
ORG ZDCBAREA Overlay the DCB DSECT
* DCBD DSORG=PS,DEVD=DA Map Data Control Block
ORG
OPENCLOS DS F OPEN/CLOSE parameter list
DS 0H
EOFR24 DS CL(EOFRLEN)
* IHADECB DSECT=NO Data Event Control Block
BLKSIZE DS F Save area for input DCB BLKSIZE
LRECL DS F Save area for input DCB LRECL
BUFFADDR DS F Location of the BLOCK Buffer
BUFFEND DS F Address after end of current block
BUFFCURR DS F Current record in the buffer
VBSADDR DS F Location of the VBS record build area
VBSEND DS F Addr. after end VBS record build area
VBSCURR DS F Location to store next byte
RDRECPTR DS F Where to store record pointer
RDLENPTR DS F Where to store read length
JFCBPTR DS F
JFCB DS 0F
IEFJFCBN LIST=YES SYS1.AMODGEN JOB File Control Block
* Format 1 Data Set Control Block
DSCB DS 0F
* IECSDSL1 (1) Map the Format 1 DSCB
DSCBCCHH DS CL5 CCHHR of DSCB returned by OBTAIN
DS CL47 Rest of OBTAIN's 148 byte work area
CLOSEMB DS CL(CLOSEMLN)
DS 0F
OPENMB DS CL(OPENMLN)
DS 0F
WOPENMB DS CL(WOPENMLN)
MEMBER24 DS CL8
ZDCBLEN EQU *-ZDCBAREA
IEZIOB Input/Output Block
*
CVT DSECT=YES
IKJTCB
IEZJSCB
IHAPSA
IHARB
IHACDE
IHASVC
END
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/sapsupa.asm#l720

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy