So here's the end of the act:
O day and night, but this is wondrous strange!
And therefore as a stranger give it welcome.
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
Here, as before, never, so help you mercy,
How strange or odd soe'er I bear myself—
As I perchance hereafter shall think meet
To put an antic disposition on—
That you, at such times seeing me, never shall,
With arms encumber'd thus, or this head-shake,
Or by pronouncing of some doubtful phrase,
As “Well, well, we know,” or “We could, an if we would,”
Or “If we list to speak” or “There be, an if they might,”
Or such ambiguous giving out, to note
That you know aught of me; this is not to do,
So grace and mercy at your most need help you,
Rest, rest, perturbed spirit! So, gentlemen,
With all my love I do commend me to you;
And what so poor a man as Hamlet is
May do to express his love and friending to you,
God willing, shall not lack. Let us go in together;
And still your fingers on your lips, I pray.
The time is out of joint. O cursed spite,
That ever I was born to set it right!
Nay, come, let's go together.
None of this sounds like madness to me. Hamlet has seen the Ghost of his murdered father, and he has been told the circumstances of the murder, and he has been told to seek revenge for the murder.
Certainly this is a lot for a thoughtful, upset, high-strung young man to take in all in one sitting, but he has not let it unbalance him. Indeed, he seems rather excited about what has been told to him, and it looks like he is already planning a course of action. And that course may include looking and acting a bit strange without really being either.
He makes Horatio and Marcellus swear not to reveal what they have seen or heard this night, for he and the Ghost know it is for Hamlet to do what he has to do, and for him alone.