Assembly 8051 / Asm51 Code Formatting Demo 2


FormatCode Code Formatter is based on serveral powerful syntax parser engines so you can exactly control the appearance of your source code. Here is the code formatting demo of FormatCode Assembly 8051 / Asm51 Code Formatter to prove the ability of code formatting functions of FormatCode:

   ;--- Before Code Formatting ---

   RS EQU P3.0
   RW EQU P3.1
   E EQU P3.5
   ORG 0000H
   MOV P1,#00000001B ; clear
   ACALL ENABLE
   MOV P1,#00000001B ; clear
   ACALL ENABLE
   MOV P1,#00111000B ; show function
   ACALL ENABLE
   MOV P1,#00001111B ; show switch
   ACALL ENABLE
   MOV P1,#00000110B ; input mode
   ACALL ENABLE
   MOV P1,#0C0H ; data dump address
   ACALL ENABLE
   mov p1,#01000001b ; ASCII
   SETB RS
   CLR RW
   CLR E
   ACALL DELAY
   SETB E
   AJMP $
   ENABLE: CLR RS ; send
   CLR RW
   CLR E
   ACALL DELAY
   SETB E
   RET
   DELAY: MOV P1,#0FFH
   CLR RS
   SETB RW
   CLR E
   NOP
   SETB E
   JB P1.7,DELAY ; busy or not
   RET
   END


   ;--- After Code Formatting ---

               RS    equ P3.0
               RW    equ P3.1
               E     equ P3.5
               org   0000H
               mov   P1, #00000001B ; clear
               acall ENABLE
               mov   P1, #00000001B ; clear
               acall ENABLE
               mov   P1, #00111000B ; show function
               acall ENABLE
               mov   P1, #00001111B ; show switch
               acall ENABLE
               mov   P1, #00000110B ; input mode
               acall ENABLE
               mov   P1, #0C0H      ; data dump address
               acall ENABLE
               mov   p1, #01000001b ; ASCII
               setb  RS
               clr   RW
               clr   E
               acall DELAY
               setb  E
               ajmp  $
   ENABLE:     clr   RS             ; send
               clr   RW
               clr   E
               acall DELAY
               setb  E
               ret
   DELAY:      mov   P1, #0FFH
               clr   RS
               setb  RW
               clr   E
               nop
               setb  E
               jb    P1.7, DELAY    ; busy or not
               ret
   end


Click here to preview the 8051 Assembly / Asm51 Code Formatting Demo 1.

With FormatCode 8051 Assembly Code Formatters, you can format and transform any foreign Asm51 source code to meet your preferred coding style or any common code convention in several seconds!