[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | VAX MACRO assembler issues |
|
Moderator: | TLE::TROWEL |
|
Created: | Mon Mar 30 1987 |
Last Modified: | Wed Jun 04 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 257 |
Total number of notes: | 916 |
253.0. "Problem migrating MACRO from VAX to Alpha" by TLAV02::AKKAMON (Land of Smail :)) Sun Feb 16 1997 11:23
Hi,
Our partner need help for VAX to Alpha migration. This company
develops trade program for Stock Exchange of Thailand (SET). Please
help.
Best regards,
akkamon srihiran
I N T E R O F F I C E M E M O R A N D U M
Date: 03-Feb-1997 01:34pm THA
From: Vasu Sirinit
[email protected]@PMDF@INTERNET
Dept:
Tel No:
TO: See Below
Subject: Migration MACRO program from VAX to AXP
I have 2 program "com_reset_term.mar" and "gbl_io_chan.mar" (
Source code is included in below ). Both program has no problem during
compilation but has problem during LINK command.
Com_reset_term.mar
%LINK-W-MULPSC, conflicting attributes for psect MSE$CODE
in module COM_RESET_TERM file ASTLIB.OLB;2
Gbl_io_chan.mar
%LINK-W-MULPSC, conflicting attributes for psect USR_CHANNEL
in module GBL_IO_CHAN file GBL_IO_CHAN.OBJ;2
In COM_RESET_TERM.MAR I removed PIC out then the program can linkable.
************
File DISK$FLOOR:[VASU]COM_RESET_TERM.MAR;1
153 .PSECT MSE$CODE,PIC,EXE,NOWRT,RD,REL,CON,LCL,SHR,LONG,NOVEC
154
******
File DISK$FLOOR:[MIGRATE.LIB]COM_RESET_TERM.MAR;1
153 .PSECT MSE$CODE,EXE,NOWRT,RD,REL,CON,LCL,SHR,LONG,NOVEC
154
In GBL_IO_CHAN.MAR I changed PIC to NOPIC and SHR to NOSHR.
************
File DISK$FLOOR:[VASU]GBL_IO_CHAN.MAR;1
24 .PSECT USR_CHANNEL,
PIC,USR,OVR,REL,GBL,SHR,NOEXE,RD,WRT,NOVEC
,LONG
25
******
File DISK$FLOOR:[MIGRATE.LIB]GBL_IO_CHAN.MAR;1
24 ;
25 ; PIC line is for VAX, NOPIC line is for AXP...
26 ;
27 ; .PSECT USR_CHANNEL,
PIC,USR,OVR,REL,GBL,SHR,NOEXE,RD,WRT,NOVEC
,LONG
28 .PSECT USR_CHANNEL, NOPIC,OVR,REL,GBL,NOSHR,NOEXE,WRT,NOVEC
29
The problem is I have no idea about PIC and SHR or why it work? My client
( SET ) have questionn about this and want to understand the detail. I can
list the question like this.
1, What is PIC ,SHR, PSECT and other word in that line?
2, How to determine whether or not a program will execute correctly in
AXP machine?
3, Why I have to do this and why the old one do that?
Please tell me all the detail as well as possible because I have
to stand up and explain with 4 or 5 programer at SET.
Thank you for your help.
Vasu sirinit
-----------------------------------------------------------------------------------------------------
com_reset_term.mar
.TITLE COM_RESET_TERM
.IDENT /01002/
;+
; TERM_EXIT
;
; Date written: 5 October, 1990
;
; Author: George S. Chapman
;
; This module provides for exit rundown of a terminal process
; On exit, it resets the terminal (soft reset) to clear ASSET
; scrolled regions upon any image exit by the system.
;
;
; Calling format:
;
; S_STATUS% = RESET_TERM ()
;
; Inputs:
;
; (None)
;
; Outputs:
;
; A VMS exit handler routine (TERM_EXIT_HANDLER) will be
established.
; This exit routine is a separate segment of this module.
;
; Register usage:
;
; Privileges required:
;
; None
;
; Quotas affected:
;
; Comments:
;
; Edit history:
;
; Edit Date By Reason
; ======= ======== === ===============================================
; 01-0002 04/02/87 GSC Fix non-PIC references to make image sharable
; 01-0003 02/01/91 GSC Add code to set/restore terminal characteristics
;
;-
.PAGE
.SBTTL Declarations
.ENABLE SUPPRESSION
.ENABLE LSB
.DISABLE GLOBAL
.LIBRARY /SYS$LIBRARY:LIB.MLB/ ; Secondary macro library
$SSDEF
$TTDEF
$TT2DEF
$STRDEF
$IODEF
.PAGE
.SBTTL Pure string descriptor storage definitions
.PSECT MSE$DESC,PIC,NOEXE,WRT,RD,REL,CON,LCL,NOSHR,QUAD,NOVEC
.ALIGN QUAD
RESET_STRING:
.LONG RESET_STRING__END - RESET_STRING__BEGIN
.BLKL 1
RESET_STRING__BEGIN:
.BYTE ^D27 ; Reset scrolled region
.ASCII /[!p/
.BYTE ^D27 ; Reset autorepeat mode
.ASCII /[?8h/
RESET_STRING__END:
SET_STRING:
.LONG SET_STRING__END - SET_STRING__BEGIN
.BLKL 1
SET_STRING__BEGIN:
.BYTE ^D27 ; Set autorepeat mode
.ASCII /[?8l/
SET_STRING__END:
TT_STRING:
.ASCII /SYS$OUTPUT/
TT_STRING__LEN = . - TT_STRING
TT_CHAR__LEN = 12 ; TT extended characteristics 12 bytes
TT_CHAR_SET:
TT_CHAR_SET__CLASS:
.BYTE 0
TT_CHAR_SET__TYPE:
.BYTE 0
TT_CHAR_SET__WIDTH:
.WORD 0
TT_CHAR_SET__CHAR: ; High byte is page size
.LONG <TT$M_NOBRDCST ! -
TT$M_SCOPE>
TT_CHAR_SET__CHAR2:
.LONG <TT2$M_ANSICRT>
TT_CHAR_CLEAR:
TT_CHAR_CLEAR__CLASS:
.BYTE 0
TT_CHAR_CLEAR__TYPE:
.BYTE 0
TT_CHAR_CLEAR__WIDTH:
.WORD 0
TT_CHAR_CLEAR__CHAR: ; High byte is page size
.LONG <TT$M_ESCAPE ! -
TT$m_MECHTAB ! -
TT$M_NOECHO ! -
TT$M_NOTYPEAHD ! -
TT$M_WRAP>
TT_CHAR_CLEAR__CHAR2:
.LONG <TT2$M_EDITING>
.PAGE
.SBTTL Impure storage definitions
.PSECT MSE$IMPURE,PIC,NOEXE,WRT,RD,REL,CON,LCL,SHR,LONG,NOVEC
TERM_EXIT_STATUS: ; Longword to receive exit status
.BLKL 1 ; when image exits
TERM_ORIG_CHAR:
.BLKB TT_CHAR__LEN ; Terminal characteristics block
TERM_CHAN:
.BLKL ; Channel on which TT is open
; ****************** EXIT HANDLER BLOCK *********************
.DEBUG EXIT_HANDLER
EXIT_HANDLER: ; VMS exit handler
.LONG 0 ; Reserved - system fwd ptr
EXIT_ROUTINE:
.BLKL 1 ; *FILL* Address of EXH
.LONG 1 ; Number of arguments
TERM_EXIT_STATUS_ADR:
.BLKL 1 ; *FILL* Address of TERM_EXIT_STATUS
; *************** END OF EXIT HANDLER BLOCK *****************
.PAGE
.PSECT MSE$CODE,PIC,EXE,NOWRT,RD,REL,CON,LCL,SHR,LONG,NOVEC
.ENTRY RESET_TERM,^M<R4,R5,R6,R7,R8>
ARG_CHANNEL = ^D4
CMPW #0,(AP) ; Must have 1 argument
BLEQU 10$ ; If so, fine
MOVZWL #SS$_INSFARG,R0 ; Else signal error
BRW 9999$
10$:
MOVAB RESET_STRING,R0 ; Set up the string descriptor
MOVAB RESET_STRING__BEGIN,- ; as a PIC reference
4(R0)
MOVAB SET_STRING,R0 ; Set up the string descriptor
MOVAB SET_STRING__BEGIN,- ; as a PIC reference
4(R0)
MOVAB TERM_EXIT_HANDLER,EXIT_ROUTINE ; Set up routine to call
on exit
MOVAL TERM_EXIT_STATUS,- ; Point to exit status variable
TERM_EXIT_STATUS_ADR
$DCLEXH_S - ; Establish the exit handler
EXIT_HANDLER
BLBC R0,1099$ ; If error, then exit
SUBL2 #8,SP ; Grab space on the stack
MOVL SP,R7 ; R7 = Pointer to string descriptor
SUBL2 #8,SP ; Grab space on the stack
MOVL SP,R6 ; R6 = Pointer to IOSB
SUBL2 #TT_CHAR__LEN,SP ; Grab space on the stack
MOVL SP,R8 ; R8 = Pointer to IOSB
MOVAB TT_STRING,4(R7) ; Point to "TT"
MOVZBL #TT_STRING__LEN,(R7)
$ASSIGN_S - ; Open the terminal
CHAN=TERM_CHAN, - ;
DEVNAM=(R7) ;
BLBC R0,1099$ ; If any error, go away
$QIOW_S - ; Get terminal characteristics
CHAN=TERM_CHAN, - ;
FUNC=#IO$_SENSEMODE, - ;
IOSB=(R6), - ;
P1 = TERM_ORIG_CHAR, - ;
P2 = #TT_CHAR__LEN
1099$: BLBC R0,2098$ ; If any error, go away
BLBC (R6),2099$ ; And check the IOSB
BISL3 TERM_ORIG_CHAR, - ; Assert chars to be SET
TT_CHAR_SET, (R8)
BISL3 TERM_ORIG_CHAR+4, -
TT_CHAR_SET+4, 4(R8)
BISL3 TERM_ORIG_CHAR+8, -
TT_CHAR_SET+4, 8(R8)
BICL2 TT_CHAR_CLEAR, (R8) ; Assert chars to be CLEARED
BICL2 TT_CHAR_CLEAR+4, 4(R8)
BICL2 TT_CHAR_CLEAR+8, 8(R8)
$QIOW_S - ; Set new terminal characteristics
CHAN=TERM_CHAN, - ;
FUNC=#IO$_SETMODE, - ;
IOSB=(R6), - ;
P1 = (R8), - ;
P2 = #TT_CHAR__LEN
2098$: BLBC R0,9999$ ; If any error, go away
2099$: BLBC (R6),19980$ ; And check the IOSB
$DASSGN_S - ; Close the terminal again
CHAN=TERM_CHAN
BLBC R0,1099$ ; If any error, go away
PUSHAL SET_STRING ; Now write out the set string
.EXTERNAL LIB$PUT_OUTPUT
CALLS #1,G^LIB$PUT_OUTPUT
BLBC R0,9999$ ; If any error, go away
; Exit this procedure
9990$: MOVZBL #SS$_NORMAL,R0 ; Force success
9999$: RET ; Exit with status in R0
; Exit with IOSB error status
19980$: MOVZWL (R6),R0 ; Show error status
RET ; Exit with status in R0
.PAGE
.ENTRY TERM_EXIT_HANDLER,^M<R4,R5,R6,R7,R8>
; *** EXIT HANDLER INVOKED BY PROCESS EXIT...
ARG_EXIT_STATUS = ^D4
CMPW #1,(AP) ; Must have 1 argument
BLEQU 10010$ ; If so, fine
MOVZWL #SS$_INSFARG,R0 ; Else signal error
BRW 19999$
10010$:
; First, reset terminal characteristics
SUBL2 #8,SP ; Grab space on the stack
MOVL SP,R7 ; R7 = Pointer to string descriptor
SUBL2 #8,SP ; Grab space on the stack
MOVL SP,R6 ; R6 = Pointer to IOSB
SUBL2 #TT_CHAR__LEN,SP ; Grab space on the stack
MOVL SP,R8 ; R8 = Pointer to IOSB
MOVAB TT_STRING,4(R7) ; Point to "TT"
MOVZBL #TT_STRING__LEN,(R7)
$ASSIGN_S - ; Open the terminal
CHAN=TERM_CHAN, - ;
DEVNAM=(R7) ;
BLBC R0,19999$ ; If any error, go away
$QIOW_S - ; Reset original terminal chars
CHAN=TERM_CHAN, - ;
FUNC=#IO$_SETMODE, - ;
IOSB=(R6), - ;
P1 = TERM_ORIG_CHAR, - ;
P2 = #TT_CHAR__LEN
BLBC R0,19999$ ; If any error, go away
BLBS (R6),19920$ ; And check the IOSB
MOVZWL (R6),R0 ; If error, get ill
BRW 19999$
19920$:
$DASSGN_S - ; Close the terminal again
CHAN=TERM_CHAN
BLBC R0,19999$ ; If any error, go away
PUSHAL RESET_STRING ; Now write out the reset string
.EXTERNAL LIB$PUT_OUTPUT
CALLS #1,G^LIB$PUT_OUTPUT
BLBC R0,19999$ ; If any error, go away
; Exit this procedure
19990$: MOVZBL #SS$_NORMAL,R0 ; Force success
19999$: RET ; Exit with status in R0
.END
-----------------------------------------------------------------------------------------------------
gbl_io_chan.mar
.TITLE GBL_IO_CHAN
.IDENT /V004.1/
;Copyright 1989 The Midwest Stock Exchange, Incorporated
; Return the VMS IO channel for a BASIC open statement
;
; (Invoked as a useropen; returns value in mapped region USR_CHANNEL)
;
; Recreated by: George Chapman
;
; Creation date: 22 October, 1987
;
; Change History:
;
; 13 Feb 1991 D. Andrzejewski
; Changed MOVL USE_CHAN to read MOVZWL USR_CHAN (USR_CHAN
; is really a word but the FAB is a longword value)
;
.EXTERNAL -
SYS$CREATE
.PSECT USR_CHANNEL,
PIC,USR,OVR,REL,GBL,SHR,NOEXE,RD,WRT,NOVEC,LONG
USR_CHAN:
.BLKL 1 ; Reserve longword for return value to user
; (VMS IO channel)
.PSECT $CODE,
PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT,NOVEC,LONG
.ENTRY GBL_IO_CHAN,^M<>
ARG__FAB_BASE = ^D4
MOVL ARG__FAB_BASE(AP),R5 ; Get the RMS FAB
INSV #1,#^X11,#1,4(R5) ; Set bits to show that
INSV #1,#^X14,#1,4(R5) ; this file is a system
; global + contig
PUSHL R5 ; Call RMS "Open for Output"
CALLS #01,G^SYS$CREATE ; system service
MOVZWL ^D12(R5),USR_CHAN ; Return the user channel
RET ; And done...
.END
Distribution:
TO: suradej uthaisang ( [email protected]@PMDF@INTERNET )
TO: Mike Hennage ( [email protected]@PMDF@INTERNET )
TO: jack ( [email protected]@PMDF@INTERNET )
TO: tomhaller ( [email protected]@PMDF@INTERNET )
TO: maguiredan ( [email protected]@PMDF@INTERNET )
TO: akkamon ( akkamon@tla )
RFC-822-headers:
Received: from mail12.digital.com (mail12.digital.com)
by dasmts.imc.das.dec.com (PMDF V5.0-7 #16470)
id <[email protected]> for [email protected];
Mon, 03 Feb 1997 01:58:08 -0500 (EST)
Received: from mozart.inet.co.th by mail12.digital.com (8.7.5/UNX 1.5/1.0/WV)
id BAA24765; Mon, 03 Feb 1997 01:55:27 -0500 (EST)
Received: from localhost by mozart.inet.co.th;
(5.65v3.2/1.1.8.2/07Nov95-0628PM) id AA15604; Mon, 03 Feb 1997 13:34:14 +0700
T.R | Title | User | Personal Name | Date | Lines |
---|
253.1 | Port To C or Other Language... | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Mon Feb 17 1997 18:36 | 45 |
|
Why not just move this to C or some other language, and be done with
it? It'll likely be rather easier, and you won't have to deal with
porting Macro32 from OpenVMS VAX to OpenVMS Alpha.
This code would be a fast port, and the same code can likely be used
on both platforms.
The PSECT declaration of USR_CHANNEL appears to conflict with some
other declaration of that psect. (I find the use of SHR and WRT
on that PSECT *very* questionable.) Look around in the linker map,
and see what else is contributing to that PSECT.
:1, What is PIC ,SHR, PSECT and other word in that line?
Please take a look at the LINKER manual or the Macro32 manual.
The PSECT attributes and processing are defined there.
PIC and SHR are position independent -- this means the PSECT can
be relocated in virtual memory. (NOPIC, the opposite, means that
the PSECT must always reside in the same part of virtual address
space. This is bad.) SHR and NOSHR indicate that the program section
can be shared -- code and non-writeable (constant) data is often
shareable, while writable data usually isn't. This attribute becomes
a factor when installing shareable images. In an installed image,
access to data (or code) in PSECTs that are both shareable and
writeable areas must be synchronized -- in most cases, this shared
and writeable access is often a questionable or incorrect design.
:2, How to determine whether or not a program will execute correctly in
:AXP machine?
The code will have to be tested on the OpenVMS Alpha (not `AXP')
system, and correct operation verified. There's no shortcut...
:3, Why I have to do this and why the old one do that?
Do what? Adjust the attributes? Probably because BASIC or
whatever you are LINKing against changed the attributes of the
PSECT.
If the customer insists on continuing to use Macro32 -- something
that should be strongly discouraged -- then this code can likely
be entirely conditionalized.
|