This is a documented disassembly of the screen file produced by the Multiface 2.
It is advisable that you understand the CRTC and the Gate Array so that you can fully understand the comments in this dissassembly.
Load address: &4000 Length: &408C Execution: &8000 ;; *** START OF FILE *** ;;**************************************************************************** 4000 defs 16384 ;screen data (uncompressed) ;; ** EXECUTE HERE ** 8000 DI ;disable interrupts ;;**************************************************************************** ;; ** COPY SCREEN DATA TO VISIBLE SCREEN ** 8001 LD HL,&4000 ;address of screen data 8004 LD DE,&C000 ;screen address 8007 PUSH HL 8008 POP BC ;BC=&4000=Length of data 8009 LDIR ;** copy screen data to screen ** ;;**************************************************************************** ;; ** INITIALISE COLOUR PALLETTE ** 800B LD HL,&8067 ;location of colour pallette in multiface screen file 800E PUSH HL 800F LD BC,17 ;16 colours + border colour 8012 PUSH BC 8013 LD DE,(&8089) ;DE = address where firmware keeps colour palette in ; hardware colour format ;colours stored in this order: border, colour 0,colour 2......colour 15 ;CPC464 = &B1D9 (first set), &B1EA (second set) ;CPC664 = ????? ;CPC6128 = &B7D4 (first set), &B7E5 (second set) ;464PLUS = &B7D4 (first set), &B7E5 (second set) ;6128PLUS= &B7D4 (first set), &B7E5 (second set) 8017 LDIR ;copy for first set of colours ;DE = address where firmware keeps colour palette in ; hardware colours + 17 8019 POP BC ;BC = 17 801A POP HL ;HL = &8067 801B LDIR ;copy to second set of colours ;;**************************************************************************** ;; ** SET CRTC DATA ;HL = &8067 + 17 = &8078 = address of CRTC data 801D EX DE,HL ;DE = address of CRTC data 801E CALL &8034 ;setup CRTC registers ;;**************************************************************************** ;; ** SET SCREEN MODE 8021 LD B,&7F ;Gate Array ;DE = address of CRTC data + 16 = &8088 8023 EX DE,HL 8024 LD C,(HL) ;get rom selection and mode data for Gate Array 8025 OUT (C),C 8027 LD A,C 8028 AND %00000011 ;keep mode information 802A EXX ;B' = &7F ;C' = &89 802B RES 0,C ;clear mode information in C' 802D RES 1,C ;C' = C' AND %11111100 802F OR C 8030 LD C,A ;combine mode and keep rom selection 8031 EXX 8032 EI ;interrupts back mr.CPU 8033 RET ;and back to basic ;NOTE: On return to basic: ; - the operating system will set the colours at the next VSYNC ; - the operating system will set the mode ;;****************************************************************************** ;; ** CALL HERE TO SETUP CRTC ** 8034 LD HL,&BCBD ;H = &BC (CRTC Register select) ;L = &BD (CRTC Register data) 8037 LD B,16 ;no of CRTC registers 8039 JR &803E ;..routine to send data to CRTC ;;****************************************************************************** ;; ** CALL HERE TO SETUP COLOURS ** ;; ** THIS IS NOT USED BY THIS CODE BUT IS PRESENT IN THE FILE ** 803B LD HL,&7F7F ;H= &7F (Gate Array) ;L= &7F (Gate Array) ;;****************************************************************************** ;; ** THIS ROUTINE CAN BE USED TO INITIALISE THE CRTC AND GATE ARRAY ** ;; ;; HL = &BCBD (for CRTC)/&7F7F (for Gate Array) ;; DE = address of CRTC register data/address of Gate Array colour information ;; B = number of registers/number of pens 803E LD C,&00 ;first pen/first CRTC register 8040 PUSH BC 8041 LD B,H ;B=&BC/&7F = CRTC register select/Gate Array pen select 8042 OUT (C),C ;send pen number to Gate Array/CRTC register select 8044 LD A,(DE) ;get Gate Array pen colour/get CRTC register data 8045 INC DE 8046 LD B,L ;B=&BD/&7F = CRTC register data/Gate Array 8047 RL B ;transfer bit 7 of port address into carry 8049 LD B,L ;B=port address 804A JR C,&8050 ;if B=&7F then carry=0 ;if B=&BC then carry=1 804C AND &1F ;make sure colour is in hardware colour range ;(0..31) 804E OR &40 ;%01000000+colour 8050 OUT (C),A ;send register data to CRTC/send colour to Gate Array 8052 POP BC 8053 INC C ;C = CRTC register count/pen count 8054 DJNZ &8040 ;..next register/next pen please.... 8056 RET ;...all done, so exit. ;;**************************************************************************** ;; ** CRTC register data ** ;; - register data for a standard size screen (25 tall,40 wide) ;; - THIS IS NOT USED BY THE CODE BUT IS PRESENT IN THE FILE 8057 defs 16 ;;**************************************************************************** ;; ** Gate Array colour information ;; - colour information for screen that was saved 8067 defs 17 ;;**************************************************************************** ;; ** CRTC register data ** ;; - register data for size of the screen that was saved 8078 defs 16 ;;**************************************************************************** ;; ** Gate Array mode and rom selection ** ;; - mode for screen that was saved 8088 defb &89 ;;**************************************************************************** ;; ** Memory address used by basic to store palette ** ;; - this is dependant on the machine that the screen was saved on.... ;; this value will be different for a CPC464 and a CPC664 8089 defw &B7D4 ;address where firmware keeps the colour pallette ;in hardware colour form 808C defw 0000 ;not used ;; *** END OF FILE ***