Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lloyddean

macrumors 65816
Original poster
May 10, 2009
1,048
19
Des Moines, WA
Anyone familiar with MPW's 'replace' command point me to something similar.

I'd like to do a replace based on tagged regular expressions.

EDIT: Want to preprocess an old 68K assembler source file.
 
Last edited:
what about regular expression in sed or awk? or tr? Sublime Text 2? etc.?

EDIT: or in Visual Studio or in XCode?
 
Last edited:
what about regular expression in sed or awk? or tr? Sublime Text 2? etc.?

EDIT: or in Visual Studio or in XCode?
I don't see anything I recognize as allowing me to search, reorder and replace text.

By reorder I mean sub-expressions within a single assembler line.
 
Last edited:
? can you kindly provide an example what exactly you want to do? (I’m, if anything, MPW-“ignorant” ?)
 
? can you kindly provide an example what exactly you want to do? (I’m, if anything, MPW-“ignorant” ?)
68K Instructions of the form, simplified example

MNEMONIC SRC,DST
to
DST = SRC

Code:
    MOVEM.L     (SP)+,D0-D7/A0-A6
    MOVEM.L     D0-D7/A0-A6,-(SP)
    MOVE        #(12*24),D1 ; cbDyingFrameSize
    MOVE        #(12*24),D1 ; cbPlaneFrameSize
    MOVE        #(12*32),D1 ; cbRobotFrameSize
    MOVE        #(18/2),g_yHeroCenter
    MOVE        #(22/2),g_yHeroCenter
    MOVE        #(32/2)-1,g_xHeroCenter
    MOVE        #(40/2)-1,g_xHeroCenter
    MOVE        #-1,g_fDead
    MOVE        #-1,g_fJmpTurn
    MOVE        #-1,g_fireCur
    MOVE        #-1,g_isPlane   ; we're now a Plane so set fPlane
    MOVE        #-2,g_fJmpTurn
    MOVE        #0,D2
    MOVE        #0,g_fireCur
    MOVE        #0x00FF,0(A0,D0.L)
    MOVE        #0x00FF,2(A0,D0.L)
    MOVE        #0x00FF,4(A0,D0.L)
    MOVE        #1,D0
    MOVE        #1,g_vectorCur
    MOVE        #15,g_jumpmx
    MOVE        #2,g_vectorCur
    MOVE        #24,D2          ; yFrameHeight
    MOVE        #3,g_fFlash
    MOVE        #3,g_vectorCur
    MOVE        #3-1,D3
    MOVE        #3-1,D5
    MOVE        #32,D2          ; cFrameHeight
    MOVE        #4,g_vectorCur
    MOVE        #4-1,D3
    MOVE        #4-1,D5
    MOVE        #44-18,g_ymaxMap
    MOVE        #44-22,g_ymaxMap
    MOVE        #5,g_vectorCur
    MOVE        #6,g_vectorCur
    MOVE        #7,D0               ; Init Direction Vector to Left
    MOVE        #7,g_irgfrmTransCur
    MOVE        #7,g_vectorCur
    MOVE        #8,g_vectorCur
    MOVE        #LEFT,D1                ; init Direction Vector to Left
    MOVE        #RIGHT,D1               ; whoops seems we're facing right
    MOVE        (A0)+,0(A1)
    MOVE        (A0)+,2(A1)
    MOVE        (A0)+,4(A1)
    MOVE        (A0)+,D0
    MOVE        (A0),g_frmHero
    MOVE        D0,(0*1024)(A0)
    MOVE        D0,(1*1024)(A0)
    MOVE        D0,(2*1024)(A0)
    MOVE        D0,(3*1024)(A0)
    MOVE        D0,0(A1)
    MOVE        D0,2(A1)
    MOVE        D0,4(A1)
    MOVE        D0,D1
    MOVE        D0,D1               ; hold on to it, in case no New Vector
    MOVE        D0,g_fJmpTurn ; reached end of Jump/Turn Sequence
    MOVE        D0,g_fldown
    MOVE        D0,g_frmHero
    MOVE        D0,g_frmHero    ; store Frame
    MOVE        D0,g_jumpf
    MOVE        D0,g_jumpf2
    MOVE        D0,g_jumpff
    MOVE        D0,g_vectorCur
    MOVE        D0,g_vectorCur      ; Store Current requested Vector
    MOVE        D0,g_vectorPrev
    MOVE        D0,g_vectorPrev     ; AND make it the Previous Vector
    MOVE        D0,g_vectorSeek
    MOVE        D0,g_wSeed
    MOVE        D0,g_xmaxMap
    MOVE        D1,D0
    MOVE        D1,D2
    MOVE        D1,g_vectorCur      ; so set the Direction Vector
    MOVE        D2,g_xMap
    MOVE        D2,g_yMap
    MOVE        g_cJump,D0
    MOVE        g_fJmpTurn,D0
    MOVE        g_frmHero,D0
    MOVE        g_frmHero,D0        ; Current Hero frame
    MOVE        g_frmHero,D0        ; Hero Frame
    MOVE        g_frmHero,D0    ; Get Hero's current Frame number
    MOVE        g_jumpf,D0
    MOVE        g_vectorCur,D0
    MOVE        g_vectorCur,D0      ; get what was Current Vector
    MOVE        g_vectorPrev,D0
    MOVE        g_vectorSeek,D0
    MOVE        g_wSeed,D0
    MOVE        g_xHero,D0
    MOVE        g_xHero,D1
    MOVE        g_xHeroCenter,D0
    MOVE        g_xMax,D0
    MOVE        g_xmaxMap,D2
    MOVE        g_yHero,D0
    MOVE        g_yHero,D1
    MOVE        g_yHero,D1      ; Hero's yCoOrd
    MOVE        g_yHeroCenter,D0
    MOVE        g_ymaxMap,D2
    MOVE       #0,D0
    MOVE.B      (A0),D0
    MOVE.B      (A0),D0         ; get next frame in Sequence
    MOVE.B      (A0),D0         ; so we can get the next Frame
    MOVE.B      (A0),g_frmHero
    MOVE.L      #-1,D0
    MOVE.L      #-1024,D1
    MOVE.L      #0,D0
    MOVE.L      #1*1024,D1
    MOVE.L      #256,D3         ; dNextScanLine
    MOVE.L      #3*1024,D1
    MOVE.L      #4*1024,D1
    MOVE.L      #64,D3
    MOVE.L      (A0)+,0(A1,D3)
    MOVE.L      (A0)+,4(A1,D3)
    MOVE.L      (A0)+,8(A1,D3)
    MOVE.L      (A0)+,D0
    MOVE.L      (A0),0(A1)
    MOVE.L      (A0),4(A1)
    MOVE.L      (A0),8(A1)
    MOVE.L      (SP)+,D0
    MOVE.L      (SP)+,D0                ; Retreive Vector
    MOVE.L      (SP)+,D0                ; restore direction Vector
    MOVE.L      A0,g_prgfrmJmpTurn
    MOVE.L      A0,g_prgfrmPlaneTurn
    MOVE.L      A0,g_prgfrmTransCur
    MOVE.L      D0,(0*1024)+2(A0)
    MOVE.L      D0,(1*1024)+2(A0)
    MOVE.L      D0,(2*1024)+2(A0)
    MOVE.L      D0,(3*1024)+2(A0)
    MOVE.L      D0,-(SP)
    MOVE.L      D0,-(SP)                ; save direction Vector
    MOVE.L      D0,0(A1)
    MOVE.L      D0,0(A1,D3)
    MOVE.L      D0,4(A1)
    MOVE.L      D0,4(A1,D3)
    MOVE.L      D0,8(A1)
    MOVE.L      D0,8(A1,D3)
    MOVE.L      D0,D1
    MOVE.L      D3,D4
    MOVE.L      g_pHeroDying,A0     ; Get Ptr to Dying (3x3) Images
    MOVE.L      g_pHeroPlane,A0     ; Get Ptr to Robot (3x3) Images
    MOVE.L      g_pHeroRobot,A0     ; Get Ptr to Robot (3x4) Images
    MOVE.L      g_pScreenBits,A1
    MOVE.L      g_prgfrmJmpTurn,A0      ; get Pointer to jump/turn sequence array
    MOVE.L      g_prgfrmPlaneTurn,A0
    MOVE.L      g_prgfrmTransCur,A0
    MOVE.L      g_prgfrmTransCur,A0     ; get Pointer
    MOVE.L      g_prgwDispMap,A0        ; A0 = g_prgwDispMap[g_yHero][g_xHero]
    MOVE.L      g_prgwLastFrameMap,A0
    MOVE.L     #-1,D0
    MOVE.L     #0,D0
    MOVE.L     #0,D1
    MOVE.L     #0,D2
    MOVE.L     #2,D0
    MOVE.L     #2,D1
    MOVE.L     #3-1,D3
    MOVE.L     #5,D0
    MOVE.W      #2,D0
    MOVE.W      (4*1024)+0(A0),D1
    MOVE.W      (4*1024)+2(A0),D1
    MOVE.W      (4*1024)+4(A0),D1
    MOVE.W      0(A0,D0.W),g_irgfrmPlaneTurn
    MOVE.W      D0,g_frmHero    ; Store next Frame
    MOVE.W      D0,g_iMapOffSetCur
    MOVE.W      g_xMap,D0
    MOVE.W      g_yMap,D1
    MOVEM.L     (SP)+,D0-D5/A0-A1
    MOVEM.L     (SP)+,D0-D7/A0-A4
    MOVEM.L     D0-D5/A0-A1,-(SP)
    MOVEM.L D0-D7/A0-A4,-(SP)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.