From what I know, the rules of writing dialogue are...
Use a comma to introduce
Use a comma when a dialogue follows quotes
Periods and commas go within closing quotations
Punctuation falls outside or inside closing quotations
Use single quotes when quoting inside dialogue itself
Use capitalization
Use paragraph breaks.
This might not answer your question fully but I hope this helps.