     1                                  ; ****************************************************************************
     2                                  ; blocks4.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; 22/02/2021
     6                                  ;
     7                                  ; ****************************************************************************
     8                                  ; nasm blocks4.s -l blocks4.txt -o BLOCKS4.PRG -Z error.txt
     9                                  ; (modified from 'blocks3.s', 21/02/2021)
    10                                  
    11                                  ; 'sysvideo' bh = 2, block copy and modification test (VESA VBE mode 101h)
    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[D8060000]            	mov	edi, bss_start
    92 00000005 B9012C0100              	mov	ecx, (bss_end - bss_start)/4
    93                                  	;xor	eax, eax
    94 0000000A F3AB                    	rep	stosd
    95                                  
    96                                  	; program message
    97 0000000C BE[DC050000]            	mov	esi, program_msg
    98 00000011 E892050000              	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                                  	; Set Video Mode to 101h ; 640x480, 256 colors
   106                                  	sys	_video, 08FFh, 101h
   106                              <1> 
   106                              <1> 
   106                              <1> 
   106                              <1> 
   106                              <1>  %if %0 >= 2
   106 0000001A BBFF080000          <1>  mov ebx, %2
   106                              <1>  %if %0 >= 3
   106 0000001F B901010000          <1>  mov ecx, %3
   106                              <1>  %if %0 = 4
   106                              <1>  mov edx, %4
   106                              <1>  %endif
   106                              <1>  %endif
   106                              <1>  %endif
   106 00000024 B81F000000          <1>  mov eax, %1
   106                              <1> 
   106 00000029 CD40                <1>  int 40h
   107 0000002B 09C0                    	or	eax, eax
   108                                  	;jz	short terminate
   109                                  	;mov	[LFB_ADDR], edx ; pointer to LFB info table/structure
   110 0000002D 7505                    	jnz	short set_vesa_mode_101h_ok
   111 0000002F E93C050000              	jmp	terminate
   112                                  
   113                                  set_vesa_mode_101h_ok:
   114                                  	; full screen - white color 
   115 00000034 B90F0F0F0F              	mov	ecx, 0F0F0F0Fh ; white
   116 00000039 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   117                                  	sys	_video
   117                              <1> 
   117                              <1> 
   117                              <1> 
   117                              <1> 
   117                              <1>  %if %0 >= 2
   117                              <1>  mov ebx, %2
   117                              <1>  %if %0 >= 3
   117                              <1>  mov ecx, %3
   117                              <1>  %if %0 = 4
   117                              <1>  mov edx, %4
   117                              <1>  %endif
   117                              <1>  %endif
   117                              <1>  %endif
   117 0000003E B81F000000          <1>  mov eax, %1
   117                              <1> 
   117 00000043 CD40                <1>  int 40h
   118                                  
   119                                  	; Black "white" text 
   120                                  	;mov	byte [tcolor], 0
   121 00000045 BEF000D000              	mov	esi, 208*65536+240
   122 0000004A BD[8D060000]            	mov	ebp, txt_white
   123 0000004F E865050000               	call	print_text
   124                                  
   125 00000054 E825050000              	call	waitforkey
   126                                  
   127                                  	; full screen replace color (replace black colors)
   128 00000059 B100                    	mov	cl, 0
   129 0000005B B228                    	mov	dl, 28h ; RED
   130 0000005D 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 0000005F B81F000000          <1>  mov eax, %1
   131                              <1> 
   131 00000064 CD40                <1>  int 40h
   132                                  
   133 00000066 E813050000              	call	waitforkey
   134                                  
   135                                  	; full screen replace color (replace white colors)
   136 0000006B B10F                    	mov	cl, 0Fh ; WHITE
   137 0000006D B200                    	mov	dl, 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 0000006F B81F000000          <1>  mov eax, %1
   139                              <1> 
   139 00000074 CD40                <1>  int 40h
   140                                  	
   141                                  	; full screen replace color (replace red colors)
   142 00000076 B128                    	mov	cl, 28h ; RED
   143 00000078 B20F                    	mov	dl, 0Fh ; 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 0000007A B81F000000          <1>  mov eax, %1
   145                              <1> 
   145 0000007F CD40                <1>  int 40h
   146                                  	
   147                                  	; now screen color is black and text color is white
   148                                  
   149 00000081 E8F8040000              	call	waitforkey
   150                                  
   151                                  	; full screen - blue color 
   152                                  
   153 00000086 B920202020              	mov	ecx, 20202020h ; blue
   154 0000008B 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 00000090 B81F000000          <1>  mov eax, %1
   155                              <1> 
   155 00000095 CD40                <1>  int 40h
   156                                  
   157 00000097 C605[D8060000]0F        	mov	byte [tcolor], 0Fh
   158 0000009E BE0201D000              	mov	esi, 208*65536+258
   159 000000A3 BD[77060000]            	mov	ebp, txt_blue
   160 000000A8 E80C050000               	call	print_text
   161                                  
   162 000000AD E8CC040000              	call	waitforkey
   163                                  
   164                                  	; full screen replace color (replace white colors)
   165 000000B2 B10F                    	mov	cl, 0Fh ; WHITE
   166 000000B4 B22C                    	mov	dl, 2Ch ; YELLOW
   167 000000B6 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 000000B8 B81F000000          <1>  mov eax, %1
   168                              <1> 
   168 000000BD CD40                <1>  int 40h
   169                                  
   170 000000BF E8BA040000              	call	waitforkey
   171                                  	
   172                                  	; full screen replace color (replace blue colors)
   173 000000C4 B120                    	mov	cl, 20h ; BLUE
   174 000000C6 B200                    	mov	dl, 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 000000C8 B81F000000          <1>  mov eax, %1
   176                              <1> 
   176 000000CD CD40                <1>  int 40h
   177                                  	
   178                                  	; full screen replace color (replace yellow colors)
   179 000000CF B12C                    	mov	cl, 2Ch ; YELLOW
   180 000000D1 B220                    	mov	dl, 20h ; 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 000000D3 B81F000000          <1>  mov eax, %1
   182                              <1> 
   182 000000D8 CD40                <1>  int 40h
   183                                  
   184                                  	; now screen color is black and text color is blue
   185                                  
   186 000000DA E89F040000              	call	waitforkey
   187                                  
   188 000000DF B928282828              	mov	ecx, 28282828h ; RED
   189 000000E4 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 000000E9 B81F000000          <1>  mov eax, %1
   190                              <1> 
   190 000000EE CD40                <1>  int 40h
   191                                  
   192                                  	;mov	byte [tcolor], 0Fh
   193 000000F0 BE1401D000              	mov	esi, 208*65536+276
   194 000000F5 BD[7C060000]            	mov	ebp, txt_red
   195 000000FA E8BA040000               	call	print_text
   196                                  
   197 000000FF E87A040000              	call	waitforkey
   198                                  
   199                                  	; full screen replace color (replace white colors)
   200 00000104 B10F                    	mov	cl, 0Fh ; WHITE
   201 00000106 B22C                    	mov	dl, 2Ch ; YELLOW
   202 00000108 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 0000010A B81F000000          <1>  mov eax, %1
   203                              <1> 
   203 0000010F CD40                <1>  int 40h
   204                                  
   205 00000111 E868040000              	call	waitforkey
   206                                  	
   207                                  	; full screen replace color (replace red colors)
   208 00000116 B128                    	mov	cl, 28h ; RED
   209 00000118 B200                    	mov	dl, 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 0000011A B81F000000          <1>  mov eax, %1
   211                              <1> 
   211 0000011F CD40                <1>  int 40h
   212                                  	
   213                                  	; full screen replace color (replace yellow colors)
   214 00000121 B12C                    	mov	cl, 2Ch ; YELLOW
   215 00000123 B228                    	mov	dl, 28h ; 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 00000125 B81F000000          <1>  mov eax, %1
   217                              <1> 
   217 0000012A CD40                <1>  int 40h
   218                                  
   219                                  	; now screen color is black and text color is red
   220                                  
   221 0000012C E84D040000              	call	waitforkey
   222                                  
   223                                  	; full screen - green color
   224                                  
   225 00000131 B930303030              	mov	ecx, 30303030h ; green 
   226 00000136 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 0000013B B81F000000          <1>  mov eax, %1
   227                              <1> 
   227 00000140 CD40                <1>  int 40h
   228                                  
   229 00000142 C605[D8060000]00        	mov	byte [tcolor], 0
   230 00000149 BEF000D000              	mov	esi, 208*65536+240
   231 0000014E BD[80060000]            	mov	ebp, txt_green
   232 00000153 E861040000               	call	print_text
   233                                  
   234 00000158 E821040000              	call	waitforkey
   235                                  
   236                                  	; full screen replace color (replace black colors)
   237 0000015D B100                    	mov	cl, 0	; BLACK
   238 0000015F B20F                    	mov	dl, 0Fh ; WHITE
   239 00000161 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 00000163 B81F000000          <1>  mov eax, %1
   240                              <1> 
   240 00000168 CD40                <1>  int 40h
   241                                  
   242 0000016A E80F040000              	call	waitforkey
   243                                  	
   244                                  	; full screen replace color (replace green colors)
   245 0000016F B130                    	mov	cl, 30h ; GREEN
   246 00000171 B200                    	mov	dl, 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 00000173 B81F000000          <1>  mov eax, %1
   248                              <1> 
   248 00000178 CD40                <1>  int 40h
   249                                  	
   250                                  	; full screen replace color (replace white colors)
   251 0000017A B10F                    	mov	cl, 0Fh ; WHITE
   252 0000017C B230                    	mov	dl, 30h ; 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 0000017E B81F000000          <1>  mov eax, %1
   254                              <1> 
   254 00000183 CD40                <1>  int 40h
   255                                  
   256                                  	; now screen color is black and text color is green
   257                                  
   258 00000185 E8F4030000              	call	waitforkey
   259                                  
   260                                  	; full screen - yellow color
   261                                  
   262 0000018A B92C2C2C2C              	mov	ecx, 2C2C2C2Ch ; yellow
   263 0000018F 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 00000194 B81F000000          <1>  mov eax, %1
   264                              <1> 
   264 00000199 CD40                <1>  int 40h
   265                                  
   266                                  	;mov	byte [tcolor], 0
   267 0000019B BEDE00D000              	mov	esi, 208*65536+222
   268 000001A0 BD[86060000]            	mov	ebp, txt_yellow
   269 000001A5 E80F040000               	call	print_text
   270                                  
   271 000001AA E8CF030000              	call	waitforkey
   272                                  
   273                                  	; full screen replace color (replace black colors)
   274 000001AF B100                    	mov	cl, 0	; BLACK
   275 000001B1 B20F                    	mov	dl, 0Fh ; WHITE
   276 000001B3 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 000001B5 B81F000000          <1>  mov eax, %1
   277                              <1> 
   277 000001BA CD40                <1>  int 40h
   278                                  
   279 000001BC E8BD030000              	call	waitforkey
   280                                  	
   281                                  	; full screen replace color (replace yellow colors)
   282 000001C1 B12C                    	mov	cl, 2Ch ; YELLOW
   283 000001C3 B200                    	mov	dl, 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 000001C5 B81F000000          <1>  mov eax, %1
   285                              <1> 
   285 000001CA CD40                <1>  int 40h
   286                                  	
   287                                  	; full screen replace color (replace white colors)
   288 000001CC B10F                    	mov	cl, 0Fh ; WHITE
   289 000001CE B22C                    	mov	dl, 2Ch ; 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 000001D0 B81F000000          <1>  mov eax, %1
   291                              <1> 
   291 000001D5 CD40                <1>  int 40h
   292                                  
   293                                  	; now screen color is black and text color is yellow
   294                                  
   295 000001D7 E8A2030000              	call	waitforkey
   296                                  
   297                                  	; Full screen copy
   298 000001DC BE[DC060000]            	mov	esi, fullscreen_buffer
   299 000001E1 89F7                    	mov	edi, esi
   300 000001E3 31C0                    	xor	eax, eax ; black
   301 000001E5 B940060000              	mov	ecx, (640*10)/4
   302 000001EA F3AB                    	rep	stosd
   303 000001EC B80F0F0F0F              	mov	eax, 0F0F0F0Fh ; white
   304 000001F1 B920030000              	mov	ecx, (640*5)/4	
   305 000001F6 F3AB                    	rep	stosd
   306 000001F8 31C0                    	xor	eax, eax ; black
   307 000001FA B920030000              	mov	ecx, (640*5)/4	
   308 000001FF F3AB                    	rep	stosd
   309 00000201 B820202020              	mov	eax, 20202020h ; blue
   310 00000206 B9C0440000              	mov	ecx, (640*110)/4
   311 0000020B F3AB                    	rep	stosd
   312 0000020D B828282828              	mov	eax, 28282828h ; red
   313 00000212 B9C0440000              	mov	ecx, (640*110)/4
   314 00000217 F3AB                    	rep	stosd
   315 00000219 B830303030              	mov	eax, 30303030h ; green 
   316 0000021E B9C0440000              	mov	ecx, (640*110)/4
   317 00000223 F3AB                    	rep	stosd
   318 00000225 B82C2C2C2C              	mov	eax, 2C2C2C2Ch ; yellow
   319 0000022A B9C0440000              	mov	ecx, (640*110)/4
   320 0000022F F3AB                    	rep	stosd
   321 00000231 31C0                    	xor	eax, eax ; black
   322 00000233 B920030000              	mov	ecx, (640*5)/4	
   323 00000238 F3AB                    	rep	stosd
   324 0000023A B80F0F0F0F              	mov	eax, 0F0F0F0Fh ; white
   325 0000023F B920030000              	mov	ecx, (640*5)/4	
   326 00000244 F3AB                    	rep	stosd
   327 00000246 31C0                    	xor	eax, eax ; black
   328 00000248 B940060000              	mov	ecx, (640*10)/4	
   329 0000024D F3AB                    	rep	stosd
   330                                  
   331 0000024F BB00020000              	mov	ebx, 0200h ; Full screen copy
   332                                  	sys	_video
   332                              <1> 
   332                              <1> 
   332                              <1> 
   332                              <1> 
   332                              <1>  %if %0 >= 2
   332                              <1>  mov ebx, %2
   332                              <1>  %if %0 >= 3
   332                              <1>  mov ecx, %3
   332                              <1>  %if %0 = 4
   332                              <1>  mov edx, %4
   332                              <1>  %endif
   332                              <1>  %endif
   332                              <1>  %endif
   332 00000254 B81F000000          <1>  mov eax, %1
   332                              <1> 
   332 00000259 CD40                <1>  int 40h
   333                                  
   334 0000025B E81E030000              	call	waitforkey
   335                                  
   336 00000260 C605[D8060000]0F        	mov	byte [tcolor], 0Fh
   337                                  
   338 00000267 BE2B002B00              	mov	esi, 43*65536+43
   339 0000026C BD[77060000]            	mov	ebp, txt_blue
   340 00000271 E843030000               	call	print_text
   341                                  	
   342 00000276 E803030000              	call	waitforkey
   343                                  
   344 0000027B BE2B009900              	mov	esi, 153*65536+43
   345 00000280 BD[7C060000]            	mov	ebp, txt_red
   346 00000285 E82F030000               	call	print_text
   347                                  	
   348 0000028A E8EF020000              	call	waitforkey
   349                                  
   350 0000028F BE2B000701              	mov	esi, 263*65536+43
   351 00000294 BD[80060000]            	mov	ebp, txt_green
   352 00000299 E81B030000               	call	print_text
   353                                  	
   354 0000029E E8DB020000              	call	waitforkey
   355                                  
   356 000002A3 BE2B007501              	mov	esi, 373*65536+43
   357 000002A8 BD[86060000]            	mov	ebp, txt_yellow
   358 000002AD E807030000               	call	print_text
   359                                  	
   360 000002B2 E8C7020000              	call	waitforkey
   361                                  
   362 000002B7 C605[D8060000]00        	mov	byte [tcolor], 0
   363                                  
   364 000002BE BE2B000701              	mov	esi, 263*65536+43
   365 000002C3 BD[80060000]            	mov	ebp, txt_green
   366 000002C8 E8EC020000               	call	print_text
   367                                  	
   368 000002CD E8AC020000              	call	waitforkey
   369                                  
   370 000002D2 BE2B007501              	mov	esi, 373*65536+43
   371 000002D7 BD[86060000]            	mov	ebp, txt_yellow
   372 000002DC E8D8020000               	call	print_text
   373                                  	
   374 000002E1 E898020000              	call	waitforkey
   375                                  
   376                                  	; screen copy and replace window sub functions
   377                                  
   378                                  	; fill white color in 1st 20 rows 
   379                                  	; in user's fullscreen buff
   380 000002E6 BF[DC060000]            	mov	edi, fullscreen_buffer
   381 000002EB B9800C0000              	mov	ecx, (20*640)/4
   382 000002F0 B80F0F0F0F              	mov	eax, 0F0F0F0Fh
   383 000002F5 F3AB                    	rep	stosd
   384                                  	; fill red color to 440 rows after white rows  
   385 000002F7 B828282828              	mov	eax, 28282828h ; RED
   386 000002FC B900130100              	mov	ecx, (440*640)/4
   387 00000301 F3AB                    	rep	stosd
   388                                  	; fill white color in last 20 rows
   389 00000303 B80F0F0F0F              	mov	eax, 0F0F0F0Fh
   390 00000308 B9800C0000              	mov	ecx, (20*640)/4
   391 0000030D F3AB                    	rep	stosd
   392                                  
   393                                  	; copy blue block (on screen) to user buffer
   394                                  	; (overwrites red colors partially)
   395 0000030F BF[04390000]            	mov	edi, fullscreen_buffer + (20*640)+40
   396 00000314 B928001400              	mov	ecx, 20*65536+40 ; column 40, row 20
   397 00000319 BAA0006E00              	mov	edx, 110*65536+160 ; size: 110*160
   398 0000031E BB41020000              	mov	ebx, 0241h ; system to user window copy
   399                                  	sys	_video	
   399                              <1> 
   399                              <1> 
   399                              <1> 
   399                              <1> 
   399                              <1>  %if %0 >= 2
   399                              <1>  mov ebx, %2
   399                              <1>  %if %0 >= 3
   399                              <1>  mov ecx, %3
   399                              <1>  %if %0 = 4
   399                              <1>  mov edx, %4
   399                              <1>  %endif
   399                              <1>  %endif
   399                              <1>  %endif
   399 00000323 B81F000000          <1>  mov eax, %1
   399                              <1> 
   399 00000328 CD40                <1>  int 40h
   400                                  
   401                                  	; Replace white color (text) only in blue block
   402                                  	; (blue block starts at row 20)
   403                                  	
   404 0000032A B10F                    	mov	cl, 0Fh ; WHITE (current color)
   405 0000032C B200                    	mov	dl, 0  ; BLACK (new color)
   406 0000032E BE28001400              	mov	esi, 20*65536+40 ; column 40, row 20
   407 00000333 BFA0006E00              	mov	edi, 110*65536+160 ; size: 110*160 
   408 00000338 BB1C020000              	mov	ebx, 021Ch ; Replace color in window
   409                                  	sys	_video
   409                              <1> 
   409                              <1> 
   409                              <1> 
   409                              <1> 
   409                              <1>  %if %0 >= 2
   409                              <1>  mov ebx, %2
   409                              <1>  %if %0 >= 3
   409                              <1>  mov ecx, %3
   409                              <1>  %if %0 = 4
   409                              <1>  mov edx, %4
   409                              <1>  %endif
   409                              <1>  %endif
   409                              <1>  %endif
   409 0000033D B81F000000          <1>  mov eax, %1
   409                              <1> 
   409 00000342 CD40                <1>  int 40h
   410                                  
   411 00000344 E835020000              	call	waitforkey
   412                                  
   413                                  	; copy red block (on screen) to user buffer
   414 00000349 BF[044C0100]            	mov	edi, fullscreen_buffer + (130*640)+40
   415 0000034E B928008200              	mov	ecx, 130*65536+40 ; column 40, row 130
   416 00000353 BA78006E00              	mov	edx, 110*65536+120 ; size: 110*120
   417 00000358 BB41020000              	mov	ebx, 0241h ; system to user window copy
   418                                  	sys	_video	
   418                              <1> 
   418                              <1> 
   418                              <1> 
   418                              <1> 
   418                              <1>  %if %0 >= 2
   418                              <1>  mov ebx, %2
   418                              <1>  %if %0 >= 3
   418                              <1>  mov ecx, %3
   418                              <1>  %if %0 = 4
   418                              <1>  mov edx, %4
   418                              <1>  %endif
   418                              <1>  %endif
   418                              <1>  %endif
   418 0000035D B81F000000          <1>  mov eax, %1
   418                              <1> 
   418 00000362 CD40                <1>  int 40h
   419                                  
   420                                  	; Replace white color (text) only in red block
   421                                  	; (red block starts at row 130)
   422                                  	
   423 00000364 B10F                    	mov	cl, 0Fh ; WHITE (current color)
   424 00000366 B200                    	mov	dl, 0  ; BLACK (new color)
   425 00000368 BE28008200              	mov	esi, 130*65536+40 ; column 40, row 130
   426 0000036D BF78006E00              	mov	edi, 110*65536+120 ; size: 110*120 
   427 00000372 BB1C020000              	mov	ebx, 021Ch ; Replace color in window
   428                                  	sys	_video
   428                              <1> 
   428                              <1> 
   428                              <1> 
   428                              <1> 
   428                              <1>  %if %0 >= 2
   428                              <1>  mov ebx, %2
   428                              <1>  %if %0 >= 3
   428                              <1>  mov ecx, %3
   428                              <1>  %if %0 = 4
   428                              <1>  mov edx, %4
   428                              <1>  %endif
   428                              <1>  %endif
   428                              <1>  %endif
   428 00000377 B81F000000          <1>  mov eax, %1
   428                              <1> 
   428 0000037C CD40                <1>  int 40h
   429                                  
   430                                  	; copy yellow block (on screen) to user buffer
   431 0000037E BF[DC710300]            	mov	edi, fullscreen_buffer + (350*640)
   432 00000383 B900005E01              	mov	ecx, 350*65536+0 ; column 0, row 350
   433 00000388 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   434 0000038D BB41020000              	mov	ebx, 0241h ; system to user window copy
   435                                  	sys	_video		
   435                              <1> 
   435                              <1> 
   435                              <1> 
   435                              <1> 
   435                              <1>  %if %0 >= 2
   435                              <1>  mov ebx, %2
   435                              <1>  %if %0 >= 3
   435                              <1>  mov ecx, %3
   435                              <1>  %if %0 = 4
   435                              <1>  mov edx, %4
   435                              <1>  %endif
   435                              <1>  %endif
   435                              <1>  %endif
   435 00000392 B81F000000          <1>  mov eax, %1
   435                              <1> 
   435 00000397 CD40                <1>  int 40h
   436                                  
   437                                  	; copy green block (on screen) to user buffer
   438 00000399 BF[DC5E0200]            	mov	edi, fullscreen_buffer + (240*640)
   439 0000039E B90000F000              	mov	ecx, 240*65536+0 ; column 0, row 240
   440 000003A3 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   441 000003A8 BB41020000              	mov	ebx, 0241h ; system to user window copy
   442                                  	sys	_video
   442                              <1> 
   442                              <1> 
   442                              <1> 
   442                              <1> 
   442                              <1>  %if %0 >= 2
   442                              <1>  mov ebx, %2
   442                              <1>  %if %0 >= 3
   442                              <1>  mov ecx, %3
   442                              <1>  %if %0 = 4
   442                              <1>  mov edx, %4
   442                              <1>  %endif
   442                              <1>  %endif
   442                              <1>  %endif
   442 000003AD B81F000000          <1>  mov eax, %1
   442                              <1> 
   442 000003B2 CD40                <1>  int 40h
   443                                  
   444 000003B4 E8C5010000              	call	waitforkey
   445                                  
   446                                  	; copy yellow block to red block position
   447                                  	; and green block to blue block position on screen
   448                                  	; (system to system copy)
   449                                  	
   450                                  	; copy yellow block (overwrite red block)
   451 000003B9 B900005E01              	mov	ecx, 350*65536 ; column 0, row 350
   452 000003BE BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   453 000003C3 BE00008200              	mov	esi, 130*65536
   454 000003C8 BB0D020000              	mov	ebx, 020Dh ; system to system window copy
   455                                  	sys	_video	
   455                              <1> 
   455                              <1> 
   455                              <1> 
   455                              <1> 
   455                              <1>  %if %0 >= 2
   455                              <1>  mov ebx, %2
   455                              <1>  %if %0 >= 3
   455                              <1>  mov ecx, %3
   455                              <1>  %if %0 = 4
   455                              <1>  mov edx, %4
   455                              <1>  %endif
   455                              <1>  %endif
   455                              <1>  %endif
   455 000003CD B81F000000          <1>  mov eax, %1
   455                              <1> 
   455 000003D2 CD40                <1>  int 40h
   456                                  
   457 000003D4 E8A5010000              	call	waitforkey
   458                                  
   459                                  	; copy green block (overwrite blue block)
   460 000003D9 B90000F000              	mov	ecx, 240*65536 ; column 0, row 240
   461 000003DE BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   462 000003E3 BE00001400              	mov	esi, 20*65536
   463 000003E8 BB0D020000              	mov	ebx, 020Dh ; system to system window copy
   464                                  	sys	_video	
   464                              <1> 
   464                              <1> 
   464                              <1> 
   464                              <1> 
   464                              <1>  %if %0 >= 2
   464                              <1>  mov ebx, %2
   464                              <1>  %if %0 >= 3
   464                              <1>  mov ecx, %3
   464                              <1>  %if %0 = 4
   464                              <1>  mov edx, %4
   464                              <1>  %endif
   464                              <1>  %endif
   464                              <1>  %endif
   464 000003ED B81F000000          <1>  mov eax, %1
   464                              <1> 
   464 000003F2 CD40                <1>  int 40h
   465                                  
   466 000003F4 E885010000              	call	waitforkey
   467                                  
   468                                  	; fill blue block on yellow block position	
   469 000003F9 B120                    	mov	cl, 20h
   470 000003FB BA00005E01              	mov	edx, 350*65536+0 
   471 00000400 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   472 00000405 BB11020000              	mov	ebx, 0211h ; new color, window
   473                                  	sys	_video
   473                              <1> 
   473                              <1> 
   473                              <1> 
   473                              <1> 
   473                              <1>  %if %0 >= 2
   473                              <1>  mov ebx, %2
   473                              <1>  %if %0 >= 3
   473                              <1>  mov ecx, %3
   473                              <1>  %if %0 = 4
   473                              <1>  mov edx, %4
   473                              <1>  %endif
   473                              <1>  %endif
   473                              <1>  %endif
   473 0000040A B81F000000          <1>  mov eax, %1
   473                              <1> 
   473 0000040F CD40                <1>  int 40h
   474                                  
   475 00000411 E868010000              	call	waitforkey
   476                                  
   477                                  	; fill red block on green block position	
   478 00000416 B128                    	mov	cl, 28h
   479 00000418 BA0000F000              	mov	edx, 240*65536+0 
   480 0000041D BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   481 00000422 BB11020000              	mov	ebx, 0211h ; new color, window
   482                                  	sys	_video
   482                              <1> 
   482                              <1> 
   482                              <1> 
   482                              <1> 
   482                              <1>  %if %0 >= 2
   482                              <1>  mov ebx, %2
   482                              <1>  %if %0 >= 3
   482                              <1>  mov ecx, %3
   482                              <1>  %if %0 = 4
   482                              <1>  mov edx, %4
   482                              <1>  %endif
   482                              <1>  %endif
   482                              <1>  %endif
   482 00000427 B81F000000          <1>  mov eax, %1
   482                              <1> 
   482 0000042C CD40                <1>  int 40h
   483                                  
   484 0000042E E84B010000              	call	waitforkey
   485                                  
   486                                  	; copy	blocks to system from user's buffer
   487 00000433 BE[99060000]            	mov	esi, blockdatabuffer ; 32+32 bits
   488 00000438 B120                    	mov	cl, 20h ; BLUE BLOCKS
   489 0000043A BA07000000              	mov	edx, 7 ; 7 blocks
   490 0000043F BB2D020000               	mov	ebx, 022Dh ; indirect pixel blocks
   491                                   	sys	_video
   491                              <1> 
   491                              <1> 
   491                              <1> 
   491                              <1> 
   491                              <1>  %if %0 >= 2
   491                              <1>  mov ebx, %2
   491                              <1>  %if %0 >= 3
   491                              <1>  mov ecx, %3
   491                              <1>  %if %0 = 4
   491                              <1>  mov edx, %4
   491                              <1>  %endif
   491                              <1>  %endif
   491                              <1>  %endif
   491 00000444 B81F000000          <1>  mov eax, %1
   491                              <1> 
   491 00000449 CD40                <1>  int 40h
   492                                  
   493 0000044B E82E010000              	call	waitforkey
   494                                  
   495                                  	; replace color
   496 00000450 B12C                    	mov	cl, 2Ch ; YELLOW (current color)
   497 00000452 B220                    	mov	dl, 20h ; BLUE (new color)
   498 00000454 BE00008200              	mov	esi, 130*65536 ; column 0, row 130
   499 00000459 BF80026E00              	mov	edi, 110*65536+640 ; size: 110*640
   500 0000045E BB1C020000              	mov	ebx, 021Ch ; Replace color in window
   501                                  	sys	_video
   501                              <1> 
   501                              <1> 
   501                              <1> 
   501                              <1> 
   501                              <1>  %if %0 >= 2
   501                              <1>  mov ebx, %2
   501                              <1>  %if %0 >= 3
   501                              <1>  mov ecx, %3
   501                              <1>  %if %0 = 4
   501                              <1>  mov edx, %4
   501                              <1>  %endif
   501                              <1>  %endif
   501                              <1>  %endif
   501 00000463 B81F000000          <1>  mov eax, %1
   501                              <1> 
   501 00000468 CD40                <1>  int 40h
   502                                  
   503 0000046A E80F010000              	call	waitforkey
   504                                  
   505                                  	; copy blue block (with 'blue" text)
   506                                  	; from users full screen buffer to system
   507                                  	; (to its old position)
   508                                  	
   509 0000046F B928001400              	mov	ecx, 20*65536+40
   510 00000474 BAA0006E00              	mov	edx, 110*65536+160
   511 00000479 BE[04390000]            	mov	esi, fullscreen_buffer+(20*640)+40
   512 0000047E BB10020000              	mov	ebx, 0210h ; copy from user to sys 
   513                                  	sys	_video
   513                              <1> 
   513                              <1> 
   513                              <1> 
   513                              <1> 
   513                              <1>  %if %0 >= 2
   513                              <1>  mov ebx, %2
   513                              <1>  %if %0 >= 3
   513                              <1>  mov ecx, %3
   513                              <1>  %if %0 = 4
   513                              <1>  mov edx, %4
   513                              <1>  %endif
   513                              <1>  %endif
   513                              <1>  %endif
   513 00000483 B81F000000          <1>  mov eax, %1
   513                              <1> 
   513 00000488 CD40                <1>  int 40h
   514                                  
   515                                  	; copy blue block to usr's buffer again
   516 0000048A B900001400              	mov	ecx, 20*65536
   517 0000048F BA80026E00              	mov	edx, 110*65536+640
   518 00000494 BF[DC380000]            	mov	edi, fullscreen_buffer+(20*640)
   519 00000499 BB41020000              	mov	ebx, 0241h ; copy from sys to user 
   520                                  	sys	_video
   520                              <1> 
   520                              <1> 
   520                              <1> 
   520                              <1> 
   520                              <1>  %if %0 >= 2
   520                              <1>  mov ebx, %2
   520                              <1>  %if %0 >= 3
   520                              <1>  mov ecx, %3
   520                              <1>  %if %0 = 4
   520                              <1>  mov edx, %4
   520                              <1>  %endif
   520                              <1>  %endif
   520                              <1>  %endif
   520 0000049E B81F000000          <1>  mov eax, %1
   520                              <1> 
   520 000004A3 CD40                <1>  int 40h
   521                                  
   522 000004A5 E8D4000000              	call	waitforkey
   523                                  
   524                                  	; fill red block on red block position	
   525 000004AA B128                    	mov	cl, 28h
   526 000004AC BA00008200              	mov	edx, 130*65536+0 
   527 000004B1 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   528 000004B6 BB11020000              	mov	ebx, 0211h ; new color, window
   529                                  	sys	_video
   529                              <1> 
   529                              <1> 
   529                              <1> 
   529                              <1> 
   529                              <1>  %if %0 >= 2
   529                              <1>  mov ebx, %2
   529                              <1>  %if %0 >= 3
   529                              <1>  mov ecx, %3
   529                              <1>  %if %0 = 4
   529                              <1>  mov edx, %4
   529                              <1>  %endif
   529                              <1>  %endif
   529                              <1>  %endif
   529 000004BB B81F000000          <1>  mov eax, %1
   529                              <1> 
   529 000004C0 CD40                <1>  int 40h
   530                                  
   531 000004C2 E8B7000000              	call	waitforkey
   532                                  
   533                                  	; copy red block (with 'red" text)
   534                                  	; from users full screen buffer to system
   535                                  	; (to its old position)
   536 000004C7 B928008200              	mov	ecx, 130*65536+40
   537 000004CC BA78006E00              	mov	edx, 110*65536+120
   538 000004D1 BE[044C0100]            	mov	esi, fullscreen_buffer+(130*640)+40
   539 000004D6 BB10020000              	mov	ebx, 0210h ; copy from user to sys 
   540                                  	sys	_video
   540                              <1> 
   540                              <1> 
   540                              <1> 
   540                              <1> 
   540                              <1>  %if %0 >= 2
   540                              <1>  mov ebx, %2
   540                              <1>  %if %0 >= 3
   540                              <1>  mov ecx, %3
   540                              <1>  %if %0 = 4
   540                              <1>  mov edx, %4
   540                              <1>  %endif
   540                              <1>  %endif
   540                              <1>  %endif
   540 000004DB B81F000000          <1>  mov eax, %1
   540                              <1> 
   540 000004E0 CD40                <1>  int 40h
   541                                  
   542                                  	; copy red block to usr's buffer again
   543 000004E2 B900008200              	mov	ecx, 130*65536
   544 000004E7 BA80026E00              	mov	edx, 110*65536+640
   545 000004EC BF[DC4B0100]            	mov	edi, fullscreen_buffer+(130*640)
   546 000004F1 BB41020000              	mov	ebx, 0241h ; copy from sys to user 
   547                                  	sys	_video
   547                              <1> 
   547                              <1> 
   547                              <1> 
   547                              <1> 
   547                              <1>  %if %0 >= 2
   547                              <1>  mov ebx, %2
   547                              <1>  %if %0 >= 3
   547                              <1>  mov ecx, %3
   547                              <1>  %if %0 = 4
   547                              <1>  mov edx, %4
   547                              <1>  %endif
   547                              <1>  %endif
   547                              <1>  %endif
   547 000004F6 B81F000000          <1>  mov eax, %1
   547                              <1> 
   547 000004FB CD40                <1>  int 40h
   548                                  
   549 000004FD E87C000000              	call	waitforkey
   550                                  
   551                                  	; replace color (full screen)
   552 00000502 B10F                    	mov	cl, 0Fh ; WHITE (current color)
   553 00000504 B200                    	mov	dl, 0  ; BLACK (new color)
   554 00000506 BB0C020000              	mov	ebx, 020Ch ; Replace color on screen
   555                                  	sys	_video
   555                              <1> 
   555                              <1> 
   555                              <1> 
   555                              <1> 
   555                              <1>  %if %0 >= 2
   555                              <1>  mov ebx, %2
   555                              <1>  %if %0 >= 3
   555                              <1>  mov ecx, %3
   555                              <1>  %if %0 = 4
   555                              <1>  mov edx, %4
   555                              <1>  %endif
   555                              <1>  %endif
   555                              <1>  %endif
   555 0000050B B81F000000          <1>  mov eax, %1
   555                              <1> 
   555 00000510 CD40                <1>  int 40h
   556                                  
   557 00000512 E867000000              	call	waitforkey
   558                                  
   559                                  	; copy full screen buffer to screen
   560 00000517 BE[DC060000]            	mov	esi, fullscreen_buffer
   561 0000051C BB00020000              	mov	ebx, 0200h
   562                                  	sys	_video
   562                              <1> 
   562                              <1> 
   562                              <1> 
   562                              <1> 
   562                              <1>  %if %0 >= 2
   562                              <1>  mov ebx, %2
   562                              <1>  %if %0 >= 3
   562                              <1>  mov ecx, %3
   562                              <1>  %if %0 = 4
   562                              <1>  mov edx, %4
   562                              <1>  %endif
   562                              <1>  %endif
   562                              <1>  %endif
   562 00000521 B81F000000          <1>  mov eax, %1
   562                              <1> 
   562 00000526 CD40                <1>  int 40h
   563                                  
   564                                  	; erase full screen buffer
   565 00000528 B9002C0100              	mov	ecx, (640*480)/4
   566 0000052D 31C0                    	xor	eax, eax
   567 0000052F 89F7                    	mov	edi, esi ; fullscreen_buffer
   568 00000531 F3AB                    	rep	stosd
   569                                  
   570 00000533 E846000000              	call	waitforkey
   571                                  
   572                                  	; copy (full) screen to full screen buffer
   573 00000538 BF[DC060000]            	mov	edi, fullscreen_buffer
   574 0000053D BB40020000              	mov	ebx, 0240h ; copy from sys to user 
   575                                  	sys	_video
   575                              <1> 
   575                              <1> 
   575                              <1> 
   575                              <1> 
   575                              <1>  %if %0 >= 2
   575                              <1>  mov ebx, %2
   575                              <1>  %if %0 >= 3
   575                              <1>  mov ecx, %3
   575                              <1>  %if %0 = 4
   575                              <1>  mov edx, %4
   575                              <1>  %endif
   575                              <1>  %endif
   575                              <1>  %endif
   575 00000542 B81F000000          <1>  mov eax, %1
   575                              <1> 
   575 00000547 CD40                <1>  int 40h
   576                                  
   577                                  	; full screen NOT operation
   578 00000549 BB07020000              	mov	ebx, 0207h
   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 0000054E B81F000000          <1>  mov eax, %1
   579                              <1> 
   579 00000553 CD40                <1>  int 40h
   580                                  
   581 00000555 E824000000              	call	waitforkey
   582                                  
   583                                  	; copy full screen buffer to screen
   584 0000055A BE[DC060000]            	mov	esi, fullscreen_buffer
   585 0000055F BB00020000              	mov	ebx, 0200h
   586                                  	sys	_video
   586                              <1> 
   586                              <1> 
   586                              <1> 
   586                              <1> 
   586                              <1>  %if %0 >= 2
   586                              <1>  mov ebx, %2
   586                              <1>  %if %0 >= 3
   586                              <1>  mov ecx, %3
   586                              <1>  %if %0 = 4
   586                              <1>  mov edx, %4
   586                              <1>  %endif
   586                              <1>  %endif
   586                              <1>  %endif
   586 00000564 B81F000000          <1>  mov eax, %1
   586                              <1> 
   586 00000569 CD40                <1>  int 40h
   587                                  	
   588                                  	; here.. it is the End of TRDOS 386 v2.0.3
   589                                  	; 'sysvideo' LFB block/window and full screen
   590                                  	; pixel-data transfer function tests
   591                                  	; (for VESA VBE video modes). 22/01/2021
   592                                  	;
   593                                  	; NOTE: This test program (blocks4.s) 
   594                                  	; contains only non-masked data transfer tests.
   595                                  	; (same functions must be tested for color-masked
   596                                  	;  pixel operations, also.) 
   597                                  
   598 0000056B E80E000000              	call	waitforkey  
   599                                  		; wait for key stroke before exit
   600                                  terminate:
   601 00000570 E82C000000              	call	set_text_mode
   602                                  	sys	_exit
   602                              <1> 
   602                              <1> 
   602                              <1> 
   602                              <1> 
   602                              <1>  %if %0 >= 2
   602                              <1>  mov ebx, %2
   602                              <1>  %if %0 >= 3
   602                              <1>  mov ecx, %3
   602                              <1>  %if %0 = 4
   602                              <1>  mov edx, %4
   602                              <1>  %endif
   602                              <1>  %endif
   602                              <1>  %endif
   602 00000575 B801000000          <1>  mov eax, %1
   602                              <1> 
   602 0000057A CD40                <1>  int 40h
   603                                  halt:
   604 0000057C EBFE                    	jmp	short halt
   605                                  
   606                                  waitforkey:
   607 0000057E B401                    	mov	ah, 1
   608 00000580 CD32                    	int	32h
   609 00000582 740B                    	jz	short getkey
   610 00000584 FF05[D4060000]          	inc	dword [counter]
   611 0000058A 90                      	nop
   612 0000058B 90                      	nop
   613 0000058C 90                      	nop
   614 0000058D EBEF                    	jmp	short waitforkey
   615                                  getkey:
   616 0000058F 30E4                    	xor	ah, ah
   617 00000591 CD32                    	int	32h
   618                                  
   619 00000593 663D032E                	cmp	ax, 2E03h
   620 00000597 7405                    	je	short _terminate
   621 00000599 3C1B                    	cmp	al, 1Bh ; ESC key
   622 0000059B 7401                    	je	short _terminate
   623 0000059D C3                      	retn
   624                                  _terminate:
   625 0000059E 58                      	pop	eax ; return address
   626 0000059F EBCF                    	jmp	short terminate
   627                                  	
   628                                  set_text_mode:
   629 000005A1 30E4                    	xor    ah, ah
   630 000005A3 B003                    	mov    al, 3                        
   631                                   	;int   10h ; al = 03h text mode, int 10 video
   632 000005A5 CD31                    	int    31h ; TRDOS 386 - Video interrupt
   633 000005A7 C3                      	retn
   634                                  
   635                                  print_msg:
   636 000005A8 B40E                    	mov	ah, 0Eh
   637 000005AA BB07000000              	mov	ebx, 7
   638                                  	;mov	bl, 7 ; char attribute & color
   639                                  p_next_chr:
   640 000005AF AC                      	lodsb
   641 000005B0 08C0                    	or	al, al
   642 000005B2 7404                    	jz	short p_retn ; retn	
   643 000005B4 CD31                    	int	31h
   644 000005B6 EBF7                    	jmp	short p_next_chr
   645                                  p_retn:
   646 000005B8 C3                      	retn
   647                                  
   648                                  print_text:
   649                                  	; ebp = text address
   650                                  	; esi = row/column position (si = column)
   651                                  p_d_x:
   652                                  	;mov	dh, 0 ; 8x16 system font
   653 000005B9 B606                    	mov	dh, 6 ; 32*64 scaled font (base: 8*16 system font) 
   654                                  p_d_x_n:
   655 000005BB 8A5500                  	mov	dl, [ebp]
   656 000005BE 20D2                    	and	dl, dl
   657 000005C0 7419                    	jz	short p_d_x_ok
   658                                  	sys	_video, 020Fh, [tcolor] 
   658                              <1> 
   658                              <1> 
   658                              <1> 
   658                              <1> 
   658                              <1>  %if %0 >= 2
   658 000005C2 BB0F020000          <1>  mov ebx, %2
   658                              <1>  %if %0 >= 3
   658 000005C7 8B0D[D8060000]      <1>  mov ecx, %3
   658                              <1>  %if %0 = 4
   658                              <1>  mov edx, %4
   658                              <1>  %endif
   658                              <1>  %endif
   658                              <1>  %endif
   658 000005CD B81F000000          <1>  mov eax, %1
   658                              <1> 
   658 000005D2 CD40                <1>  int 40h
   659 000005D4 45                      	inc	ebp
   660 000005D5 6683C624                	add	si, 36 ; next char pos
   661 000005D9 EBE0                    	jmp	short p_d_x_n
   662                                  p_d_x_ok:
   663 000005DB C3                      	retn
   664                                  
   665                                  program_msg:
   666 000005DC 5452444F5320333836-     	db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Block Operations"
   666 000005E5 2076322E302E33202D-
   666 000005EE 202827737973766964-
   666 000005F7 656F27292054657374-
   666 00000600 2050726F6772616D20-
   666 00000609 2D20426C6F636B204F-
   666 00000612 7065726174696F6E73 
   667 0000061B 0D0A                    	db 0Dh, 0Ah
   668 0000061D 6279204572646F6761-     	db "by Erdogan Tan - 22/02/2021"
   668 00000626 6E2054616E202D2032-
   668 0000062F 322F30322F32303231 
   669                                  	;db 0Dh, 0Ah, 0
   670 00000638 0D0A0D0A                	db 0Dh, 0Ah, 0Dh, 0Ah
   671 0000063C 507265737320616E79-     	db "Press any key to continue .."
   671 00000645 206B657920746F2063-
   671 0000064E 6F6E74696E7565202E-
   671 00000657 2E                 
   672 00000658 0D0A                    	db 0Dh, 0Ah	
   673 0000065A 285072657373204553-     	db "(Press ESC to exit) .."
   673 00000663 4320746F2065786974-
   673 0000066C 29202E2E           
   674 00000670 0D0A                    	db 0Dh, 0Ah
   675 00000672 0D0A                    	db 0Dh, 0Ah
   676                                  
   677                                  nextline:
   678 00000674 0D0A00                  	db 0Dh, 0Ah, 0
   679                                  
   680                                  txt_blue:
   681 00000677 424C554500              	db "BLUE", 0
   682                                  txt_red:
   683 0000067C 52454400                	db "RED", 0
   684                                  txt_green:
   685 00000680 475245454E00            	db "GREEN", 0
   686                                  txt_yellow:
   687 00000686 59454C4C4F5700          	db "YELLOW", 0
   688                                  txt_white:
   689 0000068D 574849544500            	db "WHITE", 0
   690                                  txt_black:
   691 00000693 424C41434B00            	db "BLACK", 0
   692                                  
   693                                  blockdatabuffer:
   694 00000699 00001400                	dd	20*65536
   695 0000069D 28006E00                	dd	110*65536+40
   696 000006A1 C8008200                	dd	130*65536+200
   697 000006A5 B8016E00                	dd	110*65536+440
   698 000006A9 28008200                	dd	130*65536+40
   699 000006AD A0006E00                	dd	110*65536+160
   700 000006B1 00005E01                	dd	350*65536
   701 000006B5 80026E00                	dd	110*65536+640
   702 000006B9 28001400                	dd	20*65536+40
   703 000006BD A0006E00                	dd	110*65536+160
   704 000006C1 0000F000                	dd	240*65536
   705 000006C5 80026E00                	dd	110*65536+640
   706 000006C9 C8001400                	dd	20*65536+200
   707 000006CD B8016E00                	dd	110*65536+440
   708 000006D1 00                      	db	0		
   709                                  bss:
   710                                  
   711                                  ABSOLUTE bss
   712                                  
   713 000006D2 <res 00000002>          alignb 4
   714                                  
   715                                  counter:
   716 000006D4 <res 00000004>          	resd 1	
   717                                  
   718                                  bss_start:
   719 000006D8 <res 00000004>          tcolor: resd 1
   720                                  
   721                                  fullscreen_buffer:
   722 000006DC <res 0004B000>          	resb 307200
   723                                  bss_end:
