That's right. My "go-to" obnoxious assembly language program I could type in from memory was an infinite loop that screeched the speaker by loading my favorite io address $C030 at an ultrasonic rate.
I had a similar one I'd type in hex at $300, something like:
CALL -151
300:B5 00 20 ED FD E8 AD 30 C0 4C 00 03
300G
(that's a recreation I just worked out, but I think what I used to use was a little different - I forget what technique I used to use to get a semi-random character in the accumulator for it to print)
This filled the screen with scrolling garbage while buzzing the speaker.