russurquhart1 wrote:
> I have some assembly language source, in an older document, that when it
> was ported to our current platform, the code samples got messed up.
>
> I am now faced with the task of going through and reformatting the assembly
> language examples. I'm using vim, to format the code but it is still a pretty
> manual task. I was wondering if anyone could suggest a better method.
>
> I start with something like this:
>
> <Code> MOVIZF32 R1H, #-2.0 ; R1H = -2.0 (0xC0000000) ABSF32 R1H, R1H ;
> R1H = 2.0 (0x40000000), ZF = NF = 0 MOVIZF32 R0H, #5.0 ; R0H = 5.0
> (0x40A00000) ABSF32 R0H, R0H ; R0H = 5.0 (0x40A00000), ZF = NF = 0
> MOVIZF32 R0H, #0.0 ; R0H = 0.0 ABSF32 R1H, R0H ; R1H = 0.0 ZF = 1, NF =
> 0</Code>
>
> And to maintain the formatting i need to end up with something like this:
>
> <Code>
>         MOVIZF32  R1H, #-2.0    ; R1H = -2.0 (0xC0000000)
>         ABSF32       R1H, R1H      ; R1H = 2.0 (0x40000000), ZF = NF = 0
>
>         MOVIZF32  R0H, #5.0     ; R0H = 5.0 (0x40A00000)
>         ABSF32       R0H, R0H      ; R0H = 5.0 (0x40A00000), ZF = NF = 0
>
>         MOVIZF32  R0H, #0.0     ; R0H = 0.0
>         ABSF32       R1H, R0H      ; R1H = 0.0 ZF = 1, NF = 0</Code>

Are you able to inspect the file with a hex editor (or use
":r !xxd <file name>") and determine whether there are any
Unique bytes that mark end of line? Or, did all the line endings
end up a space?

How long is a typical line which contains all the statements?

Does each statement have a comment? If so, something might be
done with a substitute. That would be easier if each instruction
had an identifiable form. Does each consist of uppercase letters
with "32" at the end? If so, try:

:%s/ \ze\u\u\+32\>/\r   /g

John

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to