     1                                  ; ****************************************************************************
     2                                  ; blocks14.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; 01/03/2021
     6                                  ;
     7                                  ; ****************************************************************************
     8                                  ; nasm blocks14.s -l blocks14.txt -o BLOCKS14.PRG -Z error.txt
     9                                  ; (modified from 'blocks13.s', 01/03/2021 & 'blocks11.s', 28/02/2021)
    10                                  
    11                                  ; 'sysvideo' bh = 2, block copy and modification test (VESA VBE mode 111h)
    12                                  
    13                                  ; 14/07/2020
    14                                  ; 31/12/2017
    15                                  ; TRDOS 386 (v2.0) system calls
    16                                  _ver 	equ 0
    17                                  _exit 	equ 1
    18                                  _fork 	equ 2
    19                                  _read 	equ 3
    20                                  _write	equ 4
    21                                  _open	equ 5
    22                                  _close 	equ 6
    23                                  _wait 	equ 7
    24                                  _create	equ 8
    25                                  _rename	equ 9
    26                                  _delete	equ 10
    27                                  _exec	equ 11
    28                                  _chdir	equ 12
    29                                  _time 	equ 13
    30                                  _mkdir 	equ 14
    31                                  _chmod	equ 15
    32                                  _rmdir	equ 16
    33                                  _break	equ 17
    34                                  _drive	equ 18
    35                                  _seek	equ 19
    36                                  _tell 	equ 20
    37                                  _memory	equ 21
    38                                  _prompt	equ 22
    39                                  _path	equ 23
    40                                  _env	equ 24
    41                                  _stime	equ 25
    42                                  _quit	equ 26	
    43                                  _intr	equ 27
    44                                  _dir	equ 28
    45                                  _emt 	equ 29
    46                                  _ldrvt 	equ 30
    47                                  _video 	equ 31
    48                                  _audio	equ 32
    49                                  _timer	equ 33
    50                                  _sleep	equ 34
    51                                  _msg    equ 35
    52                                  _geterr	equ 36
    53                                  _fpstat	equ 37
    54                                  _pri	equ 38
    55                                  _rele	equ 39
    56                                  _fff	equ 40
    57                                  _fnf	equ 41
    58                                  _alloc	equ 42
    59                                  _dalloc equ 43
    60                                  _calbac equ 44
    61                                  _dma	equ 45	
    62                                  
    63                                  %macro sys 1-4
    64                                      ; 29/04/2016 - TRDOS 386 (TRDOS v2.0)	
    65                                      ; 03/09/2015	
    66                                      ; 13/04/2015
    67                                      ; Retro UNIX 386 v1 system call.		
    68                                      %if %0 >= 2   
    69                                          mov ebx, %2
    70                                          %if %0 >= 3    
    71                                              mov ecx, %3
    72                                              %if %0 = 4
    73                                                 mov edx, %4   
    74                                              %endif
    75                                          %endif
    76                                      %endif
    77                                      mov eax, %1
    78                                      ;int 30h
    79                                      int 40h ; TRDOS 386 (TRDOS v2.0)		   
    80                                  %endmacro
    81                                  
    82                                  ; Retro UNIX 386 v1 system call format:
    83                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
    84                                  
    85                                  [BITS 32] ; We need 32-bit intructions for protected mode
    86                                  
    87                                  [ORG 0] 
    88                                  
    89                                  START_CODE:
    90                                  	; clear bss
    91 00000000 BF[E4060000]            	mov	edi, bss_start
    92 00000005 B901580200              	mov	ecx, (bss_end - bss_start)/4
    93                                  	;xor	eax, eax
    94 0000000A F3AB                    	rep	stosd
    95                                  
    96                                  	; program message
    97 0000000C BE[E9050000]            	mov	esi, program_msg
    98 00000011 E89F050000              	call	print_msg
    99                                  
   100 00000016 30E4                    	xor	ah, ah
   101                                  	;int	16h	; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY
   102                                  			; Return: AH = scan code, AL = character
   103 00000018 CD32                    	int	32h	; TRDOS 386 Keyboard interrupt 
   104                                  
   105                                  
   106                                  	; Set Video Mode to 111h ; 640x480, 16 bit high colors
   107                                  	;			 ; (RGB: 5:6:5)
   108                                  	sys	_video, 08FFh, 111h
   108                              <1> 
   108                              <1> 
   108                              <1> 
   108                              <1> 
   108                              <1>  %if %0 >= 2
   108 0000001A BBFF080000          <1>  mov ebx, %2
   108                              <1>  %if %0 >= 3
   108 0000001F B911010000          <1>  mov ecx, %3
   108                              <1>  %if %0 = 4
   108                              <1>  mov edx, %4
   108                              <1>  %endif
   108                              <1>  %endif
   108                              <1>  %endif
   108 00000024 B81F000000          <1>  mov eax, %1
   108                              <1> 
   108 00000029 CD40                <1>  int 40h
   109 0000002B 09C0                    	or	eax, eax
   110                                  	;jz	short terminate
   111                                  	;mov	[LFB_ADDR], edx ; pointer to LFB info table/structure
   112 0000002D 7505                    	jnz	short set_vesa_mode_111h_ok
   113 0000002F E949050000              	jmp	terminate
   114                                  
   115                                  set_vesa_mode_111h_ok:
   116 00000034 B9FFFF0000              	mov	ecx, 0FFFFh ; white
   117 00000039 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   118                                  	sys	_video
   118                              <1> 
   118                              <1> 
   118                              <1> 
   118                              <1> 
   118                              <1>  %if %0 >= 2
   118                              <1>  mov ebx, %2
   118                              <1>  %if %0 >= 3
   118                              <1>  mov ecx, %3
   118                              <1>  %if %0 = 4
   118                              <1>  mov edx, %4
   118                              <1>  %endif
   118                              <1>  %endif
   118                              <1>  %endif
   118 0000003E B81F000000          <1>  mov eax, %1
   118                              <1> 
   118 00000043 CD40                <1>  int 40h
   119                                  
   120                                  	;mov	dword [tcolor], 0
   121 00000045 BEF000D000              	mov	esi, 208*65536+240
   122 0000004A BD[9A060000]            	mov	ebp, txt_white
   123 0000004F E872050000               	call	print_text
   124                                  
   125 00000054 E832050000              	call	waitforkey
   126                                  
   127                                  	; full screen replace color (replace black colors)
   128 00000059 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   129 0000005B BA00F80000              	mov	edx, 1111100000000000b ; RED
   130 00000060 B30C                    	mov	bl, 0Ch
   131                                  	sys	_video
   131                              <1> 
   131                              <1> 
   131                              <1> 
   131                              <1> 
   131                              <1>  %if %0 >= 2
   131                              <1>  mov ebx, %2
   131                              <1>  %if %0 >= 3
   131                              <1>  mov ecx, %3
   131                              <1>  %if %0 = 4
   131                              <1>  mov edx, %4
   131                              <1>  %endif
   131                              <1>  %endif
   131                              <1>  %endif
   131 00000062 B81F000000          <1>  mov eax, %1
   131                              <1> 
   131 00000067 CD40                <1>  int 40h
   132                                  
   133 00000069 E81D050000              	call	waitforkey
   134                                  
   135                                  	; full screen replace color (replace white colors)
   136 0000006E B9FFFF0000              	mov	ecx, 0FFFFh  ; WHITE
   137 00000073 29D2                    	sub	edx, edx ; 0 ; BLACK
   138                                  	;mov	bl, 0Ch
   139                                  	sys	_video
   139                              <1> 
   139                              <1> 
   139                              <1> 
   139                              <1> 
   139                              <1>  %if %0 >= 2
   139                              <1>  mov ebx, %2
   139                              <1>  %if %0 >= 3
   139                              <1>  mov ecx, %3
   139                              <1>  %if %0 = 4
   139                              <1>  mov edx, %4
   139                              <1>  %endif
   139                              <1>  %endif
   139                              <1>  %endif
   139 00000075 B81F000000          <1>  mov eax, %1
   139                              <1> 
   139 0000007A CD40                <1>  int 40h
   140                                  	
   141                                  	; full screen replace color (replace red colors)
   142 0000007C B900F80000              	mov	ecx, 1111100000000000b ; RED
   143 00000081 BAFFFF0000              	mov	edx, 0FFFFh  ; WHITE
   144                                  	;mov	bl, 0Ch
   145                                  	sys	_video
   145                              <1> 
   145                              <1> 
   145                              <1> 
   145                              <1> 
   145                              <1>  %if %0 >= 2
   145                              <1>  mov ebx, %2
   145                              <1>  %if %0 >= 3
   145                              <1>  mov ecx, %3
   145                              <1>  %if %0 = 4
   145                              <1>  mov edx, %4
   145                              <1>  %endif
   145                              <1>  %endif
   145                              <1>  %endif
   145 00000086 B81F000000          <1>  mov eax, %1
   145                              <1> 
   145 0000008B CD40                <1>  int 40h
   146                                  	
   147                                  	; now screen color is black and text color is white
   148                                  
   149 0000008D E8F9040000              	call	waitforkey
   150                                  
   151                                  	; full screen - blue color 
   152                                  
   153 00000092 66B91F00                	mov	cx, 11111b ; BLUE
   154 00000096 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   155                                  	sys	_video
   155                              <1> 
   155                              <1> 
   155                              <1> 
   155                              <1> 
   155                              <1>  %if %0 >= 2
   155                              <1>  mov ebx, %2
   155                              <1>  %if %0 >= 3
   155                              <1>  mov ecx, %3
   155                              <1>  %if %0 = 4
   155                              <1>  mov edx, %4
   155                              <1>  %endif
   155                              <1>  %endif
   155                              <1>  %endif
   155 0000009B B81F000000          <1>  mov eax, %1
   155                              <1> 
   155 000000A0 CD40                <1>  int 40h
   156                                  
   157 000000A2 66C705[E4060000]FF-     	mov	word [tcolor], 0FFFFh
   157 000000AA FF                 
   158 000000AB BE0201D000              	mov	esi, 208*65536+258
   159 000000B0 BD[84060000]            	mov	ebp, txt_blue
   160 000000B5 E80C050000               	call	print_text
   161                                  
   162 000000BA E8CC040000              	call	waitforkey
   163                                  
   164                                  	; full screen replace color (replace white colors)
   165 000000BF B9FFFF0000              	mov	ecx, 0FFFFh ; WHITE
   166 000000C4 BAE0FF0000              	mov	edx, 1111111111100000b ; YELLOW
   167 000000C9 B30C                    	mov	bl, 0Ch
   168                                  	sys	_video
   168                              <1> 
   168                              <1> 
   168                              <1> 
   168                              <1> 
   168                              <1>  %if %0 >= 2
   168                              <1>  mov ebx, %2
   168                              <1>  %if %0 >= 3
   168                              <1>  mov ecx, %3
   168                              <1>  %if %0 = 4
   168                              <1>  mov edx, %4
   168                              <1>  %endif
   168                              <1>  %endif
   168                              <1>  %endif
   168 000000CB B81F000000          <1>  mov eax, %1
   168                              <1> 
   168 000000D0 CD40                <1>  int 40h
   169                                  
   170 000000D2 E8B4040000              	call	waitforkey
   171                                  	
   172                                  	; full screen replace color (replace blue colors)
   173 000000D7 66B91F00                	mov	cx, 11111b ; BLUE
   174 000000DB 31D2                    	xor	edx, edx ; 0 ; BLACK
   175                                  	;mov	bl, 0Ch
   176                                  	sys	_video
   176                              <1> 
   176                              <1> 
   176                              <1> 
   176                              <1> 
   176                              <1>  %if %0 >= 2
   176                              <1>  mov ebx, %2
   176                              <1>  %if %0 >= 3
   176                              <1>  mov ecx, %3
   176                              <1>  %if %0 = 4
   176                              <1>  mov edx, %4
   176                              <1>  %endif
   176                              <1>  %endif
   176                              <1>  %endif
   176 000000DD B81F000000          <1>  mov eax, %1
   176                              <1> 
   176 000000E2 CD40                <1>  int 40h
   177                                  	
   178                                  	; full screen replace color (replace yellow colors)
   179 000000E4 66B9FFFF                	mov	cx, 0FFFFh ; YELLOW
   180 000000E8 66BA1F00                	mov	dx, 11111b ; BLUE
   181                                  	;mov	bl, 0Ch
   182                                  	sys	_video
   182                              <1> 
   182                              <1> 
   182                              <1> 
   182                              <1> 
   182                              <1>  %if %0 >= 2
   182                              <1>  mov ebx, %2
   182                              <1>  %if %0 >= 3
   182                              <1>  mov ecx, %3
   182                              <1>  %if %0 = 4
   182                              <1>  mov edx, %4
   182                              <1>  %endif
   182                              <1>  %endif
   182                              <1>  %endif
   182 000000EC B81F000000          <1>  mov eax, %1
   182                              <1> 
   182 000000F1 CD40                <1>  int 40h
   183                                  
   184                                  	; now screen color is black and text color is blue
   185                                  
   186 000000F3 E893040000              	call	waitforkey
   187                                  
   188 000000F8 66B900F8                	mov	cx, 1111100000000000b ; RED
   189 000000FC BB01020000              	mov	ebx, 0201h ; Full screen, new color
   190                                  	sys	_video
   190                              <1> 
   190                              <1> 
   190                              <1> 
   190                              <1> 
   190                              <1>  %if %0 >= 2
   190                              <1>  mov ebx, %2
   190                              <1>  %if %0 >= 3
   190                              <1>  mov ecx, %3
   190                              <1>  %if %0 = 4
   190                              <1>  mov edx, %4
   190                              <1>  %endif
   190                              <1>  %endif
   190                              <1>  %endif
   190 00000101 B81F000000          <1>  mov eax, %1
   190                              <1> 
   190 00000106 CD40                <1>  int 40h
   191                                  
   192                                  	;mov	word [tcolor], 0FFFFh
   193 00000108 BE1401D000              	mov	esi, 208*65536+276
   194 0000010D BD[89060000]            	mov	ebp, txt_red
   195 00000112 E8AF040000               	call	print_text
   196                                  
   197 00000117 E86F040000              	call	waitforkey
   198                                  
   199                                  	; full screen replace color (replace white colors)
   200 0000011C 66B9FFFF                	mov	cx, 0FFFFh ; WHITE
   201 00000120 66BAE0FF                	mov	dx, 1111111111100000b ; YELLOW
   202 00000124 B30C                    	mov	bl, 0Ch
   203                                  	sys	_video
   203                              <1> 
   203                              <1> 
   203                              <1> 
   203                              <1> 
   203                              <1>  %if %0 >= 2
   203                              <1>  mov ebx, %2
   203                              <1>  %if %0 >= 3
   203                              <1>  mov ecx, %3
   203                              <1>  %if %0 = 4
   203                              <1>  mov edx, %4
   203                              <1>  %endif
   203                              <1>  %endif
   203                              <1>  %endif
   203 00000126 B81F000000          <1>  mov eax, %1
   203                              <1> 
   203 0000012B CD40                <1>  int 40h
   204                                  
   205 0000012D E859040000              	call	waitforkey
   206                                  	
   207                                  	; full screen replace color (replace red colors)
   208 00000132 66B900F8                	mov	cx, 1111100000000000b ; RED
   209 00000136 29D2                    	sub	edx, edx ; 0 ; BLACK
   210                                  	;mov	bl, 0Ch
   211                                  	sys	_video
   211                              <1> 
   211                              <1> 
   211                              <1> 
   211                              <1> 
   211                              <1>  %if %0 >= 2
   211                              <1>  mov ebx, %2
   211                              <1>  %if %0 >= 3
   211                              <1>  mov ecx, %3
   211                              <1>  %if %0 = 4
   211                              <1>  mov edx, %4
   211                              <1>  %endif
   211                              <1>  %endif
   211                              <1>  %endif
   211 00000138 B81F000000          <1>  mov eax, %1
   211                              <1> 
   211 0000013D CD40                <1>  int 40h
   212                                  	
   213                                  	; full screen replace color (replace yellow colors)
   214 0000013F 66B9E0FF                	mov	cx, 1111111111100000b ; YELLOW
   215 00000143 66BA00F8                	mov	dx, 1111100000000000b ; RED
   216                                  	;mov	bl, 0Ch
   217                                  	sys	_video
   217                              <1> 
   217                              <1> 
   217                              <1> 
   217                              <1> 
   217                              <1>  %if %0 >= 2
   217                              <1>  mov ebx, %2
   217                              <1>  %if %0 >= 3
   217                              <1>  mov ecx, %3
   217                              <1>  %if %0 = 4
   217                              <1>  mov edx, %4
   217                              <1>  %endif
   217                              <1>  %endif
   217                              <1>  %endif
   217 00000147 B81F000000          <1>  mov eax, %1
   217                              <1> 
   217 0000014C CD40                <1>  int 40h
   218                                  
   219                                  	; now screen color is black and text color is red
   220                                  
   221 0000014E E838040000              	call	waitforkey
   222                                  
   223                                  	; full screen - green color
   224                                  
   225 00000153 66B9E007                	mov	cx, 11111100000b ; GREEN 
   226 00000157 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   227                                  	sys	_video
   227                              <1> 
   227                              <1> 
   227                              <1> 
   227                              <1> 
   227                              <1>  %if %0 >= 2
   227                              <1>  mov ebx, %2
   227                              <1>  %if %0 >= 3
   227                              <1>  mov ecx, %3
   227                              <1>  %if %0 = 4
   227                              <1>  mov edx, %4
   227                              <1>  %endif
   227                              <1>  %endif
   227                              <1>  %endif
   227 0000015C B81F000000          <1>  mov eax, %1
   227                              <1> 
   227 00000161 CD40                <1>  int 40h
   228                                  
   229 00000163 66C705[E4060000]00-     	mov	word [tcolor], 0
   229 0000016B 00                 
   230 0000016C BEF000D000              	mov	esi, 208*65536+240
   231 00000171 BD[8D060000]            	mov	ebp, txt_green
   232 00000176 E84B040000               	call	print_text
   233                                  
   234 0000017B E80B040000              	call	waitforkey
   235                                  
   236                                  	; full screen replace color (replace black colors)
   237 00000180 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   238 00000182 66BAFFFF                	mov	dx, 0FFFFh ; WHITE
   239 00000186 B30C                    	mov	bl, 0Ch
   240                                  	sys	_video
   240                              <1> 
   240                              <1> 
   240                              <1> 
   240                              <1> 
   240                              <1>  %if %0 >= 2
   240                              <1>  mov ebx, %2
   240                              <1>  %if %0 >= 3
   240                              <1>  mov ecx, %3
   240                              <1>  %if %0 = 4
   240                              <1>  mov edx, %4
   240                              <1>  %endif
   240                              <1>  %endif
   240                              <1>  %endif
   240 00000188 B81F000000          <1>  mov eax, %1
   240                              <1> 
   240 0000018D CD40                <1>  int 40h
   241                                  
   242 0000018F E8F7030000              	call	waitforkey
   243                                  	
   244                                  	; full screen replace color (replace green colors)
   245 00000194 66B9E007                	mov	cx, 11111100000b ; GREEN
   246 00000198 31D2                    	xor	edx, edx ; 0 ; BLACK
   247                                  	;mov	bl, 0Ch
   248                                  	sys	_video
   248                              <1> 
   248                              <1> 
   248                              <1> 
   248                              <1> 
   248                              <1>  %if %0 >= 2
   248                              <1>  mov ebx, %2
   248                              <1>  %if %0 >= 3
   248                              <1>  mov ecx, %3
   248                              <1>  %if %0 = 4
   248                              <1>  mov edx, %4
   248                              <1>  %endif
   248                              <1>  %endif
   248                              <1>  %endif
   248 0000019A B81F000000          <1>  mov eax, %1
   248                              <1> 
   248 0000019F CD40                <1>  int 40h
   249                                  	
   250                                  	; full screen replace color (replace white colors)
   251 000001A1 66B9FFFF                	mov	cx, 0FFFFh ; WHITE
   252 000001A5 66BAE007                	mov	dx, 11111100000b ; GREEN
   253                                  	;mov	bl, 0Ch
   254                                  	sys	_video
   254                              <1> 
   254                              <1> 
   254                              <1> 
   254                              <1> 
   254                              <1>  %if %0 >= 2
   254                              <1>  mov ebx, %2
   254                              <1>  %if %0 >= 3
   254                              <1>  mov ecx, %3
   254                              <1>  %if %0 = 4
   254                              <1>  mov edx, %4
   254                              <1>  %endif
   254                              <1>  %endif
   254                              <1>  %endif
   254 000001A9 B81F000000          <1>  mov eax, %1
   254                              <1> 
   254 000001AE CD40                <1>  int 40h
   255                                  
   256                                  	; now screen color is black and text color is green
   257                                  
   258 000001B0 E8D6030000              	call	waitforkey
   259                                  
   260                                  	; full screen - yellow color
   261                                  
   262 000001B5 66B9E0FF                	mov	cx, 1111111111100000b ; YELLOW
   263 000001B9 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   264                                  	sys	_video
   264                              <1> 
   264                              <1> 
   264                              <1> 
   264                              <1> 
   264                              <1>  %if %0 >= 2
   264                              <1>  mov ebx, %2
   264                              <1>  %if %0 >= 3
   264                              <1>  mov ecx, %3
   264                              <1>  %if %0 = 4
   264                              <1>  mov edx, %4
   264                              <1>  %endif
   264                              <1>  %endif
   264                              <1>  %endif
   264 000001BE B81F000000          <1>  mov eax, %1
   264                              <1> 
   264 000001C3 CD40                <1>  int 40h
   265                                  
   266                                  	;mov	word [tcolor], 0
   267 000001C5 BEDE00D000              	mov	esi, 208*65536+222
   268 000001CA BD[93060000]            	mov	ebp, txt_yellow
   269 000001CF E8F2030000               	call	print_text
   270                                  
   271 000001D4 E8B2030000              	call	waitforkey
   272                                  
   273                                  	; full screen replace color (replace black colors)
   274 000001D9 31C9                    	xor	ecx, ecx ; 0 ; BLACK
   275 000001DB BAFFFF0000              	mov	edx, 0FFFFh  ; WHITE
   276 000001E0 B30C                    	mov	bl, 0Ch
   277                                  	sys	_video
   277                              <1> 
   277                              <1> 
   277                              <1> 
   277                              <1> 
   277                              <1>  %if %0 >= 2
   277                              <1>  mov ebx, %2
   277                              <1>  %if %0 >= 3
   277                              <1>  mov ecx, %3
   277                              <1>  %if %0 = 4
   277                              <1>  mov edx, %4
   277                              <1>  %endif
   277                              <1>  %endif
   277                              <1>  %endif
   277 000001E2 B81F000000          <1>  mov eax, %1
   277                              <1> 
   277 000001E7 CD40                <1>  int 40h
   278                                  
   279 000001E9 E89D030000              	call	waitforkey
   280                                  	
   281                                  	; full screen replace color (replace yellow colors)
   282 000001EE 66B9E0FF                	mov	cx, 1111111111100000b ; YELLOW
   283 000001F2 29D2                    	sub	edx, edx ; 0 ; BLACK
   284                                  	;mov	bl, 0Ch
   285                                  	sys	_video
   285                              <1> 
   285                              <1> 
   285                              <1> 
   285                              <1> 
   285                              <1>  %if %0 >= 2
   285                              <1>  mov ebx, %2
   285                              <1>  %if %0 >= 3
   285                              <1>  mov ecx, %3
   285                              <1>  %if %0 = 4
   285                              <1>  mov edx, %4
   285                              <1>  %endif
   285                              <1>  %endif
   285                              <1>  %endif
   285 000001F4 B81F000000          <1>  mov eax, %1
   285                              <1> 
   285 000001F9 CD40                <1>  int 40h
   286                                  	
   287                                  	; full screen replace color (replace white colors)
   288 000001FB 66B9FFFF                	mov	cx, 0FFFFh ; WHITE
   289 000001FF 66BAE0FF                	mov	dx, 1111111111100000b ; YELLOW
   290                                  	;mov	bl, 0Ch
   291                                  	sys	_video
   291                              <1> 
   291                              <1> 
   291                              <1> 
   291                              <1> 
   291                              <1>  %if %0 >= 2
   291                              <1>  mov ebx, %2
   291                              <1>  %if %0 >= 3
   291                              <1>  mov ecx, %3
   291                              <1>  %if %0 = 4
   291                              <1>  mov edx, %4
   291                              <1>  %endif
   291                              <1>  %endif
   291                              <1>  %endif
   291 00000203 B81F000000          <1>  mov eax, %1
   291                              <1> 
   291 00000208 CD40                <1>  int 40h
   292                                  
   293                                  	; now screen color is black and text color is yellow
   294                                  
   295 0000020A E87C030000              	call	waitforkey
   296                                  
   297                                  	; Full screen copy
   298 0000020F BE[E8060000]            	mov	esi, fullscreen_buffer
   299 00000214 89F7                    	mov	edi, esi
   300                                  
   301                                  	; Black
   302 00000216 B900190000              	mov	ecx, 640*10
   303 0000021B 31C0                    	xor	eax, eax ; black
   304 0000021D F366AB                  	rep	stosw
   305                                  
   306                                  	; White
   307 00000220 B9800C0000              	mov	ecx, 640*5
   308 00000225 B8FFFF0000              	mov	eax, 0FFFFh
   309 0000022A F366AB                  	rep	stosw
   310                                  
   311                                  	; Black
   312 0000022D B9800C0000              	mov	ecx, 640*5
   313 00000232 31C0                    	xor	eax, eax ; black
   314 00000234 F366AB                  	rep	stosw
   315                                  
   316                                  	; Blue
   317 00000237 B900130100              	mov	ecx, 640*110
   318 0000023C B01F                    	mov	al, 11111b
   319 0000023E F366AB                  	rep	stosw
   320                                  
   321                                  	; Red
   322 00000241 B900130100              	mov	ecx, 640*110
   323 00000246 66B800F8                	mov	ax, 1111100000000000b
   324 0000024A F366AB                  	rep	stosw
   325                                  
   326                                  	; Green
   327 0000024D B900130100              	mov	ecx, 640*110
   328 00000252 66B8E007                	mov	ax, 11111100000b
   329 00000256 F366AB                  	rep	stosw
   330                                  
   331                                  	; Yellow
   332 00000259 B900130100              	mov	ecx, 640*110
   333 0000025E 66B8E0FF                	mov	ax, 1111111111100000b
   334 00000262 F366AB                  	rep	stosw
   335                                  
   336                                  	; Black
   337 00000265 B9800C0000              	mov	ecx, 640*5
   338 0000026A 31C0                    	xor	eax, eax ; black
   339 0000026C F366AB                  	rep	stosw
   340                                  
   341                                  	; White
   342 0000026F B9800C0000              	mov	ecx, 640*5
   343 00000274 66B8FFFF                	mov	ax, 0FFFFh
   344 00000278 F366AB                  	rep	stosw
   345                                  
   346                                  	; Black
   347 0000027B B900190000              	mov	ecx, 640*10
   348 00000280 31C0                    	xor	eax, eax ; black
   349 00000282 F366AB                  	rep	stosw
   350                                  
   351 00000285 BB00020000              	mov	ebx, 0200h ; Full screen copy
   352                                  	sys	_video
   352                              <1> 
   352                              <1> 
   352                              <1> 
   352                              <1> 
   352                              <1>  %if %0 >= 2
   352                              <1>  mov ebx, %2
   352                              <1>  %if %0 >= 3
   352                              <1>  mov ecx, %3
   352                              <1>  %if %0 = 4
   352                              <1>  mov edx, %4
   352                              <1>  %endif
   352                              <1>  %endif
   352                              <1>  %endif
   352 0000028A B81F000000          <1>  mov eax, %1
   352                              <1> 
   352 0000028F CD40                <1>  int 40h
   353                                  
   354 00000291 E8F5020000              	call	waitforkey
   355                                  
   356 00000296 66C705[E4060000]FF-     	mov	word [tcolor], 0FFFFh
   356 0000029E FF                 
   357                                  
   358 0000029F BE2B002B00              	mov	esi, 43*65536+43
   359 000002A4 BD[84060000]            	mov	ebp, txt_blue
   360 000002A9 E818030000               	call	print_text
   361                                  	
   362 000002AE E8D8020000              	call	waitforkey
   363                                  
   364 000002B3 BE2B009900              	mov	esi, 153*65536+43
   365 000002B8 BD[89060000]            	mov	ebp, txt_red
   366 000002BD E804030000               	call	print_text
   367                                  	
   368 000002C2 E8C4020000              	call	waitforkey
   369                                  
   370 000002C7 BE2B000701              	mov	esi, 263*65536+43
   371 000002CC BD[8D060000]            	mov	ebp, txt_green
   372 000002D1 E8F0020000               	call	print_text
   373                                  	
   374 000002D6 E8B0020000              	call	waitforkey
   375                                  
   376 000002DB BE2B007501              	mov	esi, 373*65536+43
   377 000002E0 BD[93060000]            	mov	ebp, txt_yellow
   378 000002E5 E8DC020000               	call	print_text
   379                                  	
   380 000002EA E89C020000              	call	waitforkey
   381                                  
   382 000002EF C705[E4060000]0000-     	mov	dword [tcolor], 0
   382 000002F7 0000               
   383                                  
   384 000002F9 BE2B000701              	mov	esi, 263*65536+43
   385 000002FE BD[8D060000]            	mov	ebp, txt_green
   386 00000303 E8BE020000               	call	print_text
   387                                  	
   388 00000308 E87E020000              	call	waitforkey
   389                                  
   390 0000030D BE2B007501              	mov	esi, 373*65536+43
   391 00000312 BD[93060000]            	mov	ebp, txt_yellow
   392 00000317 E8AA020000               	call	print_text
   393                                  	
   394 0000031C E86A020000              	call	waitforkey
   395                                  
   396                                  	; screen copy and replace window sub functions
   397                                  
   398                                  	; fill white color in 1st 20 rows 
   399                                  	; in user's fullscreen buff
   400 00000321 BF[E8060000]            	mov	edi, fullscreen_buffer
   401 00000326 B900320000              	mov	ecx, 20*640
   402 0000032B B8FFFF0000              	mov	eax, 0FFFFh
   403 00000330 F366AB                  	rep	stosw
   404                                   
   405                                  	; fill red color to 440 rows after white rows  
   406 00000333 B9004C0400              	mov	ecx, 440*640
   407 00000338 66B800F8                	mov	ax, 1111100000000000b ; RED
   408 0000033C F366AB                  	rep	stosw
   409                                  
   410                                  	; fill white color in last 20 rows
   411 0000033F B900320000              	mov	ecx, 20*640
   412 00000344 66B8FFFF                	mov	ax, 0FFFFh
   413 00000348 F366AB                  	rep	stosw
   414                                  
   415                                  	; copy blue block (on screen) to user buffer
   416                                  	; (overwrites red colors partially)
   417 0000034B BF[386B0000]            	mov	edi, fullscreen_buffer + ((20*640)+40)*2
   418 00000350 B928001400              	mov	ecx, 20*65536+40 ; column 40, row 20
   419 00000355 BAA0006E00              	mov	edx, 110*65536+160 ; size: 110*160
   420 0000035A BB41020000              	mov	ebx, 0241h ; system to user window copy
   421                                  	;mov	bl, 41h
   422                                  	sys	_video	
   422                              <1> 
   422                              <1> 
   422                              <1> 
   422                              <1> 
   422                              <1>  %if %0 >= 2
   422                              <1>  mov ebx, %2
   422                              <1>  %if %0 >= 3
   422                              <1>  mov ecx, %3
   422                              <1>  %if %0 = 4
   422                              <1>  mov edx, %4
   422                              <1>  %endif
   422                              <1>  %endif
   422                              <1>  %endif
   422 0000035F B81F000000          <1>  mov eax, %1
   422                              <1> 
   422 00000364 CD40                <1>  int 40h
   423                                  
   424                                  	; Replace white color (text) only in blue block
   425                                  	; (blue block starts at row 20)
   426                                  	
   427 00000366 B9FFFF0000              	mov	ecx, 0FFFFh ; WHITE (current color)
   428 0000036B 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   429 0000036D BE28001400              	mov	esi, 20*65536+40 ; column 40, row 20
   430 00000372 BFA0006E00              	mov	edi, 110*65536+160 ; size: 110*160 
   431                                  	;mov	ebx, 021Ch ; Replace color in window
   432 00000377 B31C                    	mov	bl, 1Ch
   433                                  	sys	_video
   433                              <1> 
   433                              <1> 
   433                              <1> 
   433                              <1> 
   433                              <1>  %if %0 >= 2
   433                              <1>  mov ebx, %2
   433                              <1>  %if %0 >= 3
   433                              <1>  mov ecx, %3
   433                              <1>  %if %0 = 4
   433                              <1>  mov edx, %4
   433                              <1>  %endif
   433                              <1>  %endif
   433                              <1>  %endif
   433 00000379 B81F000000          <1>  mov eax, %1
   433                              <1> 
   433 0000037E CD40                <1>  int 40h
   434                                  
   435 00000380 E806020000              	call	waitforkey
   436                                  
   437                                  	; copy red block (on screen) to user buffer
   438 00000385 BF[38910200]            	mov	edi, fullscreen_buffer + ((130*640)+40)*2
   439 0000038A B928008200              	mov	ecx, 130*65536+40 ; column 40, row 130
   440 0000038F BA78006E00              	mov	edx, 110*65536+120 ; size: 110*120
   441                                  	;mov	ebx, 0241h ; system to user window copy
   442 00000394 B341                    	mov	bl, 41h
   443                                  	sys	_video	
   443                              <1> 
   443                              <1> 
   443                              <1> 
   443                              <1> 
   443                              <1>  %if %0 >= 2
   443                              <1>  mov ebx, %2
   443                              <1>  %if %0 >= 3
   443                              <1>  mov ecx, %3
   443                              <1>  %if %0 = 4
   443                              <1>  mov edx, %4
   443                              <1>  %endif
   443                              <1>  %endif
   443                              <1>  %endif
   443 00000396 B81F000000          <1>  mov eax, %1
   443                              <1> 
   443 0000039B CD40                <1>  int 40h
   444                                  
   445                                  	; Replace white color (text) only in red block
   446                                  	; (red block starts at row 130)
   447                                  	
   448 0000039D B9FFFF0000              	mov	ecx, 0FFFFh ; WHITE (current color)
   449 000003A2 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   450 000003A4 BE28008200              	mov	esi, 130*65536+40 ; column 40, row 130
   451 000003A9 BF78006E00              	mov	edi, 110*65536+120 ; size: 110*120 
   452                                  	;mov	ebx, 021Ch ; Replace color in window
   453 000003AE B31C                    	mov	bl, 1Ch
   454                                  	sys	_video
   454                              <1> 
   454                              <1> 
   454                              <1> 
   454                              <1> 
   454                              <1>  %if %0 >= 2
   454                              <1>  mov ebx, %2
   454                              <1>  %if %0 >= 3
   454                              <1>  mov ecx, %3
   454                              <1>  %if %0 = 4
   454                              <1>  mov edx, %4
   454                              <1>  %endif
   454                              <1>  %endif
   454                              <1>  %endif
   454 000003B0 B81F000000          <1>  mov eax, %1
   454                              <1> 
   454 000003B5 CD40                <1>  int 40h
   455                                  
   456                                  	; copy yellow block (on screen) to user buffer
   457 000003B7 BF[E8DC0600]            	mov	edi, fullscreen_buffer + (350*640)*2
   458 000003BC B900005E01              	mov	ecx, 350*65536+0 ; column 0, row 350
   459 000003C1 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   460                                  	;mov	ebx, 0241h ; system to user window copy
   461 000003C6 B341                    	mov	bl, 41h
   462                                  	sys	_video		
   462                              <1> 
   462                              <1> 
   462                              <1> 
   462                              <1> 
   462                              <1>  %if %0 >= 2
   462                              <1>  mov ebx, %2
   462                              <1>  %if %0 >= 3
   462                              <1>  mov ecx, %3
   462                              <1>  %if %0 = 4
   462                              <1>  mov edx, %4
   462                              <1>  %endif
   462                              <1>  %endif
   462                              <1>  %endif
   462 000003C8 B81F000000          <1>  mov eax, %1
   462                              <1> 
   462 000003CD CD40                <1>  int 40h
   463                                  
   464                                  	; copy green block (on screen) to user buffer
   465 000003CF BF[E8B60400]            	mov	edi, fullscreen_buffer + (240*640)*2
   466 000003D4 B90000F000              	mov	ecx, 240*65536+0 ; column 0, row 240
   467 000003D9 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   468                                  	;;mov	ebx, 0241h ; system to user window copy
   469                                  	;mov	bl, 41h
   470                                  	sys	_video
   470                              <1> 
   470                              <1> 
   470                              <1> 
   470                              <1> 
   470                              <1>  %if %0 >= 2
   470                              <1>  mov ebx, %2
   470                              <1>  %if %0 >= 3
   470                              <1>  mov ecx, %3
   470                              <1>  %if %0 = 4
   470                              <1>  mov edx, %4
   470                              <1>  %endif
   470                              <1>  %endif
   470                              <1>  %endif
   470 000003DE B81F000000          <1>  mov eax, %1
   470                              <1> 
   470 000003E3 CD40                <1>  int 40h
   471                                  
   472 000003E5 E8A1010000              	call	waitforkey
   473                                  
   474                                  	; copy yellow block to red block position
   475                                  	; and green block to blue block position on screen
   476                                  	; (system to system copy)
   477                                  	
   478                                  	; copy yellow block (overwrite red block)
   479 000003EA B900005E01              	mov	ecx, 350*65536 ; column 0, row 350
   480 000003EF BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   481 000003F4 BE00008200              	mov	esi, 130*65536
   482                                  	;mov	ebx, 020Dh ; system to system window copy
   483 000003F9 B30D                    	mov	bl, 0Dh
   484                                  	sys	_video	
   484                              <1> 
   484                              <1> 
   484                              <1> 
   484                              <1> 
   484                              <1>  %if %0 >= 2
   484                              <1>  mov ebx, %2
   484                              <1>  %if %0 >= 3
   484                              <1>  mov ecx, %3
   484                              <1>  %if %0 = 4
   484                              <1>  mov edx, %4
   484                              <1>  %endif
   484                              <1>  %endif
   484                              <1>  %endif
   484 000003FB B81F000000          <1>  mov eax, %1
   484                              <1> 
   484 00000400 CD40                <1>  int 40h
   485                                  
   486 00000402 E884010000              	call	waitforkey
   487                                  
   488                                  	; copy green block (overwrite blue block)
   489 00000407 B90000F000              	mov	ecx, 240*65536 ; column 0, row 240
   490 0000040C BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   491 00000411 BE00001400              	mov	esi, 20*65536
   492                                  	;;mov	ebx, 020Dh ; system to system window copy
   493                                  	;mov	bl, 0Dh
   494                                  	sys	_video	
   494                              <1> 
   494                              <1> 
   494                              <1> 
   494                              <1> 
   494                              <1>  %if %0 >= 2
   494                              <1>  mov ebx, %2
   494                              <1>  %if %0 >= 3
   494                              <1>  mov ecx, %3
   494                              <1>  %if %0 = 4
   494                              <1>  mov edx, %4
   494                              <1>  %endif
   494                              <1>  %endif
   494                              <1>  %endif
   494 00000416 B81F000000          <1>  mov eax, %1
   494                              <1> 
   494 0000041B CD40                <1>  int 40h
   495                                  
   496 0000041D E869010000              	call	waitforkey
   497                                  
   498                                  	; fill blue block on yellow block position	
   499 00000422 B91F000000              	mov	ecx, 11111b
   500 00000427 BA00005E01              	mov	edx, 350*65536+0 
   501 0000042C BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   502                                  	;mov	ebx, 0211h ; new color, window
   503 00000431 B311                    	mov	bl, 11h
   504                                  	sys	_video
   504                              <1> 
   504                              <1> 
   504                              <1> 
   504                              <1> 
   504                              <1>  %if %0 >= 2
   504                              <1>  mov ebx, %2
   504                              <1>  %if %0 >= 3
   504                              <1>  mov ecx, %3
   504                              <1>  %if %0 = 4
   504                              <1>  mov edx, %4
   504                              <1>  %endif
   504                              <1>  %endif
   504                              <1>  %endif
   504 00000433 B81F000000          <1>  mov eax, %1
   504                              <1> 
   504 00000438 CD40                <1>  int 40h
   505                                  
   506 0000043A E84C010000              	call	waitforkey
   507                                  
   508                                  	; fill red block on green block position	
   509 0000043F 66B900F8                	mov	cx, 1111100000000000b
   510 00000443 BA0000F000              	mov	edx, 240*65536+0 
   511 00000448 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   512                                  	;;mov	ebx, 0211h ; new color, window
   513                                  	;mov	bl, 11h
   514                                  	sys	_video
   514                              <1> 
   514                              <1> 
   514                              <1> 
   514                              <1> 
   514                              <1>  %if %0 >= 2
   514                              <1>  mov ebx, %2
   514                              <1>  %if %0 >= 3
   514                              <1>  mov ecx, %3
   514                              <1>  %if %0 = 4
   514                              <1>  mov edx, %4
   514                              <1>  %endif
   514                              <1>  %endif
   514                              <1>  %endif
   514 0000044D B81F000000          <1>  mov eax, %1
   514                              <1> 
   514 00000452 CD40                <1>  int 40h
   515                                  
   516 00000454 E832010000              	call	waitforkey
   517                                  
   518                                  	; copy	blocks to system from user's buffer
   519 00000459 BE[A6060000]            	mov	esi, blockdatabuffer ; 32+32 bits
   520 0000045E 66B91F00                	mov	cx, 11111b ; BLUE
   521 00000462 BA07000000              	mov	edx, 7 ; 7 blocks
   522                                   	;mov	ebx, 022Dh ; indirect pixel blocks
   523 00000467 B32D                    	mov	bl, 2Dh
   524                                   	sys	_video
   524                              <1> 
   524                              <1> 
   524                              <1> 
   524                              <1> 
   524                              <1>  %if %0 >= 2
   524                              <1>  mov ebx, %2
   524                              <1>  %if %0 >= 3
   524                              <1>  mov ecx, %3
   524                              <1>  %if %0 = 4
   524                              <1>  mov edx, %4
   524                              <1>  %endif
   524                              <1>  %endif
   524                              <1>  %endif
   524 00000469 B81F000000          <1>  mov eax, %1
   524                              <1> 
   524 0000046E CD40                <1>  int 40h
   525                                  
   526 00000470 E816010000              	call	waitforkey
   527                                  
   528                                  	; replace color
   529 00000475 66B9E0FF                	mov	cx, 1111111111100000b 
   530                                  			; YELLOW (current color)
   531 00000479 66BA1F00                	mov	dx, 11111b ; BLUE (new color)
   532 0000047D BE00008200              	mov	esi, 130*65536 ; column 0, row 130
   533 00000482 BF80026E00              	mov	edi, 110*65536+640 ; size: 110*640
   534                                  	;mov	ebx, 021Ch ; Replace color in window
   535 00000487 B31C                    	mov	bl, 1Ch
   536                                  	sys	_video
   536                              <1> 
   536                              <1> 
   536                              <1> 
   536                              <1> 
   536                              <1>  %if %0 >= 2
   536                              <1>  mov ebx, %2
   536                              <1>  %if %0 >= 3
   536                              <1>  mov ecx, %3
   536                              <1>  %if %0 = 4
   536                              <1>  mov edx, %4
   536                              <1>  %endif
   536                              <1>  %endif
   536                              <1>  %endif
   536 00000489 B81F000000          <1>  mov eax, %1
   536                              <1> 
   536 0000048E CD40                <1>  int 40h
   537                                  
   538 00000490 E8F6000000              	call	waitforkey
   539                                  
   540                                  	; copy blue block (with 'blue" text)
   541                                  	; from users full screen buffer to system
   542                                  	; (to its old position)
   543                                  	
   544 00000495 B928001400              	mov	ecx, 20*65536+40
   545 0000049A BAA0006E00              	mov	edx, 110*65536+160
   546 0000049F BE[386B0000]            	mov	esi, fullscreen_buffer+((20*640)+40)*2
   547                                  	;mov	ebx, 0210h ; copy from user to sys 
   548 000004A4 B310                    	mov	bl, 10h
   549                                  	sys	_video
   549                              <1> 
   549                              <1> 
   549                              <1> 
   549                              <1> 
   549                              <1>  %if %0 >= 2
   549                              <1>  mov ebx, %2
   549                              <1>  %if %0 >= 3
   549                              <1>  mov ecx, %3
   549                              <1>  %if %0 = 4
   549                              <1>  mov edx, %4
   549                              <1>  %endif
   549                              <1>  %endif
   549                              <1>  %endif
   549 000004A6 B81F000000          <1>  mov eax, %1
   549                              <1> 
   549 000004AB CD40                <1>  int 40h
   550                                  
   551                                  	; copy blue block to usr's buffer again
   552 000004AD B900001400              	mov	ecx, 20*65536
   553 000004B2 BA80026E00              	mov	edx, 110*65536+640
   554 000004B7 BF[E86A0000]            	mov	edi, fullscreen_buffer+(20*640)*2
   555                                  	;mov	ebx, 0241h ; copy from sys to user
   556 000004BC B341                    	mov	bl, 41h 
   557                                  	sys	_video
   557                              <1> 
   557                              <1> 
   557                              <1> 
   557                              <1> 
   557                              <1>  %if %0 >= 2
   557                              <1>  mov ebx, %2
   557                              <1>  %if %0 >= 3
   557                              <1>  mov ecx, %3
   557                              <1>  %if %0 = 4
   557                              <1>  mov edx, %4
   557                              <1>  %endif
   557                              <1>  %endif
   557                              <1>  %endif
   557 000004BE B81F000000          <1>  mov eax, %1
   557                              <1> 
   557 000004C3 CD40                <1>  int 40h
   558                                  
   559 000004C5 E8C1000000              	call	waitforkey
   560                                  
   561                                  	; fill red block on red block position	
   562 000004CA 66B900F8                	mov	cx, 1111100000000000b ; RED
   563 000004CE BA00008200              	mov	edx, 130*65536+0 
   564 000004D3 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   565                                  	;mov	ebx, 0211h ; new color, window
   566 000004D8 B311                    	mov	bl, 11h
   567                                  	sys	_video
   567                              <1> 
   567                              <1> 
   567                              <1> 
   567                              <1> 
   567                              <1>  %if %0 >= 2
   567                              <1>  mov ebx, %2
   567                              <1>  %if %0 >= 3
   567                              <1>  mov ecx, %3
   567                              <1>  %if %0 = 4
   567                              <1>  mov edx, %4
   567                              <1>  %endif
   567                              <1>  %endif
   567                              <1>  %endif
   567 000004DA B81F000000          <1>  mov eax, %1
   567                              <1> 
   567 000004DF CD40                <1>  int 40h
   568                                  
   569 000004E1 E8A5000000              	call	waitforkey
   570                                  
   571                                  	; copy red block (with 'red" text)
   572                                  	; from users full screen buffer to system
   573                                  	; (to its old position)
   574 000004E6 B928008200              	mov	ecx, 130*65536+40
   575 000004EB BA78006E00              	mov	edx, 110*65536+120
   576 000004F0 BE[38910200]            	mov	esi, fullscreen_buffer+((130*640)+40)*2
   577                                  	;mov	ebx, 0210h ; copy from user to sys 
   578 000004F5 B310                    	mov	bl, 10h
   579                                  	sys	_video
   579                              <1> 
   579                              <1> 
   579                              <1> 
   579                              <1> 
   579                              <1>  %if %0 >= 2
   579                              <1>  mov ebx, %2
   579                              <1>  %if %0 >= 3
   579                              <1>  mov ecx, %3
   579                              <1>  %if %0 = 4
   579                              <1>  mov edx, %4
   579                              <1>  %endif
   579                              <1>  %endif
   579                              <1>  %endif
   579 000004F7 B81F000000          <1>  mov eax, %1
   579                              <1> 
   579 000004FC CD40                <1>  int 40h
   580                                  
   581                                  	; copy red block to usr's buffer again
   582 000004FE B900008200              	mov	ecx, 130*65536
   583 00000503 BA80026E00              	mov	edx, 110*65536+640
   584 00000508 BF[E8900200]            	mov	edi, fullscreen_buffer+(130*640)*2
   585                                  	;mov	ebx, 0241h ; copy from sys to user 
   586 0000050D B341                    	mov	bl, 41h
   587                                  	sys	_video
   587                              <1> 
   587                              <1> 
   587                              <1> 
   587                              <1> 
   587                              <1>  %if %0 >= 2
   587                              <1>  mov ebx, %2
   587                              <1>  %if %0 >= 3
   587                              <1>  mov ecx, %3
   587                              <1>  %if %0 = 4
   587                              <1>  mov edx, %4
   587                              <1>  %endif
   587                              <1>  %endif
   587                              <1>  %endif
   587 0000050F B81F000000          <1>  mov eax, %1
   587                              <1> 
   587 00000514 CD40                <1>  int 40h
   588                                  
   589 00000516 E870000000              	call	waitforkey
   590                                  
   591                                  	; replace color (full screen)
   592 0000051B B9FFFF0000              	mov	ecx, 0FFFFh ; WHITE (current color)
   593 00000520 31D2                    	xor	edx, edx ; 0 ; BLACK (new color)
   594                                  	;mov	ebx, 020Ch ; Replace color on screen
   595 00000522 B30C                    	mov	bl, 0Ch
   596                                  	sys	_video
   596                              <1> 
   596                              <1> 
   596                              <1> 
   596                              <1> 
   596                              <1>  %if %0 >= 2
   596                              <1>  mov ebx, %2
   596                              <1>  %if %0 >= 3
   596                              <1>  mov ecx, %3
   596                              <1>  %if %0 = 4
   596                              <1>  mov edx, %4
   596                              <1>  %endif
   596                              <1>  %endif
   596                              <1>  %endif
   596 00000524 B81F000000          <1>  mov eax, %1
   596                              <1> 
   596 00000529 CD40                <1>  int 40h
   597                                  
   598 0000052B E85B000000              	call	waitforkey
   599                                  
   600                                  	; copy full screen buffer to screen
   601 00000530 BE[E8060000]            	mov	esi, fullscreen_buffer
   602                                  	;mov	ebx, 0200h
   603 00000535 B300                    	mov	bl, 0
   604                                  	sys	_video
   604                              <1> 
   604                              <1> 
   604                              <1> 
   604                              <1> 
   604                              <1>  %if %0 >= 2
   604                              <1>  mov ebx, %2
   604                              <1>  %if %0 >= 3
   604                              <1>  mov ecx, %3
   604                              <1>  %if %0 = 4
   604                              <1>  mov edx, %4
   604                              <1>  %endif
   604                              <1>  %endif
   604                              <1>  %endif
   604 00000537 B81F000000          <1>  mov eax, %1
   604                              <1> 
   604 0000053C CD40                <1>  int 40h
   605                                  
   606                                  	; erase full screen buffer
   607 0000053E B900580200              	mov	ecx, (640*480)*2/4
   608 00000543 31C0                    	xor	eax, eax ; 0
   609 00000545 89F7                    	mov	edi, esi ; fullscreen_buffer
   610 00000547 F3AB                    	rep	stosd
   611                                  
   612 00000549 E83D000000              	call	waitforkey
   613                                  
   614                                  	; copy (full) screen to full screen buffer
   615 0000054E BF[E8060000]            	mov	edi, fullscreen_buffer
   616                                  	;mov	ebx, 0240h ; copy from sys to user 
   617 00000553 B340                    	mov	bl, 40h
   618                                  	sys	_video
   618                              <1> 
   618                              <1> 
   618                              <1> 
   618                              <1> 
   618                              <1>  %if %0 >= 2
   618                              <1>  mov ebx, %2
   618                              <1>  %if %0 >= 3
   618                              <1>  mov ecx, %3
   618                              <1>  %if %0 = 4
   618                              <1>  mov edx, %4
   618                              <1>  %endif
   618                              <1>  %endif
   618                              <1>  %endif
   618 00000555 B81F000000          <1>  mov eax, %1
   618                              <1> 
   618 0000055A CD40                <1>  int 40h
   619                                  
   620                                  	; full screen NOT operation
   621                                  	;mov	ebx, 0207h
   622 0000055C B307                    	mov	bl, 07h
   623                                  	sys	_video
   623                              <1> 
   623                              <1> 
   623                              <1> 
   623                              <1> 
   623                              <1>  %if %0 >= 2
   623                              <1>  mov ebx, %2
   623                              <1>  %if %0 >= 3
   623                              <1>  mov ecx, %3
   623                              <1>  %if %0 = 4
   623                              <1>  mov edx, %4
   623                              <1>  %endif
   623                              <1>  %endif
   623                              <1>  %endif
   623 0000055E B81F000000          <1>  mov eax, %1
   623                              <1> 
   623 00000563 CD40                <1>  int 40h
   624                                  
   625 00000565 E821000000              	call	waitforkey
   626                                  
   627                                  	; copy full screen buffer to screen
   628 0000056A BE[E8060000]            	mov	esi, fullscreen_buffer
   629                                  	;mov	ebx, 0200h
   630 0000056F 30DB                    	xor	bl, bl ; 0
   631                                  	sys	_video
   631                              <1> 
   631                              <1> 
   631                              <1> 
   631                              <1> 
   631                              <1>  %if %0 >= 2
   631                              <1>  mov ebx, %2
   631                              <1>  %if %0 >= 3
   631                              <1>  mov ecx, %3
   631                              <1>  %if %0 = 4
   631                              <1>  mov edx, %4
   631                              <1>  %endif
   631                              <1>  %endif
   631                              <1>  %endif
   631 00000571 B81F000000          <1>  mov eax, %1
   631                              <1> 
   631 00000576 CD40                <1>  int 40h
   632                                  	
   633 00000578 E80E000000              	call	waitforkey  
   634                                  		; wait for key stroke before exit
   635                                  terminate:
   636 0000057D E82C000000              	call	set_text_mode
   637                                  	sys	_exit
   637                              <1> 
   637                              <1> 
   637                              <1> 
   637                              <1> 
   637                              <1>  %if %0 >= 2
   637                              <1>  mov ebx, %2
   637                              <1>  %if %0 >= 3
   637                              <1>  mov ecx, %3
   637                              <1>  %if %0 = 4
   637                              <1>  mov edx, %4
   637                              <1>  %endif
   637                              <1>  %endif
   637                              <1>  %endif
   637 00000582 B801000000          <1>  mov eax, %1
   637                              <1> 
   637 00000587 CD40                <1>  int 40h
   638                                  halt:
   639 00000589 EBFE                    	jmp	short halt
   640                                  
   641                                  waitforkey:
   642 0000058B B401                    	mov	ah, 1
   643 0000058D CD32                    	int	32h
   644 0000058F 740B                    	jz	short getkey
   645 00000591 FF05[E0060000]          	inc	dword [counter]
   646 00000597 90                      	nop
   647 00000598 90                      	nop
   648 00000599 90                      	nop
   649 0000059A EBEF                    	jmp	short waitforkey
   650                                  getkey:
   651 0000059C 30E4                    	xor	ah, ah
   652 0000059E CD32                    	int	32h
   653                                  
   654 000005A0 663D032E                	cmp	ax, 2E03h
   655 000005A4 7405                    	je	short _terminate
   656 000005A6 3C1B                    	cmp	al, 1Bh ; ESC key
   657 000005A8 7401                    	je	short _terminate
   658 000005AA C3                      	retn
   659                                  _terminate:
   660 000005AB 58                      	pop	eax ; return address
   661 000005AC EBCF                    	jmp	short terminate
   662                                  	
   663                                  set_text_mode:
   664 000005AE 30E4                    	xor    ah, ah
   665 000005B0 B003                    	mov    al, 3                        
   666                                   	;int   10h ; al = 03h text mode, int 10 video
   667 000005B2 CD31                    	int    31h ; TRDOS 386 - Video interrupt
   668 000005B4 C3                      	retn
   669                                  
   670                                  print_msg:
   671 000005B5 B40E                    	mov	ah, 0Eh
   672 000005B7 BB07000000              	mov	ebx, 7
   673                                  	;mov	bl, 7 ; char attribute & color
   674                                  p_next_chr:
   675 000005BC AC                      	lodsb
   676 000005BD 08C0                    	or	al, al
   677 000005BF 7404                    	jz	short p_retn ; retn	
   678 000005C1 CD31                    	int	31h
   679 000005C3 EBF7                    	jmp	short p_next_chr
   680                                  p_retn:
   681 000005C5 C3                      	retn
   682                                  
   683                                  print_text:
   684                                  	; ebp = text address
   685                                  	; esi = row/column position (si = column)
   686                                  p_d_x:
   687                                  	;mov	dh, 0 ; 8x16 system font
   688 000005C6 B606                    	mov	dh, 6 ; 32*64 scaled font (base: 8*16 system font) 
   689                                  p_d_x_n:
   690 000005C8 8A5500                  	mov	dl, [ebp]
   691 000005CB 20D2                    	and	dl, dl
   692 000005CD 7419                    	jz	short p_d_x_ok
   693                                  	sys	_video, 020Fh, [tcolor] 
   693                              <1> 
   693                              <1> 
   693                              <1> 
   693                              <1> 
   693                              <1>  %if %0 >= 2
   693 000005CF BB0F020000          <1>  mov ebx, %2
   693                              <1>  %if %0 >= 3
   693 000005D4 8B0D[E4060000]      <1>  mov ecx, %3
   693                              <1>  %if %0 = 4
   693                              <1>  mov edx, %4
   693                              <1>  %endif
   693                              <1>  %endif
   693                              <1>  %endif
   693 000005DA B81F000000          <1>  mov eax, %1
   693                              <1> 
   693 000005DF CD40                <1>  int 40h
   694 000005E1 45                      	inc	ebp
   695 000005E2 6683C624                	add	si, 36 ; next char pos
   696 000005E6 EBE0                    	jmp	short p_d_x_n
   697                                  p_d_x_ok:
   698 000005E8 C3                      	retn
   699                                  
   700                                  program_msg:
   701 000005E9 5452444F5320333836-     	db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Block Operations"
   701 000005F2 2076322E302E33202D-
   701 000005FB 202827737973766964-
   701 00000604 656F27292054657374-
   701 0000060D 2050726F6772616D20-
   701 00000616 2D20426C6F636B204F-
   701 0000061F 7065726174696F6E73 
   702 00000628 0D0A                    	db 0Dh, 0Ah
   703 0000062A 6279204572646F6761-     	db "by Erdogan Tan - 01/03/2021"
   703 00000633 6E2054616E202D2030-
   703 0000063C 312F30332F32303231 
   704                                  	;db 0Dh, 0Ah, 0
   705 00000645 0D0A0D0A                	db 0Dh, 0Ah, 0Dh, 0Ah
   706 00000649 507265737320616E79-     	db "Press any key to continue .."
   706 00000652 206B657920746F2063-
   706 0000065B 6F6E74696E7565202E-
   706 00000664 2E                 
   707 00000665 0D0A                    	db 0Dh, 0Ah	
   708 00000667 285072657373204553-     	db "(Press ESC to exit) .."
   708 00000670 4320746F2065786974-
   708 00000679 29202E2E           
   709 0000067D 0D0A                    	db 0Dh, 0Ah
   710 0000067F 0D0A                    	db 0Dh, 0Ah
   711                                  
   712                                  nextline:
   713 00000681 0D0A00                  	db 0Dh, 0Ah, 0
   714                                  
   715                                  txt_blue:
   716 00000684 424C554500              	db "BLUE", 0
   717                                  txt_red:
   718 00000689 52454400                	db "RED", 0
   719                                  txt_green:
   720 0000068D 475245454E00            	db "GREEN", 0
   721                                  txt_yellow:
   722 00000693 59454C4C4F5700          	db "YELLOW", 0
   723                                  txt_white:
   724 0000069A 574849544500            	db "WHITE", 0
   725                                  txt_black:
   726 000006A0 424C41434B00            	db "BLACK", 0
   727                                  
   728                                  blockdatabuffer:
   729 000006A6 00001400                	dd	20*65536
   730 000006AA 28006E00                	dd	110*65536+40
   731 000006AE C8008200                	dd	130*65536+200
   732 000006B2 B8016E00                	dd	110*65536+440
   733 000006B6 28008200                	dd	130*65536+40
   734 000006BA A0006E00                	dd	110*65536+160
   735 000006BE 00005E01                	dd	350*65536
   736 000006C2 80026E00                	dd	110*65536+640
   737 000006C6 28001400                	dd	20*65536+40
   738 000006CA A0006E00                	dd	110*65536+160
   739 000006CE 0000F000                	dd	240*65536
   740 000006D2 80026E00                	dd	110*65536+640
   741 000006D6 C8001400                	dd	20*65536+200
   742 000006DA B8016E00                	dd	110*65536+440
   743 000006DE 00                      	db	0		
   744                                  bss:
   745                                  
   746                                  ABSOLUTE bss
   747                                  
   748 000006DF <res 00000001>          alignb 4
   749                                  
   750                                  counter:
   751 000006E0 <res 00000004>          	resd 1	
   752                                  
   753                                  bss_start:
   754 000006E4 <res 00000004>          tcolor: resd 1
   755                                  
   756                                  fullscreen_buffer:
   757 000006E8 <res 00096000>          	resb 307200*2
   758                                  bss_end:
