     1                                  ; ****************************************************************************
     2                                  ; blocks12.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; 01/03/2021
     6                                  ;
     7                                  ; ****************************************************************************
     8                                  ; nasm blocks12.s -l blocks12.txt -o BLOCKS12.PRG -Z error.txt
     9                                  ; (modified from 'blocks4.s', 22/02/2021 & 'blocks9.s', 28/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[20070000]            	mov	edi, bss_start
    92 00000005 B901840300              	mov	ecx, (bss_end - bss_start)/4
    93                                  	;xor	eax, eax
    94 0000000A F3AB                    	rep	stosd
    95                                  
    96                                  	; program message
    97 0000000C BE[24060000]            	mov	esi, program_msg
    98 00000011 E8DA050000              	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 112h ; 640x480, 24 bit true colors
   106                                  	sys	_video, 08FFh, 112h
   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 B912010000          <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_112h_ok
   111 0000002F E984050000              	jmp	terminate
   112                                  
   113                                  set_vesa_mode_112h_ok:
   114 00000034 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; white
   115 00000039 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   116                                  	sys	_video
   116                              <1> 
   116                              <1> 
   116                              <1> 
   116                              <1> 
   116                              <1>  %if %0 >= 2
   116                              <1>  mov ebx, %2
   116                              <1>  %if %0 >= 3
   116                              <1>  mov ecx, %3
   116                              <1>  %if %0 = 4
   116                              <1>  mov edx, %4
   116                              <1>  %endif
   116                              <1>  %endif
   116                              <1>  %endif
   116 0000003E B81F000000          <1>  mov eax, %1
   116                              <1> 
   116 00000043 CD40                <1>  int 40h
   117                                  
   118                                  	;mov	dword [tcolor], 0
   119 00000045 BEF000D000              	mov	esi, 208*65536+240
   120 0000004A BD[D5060000]            	mov	ebp, txt_white
   121 0000004F E8AD050000               	call	print_text
   122                                  
   123 00000054 E86D050000              	call	waitforkey
   124                                  
   125                                  	; full screen replace color (replace black colors)
   126 00000059 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   127 0000005B BA0000FF00              	mov	edx, 0FF0000h ; RED
   128 00000060 B30C                    	mov	bl, 0Ch
   129                                  	sys	_video
   129                              <1> 
   129                              <1> 
   129                              <1> 
   129                              <1> 
   129                              <1>  %if %0 >= 2
   129                              <1>  mov ebx, %2
   129                              <1>  %if %0 >= 3
   129                              <1>  mov ecx, %3
   129                              <1>  %if %0 = 4
   129                              <1>  mov edx, %4
   129                              <1>  %endif
   129                              <1>  %endif
   129                              <1>  %endif
   129 00000062 B81F000000          <1>  mov eax, %1
   129                              <1> 
   129 00000067 CD40                <1>  int 40h
   130                                  
   131 00000069 E858050000              	call	waitforkey
   132                                  
   133                                  	; full screen replace color (replace white colors)
   134 0000006E B9FFFFFF00              	mov	ecx, 0FFFFFFh  ; WHITE
   135 00000073 29D2                    	sub	edx, edx ; 0 ; BLACK
   136                                  	;mov	bl, 0Ch
   137                                  	sys	_video
   137                              <1> 
   137                              <1> 
   137                              <1> 
   137                              <1> 
   137                              <1>  %if %0 >= 2
   137                              <1>  mov ebx, %2
   137                              <1>  %if %0 >= 3
   137                              <1>  mov ecx, %3
   137                              <1>  %if %0 = 4
   137                              <1>  mov edx, %4
   137                              <1>  %endif
   137                              <1>  %endif
   137                              <1>  %endif
   137 00000075 B81F000000          <1>  mov eax, %1
   137                              <1> 
   137 0000007A CD40                <1>  int 40h
   138                                  	
   139                                  	; full screen replace color (replace red colors)
   140 0000007C B90000FF00              	mov	ecx, 0FF0000h ; RED
   141 00000081 BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   142                                  	;mov	bl, 0Ch
   143                                  	sys	_video
   143                              <1> 
   143                              <1> 
   143                              <1> 
   143                              <1> 
   143                              <1>  %if %0 >= 2
   143                              <1>  mov ebx, %2
   143                              <1>  %if %0 >= 3
   143                              <1>  mov ecx, %3
   143                              <1>  %if %0 = 4
   143                              <1>  mov edx, %4
   143                              <1>  %endif
   143                              <1>  %endif
   143                              <1>  %endif
   143 00000086 B81F000000          <1>  mov eax, %1
   143                              <1> 
   143 0000008B CD40                <1>  int 40h
   144                                  	
   145                                  	; now screen color is black and text color is white
   146                                  
   147 0000008D E834050000              	call	waitforkey
   148                                  
   149                                  	; full screen - blue color 
   150                                  
   151 00000092 B9FF000000              	mov	ecx, 0FFh  ; Blue
   152 00000097 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   153                                  	sys	_video
   153                              <1> 
   153                              <1> 
   153                              <1> 
   153                              <1> 
   153                              <1>  %if %0 >= 2
   153                              <1>  mov ebx, %2
   153                              <1>  %if %0 >= 3
   153                              <1>  mov ecx, %3
   153                              <1>  %if %0 = 4
   153                              <1>  mov edx, %4
   153                              <1>  %endif
   153                              <1>  %endif
   153                              <1>  %endif
   153 0000009C B81F000000          <1>  mov eax, %1
   153                              <1> 
   153 000000A1 CD40                <1>  int 40h
   154                                  
   155 000000A3 C705[20070000]FFFF-     	mov	dword [tcolor], 0FFFFFFh
   155 000000AB FF00               
   156 000000AD BE0201D000              	mov	esi, 208*65536+258
   157 000000B2 BD[BF060000]            	mov	ebp, txt_blue
   158 000000B7 E845050000               	call	print_text
   159                                  
   160 000000BC E805050000              	call	waitforkey
   161                                  
   162                                  	; full screen replace color (replace white colors)
   163 000000C1 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   164 000000C6 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   165 000000CB B30C                    	mov	bl, 0Ch
   166                                  	sys	_video
   166                              <1> 
   166                              <1> 
   166                              <1> 
   166                              <1> 
   166                              <1>  %if %0 >= 2
   166                              <1>  mov ebx, %2
   166                              <1>  %if %0 >= 3
   166                              <1>  mov ecx, %3
   166                              <1>  %if %0 = 4
   166                              <1>  mov edx, %4
   166                              <1>  %endif
   166                              <1>  %endif
   166                              <1>  %endif
   166 000000CD B81F000000          <1>  mov eax, %1
   166                              <1> 
   166 000000D2 CD40                <1>  int 40h
   167                                  
   168 000000D4 E8ED040000              	call	waitforkey
   169                                  	
   170                                  	; full screen replace color (replace blue colors)
   171 000000D9 B9FF000000              	mov	ecx, 0FFh ; BLUE
   172 000000DE 31D2                    	xor	edx, edx ; 0 ; BLACK
   173                                  	;mov	bl, 0Ch
   174                                  	sys	_video
   174                              <1> 
   174                              <1> 
   174                              <1> 
   174                              <1> 
   174                              <1>  %if %0 >= 2
   174                              <1>  mov ebx, %2
   174                              <1>  %if %0 >= 3
   174                              <1>  mov ecx, %3
   174                              <1>  %if %0 = 4
   174                              <1>  mov edx, %4
   174                              <1>  %endif
   174                              <1>  %endif
   174                              <1>  %endif
   174 000000E0 B81F000000          <1>  mov eax, %1
   174                              <1> 
   174 000000E5 CD40                <1>  int 40h
   175                                  	
   176                                  	; full screen replace color (replace yellow colors)
   177 000000E7 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   178 000000EC BAFF000000              	mov	edx, 0FFh ; BLUE
   179                                  	;mov	bl, 0Ch
   180                                  	sys	_video
   180                              <1> 
   180                              <1> 
   180                              <1> 
   180                              <1> 
   180                              <1>  %if %0 >= 2
   180                              <1>  mov ebx, %2
   180                              <1>  %if %0 >= 3
   180                              <1>  mov ecx, %3
   180                              <1>  %if %0 = 4
   180                              <1>  mov edx, %4
   180                              <1>  %endif
   180                              <1>  %endif
   180                              <1>  %endif
   180 000000F1 B81F000000          <1>  mov eax, %1
   180                              <1> 
   180 000000F6 CD40                <1>  int 40h
   181                                  
   182                                  	; now screen color is black and text color is blue
   183                                  
   184 000000F8 E8C9040000              	call	waitforkey
   185                                  
   186 000000FD B90000FF00              	mov	ecx, 0FF0000h ; RED
   187 00000102 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   188                                  	sys	_video
   188                              <1> 
   188                              <1> 
   188                              <1> 
   188                              <1> 
   188                              <1>  %if %0 >= 2
   188                              <1>  mov ebx, %2
   188                              <1>  %if %0 >= 3
   188                              <1>  mov ecx, %3
   188                              <1>  %if %0 = 4
   188                              <1>  mov edx, %4
   188                              <1>  %endif
   188                              <1>  %endif
   188                              <1>  %endif
   188 00000107 B81F000000          <1>  mov eax, %1
   188                              <1> 
   188 0000010C CD40                <1>  int 40h
   189                                  
   190                                  	;mov	byte [tcolor], 0Fh
   191 0000010E BE1401D000              	mov	esi, 208*65536+276
   192 00000113 BD[C4060000]            	mov	ebp, txt_red
   193 00000118 E8E4040000               	call	print_text
   194                                  
   195 0000011D E8A4040000              	call	waitforkey
   196                                  
   197                                  	; full screen replace color (replace white colors)
   198 00000122 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   199 00000127 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   200 0000012C B30C                    	mov	bl, 0Ch
   201                                  	sys	_video
   201                              <1> 
   201                              <1> 
   201                              <1> 
   201                              <1> 
   201                              <1>  %if %0 >= 2
   201                              <1>  mov ebx, %2
   201                              <1>  %if %0 >= 3
   201                              <1>  mov ecx, %3
   201                              <1>  %if %0 = 4
   201                              <1>  mov edx, %4
   201                              <1>  %endif
   201                              <1>  %endif
   201                              <1>  %endif
   201 0000012E B81F000000          <1>  mov eax, %1
   201                              <1> 
   201 00000133 CD40                <1>  int 40h
   202                                  
   203 00000135 E88C040000              	call	waitforkey
   204                                  	
   205                                  	; full screen replace color (replace red colors)
   206 0000013A B90000FF00              	mov	ecx, 0FF0000h ; RED
   207 0000013F 29D2                    	sub	edx, edx ; 0 ; BLACK
   208                                  	;mov	bl, 0Ch
   209                                  	sys	_video
   209                              <1> 
   209                              <1> 
   209                              <1> 
   209                              <1> 
   209                              <1>  %if %0 >= 2
   209                              <1>  mov ebx, %2
   209                              <1>  %if %0 >= 3
   209                              <1>  mov ecx, %3
   209                              <1>  %if %0 = 4
   209                              <1>  mov edx, %4
   209                              <1>  %endif
   209                              <1>  %endif
   209                              <1>  %endif
   209 00000141 B81F000000          <1>  mov eax, %1
   209                              <1> 
   209 00000146 CD40                <1>  int 40h
   210                                  	
   211                                  	; full screen replace color (replace yellow colors)
   212 00000148 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   213 0000014D BA0000FF00              	mov	edx, 0FF0000h ; RED
   214                                  	;mov	bl, 0Ch
   215                                  	sys	_video
   215                              <1> 
   215                              <1> 
   215                              <1> 
   215                              <1> 
   215                              <1>  %if %0 >= 2
   215                              <1>  mov ebx, %2
   215                              <1>  %if %0 >= 3
   215                              <1>  mov ecx, %3
   215                              <1>  %if %0 = 4
   215                              <1>  mov edx, %4
   215                              <1>  %endif
   215                              <1>  %endif
   215                              <1>  %endif
   215 00000152 B81F000000          <1>  mov eax, %1
   215                              <1> 
   215 00000157 CD40                <1>  int 40h
   216                                  
   217                                  	; now screen color is black and text color is red
   218                                  
   219 00000159 E868040000              	call	waitforkey
   220                                  
   221                                  	; full screen - green color
   222                                  
   223 0000015E B900FF0000              	mov	ecx, 0FF00h ; green 
   224 00000163 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   225                                  	sys	_video
   225                              <1> 
   225                              <1> 
   225                              <1> 
   225                              <1> 
   225                              <1>  %if %0 >= 2
   225                              <1>  mov ebx, %2
   225                              <1>  %if %0 >= 3
   225                              <1>  mov ecx, %3
   225                              <1>  %if %0 = 4
   225                              <1>  mov edx, %4
   225                              <1>  %endif
   225                              <1>  %endif
   225                              <1>  %endif
   225 00000168 B81F000000          <1>  mov eax, %1
   225                              <1> 
   225 0000016D CD40                <1>  int 40h
   226                                  
   227 0000016F C705[20070000]0000-     	mov	dword [tcolor], 0
   227 00000177 0000               
   228 00000179 BEF000D000              	mov	esi, 208*65536+240
   229 0000017E BD[C8060000]            	mov	ebp, txt_green
   230 00000183 E879040000               	call	print_text
   231                                  
   232 00000188 E839040000              	call	waitforkey
   233                                  
   234                                  	; full screen replace color (replace black colors)
   235 0000018D 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   236 0000018F BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   237 00000194 B30C                    	mov	bl, 0Ch
   238                                  	sys	_video
   238                              <1> 
   238                              <1> 
   238                              <1> 
   238                              <1> 
   238                              <1>  %if %0 >= 2
   238                              <1>  mov ebx, %2
   238                              <1>  %if %0 >= 3
   238                              <1>  mov ecx, %3
   238                              <1>  %if %0 = 4
   238                              <1>  mov edx, %4
   238                              <1>  %endif
   238                              <1>  %endif
   238                              <1>  %endif
   238 00000196 B81F000000          <1>  mov eax, %1
   238                              <1> 
   238 0000019B CD40                <1>  int 40h
   239                                  
   240 0000019D E824040000              	call	waitforkey
   241                                  	
   242                                  	; full screen replace color (replace green colors)
   243 000001A2 B900FF0000              	mov	ecx, 0FF00h ; GREEN
   244 000001A7 31D2                    	xor	edx, edx ; 0 ; BLACK
   245                                  	;mov	bl, 0Ch
   246                                  	sys	_video
   246                              <1> 
   246                              <1> 
   246                              <1> 
   246                              <1> 
   246                              <1>  %if %0 >= 2
   246                              <1>  mov ebx, %2
   246                              <1>  %if %0 >= 3
   246                              <1>  mov ecx, %3
   246                              <1>  %if %0 = 4
   246                              <1>  mov edx, %4
   246                              <1>  %endif
   246                              <1>  %endif
   246                              <1>  %endif
   246 000001A9 B81F000000          <1>  mov eax, %1
   246                              <1> 
   246 000001AE CD40                <1>  int 40h
   247                                  	
   248                                  	; full screen replace color (replace white colors)
   249 000001B0 B9FFFFFF00              	mov	ecx, 0FFFFFFh  ; WHITE
   250 000001B5 BA00FF0000              	mov	edx, 0FF00h ; GREEN 
   251                                  	;mov	bl, 0Ch
   252                                  	sys	_video
   252                              <1> 
   252                              <1> 
   252                              <1> 
   252                              <1> 
   252                              <1>  %if %0 >= 2
   252                              <1>  mov ebx, %2
   252                              <1>  %if %0 >= 3
   252                              <1>  mov ecx, %3
   252                              <1>  %if %0 = 4
   252                              <1>  mov edx, %4
   252                              <1>  %endif
   252                              <1>  %endif
   252                              <1>  %endif
   252 000001BA B81F000000          <1>  mov eax, %1
   252                              <1> 
   252 000001BF CD40                <1>  int 40h
   253                                  
   254                                  	; now screen color is black and text color is green
   255                                  
   256 000001C1 E800040000              	call	waitforkey
   257                                  
   258                                  	; full screen - yellow color
   259                                  
   260 000001C6 B90FF0FF0F              	mov	ecx, 0FFFF00Fh  ; yellow
   261 000001CB BB01020000              	mov	ebx, 0201h ; Full screen, new color
   262                                  	sys	_video
   262                              <1> 
   262                              <1> 
   262                              <1> 
   262                              <1> 
   262                              <1>  %if %0 >= 2
   262                              <1>  mov ebx, %2
   262                              <1>  %if %0 >= 3
   262                              <1>  mov ecx, %3
   262                              <1>  %if %0 = 4
   262                              <1>  mov edx, %4
   262                              <1>  %endif
   262                              <1>  %endif
   262                              <1>  %endif
   262 000001D0 B81F000000          <1>  mov eax, %1
   262                              <1> 
   262 000001D5 CD40                <1>  int 40h
   263                                  
   264                                  	;mov	dword [tcolor], 0
   265 000001D7 BEDE00D000              	mov	esi, 208*65536+222
   266 000001DC BD[CE060000]            	mov	ebp, txt_yellow
   267 000001E1 E81B040000               	call	print_text
   268                                  
   269 000001E6 E8DB030000              	call	waitforkey
   270                                  
   271                                  	; full screen replace color (replace black colors)
   272 000001EB 31C9                    	xor	ecx, ecx ; 0 ; BLACK
   273 000001ED BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   274 000001F2 B30C                    	mov	bl, 0Ch
   275                                  	sys	_video
   275                              <1> 
   275                              <1> 
   275                              <1> 
   275                              <1> 
   275                              <1>  %if %0 >= 2
   275                              <1>  mov ebx, %2
   275                              <1>  %if %0 >= 3
   275                              <1>  mov ecx, %3
   275                              <1>  %if %0 = 4
   275                              <1>  mov edx, %4
   275                              <1>  %endif
   275                              <1>  %endif
   275                              <1>  %endif
   275 000001F4 B81F000000          <1>  mov eax, %1
   275                              <1> 
   275 000001F9 CD40                <1>  int 40h
   276                                  
   277 000001FB E8C6030000              	call	waitforkey
   278                                  	
   279                                  	; full screen replace color (replace yellow colors)
   280 00000200 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   281 00000205 29D2                    	sub	edx, edx ; 0 ; BLACK
   282                                  	;mov	bl, 0Ch
   283                                  	sys	_video
   283                              <1> 
   283                              <1> 
   283                              <1> 
   283                              <1> 
   283                              <1>  %if %0 >= 2
   283                              <1>  mov ebx, %2
   283                              <1>  %if %0 >= 3
   283                              <1>  mov ecx, %3
   283                              <1>  %if %0 = 4
   283                              <1>  mov edx, %4
   283                              <1>  %endif
   283                              <1>  %endif
   283                              <1>  %endif
   283 00000207 B81F000000          <1>  mov eax, %1
   283                              <1> 
   283 0000020C CD40                <1>  int 40h
   284                                  	
   285                                  	; full screen replace color (replace white colors)
   286 0000020E B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   287 00000213 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   288                                  	;mov	bl, 0Ch
   289                                  	sys	_video
   289                              <1> 
   289                              <1> 
   289                              <1> 
   289                              <1> 
   289                              <1>  %if %0 >= 2
   289                              <1>  mov ebx, %2
   289                              <1>  %if %0 >= 3
   289                              <1>  mov ecx, %3
   289                              <1>  %if %0 = 4
   289                              <1>  mov edx, %4
   289                              <1>  %endif
   289                              <1>  %endif
   289                              <1>  %endif
   289 00000218 B81F000000          <1>  mov eax, %1
   289                              <1> 
   289 0000021D CD40                <1>  int 40h
   290                                  
   291                                  	; now screen color is black and text color is yellow
   292                                  
   293 0000021F E8A2030000              	call	waitforkey
   294                                  
   295                                  	; Full screen copy
   296 00000224 BE[24070000]            	mov	esi, fullscreen_buffer
   297 00000229 89F7                    	mov	edi, esi
   298                                  
   299                                  	; Black
   300 0000022B B900190000              	mov	ecx, 640*10
   301 00000230 31C0                    	xor	eax, eax ; black
   302                                  _l1s1:
   303 00000232 66AB                    	stosw
   304 00000234 AA                      	stosb
   305 00000235 E2FB                    	loop	_l1s1
   306                                  
   307                                  	; White
   308 00000237 B9800C0000              	mov	ecx, 640*5
   309 0000023C B8FFFFFF00              	mov	eax, 0FFFFFFh
   310                                  _l1w1:
   311 00000241 66AB                    	stosw
   312 00000243 AA                      	stosb
   313 00000244 E2FB                    	loop	_l1w1
   314                                  
   315                                  	; Black
   316 00000246 B9800C0000              	mov	ecx, 640*5
   317 0000024B 31C0                    	xor	eax, eax ; black
   318                                  _l1s2:
   319 0000024D 66AB                    	stosw
   320 0000024F AA                      	stosb
   321 00000250 E2FB                    	loop	_l1s2
   322                                  
   323                                  	; Blue
   324 00000252 B900130100              	mov	ecx, 640*110
   325                                  	;xor	eax, eax
   326                                  _l1b:
   327 00000257 B0FF                    	mov	al, 0FFh
   328 00000259 AA                      	stosb
   329 0000025A 30C0                    	xor	al, al
   330 0000025C 66AB                    	stosw	
   331 0000025E E2F7                    	loop	_l1b
   332                                  
   333                                  	; Red
   334 00000260 B900130100              	mov	ecx, 640*110
   335                                  	;xor	eax, eax
   336                                  _l1r:
   337 00000265 66AB                    	stosw
   338 00000267 B0FF                    	mov	al, 0FFh
   339 00000269 AA                      	stosb
   340 0000026A 30C0                    	xor	al, al
   341 0000026C E2F7                    	loop	_l1r
   342                                  
   343                                  	; Green
   344 0000026E B900130100              	mov	ecx, 640*110
   345                                  	;xor	eax, eax
   346                                  _l1g:
   347 00000273 AA                      	stosb
   348 00000274 B0FF                    	mov	al, 0FFh
   349 00000276 66AB                    	stosw
   350 00000278 30C0                    	xor	al, al
   351 0000027A E2F7                    	loop	_l1g
   352                                  
   353                                  	; Yellow
   354 0000027C B900130100              	mov	ecx, 640*110
   355 00000281 B4FF                    	mov	ah, 0FFh
   356                                  _l1y:
   357 00000283 30C0                    	xor	al, al
   358 00000285 AA                      	stosb
   359 00000286 B0FF                    	mov	al, 0FFh
   360 00000288 66AB                    	stosw
   361 0000028A E2F7                    	loop	_l1y
   362                                  
   363                                  	; Black
   364 0000028C B9800C0000              	mov	ecx, 640*5
   365 00000291 31C0                    	xor	eax, eax ; black
   366                                  _l1s3:
   367 00000293 66AB                    	stosw
   368 00000295 AA                      	stosb
   369 00000296 E2FB                    	loop	_l1s3
   370                                  
   371                                  	; White
   372 00000298 B9800C0000              	mov	ecx, 640*5
   373 0000029D B8FFFFFF00              	mov	eax, 0FFFFFFh
   374                                  _l1w2:
   375 000002A2 66AB                    	stosw
   376 000002A4 AA                      	stosb
   377 000002A5 E2FB                    	loop	_l1w2
   378                                  
   379                                  	; Black
   380 000002A7 B900190000              	mov	ecx, 640*10
   381 000002AC 31C0                    	xor	eax, eax ; black
   382                                  _l1s4:
   383 000002AE 66AB                    	stosw
   384 000002B0 AA                      	stosb
   385 000002B1 E2FB                    	loop	_l1s4
   386                                  
   387 000002B3 BB00020000              	mov	ebx, 0200h ; Full screen copy
   388                                  	sys	_video
   388                              <1> 
   388                              <1> 
   388                              <1> 
   388                              <1> 
   388                              <1>  %if %0 >= 2
   388                              <1>  mov ebx, %2
   388                              <1>  %if %0 >= 3
   388                              <1>  mov ecx, %3
   388                              <1>  %if %0 = 4
   388                              <1>  mov edx, %4
   388                              <1>  %endif
   388                              <1>  %endif
   388                              <1>  %endif
   388 000002B8 B81F000000          <1>  mov eax, %1
   388                              <1> 
   388 000002BD CD40                <1>  int 40h
   389                                  
   390 000002BF E802030000              	call	waitforkey
   391                                  
   392 000002C4 C705[20070000]FFFF-     	mov	dword [tcolor], 0FFFFFFh
   392 000002CC FF00               
   393                                  
   394 000002CE BE2B002B00              	mov	esi, 43*65536+43
   395 000002D3 BD[BF060000]            	mov	ebp, txt_blue
   396 000002D8 E824030000               	call	print_text
   397                                  	
   398 000002DD E8E4020000              	call	waitforkey
   399                                  
   400 000002E2 BE2B009900              	mov	esi, 153*65536+43
   401 000002E7 BD[C4060000]            	mov	ebp, txt_red
   402 000002EC E810030000               	call	print_text
   403                                  	
   404 000002F1 E8D0020000              	call	waitforkey
   405                                  
   406 000002F6 BE2B000701              	mov	esi, 263*65536+43
   407 000002FB BD[C8060000]            	mov	ebp, txt_green
   408 00000300 E8FC020000               	call	print_text
   409                                  	
   410 00000305 E8BC020000              	call	waitforkey
   411                                  
   412 0000030A BE2B007501              	mov	esi, 373*65536+43
   413 0000030F BD[CE060000]            	mov	ebp, txt_yellow
   414 00000314 E8E8020000               	call	print_text
   415                                  	
   416 00000319 E8A8020000              	call	waitforkey
   417                                  
   418 0000031E C705[20070000]0000-     	mov	dword [tcolor], 0
   418 00000326 0000               
   419                                  
   420 00000328 BE2B000701              	mov	esi, 263*65536+43
   421 0000032D BD[C8060000]            	mov	ebp, txt_green
   422 00000332 E8CA020000               	call	print_text
   423                                  	
   424 00000337 E88A020000              	call	waitforkey
   425                                  
   426 0000033C BE2B007501              	mov	esi, 373*65536+43
   427 00000341 BD[CE060000]            	mov	ebp, txt_yellow
   428 00000346 E8B6020000               	call	print_text
   429                                  	
   430 0000034B E876020000              	call	waitforkey
   431                                  
   432                                  	; screen copy and replace window sub functions
   433                                  
   434                                  	; fill white color in 1st 20 rows 
   435                                  	; in user's fullscreen buff
   436 00000350 BF[24070000]            	mov	edi, fullscreen_buffer
   437 00000355 B900320000              	mov	ecx, 20*640
   438 0000035A B8FFFFFF00              	mov	eax, 0FFFFFFh
   439                                  _l2w1:
   440 0000035F 66AB                    	stosw
   441 00000361 AA                      	stosb
   442 00000362 E2FB                    	loop	_l2w1
   443                                   
   444                                  	; fill red color to 440 rows after white rows  
   445 00000364 B9004C0400              	mov	ecx, 440*640
   446                                  	;mov	eax, 0FF0000h ; RED
   447                                  _l2r:
   448 00000369 31C0                    	xor	eax, eax
   449 0000036B 66AB                    	stosw
   450 0000036D B0FF                    	mov	al, 0FFh
   451 0000036F AA                      	stosb
   452 00000370 E2F7                    	loop	_l2r
   453                                  
   454                                  	; fill white color in last 20 rows
   455 00000372 B900320000              	mov	ecx, 20*640
   456 00000377 B8FFFFFF00              	mov	eax, 0FFFFFFh
   457                                  _l2w2:
   458 0000037C 66AB                    	stosw
   459 0000037E AA                      	stosb
   460 0000037F E2FB                    	loop	_l2w2
   461                                  
   462                                  	; copy blue block (on screen) to user buffer
   463                                  	; (overwrites red colors partially)
   464 00000381 BF[9C9D0000]            	mov	edi, fullscreen_buffer + ((20*640)+40)*3
   465 00000386 B928001400              	mov	ecx, 20*65536+40 ; column 40, row 20
   466 0000038B BAA0006E00              	mov	edx, 110*65536+160 ; size: 110*160
   467 00000390 BB41020000              	mov	ebx, 0241h ; system to user window copy
   468                                  	;mov	bl, 41h
   469                                  	sys	_video	
   469                              <1> 
   469                              <1> 
   469                              <1> 
   469                              <1> 
   469                              <1>  %if %0 >= 2
   469                              <1>  mov ebx, %2
   469                              <1>  %if %0 >= 3
   469                              <1>  mov ecx, %3
   469                              <1>  %if %0 = 4
   469                              <1>  mov edx, %4
   469                              <1>  %endif
   469                              <1>  %endif
   469                              <1>  %endif
   469 00000395 B81F000000          <1>  mov eax, %1
   469                              <1> 
   469 0000039A CD40                <1>  int 40h
   470                                  
   471                                  	; Replace white color (text) only in blue block
   472                                  	; (blue block starts at row 20)
   473                                  	
   474 0000039C B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   475 000003A1 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   476 000003A3 BE28001400              	mov	esi, 20*65536+40 ; column 40, row 20
   477 000003A8 BFA0006E00              	mov	edi, 110*65536+160 ; size: 110*160 
   478                                  	;mov	ebx, 021Ch ; Replace color in window
   479 000003AD B31C                    	mov	bl, 1Ch
   480                                  	sys	_video
   480                              <1> 
   480                              <1> 
   480                              <1> 
   480                              <1> 
   480                              <1>  %if %0 >= 2
   480                              <1>  mov ebx, %2
   480                              <1>  %if %0 >= 3
   480                              <1>  mov ecx, %3
   480                              <1>  %if %0 = 4
   480                              <1>  mov edx, %4
   480                              <1>  %endif
   480                              <1>  %endif
   480                              <1>  %endif
   480 000003AF B81F000000          <1>  mov eax, %1
   480                              <1> 
   480 000003B4 CD40                <1>  int 40h
   481                                  
   482 000003B6 E80B020000              	call	waitforkey
   483                                  
   484                                  	; copy red block (on screen) to user buffer
   485 000003BB BF[9CD60300]            	mov	edi, fullscreen_buffer + ((130*640)+40)*3
   486 000003C0 B928008200              	mov	ecx, 130*65536+40 ; column 40, row 130
   487 000003C5 BA78006E00              	mov	edx, 110*65536+120 ; size: 110*120
   488                                  	;mov	ebx, 0241h ; system to user window copy
   489 000003CA B341                    	mov	bl, 41h
   490                                  	sys	_video	
   490                              <1> 
   490                              <1> 
   490                              <1> 
   490                              <1> 
   490                              <1>  %if %0 >= 2
   490                              <1>  mov ebx, %2
   490                              <1>  %if %0 >= 3
   490                              <1>  mov ecx, %3
   490                              <1>  %if %0 = 4
   490                              <1>  mov edx, %4
   490                              <1>  %endif
   490                              <1>  %endif
   490                              <1>  %endif
   490 000003CC B81F000000          <1>  mov eax, %1
   490                              <1> 
   490 000003D1 CD40                <1>  int 40h
   491                                  
   492                                  	; Replace white color (text) only in red block
   493                                  	; (red block starts at row 130)
   494                                  	
   495 000003D3 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   496 000003D8 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   497 000003DA BE28008200              	mov	esi, 130*65536+40 ; column 40, row 130
   498 000003DF BF78006E00              	mov	edi, 110*65536+120 ; size: 110*120 
   499                                  	;mov	ebx, 021Ch ; Replace color in window
   500 000003E4 B31C                    	mov	bl, 1Ch
   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 000003E6 B81F000000          <1>  mov eax, %1
   501                              <1> 
   501 000003EB CD40                <1>  int 40h
   502                                  
   503                                  	; copy yellow block (on screen) to user buffer
   504 000003ED BF[24480A00]            	mov	edi, fullscreen_buffer + (350*640)*3
   505 000003F2 B900005E01              	mov	ecx, 350*65536+0 ; column 0, row 350
   506 000003F7 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   507                                  	;mov	ebx, 0241h ; system to user window copy
   508 000003FC B341                    	mov	bl, 41h
   509                                  	sys	_video		
   509                              <1> 
   509                              <1> 
   509                              <1> 
   509                              <1> 
   509                              <1>  %if %0 >= 2
   509                              <1>  mov ebx, %2
   509                              <1>  %if %0 >= 3
   509                              <1>  mov ecx, %3
   509                              <1>  %if %0 = 4
   509                              <1>  mov edx, %4
   509                              <1>  %endif
   509                              <1>  %endif
   509                              <1>  %endif
   509 000003FE B81F000000          <1>  mov eax, %1
   509                              <1> 
   509 00000403 CD40                <1>  int 40h
   510                                  
   511                                  	; copy green block (on screen) to user buffer
   512 00000405 BF[240F0700]            	mov	edi, fullscreen_buffer + (240*640)*3
   513 0000040A B90000F000              	mov	ecx, 240*65536+0 ; column 0, row 240
   514 0000040F BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   515                                  	;;mov	ebx, 0241h ; system to user window copy
   516                                  	;mov	bl, 41h
   517                                  	sys	_video
   517                              <1> 
   517                              <1> 
   517                              <1> 
   517                              <1> 
   517                              <1>  %if %0 >= 2
   517                              <1>  mov ebx, %2
   517                              <1>  %if %0 >= 3
   517                              <1>  mov ecx, %3
   517                              <1>  %if %0 = 4
   517                              <1>  mov edx, %4
   517                              <1>  %endif
   517                              <1>  %endif
   517                              <1>  %endif
   517 00000414 B81F000000          <1>  mov eax, %1
   517                              <1> 
   517 00000419 CD40                <1>  int 40h
   518                                  
   519 0000041B E8A6010000              	call	waitforkey
   520                                  
   521                                  	; copy yellow block to red block position
   522                                  	; and green block to blue block position on screen
   523                                  	; (system to system copy)
   524                                  	
   525                                  	; copy yellow block (overwrite red block)
   526 00000420 B900005E01              	mov	ecx, 350*65536 ; column 0, row 350
   527 00000425 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   528 0000042A BE00008200              	mov	esi, 130*65536
   529                                  	;mov	ebx, 020Dh ; system to system window copy
   530 0000042F B30D                    	mov	bl, 0Dh
   531                                  	sys	_video	
   531                              <1> 
   531                              <1> 
   531                              <1> 
   531                              <1> 
   531                              <1>  %if %0 >= 2
   531                              <1>  mov ebx, %2
   531                              <1>  %if %0 >= 3
   531                              <1>  mov ecx, %3
   531                              <1>  %if %0 = 4
   531                              <1>  mov edx, %4
   531                              <1>  %endif
   531                              <1>  %endif
   531                              <1>  %endif
   531 00000431 B81F000000          <1>  mov eax, %1
   531                              <1> 
   531 00000436 CD40                <1>  int 40h
   532                                  
   533 00000438 E889010000              	call	waitforkey
   534                                  
   535                                  	; copy green block (overwrite blue block)
   536 0000043D B90000F000              	mov	ecx, 240*65536 ; column 0, row 240
   537 00000442 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   538 00000447 BE00001400              	mov	esi, 20*65536
   539                                  	;;mov	ebx, 020Dh ; system to system window copy
   540                                  	;mov	bl, 0Dh
   541                                  	sys	_video	
   541                              <1> 
   541                              <1> 
   541                              <1> 
   541                              <1> 
   541                              <1>  %if %0 >= 2
   541                              <1>  mov ebx, %2
   541                              <1>  %if %0 >= 3
   541                              <1>  mov ecx, %3
   541                              <1>  %if %0 = 4
   541                              <1>  mov edx, %4
   541                              <1>  %endif
   541                              <1>  %endif
   541                              <1>  %endif
   541 0000044C B81F000000          <1>  mov eax, %1
   541                              <1> 
   541 00000451 CD40                <1>  int 40h
   542                                  
   543 00000453 E86E010000              	call	waitforkey
   544                                  
   545                                  	; fill blue block on yellow block position	
   546 00000458 B9FF000000              	mov	ecx, 0FFh
   547 0000045D BA00005E01              	mov	edx, 350*65536+0 
   548 00000462 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   549                                  	;mov	ebx, 0211h ; new color, window
   550 00000467 B311                    	mov	bl, 11h
   551                                  	sys	_video
   551                              <1> 
   551                              <1> 
   551                              <1> 
   551                              <1> 
   551                              <1>  %if %0 >= 2
   551                              <1>  mov ebx, %2
   551                              <1>  %if %0 >= 3
   551                              <1>  mov ecx, %3
   551                              <1>  %if %0 = 4
   551                              <1>  mov edx, %4
   551                              <1>  %endif
   551                              <1>  %endif
   551                              <1>  %endif
   551 00000469 B81F000000          <1>  mov eax, %1
   551                              <1> 
   551 0000046E CD40                <1>  int 40h
   552                                  
   553 00000470 E851010000              	call	waitforkey
   554                                  
   555                                  	; fill red block on green block position	
   556 00000475 B90000FF00              	mov	ecx, 0FF0000h
   557 0000047A BA0000F000              	mov	edx, 240*65536+0 
   558 0000047F BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   559                                  	;;mov	ebx, 0211h ; new color, window
   560                                  	;mov	bl, 11h
   561                                  	sys	_video
   561                              <1> 
   561                              <1> 
   561                              <1> 
   561                              <1> 
   561                              <1>  %if %0 >= 2
   561                              <1>  mov ebx, %2
   561                              <1>  %if %0 >= 3
   561                              <1>  mov ecx, %3
   561                              <1>  %if %0 = 4
   561                              <1>  mov edx, %4
   561                              <1>  %endif
   561                              <1>  %endif
   561                              <1>  %endif
   561 00000484 B81F000000          <1>  mov eax, %1
   561                              <1> 
   561 00000489 CD40                <1>  int 40h
   562                                  
   563 0000048B E836010000              	call	waitforkey
   564                                  
   565                                  	; copy	blocks to system from user's buffer
   566 00000490 BE[E1060000]            	mov	esi, blockdatabuffer ; 32+32 bits
   567 00000495 B9FF000000              	mov	ecx, 0FFh
   568 0000049A BA07000000              	mov	edx, 7 ; 7 blocks
   569                                   	;mov	ebx, 022Dh ; indirect pixel blocks
   570 0000049F B32D                    	mov	bl, 2Dh
   571                                   	sys	_video
   571                              <1> 
   571                              <1> 
   571                              <1> 
   571                              <1> 
   571                              <1>  %if %0 >= 2
   571                              <1>  mov ebx, %2
   571                              <1>  %if %0 >= 3
   571                              <1>  mov ecx, %3
   571                              <1>  %if %0 = 4
   571                              <1>  mov edx, %4
   571                              <1>  %endif
   571                              <1>  %endif
   571                              <1>  %endif
   571 000004A1 B81F000000          <1>  mov eax, %1
   571                              <1> 
   571 000004A6 CD40                <1>  int 40h
   572                                  
   573 000004A8 E819010000              	call	waitforkey
   574                                  
   575                                  	; replace color
   576 000004AD B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW (current color)
   577 000004B2 BAFF000000              	mov	edx, 0FFh ; BLUE (new color)
   578 000004B7 BE00008200              	mov	esi, 130*65536 ; column 0, row 130
   579 000004BC BF80026E00              	mov	edi, 110*65536+640 ; size: 110*640
   580                                  	;mov	ebx, 021Ch ; Replace color in window
   581 000004C1 B31C                    	mov	bl, 1Ch
   582                                  	sys	_video
   582                              <1> 
   582                              <1> 
   582                              <1> 
   582                              <1> 
   582                              <1>  %if %0 >= 2
   582                              <1>  mov ebx, %2
   582                              <1>  %if %0 >= 3
   582                              <1>  mov ecx, %3
   582                              <1>  %if %0 = 4
   582                              <1>  mov edx, %4
   582                              <1>  %endif
   582                              <1>  %endif
   582                              <1>  %endif
   582 000004C3 B81F000000          <1>  mov eax, %1
   582                              <1> 
   582 000004C8 CD40                <1>  int 40h
   583                                  
   584 000004CA E8F7000000              	call	waitforkey
   585                                  
   586                                  	; copy blue block (with 'blue" text)
   587                                  	; from users full screen buffer to system
   588                                  	; (to its old position)
   589                                  	
   590 000004CF B928001400              	mov	ecx, 20*65536+40
   591 000004D4 BAA0006E00              	mov	edx, 110*65536+160
   592 000004D9 BE[9C9D0000]            	mov	esi, fullscreen_buffer+((20*640)+40)*3
   593                                  	;mov	ebx, 0210h ; copy from user to sys 
   594 000004DE B310                    	mov	bl, 10h
   595                                  	sys	_video
   595                              <1> 
   595                              <1> 
   595                              <1> 
   595                              <1> 
   595                              <1>  %if %0 >= 2
   595                              <1>  mov ebx, %2
   595                              <1>  %if %0 >= 3
   595                              <1>  mov ecx, %3
   595                              <1>  %if %0 = 4
   595                              <1>  mov edx, %4
   595                              <1>  %endif
   595                              <1>  %endif
   595                              <1>  %endif
   595 000004E0 B81F000000          <1>  mov eax, %1
   595                              <1> 
   595 000004E5 CD40                <1>  int 40h
   596                                  
   597                                  	; copy blue block to usr's buffer again
   598 000004E7 B900001400              	mov	ecx, 20*65536
   599 000004EC BA80026E00              	mov	edx, 110*65536+640
   600 000004F1 BF[249D0000]            	mov	edi, fullscreen_buffer+(20*640)*3
   601                                  	;mov	ebx, 0241h ; copy from sys to user
   602 000004F6 B341                    	mov	bl, 41h 
   603                                  	sys	_video
   603                              <1> 
   603                              <1> 
   603                              <1> 
   603                              <1> 
   603                              <1>  %if %0 >= 2
   603                              <1>  mov ebx, %2
   603                              <1>  %if %0 >= 3
   603                              <1>  mov ecx, %3
   603                              <1>  %if %0 = 4
   603                              <1>  mov edx, %4
   603                              <1>  %endif
   603                              <1>  %endif
   603                              <1>  %endif
   603 000004F8 B81F000000          <1>  mov eax, %1
   603                              <1> 
   603 000004FD CD40                <1>  int 40h
   604                                  
   605 000004FF E8C2000000              	call	waitforkey
   606                                  
   607                                  	; fill red block on red block position	
   608 00000504 B90000FF00              	mov	ecx, 0FF0000h  ;RED
   609 00000509 BA00008200              	mov	edx, 130*65536+0 
   610 0000050E BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   611                                  	;mov	ebx, 0211h ; new color, window
   612 00000513 B311                    	mov	bl, 11h
   613                                  	sys	_video
   613                              <1> 
   613                              <1> 
   613                              <1> 
   613                              <1> 
   613                              <1>  %if %0 >= 2
   613                              <1>  mov ebx, %2
   613                              <1>  %if %0 >= 3
   613                              <1>  mov ecx, %3
   613                              <1>  %if %0 = 4
   613                              <1>  mov edx, %4
   613                              <1>  %endif
   613                              <1>  %endif
   613                              <1>  %endif
   613 00000515 B81F000000          <1>  mov eax, %1
   613                              <1> 
   613 0000051A CD40                <1>  int 40h
   614                                  
   615 0000051C E8A5000000              	call	waitforkey
   616                                  
   617                                  	; copy red block (with 'red" text)
   618                                  	; from users full screen buffer to system
   619                                  	; (to its old position)
   620 00000521 B928008200              	mov	ecx, 130*65536+40
   621 00000526 BA78006E00              	mov	edx, 110*65536+120
   622 0000052B BE[9CD60300]            	mov	esi, fullscreen_buffer+((130*640)+40)*3
   623                                  	;mov	ebx, 0210h ; copy from user to sys 
   624 00000530 B310                    	mov	bl, 10h
   625                                  	sys	_video
   625                              <1> 
   625                              <1> 
   625                              <1> 
   625                              <1> 
   625                              <1>  %if %0 >= 2
   625                              <1>  mov ebx, %2
   625                              <1>  %if %0 >= 3
   625                              <1>  mov ecx, %3
   625                              <1>  %if %0 = 4
   625                              <1>  mov edx, %4
   625                              <1>  %endif
   625                              <1>  %endif
   625                              <1>  %endif
   625 00000532 B81F000000          <1>  mov eax, %1
   625                              <1> 
   625 00000537 CD40                <1>  int 40h
   626                                  
   627                                  	; copy red block to usr's buffer again
   628 00000539 B900008200              	mov	ecx, 130*65536
   629 0000053E BA80026E00              	mov	edx, 110*65536+640
   630 00000543 BF[24D60300]            	mov	edi, fullscreen_buffer+(130*640)*3
   631                                  	;mov	ebx, 0241h ; copy from sys to user 
   632 00000548 B341                    	mov	bl, 41h
   633                                  	sys	_video
   633                              <1> 
   633                              <1> 
   633                              <1> 
   633                              <1> 
   633                              <1>  %if %0 >= 2
   633                              <1>  mov ebx, %2
   633                              <1>  %if %0 >= 3
   633                              <1>  mov ecx, %3
   633                              <1>  %if %0 = 4
   633                              <1>  mov edx, %4
   633                              <1>  %endif
   633                              <1>  %endif
   633                              <1>  %endif
   633 0000054A B81F000000          <1>  mov eax, %1
   633                              <1> 
   633 0000054F CD40                <1>  int 40h
   634                                  
   635 00000551 E870000000              	call	waitforkey
   636                                  
   637                                  	; replace color (full screen)
   638 00000556 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   639 0000055B 31D2                    	xor	edx, edx ; 0 ; BLACK (new color)
   640                                  	;mov	ebx, 020Ch ; Replace color on screen
   641 0000055D B30C                    	mov	bl, 0Ch
   642                                  	sys	_video
   642                              <1> 
   642                              <1> 
   642                              <1> 
   642                              <1> 
   642                              <1>  %if %0 >= 2
   642                              <1>  mov ebx, %2
   642                              <1>  %if %0 >= 3
   642                              <1>  mov ecx, %3
   642                              <1>  %if %0 = 4
   642                              <1>  mov edx, %4
   642                              <1>  %endif
   642                              <1>  %endif
   642                              <1>  %endif
   642 0000055F B81F000000          <1>  mov eax, %1
   642                              <1> 
   642 00000564 CD40                <1>  int 40h
   643                                  
   644 00000566 E85B000000              	call	waitforkey
   645                                  
   646                                  	; copy full screen buffer to screen
   647 0000056B BE[24070000]            	mov	esi, fullscreen_buffer
   648                                  	;mov	ebx, 0200h
   649 00000570 B300                    	mov	bl, 0
   650                                  	sys	_video
   650                              <1> 
   650                              <1> 
   650                              <1> 
   650                              <1> 
   650                              <1>  %if %0 >= 2
   650                              <1>  mov ebx, %2
   650                              <1>  %if %0 >= 3
   650                              <1>  mov ecx, %3
   650                              <1>  %if %0 = 4
   650                              <1>  mov edx, %4
   650                              <1>  %endif
   650                              <1>  %endif
   650                              <1>  %endif
   650 00000572 B81F000000          <1>  mov eax, %1
   650                              <1> 
   650 00000577 CD40                <1>  int 40h
   651                                  
   652                                  	; erase full screen buffer
   653 00000579 B900840300              	mov	ecx, (640*480)*3/4
   654 0000057E 31C0                    	xor	eax, eax
   655 00000580 89F7                    	mov	edi, esi ; fullscreen_buffer
   656 00000582 F3AB                    	rep	stosd
   657                                  
   658 00000584 E83D000000              	call	waitforkey
   659                                  
   660                                  	; copy (full) screen to full screen buffer
   661 00000589 BF[24070000]            	mov	edi, fullscreen_buffer
   662                                  	;mov	ebx, 0240h ; copy from sys to user 
   663 0000058E B340                    	mov	bl, 40h
   664                                  	sys	_video
   664                              <1> 
   664                              <1> 
   664                              <1> 
   664                              <1> 
   664                              <1>  %if %0 >= 2
   664                              <1>  mov ebx, %2
   664                              <1>  %if %0 >= 3
   664                              <1>  mov ecx, %3
   664                              <1>  %if %0 = 4
   664                              <1>  mov edx, %4
   664                              <1>  %endif
   664                              <1>  %endif
   664                              <1>  %endif
   664 00000590 B81F000000          <1>  mov eax, %1
   664                              <1> 
   664 00000595 CD40                <1>  int 40h
   665                                  
   666                                  	; full screen NOT operation
   667                                  	;mov	ebx, 0207h
   668 00000597 B307                    	mov	bl, 07h
   669                                  	sys	_video
   669                              <1> 
   669                              <1> 
   669                              <1> 
   669                              <1> 
   669                              <1>  %if %0 >= 2
   669                              <1>  mov ebx, %2
   669                              <1>  %if %0 >= 3
   669                              <1>  mov ecx, %3
   669                              <1>  %if %0 = 4
   669                              <1>  mov edx, %4
   669                              <1>  %endif
   669                              <1>  %endif
   669                              <1>  %endif
   669 00000599 B81F000000          <1>  mov eax, %1
   669                              <1> 
   669 0000059E CD40                <1>  int 40h
   670                                  
   671 000005A0 E821000000              	call	waitforkey
   672                                  
   673                                  	; copy full screen buffer to screen
   674 000005A5 BE[24070000]            	mov	esi, fullscreen_buffer
   675                                  	;mov	ebx, 0200h
   676 000005AA 30DB                    	xor	bl, bl ; 0
   677                                  	sys	_video
   677                              <1> 
   677                              <1> 
   677                              <1> 
   677                              <1> 
   677                              <1>  %if %0 >= 2
   677                              <1>  mov ebx, %2
   677                              <1>  %if %0 >= 3
   677                              <1>  mov ecx, %3
   677                              <1>  %if %0 = 4
   677                              <1>  mov edx, %4
   677                              <1>  %endif
   677                              <1>  %endif
   677                              <1>  %endif
   677 000005AC B81F000000          <1>  mov eax, %1
   677                              <1> 
   677 000005B1 CD40                <1>  int 40h
   678                                  	
   679 000005B3 E80E000000              	call	waitforkey  
   680                                  		; wait for key stroke before exit
   681                                  terminate:
   682 000005B8 E82C000000              	call	set_text_mode
   683                                  	sys	_exit
   683                              <1> 
   683                              <1> 
   683                              <1> 
   683                              <1> 
   683                              <1>  %if %0 >= 2
   683                              <1>  mov ebx, %2
   683                              <1>  %if %0 >= 3
   683                              <1>  mov ecx, %3
   683                              <1>  %if %0 = 4
   683                              <1>  mov edx, %4
   683                              <1>  %endif
   683                              <1>  %endif
   683                              <1>  %endif
   683 000005BD B801000000          <1>  mov eax, %1
   683                              <1> 
   683 000005C2 CD40                <1>  int 40h
   684                                  halt:
   685 000005C4 EBFE                    	jmp	short halt
   686                                  
   687                                  waitforkey:
   688 000005C6 B401                    	mov	ah, 1
   689 000005C8 CD32                    	int	32h
   690 000005CA 740B                    	jz	short getkey
   691 000005CC FF05[1C070000]          	inc	dword [counter]
   692 000005D2 90                      	nop
   693 000005D3 90                      	nop
   694 000005D4 90                      	nop
   695 000005D5 EBEF                    	jmp	short waitforkey
   696                                  getkey:
   697 000005D7 30E4                    	xor	ah, ah
   698 000005D9 CD32                    	int	32h
   699                                  
   700 000005DB 663D032E                	cmp	ax, 2E03h
   701 000005DF 7405                    	je	short _terminate
   702 000005E1 3C1B                    	cmp	al, 1Bh ; ESC key
   703 000005E3 7401                    	je	short _terminate
   704 000005E5 C3                      	retn
   705                                  _terminate:
   706 000005E6 58                      	pop	eax ; return address
   707 000005E7 EBCF                    	jmp	short terminate
   708                                  	
   709                                  set_text_mode:
   710 000005E9 30E4                    	xor    ah, ah
   711 000005EB B003                    	mov    al, 3                        
   712                                   	;int   10h ; al = 03h text mode, int 10 video
   713 000005ED CD31                    	int    31h ; TRDOS 386 - Video interrupt
   714 000005EF C3                      	retn
   715                                  
   716                                  print_msg:
   717 000005F0 B40E                    	mov	ah, 0Eh
   718 000005F2 BB07000000              	mov	ebx, 7
   719                                  	;mov	bl, 7 ; char attribute & color
   720                                  p_next_chr:
   721 000005F7 AC                      	lodsb
   722 000005F8 08C0                    	or	al, al
   723 000005FA 7404                    	jz	short p_retn ; retn	
   724 000005FC CD31                    	int	31h
   725 000005FE EBF7                    	jmp	short p_next_chr
   726                                  p_retn:
   727 00000600 C3                      	retn
   728                                  
   729                                  print_text:
   730                                  	; ebp = text address
   731                                  	; esi = row/column position (si = column)
   732                                  p_d_x:
   733                                  	;mov	dh, 0 ; 8x16 system font
   734 00000601 B606                    	mov	dh, 6 ; 32*64 scaled font (base: 8*16 system font) 
   735                                  p_d_x_n:
   736 00000603 8A5500                  	mov	dl, [ebp]
   737 00000606 20D2                    	and	dl, dl
   738 00000608 7419                    	jz	short p_d_x_ok
   739                                  	sys	_video, 020Fh, [tcolor] 
   739                              <1> 
   739                              <1> 
   739                              <1> 
   739                              <1> 
   739                              <1>  %if %0 >= 2
   739 0000060A BB0F020000          <1>  mov ebx, %2
   739                              <1>  %if %0 >= 3
   739 0000060F 8B0D[20070000]      <1>  mov ecx, %3
   739                              <1>  %if %0 = 4
   739                              <1>  mov edx, %4
   739                              <1>  %endif
   739                              <1>  %endif
   739                              <1>  %endif
   739 00000615 B81F000000          <1>  mov eax, %1
   739                              <1> 
   739 0000061A CD40                <1>  int 40h
   740 0000061C 45                      	inc	ebp
   741 0000061D 6683C624                	add	si, 36 ; next char pos
   742 00000621 EBE0                    	jmp	short p_d_x_n
   743                                  p_d_x_ok:
   744 00000623 C3                      	retn
   745                                  
   746                                  program_msg:
   747 00000624 5452444F5320333836-     	db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Block Operations"
   747 0000062D 2076322E302E33202D-
   747 00000636 202827737973766964-
   747 0000063F 656F27292054657374-
   747 00000648 2050726F6772616D20-
   747 00000651 2D20426C6F636B204F-
   747 0000065A 7065726174696F6E73 
   748 00000663 0D0A                    	db 0Dh, 0Ah
   749 00000665 6279204572646F6761-     	db "by Erdogan Tan - 01/03/2021"
   749 0000066E 6E2054616E202D2030-
   749 00000677 312F30332F32303231 
   750                                  	;db 0Dh, 0Ah, 0
   751 00000680 0D0A0D0A                	db 0Dh, 0Ah, 0Dh, 0Ah
   752 00000684 507265737320616E79-     	db "Press any key to continue .."
   752 0000068D 206B657920746F2063-
   752 00000696 6F6E74696E7565202E-
   752 0000069F 2E                 
   753 000006A0 0D0A                    	db 0Dh, 0Ah	
   754 000006A2 285072657373204553-     	db "(Press ESC to exit) .."
   754 000006AB 4320746F2065786974-
   754 000006B4 29202E2E           
   755 000006B8 0D0A                    	db 0Dh, 0Ah
   756 000006BA 0D0A                    	db 0Dh, 0Ah
   757                                  
   758                                  nextline:
   759 000006BC 0D0A00                  	db 0Dh, 0Ah, 0
   760                                  
   761                                  txt_blue:
   762 000006BF 424C554500              	db "BLUE", 0
   763                                  txt_red:
   764 000006C4 52454400                	db "RED", 0
   765                                  txt_green:
   766 000006C8 475245454E00            	db "GREEN", 0
   767                                  txt_yellow:
   768 000006CE 59454C4C4F5700          	db "YELLOW", 0
   769                                  txt_white:
   770 000006D5 574849544500            	db "WHITE", 0
   771                                  txt_black:
   772 000006DB 424C41434B00            	db "BLACK", 0
   773                                  
   774                                  blockdatabuffer:
   775 000006E1 00001400                	dd	20*65536
   776 000006E5 28006E00                	dd	110*65536+40
   777 000006E9 C8008200                	dd	130*65536+200
   778 000006ED B8016E00                	dd	110*65536+440
   779 000006F1 28008200                	dd	130*65536+40
   780 000006F5 A0006E00                	dd	110*65536+160
   781 000006F9 00005E01                	dd	350*65536
   782 000006FD 80026E00                	dd	110*65536+640
   783 00000701 28001400                	dd	20*65536+40
   784 00000705 A0006E00                	dd	110*65536+160
   785 00000709 0000F000                	dd	240*65536
   786 0000070D 80026E00                	dd	110*65536+640
   787 00000711 C8001400                	dd	20*65536+200
   788 00000715 B8016E00                	dd	110*65536+440
   789 00000719 00                      	db	0		
   790                                  bss:
   791                                  
   792                                  ABSOLUTE bss
   793                                  
   794 0000071A <res 00000002>          alignb 4
   795                                  
   796                                  counter:
   797 0000071C <res 00000004>          	resd 1	
   798                                  
   799                                  bss_start:
   800 00000720 <res 00000004>          tcolor: resd 1
   801                                  
   802                                  fullscreen_buffer:
   803 00000724 <res 000E1000>          	resb 307200*3
   804                                  bss_end:
