Message board for the users of flat assembler.
> Heap > am i stupid?
Im having big problems to keep concentration on my code. For example, recently ive been writing few algoritms to bo some operations on bits, for example last one was signed division of large data. Ive spent 4 days on it.
Whats wrong with me? When think about how to approach it, before writing anything, it sounds really simple. Shift bits by X, subtract, if subtraction give 0 do it again, if cf break loop, and default write zeros and do normal subtraction.
Then rotate, and so on untill i process all data or get ending condition. It only seems simple before i start to write code.
When i start writing, the first thing i do (not?) is realize that i need a ton of local variables, and each of them named like [bp - XX]. In the past i was using registers, saving them on stack, using si, di, cx as counters, but when i found out that i need to have access to them in any given time i switched only to stack frames.
To simplify my coding, i use registers only this way:
ax - accumulator
bx - addres
bp - stack frame
dx - multiplication and pio
cx - bit shifts
di/si/sp - never use
This way bx registers is abused in my code, but its more readable.
This doesnt help much. When i start writing code, make first first loop i forget what i was supposed to do next. I try to remember, and when i do - i code it, and while doing so, i in turn forget about what was the first loop doing. At this point the most efficient thing to do is do delete everything and start over again, because when i try to understand what i wrote and check if its correct - i completly lose track of everything and find myself writing nonsense.
I dont know why im having such problems, its just impossible to code anything. At the beggining it looks simple, but in the middle i just dont know what im doing anymore. I know what im supposed to do, but i lose the big picture.
Am i that stupid, or i take wrong approach to code?
I use local variables as counters, when i need temporary variable, i use separate memory for each of them, even if its clearly i could reuse one.
I absolutly dont use any optimizations, like movs/xor ax, ax, just straightforward method.
I even tried not to cache memory in ax to do few operations on it, but access it every single time, just to keep it simple.
Still, whats wrong? Anyone having simmilar problems, that in the middle of writing code you have no idea what your doing?
|09 Feb 2011, 04:01||
Draw a flow chart, or sketch out the algorithm, on paper. Jumping straight in and coding things from scratch can sometimes be difficult without these external aids to help direct your coding.
|09 Feb 2011, 04:21||
i've spent 2 years 2 study floats perfectly
i'm afraid watching my old sources(deleted)
i'm sometimes using paper for notes
i can not add-sub-mul-div quickly in mind
i forget names of my friends
you seem to be doubting about what you really need
reuse named vars :b
optimization is always difficult, writing and instro you must think beforehand
relax at last
in the past i had a math teacher and she was a bitch, my common mark was 5-6 while maximal was 12, one time i've received 11, as the itch said, but she put 7 arguing i was not so clever to do that; later i got another teacher and she was fair: 2-11 the marks were so believe yourself, ask the forum
|09 Feb 2011, 06:23||
You are getting old dude, take some vitamin-B12.
Nombre: Aquiles Castro.
|09 Feb 2011, 11:25||
Maybe you have too much lyrica in your thinking.
or a 3D model...
Draw a flow chart,
|09 Feb 2011, 11:50||
When I design, I always go in -v (i.e. verbose) mode
In the source code file, I write pseudo code, draw ASCII-art charts and describe (as in novel back-story) every single bit of code I'll need to implement.
|09 Feb 2011, 12:52||
write your code into the asm file as comments after one another. then later just start to replace comments with code.
|10 Feb 2011, 09:43||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.