base SDL code