Page 2 of 3
Re: Printing newlines
Posted: Tue Dec 22, 2020 10:09 pm
by moonchild
bloodline wrote:Operating system development is probably second only to compiler writing in terms of difficulty
Having done both (though admittedly somewhat less on the osdev side), I'm not sure this is fair.
Compilers do get somewhat heavier on the math side; but that's par for the course, and the same is true of machine learning, graphics programming, etc. In terms of
scope, I don't think anything beats os development.
Re: Printing newlines
Posted: Wed Dec 23, 2020 1:05 am
by StudlyCaps
rizxt wrote:You don't know how to conditionally not do something?
I think they know
how to do it, they probably just forgot to make it not print the '\n' as a char. Still, I think hausemaster might be trying to learn how to swim by jumping in the ocean.
Re: Printing newlines
Posted: Wed Dec 23, 2020 3:53 am
by iansjack
rizxt wrote:I would suggest learning how to code before you write an OS.
O would some power the giftie gie us to see ourselves as others see us.
Re: Printing newlines
Posted: Wed Dec 23, 2020 5:11 am
by bloodline
iansjack wrote:rizxt wrote:I would suggest learning how to code before you write an OS.
O would some power the giftie gie us to see ourselves as others see us.

Very good sir!

Re: Printing newlines
Posted: Wed Dec 23, 2020 8:00 am
by hausemaster
rizxt wrote:You don't know how to conditionally not do something?
What????
I would give you some leeway in assembly land... but this is extremely beginner stuff, for basic programming.
I would suggest learning how to code before you write an OS.
Learn how to read before you write a book.
Don't tell me "learn how to code", this is something I already know. So **** off before you decide to insult me again. This is why I left the forum on my other account. You keep discouraging me, and raping me.
Re: Printing newlines
Posted: Wed Dec 23, 2020 8:19 am
by Doctor5555
I'd recommend that you read
http://www.catb.org/~esr/faqs/smart-questions.html before asking more questions here. That page is also linked in the "FORUM RULES" announcement post, item #4.
Re: Printing newlines
Posted: Wed Dec 23, 2020 8:36 am
by Doctor5555
By the way, don't be discouraged by what has been said above. Programming an OS is difficult even for the best coders in the world, but it is just like coding anything else for the most part, with a little bit of added assembly and much more interesting problems.
If you are more comfortable with C++ than C, then you can use C++ without the standard library instead once you have implemented constructors and destructors, although it will take more effort to set up the standard library later.
Re: Printing newlines
Posted: Wed Dec 23, 2020 12:38 pm
by hausemaster
I've fixed it, infact it was VERY easy. But terminal scrolling?
Edit: I have officially given up on this project, and realize I'm far too dumb to accomplish anything. glad you guys helped me come to my senses, probably gonna kill myself later, idk
Re: Printing newlines
Posted: Wed Dec 23, 2020 12:45 pm
by bloodline
hausemaster wrote:I've fixed it, infact it was VERY easy. But terminal scrolling?
Edit: I have officially given up on this project, and realize I'm far too dumb to accomplish anything. glad you guys helped me come to my senses, probably gonna kill myself later, idk
Why not have a go at implementing a scroll algorithm? Try out a few different ideas, then you can present them here and we can explain where you have had some good ideas, and where you have made some bad decisions.
There isn’t any point one of us just telling you how to do it, as you won’t learn anything... you might as well just cut and paste from somewhere.
Re: Printing newlines
Posted: Wed Dec 23, 2020 12:49 pm
by hausemaster
bloodline wrote:hausemaster wrote:I've fixed it, infact it was VERY easy. But terminal scrolling?
Edit: I have officially given up on this project, and realize I'm far too dumb to accomplish anything. glad you guys helped me come to my senses, probably gonna kill myself later, idk
Why not have a go at implementing a scroll algorithm? Try out a few different ideas, then you can present them here and we can explain where you have had some good ideas, and where you have made some bad decisions.
There isn’t any point one of us just telling you how to do it, as you won’t learn anything... you might as well just cut and paste from somewhere.
blah blah fine fine, I'll try something.. that is if I didn't delete everything, I gotta redo my compiler and all that ****, honestly it's too much work, I'm not going to make any money off of it, so it's not worth it. I've wanted to do this for all my life, since I was a kid, but now it makes me want to die. Programming was always hard for me, but the payoff was amazing everytime, that's why I did it. But this, this is just pain. I've been sitting at my terminal for hours trying to figure out the most easiest thing ever. This truly helped me realize I'm far too stupid for anything in the world, It's not worth living if I know I'll never do anything great. I'm sorry everyone, you've been wonderful, I've been the bad person. I'm sorry. Goodbye.
-Hausemaster
Re: Printing newlines
Posted: Wed Dec 23, 2020 5:43 pm
by eekee
Hausemaster: In programming, sooner or later,
everyone finds themselves stuck for hours or days or weeks on something which turns out to be really simple in the end. IMO, you're not a real programmer until you've experienced that at least once.

I know a good kernel dev who has said "I am stupid" more than once over this sort of thing. Eventually, I think you learn tricks to get around the block, much like professional writers (or long-form webcomicers ) learn how to get around writers block.
I do think you have made a mistake: Someone told you to use an if condition, and you replied, "I don't know how to do that."
Yeah, right! 
I'm certain you do know how to do it because you can write C++ and assembler. There are no if conditions in hello world, but any program of any interest at all has them, so I
know you know how to know them! (In assembler, the equivalent is conditional jumps.) I think other forum posters were much too quick to tell you this is too hard for you instead of thinking about what you said you could do.

*glares at certain other forum posters*
I totally get that amazing payoff feeling when you succeed at programming.

Re: Printing newlines
Posted: Thu Dec 24, 2020 1:38 am
by bloodline
hausemaster wrote:
blah blah fine fine, I'll try something..
That’s the spirit!
that is if I didn't delete everything, I gotta redo my compiler and all that ****, honestly it's too much work, I'm not going to make any money off of it, so it's not worth it.
That’s not how eduction works.
I've wanted to do this for all my life, since I was a kid, but now it makes me want to die. Programming was always hard for me, but the payoff was amazing everytime, that's why I did it. But this, this is just pain.
No pain, no gain.
The more difficult something is to do, the more rewarding the completion of the task.
I've been sitting at my terminal for hours trying to figure out the most easiest thing ever. This truly helped me realize I'm far too stupid for anything in the world, It's not worth living if I know I'll never do anything great. I'm sorry everyone, you've been wonderful, I've been the bad person. I'm sorry.
I cannot comment upon your intelligence, but I would err that you perhaps lack the temperament for computer programming.
Re: Printing newlines
Posted: Wed Jan 27, 2021 10:09 pm
by Seasoft
bloodline wrote:hausemaster wrote:yeah osdeving is probably pretty hard, atleast for a kid.
Operating system development is probably second only to compiler writing in terms of difficulty. Not only do you need to know your target hardware extremely intimately, you must also have a clear understanding of the programming language you plan to use, and to really muddy the waters you also need to understand the different operating system paradigms well enough to know which fits your use case.
From the questions you are asking, it seems like you are new to C, if this is true, you would do well to spend some time working through some c exercise projects. Perhaps buy an Arduino and learn more about low level hardware concepts, like interrupts and bitwise operations. These things you will need to know.
-edit- Don’t be discouraged, the rudiments of my OSDev project can trace their design roots back to my first kernel sketches written when I was 14 (which is why they are heavily 68k oriented)!
I'm actually having the same issue as hausemaster is having above, I incremented the row and zero'd the column part, but I wasn't able to get rid of the stragne ASCII block character. I don't know how to prevent a certain char from being rendered or its only on the tip of my tongue.
Re: Printing newlines
Posted: Wed Jan 27, 2021 11:18 pm
by neon
Hi,
General advice on debugging... Sometimes it can be helpful to write out and walk through a higher level logic flow of what you want the code to do. This can be writing pseudo code and literally reasoning to yourself by walking through it while feeding in different scenarios. Don't copy and paste code that you are not able to follow the control flow of; instead build it up and you'll see the problem and be able to correct it and any potential future bugs with it. Typically when it comes to more complicated code, I write a series of comments first following all potential cases and the expected control flow and work on it a bit at a time -- splitting it into more functions as needed and building it bottom-up. It can also be helpful with writing something in a userland test program first and porting it to facilitate debugging. Sometimes it can be helpful to write small unit tests as well for internal testing of bugs of code currently being worked on. Finally, quite possibly the very first thing you should be doing is enabling the serial port and redirecting output to a file (at first). You can send the characters as numbers whenever you are printing it out and you'll see the exact character that the code is trying to print as a []. It can be a newline, but if this is part of a string it can also be a carriage return depending on how new lines are being handled. It can also be a garbage character on the stack if it prints out something uninitialized or something results in the code entering on unexpected state. If it is indeed printing out the newline, then you must prevent it somehow -- a return, break, continue, whatever is needed depending on what the code looks like. If you aren't sure, follow the high level control logic of it -- some control path is allowing it.
In any case, I'd be interested to see what the code looks like for review. If this is indeed a common error, it might be helpful to discuss why and add it to the Wiki. In short...you prevent it from displaying by not displaying it.
Re: Printing newlines
Posted: Thu Jan 28, 2021 3:22 am
by iansjack
Seasoft wrote:I don't know how to prevent a certain char from being rendered or its only on the tip of my tongue.
Well, in your print routine you just process control characters (such as CR and LF) but don't echo them to the screen. How much simpler can it be?