[General Design] Commenting Help

A General Discussion forum for TI calculators

Moderator: MaxCoderz Staff

User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

[General Design] Commenting Help

Post by Jim e »

I am in desperate need of a commenting method, I have written many lines code today and in a matter of hours it has become a horrid mess. I can't believe that, despite my effort to keep it simple, It's becoming unrecognizable. I remember in documenting assmebly kv83 an nice way to comment, but I rarely write that neatly and my code is never that uniform.
Does any have a good way to comment on code?

Also what does every one else use to write asm programs?
I'm just using Microsoft WordPad, I think it's causing me some confusion trouble.

....sigh.... back to coding.
Image
Spencer
Extreme Poster
Posts: 346
Joined: Mon 17 Jan, 2005 8:56 am
Location: Indiana

Post by Spencer »

I like notepad because of the tab character instead of spaces. Its search and goto are faster as well. Why do you need a method? Do what'd best for your needs. If you forget what registers are holding, make a register table saying what each has: "At this point: hl - x ptr \ de - img ptr" that sort of thing. If you have no idea what the hell is going on, comment on every line's purpose (like enemy collisions with the grid in Zelda, HA HA). I think pretty code is a waste of time.
Last edited by Spencer on Fri 01 Apr, 2005 6:09 am, edited 1 time in total.
Gambit
Sir Posts-A-Lot
Posts: 252
Joined: Mon 21 Feb, 2005 5:34 am
Location: Laveen, Arizona

Re: Commenting Help

Post by Gambit »

Jim e wrote:Also what does every one else use to write asm programs?
I'm just using Microsoft WordPad, I think it's causing me some confusion trouble.
Crimson Editor. I especially like the customizable user tools where you can compile assembly programs w/o switching to DOS. 8) I used to use Notepad, but now, w/o syntax highlighting, I get lost :( WordPad... :evil:

/edit: My 100th post!
"If SOURCE is outlawed, only outlaws will have SOURCE."
User avatar
Madskillz
Calc Wizard
Posts: 745
Joined: Fri 17 Dec, 2004 10:22 pm
Location: Wandering around in the Jungle...
Contact:

Post by Madskillz »

I use notepad too...I dont think anybody can keep their code as neat as KV. I try, but I usually add and remove stuff, mine is always messy. I am always happy when it works! Which if I am lucky is on the first try, but that hardly ever happens unless I am showing a titlescreen/sprite, but who can get those wrong right! :D
The Revolution is here...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

I use either notepad or wordpad, and i rarely comment my code effectively :S.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Andy_J
Calc Master
Posts: 1110
Joined: Mon 20 Dec, 2004 10:01 pm
Location: In the state of Roo Fearing
Contact:

Post by Andy_J »

Yay Crimson Editor! I use it to print out my programs for computer science class (jGRASP doesn't do a good job printing), but I don't use it to edit much anymore. I use it when I do do RAM programs, though. I use ZDS for my Apps.
ImageImage
Image
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

I usually comment blocks of 10-20 instructions with a line describing what they are supposed to achieve. I think I reached my commenting nirvana with AG. ;)
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

I usually just add a few lines at the beginning of each routine, describing what it does (or is supposed to do), and I sometimes comment difficult parts of the routine. For the rest: See signature :)

And I use UltraEdit for most of my programming. With my own z80 syntax highlighting definitions. I really can't work without syntax highlighting anymore :D
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

The problem is that my routines take long and call other routines. One in particular takes up around 500 bytes, thats 'alot' for a routine. Plus there is a lot of different sections to the code.

I don't know I kinda want an editor that supports colored comments.

Oh and notepad has a limit on it's file size. I never Have one folder for one project so breaking a program up into a bunch of includes would get messy.
Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Jim e wrote:I never Have one folder for one project so breaking a program up into a bunch of includes would get messy.
Then you very much need to start making folders for your projects :D

My compile structure:

Code: Select all

- Assembly dir        (compile batchfiles, tasm, bin progs etc)
     - Source         (.asm files)
          - Includes  (.inc files)
     - Executables
          - Ti-73     (executables for all .asm files, compiled for Ti-73)
          - Ti-83     (executables for all .asm files, compiled for Ti-83)
          - Ti-83Plus (executables for all .asm files, compiled for Ti-83+)
I only have one real project at the moment, so I just put all my source files in the source directory, but I'll add subdirectories in Source and in Executables if I take up another project.

Oh, and I just added Ti-73 for fun when Mallard came out ;) That include file is just so damn easy to use...
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
coelurus
Calc Wizard
Posts: 585
Joined: Sun 19 Dec, 2004 9:02 pm
Location: Sweden
Contact:

Post by coelurus »

Breaking things up is a personal matter, I wrote Gemini in one file and only put data in external files and it worked pretty well. I made one dedicated directory for the project, though.
As for commenting code; just write what a routine does and maybe some of the basic ideas for the routine plus minor pointers to what happens inside the routine. Some optimized or otherwise tricky sections are best left "remembered". Just something one learns as time goes by, try sometime to add comments everywhere and you'll see where they're totally unnecessary.

Editor: vim :)
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Oh, yeah definately, data must be seperate. BUt remeber things for a alot of code can get annoying. But the real issue is that I don't like working with my messy code, and the fact that I intend to have it so other people can understand it makes harder for me to figure out how comment on it.

Though I do keep apps in seprate directory and now that I think of it any thing truely big enough, movie or sound demos, I have seprate project folders for them.

Vim, whats vim?
Image
koolmansam375
Extreme Poster
Posts: 479
Joined: Fri 17 Dec, 2004 11:09 pm
Contact:

Post by koolmansam375 »

Jim e wrote:Vim, whats vim?
vi improved. Its only(?) on *nix boxes.
Image

Pongwars shall live!

blog is down atm. :-(
coelurus
Calc Wizard
Posts: 585
Joined: Sun 19 Dec, 2004 9:02 pm
Location: Sweden
Contact:

Post by coelurus »

If you intend your projects to be useable by others, then ask some people you know to look at your code (beta-testers :) ).

Vim is available for Windows but it kinda loses its charm there. I still use it everywhere.
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

coelurus wrote:Vim is available for Windows but it kinda loses its charm there. I still use it everywhere.
Na zdraví, that's all I can say. ;)
Post Reply