Gury Posted February 4, 2010 Share Posted February 4, 2010 (edited) Hello there, I present another kind of screen manipulation, similar to one in the article for clearing the screen. This time we will rotate screen and make mirror images. Moj mikro magazine article is here. At the bottom of the page you can download all the listings shown in this article in one zipped file. It contains ATR disk image file with Atari DOS system for using with real Atari hardware or any Atari 8-bit emulator, with disk drive enabled. Files on disk are Atari BASIC listings. The assembly language listings (routines) are available in specially referenced links to articles from Moj Mikro magazines. To load programs properly, Atari must be powered with Atari BASIC enabled, or you can try programs with compatible BASIC, for example Turbo BASIC XL. Demonstration programs are written in Atari BASIC. They use graphics mode 8 with routines written in assembly language for fast execution. They are stored in DATA lines, so everybody can try and test them, without the need of assembly language program editor. All the routines can be modified for other graphics modes. Try and modify the example programs in whatever manner and in whatever purpose you want. Vertical rotation of the screen Moj Mikro magazine: year 1989, no. 1, page 26 - 28 Author: Zlatko Bleha Atari BASIC programs on disk (tokenized): M8901262.BAS, M8901263.BAS Assembly language listing of the routine used is here. Description: First example shows rotation of the screen vertically. This means the picture will be drawn upside down when program is finished manipulating video screen bytes. This program could be of good use in case you rotate your TV or monitor on the head and you are too lazy to put it in right direction. Just run this program and everything will seem normal. Just kidding Program example (with machine language routine): The assembly language routine begins retrieving data from the center of the screen to the corners with simultaneously exchanging bytes. We take byte from the upper row and store it in a variable (or stack). Then we take byte from the lower row and put it in the location of the byte we took from the upper row. The byte we saved from the upper row we put to location of the byte from lower row. We use X and Y registers for our byte manipulation. X register represents offset number of byte in the row, and the Y register serves as counter for the current row. This example shows how fast the assembly language routine is compared to pure program written in Atari BASIC, which is here for comparison. Milliseconds versus minutes. Of course, you can use this routine in your own Atari BASIC programs with USR command as shown in demonstration program. This is because all the machine code is located in DATA statements and loaded in memory when program is run. The same method apply to all listings in this article. Program example (without machine language routine): Usage: Load program from disk by typing: Demonstration program with machine language routine: LOAD "D:M8901262.BAS" Demonstration program without machine language routine: LOAD "D:M8901263.BAS" When program is loaded, type RUN. Mirror screen Moj Mikro magazine: year 1989, no. 1, page 26 - 28 Author: Zlatko Bleha Atari BASIC program on disk (tokenized): M8901261.BAS Assembly language listing of the routine used is here. Description: The purpose of this routine is copying the upper part of the screen to the lower part, producing a mirror effect. Routine is modified version of previous routine. The difference is that the copying is done only in one way. As a result, the lower part will be overwritten with the contents of the upper part of the screen. Advanced machine language programmers could modify the routine to preserve the contents of the lower part of the screen, if they want to. Program example: Usage: Load program from disk by typing: LOAD "D:M8901261.BAS" When program is loaded, type RUN. Press Start console key to produce mirror image. Horizontal rotation of the screen Moj Mikro magazine: year 1989, no. 1, page 26 - 28 Author: Zlatko Bleha Atari BASIC program on disk (tokenized): M8901264.BAS Assembly language listing of the routine used is here. Description: You will ask, what about horizontal screen manipulation? Yes, why not. This routine is more complex than the last two. The solution is to change the values of the bytes by shifting their bits by using machine language instructions ROL and ROR. You can check details in assembly language listing and maybe it will become more clear to you how it is done. Enjoy! Program example: Usage: Load program from disk by typing: LOAD "D:M8901264.BAS" When program is loaded, type RUN. Continuously Press Start console key to switch between horizontally mirrored image. Greetings, Gury Screen manipulation.zip Edited February 4, 2010 by Gury Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.