i didnt copy and paste this
i wrote it from scratch right in the Post reply editor
just try to find that code somewhere on the internet
I don't need to, it's strikingly similar to one of the early samples in Michael Abrash's graphics programming blackbook, in fact it's the first in the VGA chapter.
BTW I highly recommend that book! It covers CGA, too