http://atmturbo.nedopc.com/inf/books...c/atm_hard.zip

Код:
CALL	SHADOW
		…..
SHADOW	LD	BC,#2A53	; OUT (C),A in TR-DOS address space
		PUSH	BC		; Putting on stack
		LD	BC,#nnnn	; Address of the shadow port
		LD	A,#nn	; Data to out
		JP	#3D2F	; Jump to RET in TR-DOS space
out #FFF7 = %xx11111111110111 (#3FF7,#7FF7,#BFF7,#FFF7)
(A0=A2=A4=A7=1; A3=0)

Bits description:

D0–D5 – inverted page number, RAM or ROM (#00-#3F). If you want to setup page #05 (%00000101) then you should out its inverted value %11111010
D6 – defines ROM or RAM page
D6=0 – ROM page defined by bits D0-D5
D6=1 – RAM page defined by bits D0-D5

D7 – Defines what memory manager`s ports and bits are used to form page number
D7=0 – Page number defined by port #xFF7 only
D7=1 – Use not inverted bits D0-D2 of port #7FFd instead of inverted bits in port #xFF7 If RAM selected by D6: inverted bits D0-D2 replaced with not inverted bits of port #7FFD

Код:
LD	A, #2B		;PAge number is 43 dec
	PUSH	AF
	SCF			;invert if for port #xFF7
	AND	%11111000	;D7=1 – use port #7FFD
	LD	BC, #FFF7	;window 3 (#C000)
	OUT	(C), A	;set bits 3-5 of the page number
	POP	AF		;restore page number
	AND	%00000111	;cut off higher bits
	LD	BC, #7FFD
	OUT	(C), A	;set bits 0-2 of the page number

<<cut>>

Bits on address bus : A14-A15 - selects window in address space:

A14 A15 window port
0 0 #0000-#3FFF (port #3FF7)
1 0 #4000-#7FFF (port #7FF7)
0 1 #8000-#BFFF (port #BFF7)
1 1 #C000-#FFFF (port #FFF7)
P.S.: Fast and lazy translation after hard day...