All of those games use an array for collision.
Dim Map(Number of tiles X, Number Of Tiles Y)
You store values in there for whatever collision you want.
For example You store a 0, for no collision at all, or a 1 for a collision.
So you have X and Y which relate to positions on your screen. Now you can look in X and Y to see what is stored in there.
Data 0,0,0,0,0,1
Look above. You read that sort of data into the array. You have five zeros, so there is no collision for five image blocks. Image blocks can be any size. They are usually 32*32 pixels. So imagine the first five image blocks are images of a road that you can walk along.
The sixth part of the Data is a 1. Now as your player walks along the road starting at the first zero he walks 32 pixels before you look for the next zero, then you let him walk another 32 pixels before you check the next set of data. when he has walked 5 times 32 pixels he will walk into a 1. Now you stop him from walking.