![]() ![]() MZ-800 course Chapter 4 |
||||||||||||||
4. Video-RAM | ||||||||||||||
Addressing the Video-RAM from the ROM-monitor is also done with bankswitching. The screen does change when you do a bankswitch, because we jump from the 700-mode to an 800-mode, which alters the screen resolution. This is not the case when you do this from BASIC, because the computer will already be in 800-mode. In chapter 3 you have seen two programs that do something with the Video-RAM from the ROM-monitor. In this part of chapter 4 we will look at several programs that do something with Video-RAM. The assembler listing and explanation will be given as well because this is more conveniently arranged and because the assembly chapter is large enough. Program 1: Alphabet-scroll. This program scrolls the alphabet upward over the screen. 6000 DB 600B 03 6016 23 6021 00 602C 77 6037 11 6042 23 6001 E0 600C D3 6017 0B 6022 00 602D 00 6038 00 6043 13 6002 3E 600D CC 6018 78 6023 00 602E 13 6039 80 6044 0B 6003 00 600E 21 6019 B1 6024 00 602F 00 603A 21 6045 78 6004 D3 600F 00 601A C2 6025 11 6030 00 603B D8 6046 B1 6005 CE 6010 80 601B 14 6026 30 6031 00 603C 7F 6047 C2 6006 3E 6011 01 601C 60 6027 5F 6032 00 603D 01 6048 40 6007 00 6012 40 601D 3E 6028 21 6033 7B 603E 40 6049 60 6008 D3 6013 1F 601E 37 6029 19 6034 32 603F 1F 604A C3 6009 F0 6014 AF 601F D3 602A 9F 6035 25 6040 1A 604B 25 600A 3E 6015 77 6020 F0 602B 1A 6036 60 6041 77 604C 60 Filename? A-Z SCROLL Assembler listing of program 1: 6000 IN A,(E0H) 6002 LD A,00H 6004 OUT (CEH),A 6006 LD A,00H 600A LD A,03H 600C OUT (CCH),A 600E LD HL,8000H 6011 LD BC,1F40H 6014 ONE: 6014 XOR A 6015 LD (HL),A 6016 INC HL 6017 DEC BC 6018 LD A,B 6019 OR C 601A JP NZ,ONE 601D LD A,37H 601F OUT (F0H),A 6021 LD A,00H 6023 LD A,00H 6025 TWO: 6025 LD DE,5F30H 6028 LD HL,9F19H 602B LD A,(DE) 602C LD (HL),A 602D NOP 602E INC DE 602F NOP 6030 NOP 6031 NOP 6032 NOP 6033 LD A,E 6034 LD (6026H),A 6037 LD DE,8000H 603A LD HL,7FD8H 603D LD BC,1F40H 6040 THREE: 6040 LD A,(DE) 6041 LD (HL),A 6042 INC HL 6043 INC DE 6044 DEC BC 6045 LD A,B 6046 OR C 6047 JP NZ,THREE 604A JP TWO Explanation of program 1: First of all there is a bankswitch at address 6000. Then, the computer is set to one of the 800-modes at addresses 6002 - 6005. Then palette 0 with colour 0 is loaded. Palette 0 will be black. With port F0H the colour of the palette can be altered. The palette, as well as the colour will be in address A. The first number in A is the palette and the second is the colour the palette has. This all happens at addresses 6006 - 6009. At addresses 600A - 600D the palette is selected, in this case palette 3. From 600E - 601C the screen is cleared. Then palette 3 is loaded with value 7 ( light-gray ) at addresses 601D - 6020. Then a useless piece follows. At 6025 - 6034 1/8 part of a letter is drawn at the bottom of the screen and from 6035 on, the screen is scrolled 1 line up. This cycle is repeated until the reset button is pressed. The program also contains some empty instruction that can be recognized as the NOP instruction. The program was already written when we found out that these parts were of no use, so we replaced them with NOPs. In the chapter about assembly we shall go into the Video-RAM even further. Program 2: 13 rows of 16 colours. This program draws 16 lines in 16 different colours after each other and repeats this 13 times. So this program should only work with the extra ICs. If you do not own them, you can still run this program, but you will see only 4 colours instead of 16. You will probably understand by now why the third screen in Tut-Ench-Amun can be seen with the ICs and not without them. This is because screen 3 has more than 4 colours in use. 2000 dB 2008 D3 2010 AF 2018 20 2020 D3 2028 FB 2030 ED 2001 E0 2009 CC 2011 77 2019 21 2021 CC 2029 3C 2031 C3 2002 3E 200A 21 2012 23 201A 00 2022 06 202A FE 2032 31 2003 02 200B 00 2013 0B 201B 80 2023 28 202B 90 2033 20 2004 D3 200C 80 2014 78 201C 0E 2024 36 202C 20 2005 CE 200D 01 2015 B1 201D 0D 2025 FF 202D F2 2006 3E 200E 40 2016 C2 201E 3E 2026 23 202E 0D 2007 03 200F 1F 2017 10 201F 80 2027 10 202F 20 Filename? COLOUR ROWS Assembler listing of program 2: 2000 IN A,(E0H) 2002 LD A,02H 2004 OUT (CEH),A 2006 LD A,03H 2008 OUT (CCH),A 200A LD HL,8000H 200D LD BC,1F40H 2010 ONE: 2010 XOR A 2011 LD (HL),A 2012 INC HL 2013 DEC BC 2014 LD A,B 2015 OR C 2016 JP NZ,ONE 2019 LD HL,8000H 201C LD E,0DH 201E TWO: 201E LD A,80H 2020 THREE: 2020 OUT (CCH,A) 2022 LD B,28H 2024 FOUR: 2024 LD (HL),FFH 2026 INC HL 2027 DJNZ FOUR 2029 INC A 202A CP 90H 202C JR NZ,THREE 202E DEC C 202F JR NZ,TWO 2031 FIVE: 2031 JP FIVE Explanation of program 2: At first there is a bankswitch and then we switch to the 800-mode with 16 colours. Then the screen is cleared. In fact this has no use, but it is not important. Then 16 rows with different colours are drawn 14 times. Options of port CEH. You have seen that with port CEH the screen resolution and the amount of colours can be altered. Now we shall discuss all functionality of port CEH. All possible values and their screen resolution will be shown. You must send these values to port CEH to get the effect.
|