![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I wrote this a while ago. It takes code that has had all formatting removed and turns it into nicely tabulated code.
It turns this, Reset ORG 0x000 ; processor reset vector nop goto main ; go to beginning of program ISR ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents movf STATUS,w ; move STATUS register into W register movwf status_temp ; save off contents of STATUS register movf PCLATH,W ; move PCLATH register into W register movwf pclath_temp ; save off contents of PCLATH register Into, Code:
Reset ORG 0x000 ; processor reset vector nop goto main ; go to beginning of program ISR ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents movf STATUS,w ; move STATUS register into W register movwf status_temp ; save off contents of STATUS register movf PCLATH,W ; move PCLATH register into W register movwf pclath_temp ; save off contents of PCLATH register For it to differentiate between opcodes and labels it uses a file called Codes.csv but this can be overridden by a command line switch. Operation is pretty obvious except for the Auto button. Auto copies code from the clipboard, tidies it up and places it back on the clipboard. Command line switches are, /F"Filename.csv" = new opcode file /T = use tabs /S = use spaces /A = auto /L = make opcodes lower case /U = make opcodes upper case /N = make narrow - uses less horizontal space. To use the switches, make a shortcut to the executable and add the switches to it. (ex "C:\Projects\CodeTidy.exe" /f"Z80.csv" /t) The opcode file override is so you can have a version for other processors. If the /a command line switch is used then you won't see anything. It will run, tidy any code on the clipboard and exit. The zip file contains a setup program. If you installed the earlier version then it is best to uninstall it first via control panel before installing the new one. Please check further down this thread as if there is a bug in this code I will not be able to edit this post due to the 15 minute edit timer. Mike. The other thread had gotten long and convoluted so I started this new one. If a mod wants to delete the old one it would prevent future confusion. Last edited by Pommie; 6th July 2008 at 04:12 PM. |
|
|
|
|
|
|
(permalink) |
|
And here for Eric and anyone else that is interested are the source files. Be warned, as I wrote this for myself and don't intend to maintain it, there are no comments. However, it should be fairly easy to follow for anyone with reasonable VB experience.
Eric, the tab sizes are now constants at the top of the file. The nTab constants are the reduced width ones. If you make them values that are not multiples of 8 then the formatting is strange. Mike. Last edited by Pommie; 6th July 2008 at 03:27 PM. |
|
|
|
|
|
|
(permalink) |
|
Mike excellent work.I haven't see such a thing in any other forums.
For sure this must placed in the "sticky" on this microcontroller section. Can we edit the copied code from your software using tabs? I mean when I use tabs it must move the tabs instead of moving to top option & command buttons.Oh no this is more than enough. Wow great job. Last edited by Gayan Soyza; 5th June 2008 at 04:12 AM. |
|
|
|
|
|
|
(permalink) |
|
Gayan,
If you want to put additional tabs into the tidied code you have to use Ctrl-Tab. One thing I should have done was to tidy up the tab order. Mike. Last edited by Pommie; 5th June 2008 at 04:40 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
Many thanks. Pleased to see the 'dodgy digit' aka 'as the fickle finger of fate' hasn't slowed you down.!
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Pic code tidier. | Pommie | Micro Controllers | 14 | 28th May 2008 07:09 AM |
| Need assembly code or other source code of a "Miniature digital pin number lock"... | chunei | Micro Controllers | 1 | 13th August 2007 05:45 PM |
| code help | emaney | Micro Controllers | 6 | 26th June 2007 12:56 AM |
| help with a code | jijita | Micro Controllers | 1 | 16th August 2004 08:17 AM |
| some testing code.... of code of 89C51 for LCD | kumar_3k | Electronic Projects Design/Ideas/Reviews | 0 | 5th November 2003 05:23 PM |