Funny enough, that piece of asm looks familiar (I mean, not exactly, but roughly). I think I remember seeing something similar in a YouTube video about programming a particular piece of hardware or DOS or something.
I might be able to give some more specific feedback later when I have time... but it seems a lot of people get this idea that they need to make a "game engine" instead of a just making a
game. If you want to make a "game engine", then when planning your project, the question is, what are your goals for what a user of this game engine should be able to do?
Personally, I think that it's the wrong way of thinking for newcomers to think in terms of a making "game engine" from scratch. Instead, think about just make a game, with some basic mechanics and logic. The important thing is to get experience.
If you wanted to make a basic 2D game with a graphical window, I would suggest downloading and building SFML.
https://www.sfml-dev.org/
SFML comes with a Graphics library that can do things like make rectangles, polygons, load textures, and the like. It also comes with very basic rectangle object collision detection (intersects, contains). And it can handle user mouse/keyboard input.