Check out these for some differences between the two library versions:
I'm not sure if this is helpful, or rambling and confusing, so if the latter, feel free to disregard:
Basically, in Allegro 4, everything was double buffered (draw everything to a memory bitmap, and then when you're entirely done, blit that to the screen at the right time with vsync so it doesn't flicker) or page flipped. (Rare, everything is in video memory and VRAM-to-VRAM copied to a off-screen page of VRAM. Then when ready, change the videocard's "screen" to point to that new page. It uses two pages, and they are flipped between each other.)
I believe Allegro 5 is page flipped because modern Direct3D and OpenGL do that. Allegro is a thin layer over those. Whereas Allegro 4 had to "re-invent the wheel" with specific routines for everything because in general, there were no frameworks for that.
There are two ways to do things:
The old way, you either used double buffering (everyhthing was kept locally in RAM), or page flipping (everything in VRAM so it's hardware accelerated 2-D if the card supports it.).
The new way goes through OpenGL/DirectX, which then go through the native graphics driver. So instead of fiddling with registers, you're calling API's which call driver API's which say "draw this please." Everything is in a texture, and Allegro bitmaps are tied to textures with some additional helper information around them.
[This paragraph can be skipped:]
The new way also has the "Fixed/Classic Pipeline" (~1995-2005) vs "Modern Pipeline" (~2005 onward). Classic pipeline used to be faster because it was set-in-stone. Shaders were for special things, and the fixed pipeline did everything else like vertex transformation. The modern pipeline let you (and forced you!) to use shaders for everything. Without a shader, you don't get anything on the screen. These days, the fixed pipeline forces the card into compatibility mode. It's slower, but still 1000's of times faster than your traditional old videocards. IIRC, Allegro normally runs in fixed mode, and that's fine for 2-D games. But if you go on, you'll want to look into the details of this.
They already mentioned that A4 used timers, A5 uses event queues.
Allegro 5 uses event queues for everything. They're not too hard, but they're different, so read up on them. You're just running an event handler that checks if any events are on the event queue, and if so, it deals with them. That's it. But if you're careful, you can still structure a game like Allegro 4 without an event handler, so it should be relatively easy to port an A4 game to A5 without ripping out the core logic.
My question : Is there a way to do this? If not how should I do it using a minimum of memory.
I don't recall the solution to your problem off-the-top of my head, but don't worry about using "minimum amounts of memory." Memory is cheap. Super cheap. Use whatever solution makes sense. It's unlikely you'll be wasting too much memory.
Don't worry about it. I definitely had far worse English when I started here.