     1                                  ; ****************************************************************************
     2                                  ; blocks13.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; 01/03/2021
     6                                  ;
     7                                  ; ****************************************************************************
     8                                  ; nasm blocks13.s -l blocks13.txt -o BLOCKS13.PRG -Z error.txt
     9                                  ; (modified from 'blocks12.s', 01/03/2021 & 'blocks10.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[0C070000]            	mov	edi, bss_start
    92 00000005 B901B00400              	mov	ecx, (bss_end - bss_start)/4
    93                                  	;xor	eax, eax
    94 0000000A F3AB                    	rep	stosd
    95                                  
    96                                  	; program message
    97 0000000C BE[0F060000]            	mov	esi, program_msg
    98 00000011 E8C5050000              	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                                  	; Get VESA VBE video bios number 
   106                                  	;	(vbe2 or vbe3, emulator or not)  
   107                                  	;mov	ebx, 0906h
   108                                  	;sys	_video
   109                                  	
   110                                  	; 01/03/2021
   111                                  	; get [truecolor] status (24bpp or 32bpp for VBE3 vbios)
   112 0000001A BB09090000              	mov	ebx, 0909h
   113                                  	sys	_video
   113                              <1> 
   113                              <1> 
   113                              <1> 
   113                              <1> 
   113                              <1>  %if %0 >= 2
   113                              <1>  mov ebx, %2
   113                              <1>  %if %0 >= 3
   113                              <1>  mov ecx, %3
   113                              <1>  %if %0 = 4
   113                              <1>  mov edx, %4
   113                              <1>  %endif
   113                              <1>  %endif
   113                              <1>  %endif
   113 0000001F B81F000000          <1>  mov eax, %1
   113                              <1> 
   113 00000024 CD40                <1>  int 40h
   114                                  
   115 00000026 B912010000              	mov	ecx, 112h ; VESA VBE video mode	(640x480, 24bpp)
   116                                  	
   117                                  	;cmp	ah, 3
   118                                  	;je	short set_vmode
   119                                  	;cmp	ah, 2
   120                                  	;;jne	terminate ; invalid !?
   121                                  	;jne	short set_vmode
   122                                  	;and	al, al
   123                                  	;jz	short set_vmode ; invalid !? (AL must be >= C0h.)
   124                                  	
   125                                  	; 01/03/2021
   126 0000002B 3C20                    	cmp	al, 32
   127 0000002D 7402                    	je	short set_vmode
   128                                  	
   129                                  	; VBE2 bios or default truecolor bpp is 24 bpp	
   130                                  	; so, we are using video mode 142h 
   131                                  	; (TRDOS 386 running in emulator or very old hardware!)
   132                                  	
   133                                  	; BOCHS/QEMU/VBOX emulator 
   134 0000002F B142                    	mov	cl, 42h ; Bochs/Plex86 video mode 142h
   135                                  			; (640*480, 32bpp) 		
   136                                  
   137                                  	; Set Video Mode to 112h ; 640x480, 32 bit true colors
   138                                  	;
   139                                  	; NOTE: NVIDIA GEFORCE FX 550 VIDEO BIOS uses 32bpp 
   140                                  	;       instead of 24bpp for same VBE video mode numbers. 
   141                                  	;       So, 112h is 640*480, 24bpp for BOCHS/QEMU emulator
   142                                  	;	but, it is 640*480, 32 bpp for real computer 
   143                                  	;	with NVIDIA graphics card and video bios. 
   144                                  	; (Also it is -it must be- 32bpp for other new hardware.)	  	
   145                                  
   146                                  	;sys	_video, 08FFh, 112h
   147                                  set_vmode:
   148                                  	; ecx = VESA VBE video mode
   149                                  	sys	_video, 08FFh
   149                              <1> 
   149                              <1> 
   149                              <1> 
   149                              <1> 
   149                              <1>  %if %0 >= 2
   149 00000031 BBFF080000          <1>  mov ebx, %2
   149                              <1>  %if %0 >= 3
   149                              <1>  mov ecx, %3
   149                              <1>  %if %0 = 4
   149                              <1>  mov edx, %4
   149                              <1>  %endif
   149                              <1>  %endif
   149                              <1>  %endif
   149 00000036 B81F000000          <1>  mov eax, %1
   149                              <1> 
   149 0000003B CD40                <1>  int 40h
   150 0000003D 09C0                    	or	eax, eax
   151                                  	;jz	short terminate
   152                                  	;mov	[LFB_ADDR], edx ; pointer to LFB info table/structure
   153 0000003F 7505                    	jnz	short set_vesa_mode_112h_ok
   154 00000041 E95D050000              	jmp	terminate
   155                                  
   156                                  set_vesa_mode_112h_ok:
   157 00000046 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; white
   158 0000004B BB01020000              	mov	ebx, 0201h ; Full screen, new color
   159                                  	sys	_video
   159                              <1> 
   159                              <1> 
   159                              <1> 
   159                              <1> 
   159                              <1>  %if %0 >= 2
   159                              <1>  mov ebx, %2
   159                              <1>  %if %0 >= 3
   159                              <1>  mov ecx, %3
   159                              <1>  %if %0 = 4
   159                              <1>  mov edx, %4
   159                              <1>  %endif
   159                              <1>  %endif
   159                              <1>  %endif
   159 00000050 B81F000000          <1>  mov eax, %1
   159                              <1> 
   159 00000055 CD40                <1>  int 40h
   160                                  
   161                                  	;mov	dword [tcolor], 0
   162 00000057 BEF000D000              	mov	esi, 208*65536+240
   163 0000005C BD[C0060000]            	mov	ebp, txt_white
   164 00000061 E886050000               	call	print_text
   165                                  
   166 00000066 E846050000              	call	waitforkey
   167                                  
   168                                  	; full screen replace color (replace black colors)
   169 0000006B 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   170 0000006D BA0000FF00              	mov	edx, 0FF0000h ; RED
   171 00000072 B30C                    	mov	bl, 0Ch
   172                                  	sys	_video
   172                              <1> 
   172                              <1> 
   172                              <1> 
   172                              <1> 
   172                              <1>  %if %0 >= 2
   172                              <1>  mov ebx, %2
   172                              <1>  %if %0 >= 3
   172                              <1>  mov ecx, %3
   172                              <1>  %if %0 = 4
   172                              <1>  mov edx, %4
   172                              <1>  %endif
   172                              <1>  %endif
   172                              <1>  %endif
   172 00000074 B81F000000          <1>  mov eax, %1
   172                              <1> 
   172 00000079 CD40                <1>  int 40h
   173                                  
   174 0000007B E831050000              	call	waitforkey
   175                                  
   176                                  	; full screen replace color (replace white colors)
   177 00000080 B9FFFFFF00              	mov	ecx, 0FFFFFFh  ; WHITE
   178 00000085 29D2                    	sub	edx, edx ; 0 ; BLACK
   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 00000087 B81F000000          <1>  mov eax, %1
   180                              <1> 
   180 0000008C CD40                <1>  int 40h
   181                                  	
   182                                  	; full screen replace color (replace red colors)
   183 0000008E B90000FF00              	mov	ecx, 0FF0000h ; RED
   184 00000093 BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   185                                  	;mov	bl, 0Ch
   186                                  	sys	_video
   186                              <1> 
   186                              <1> 
   186                              <1> 
   186                              <1> 
   186                              <1>  %if %0 >= 2
   186                              <1>  mov ebx, %2
   186                              <1>  %if %0 >= 3
   186                              <1>  mov ecx, %3
   186                              <1>  %if %0 = 4
   186                              <1>  mov edx, %4
   186                              <1>  %endif
   186                              <1>  %endif
   186                              <1>  %endif
   186 00000098 B81F000000          <1>  mov eax, %1
   186                              <1> 
   186 0000009D CD40                <1>  int 40h
   187                                  	
   188                                  	; now screen color is black and text color is white
   189                                  
   190 0000009F E80D050000              	call	waitforkey
   191                                  
   192                                  	; full screen - blue color 
   193                                  
   194 000000A4 B9FF000000              	mov	ecx, 0FFh  ; Blue
   195 000000A9 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   196                                  	sys	_video
   196                              <1> 
   196                              <1> 
   196                              <1> 
   196                              <1> 
   196                              <1>  %if %0 >= 2
   196                              <1>  mov ebx, %2
   196                              <1>  %if %0 >= 3
   196                              <1>  mov ecx, %3
   196                              <1>  %if %0 = 4
   196                              <1>  mov edx, %4
   196                              <1>  %endif
   196                              <1>  %endif
   196                              <1>  %endif
   196 000000AE B81F000000          <1>  mov eax, %1
   196                              <1> 
   196 000000B3 CD40                <1>  int 40h
   197                                  
   198 000000B5 C705[0C070000]FFFF-     	mov	dword [tcolor], 0FFFFFFh
   198 000000BD FF00               
   199 000000BF BE0201D000              	mov	esi, 208*65536+258
   200 000000C4 BD[AA060000]            	mov	ebp, txt_blue
   201 000000C9 E81E050000               	call	print_text
   202                                  
   203 000000CE E8DE040000              	call	waitforkey
   204                                  
   205                                  	; full screen replace color (replace white colors)
   206 000000D3 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   207 000000D8 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   208 000000DD B30C                    	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 000000DF B81F000000          <1>  mov eax, %1
   209                              <1> 
   209 000000E4 CD40                <1>  int 40h
   210                                  
   211 000000E6 E8C6040000              	call	waitforkey
   212                                  	
   213                                  	; full screen replace color (replace blue colors)
   214 000000EB B9FF000000              	mov	ecx, 0FFh ; BLUE
   215 000000F0 31D2                    	xor	edx, edx ; 0 ; BLACK
   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 000000F2 B81F000000          <1>  mov eax, %1
   217                              <1> 
   217 000000F7 CD40                <1>  int 40h
   218                                  	
   219                                  	; full screen replace color (replace yellow colors)
   220 000000F9 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   221 000000FE BAFF000000              	mov	edx, 0FFh ; BLUE
   222                                  	;mov	bl, 0Ch
   223                                  	sys	_video
   223                              <1> 
   223                              <1> 
   223                              <1> 
   223                              <1> 
   223                              <1>  %if %0 >= 2
   223                              <1>  mov ebx, %2
   223                              <1>  %if %0 >= 3
   223                              <1>  mov ecx, %3
   223                              <1>  %if %0 = 4
   223                              <1>  mov edx, %4
   223                              <1>  %endif
   223                              <1>  %endif
   223                              <1>  %endif
   223 00000103 B81F000000          <1>  mov eax, %1
   223                              <1> 
   223 00000108 CD40                <1>  int 40h
   224                                  
   225                                  	; now screen color is black and text color is blue
   226                                  
   227 0000010A E8A2040000              	call	waitforkey
   228                                  
   229 0000010F B90000FF00              	mov	ecx, 0FF0000h ; RED
   230 00000114 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   231                                  	sys	_video
   231                              <1> 
   231                              <1> 
   231                              <1> 
   231                              <1> 
   231                              <1>  %if %0 >= 2
   231                              <1>  mov ebx, %2
   231                              <1>  %if %0 >= 3
   231                              <1>  mov ecx, %3
   231                              <1>  %if %0 = 4
   231                              <1>  mov edx, %4
   231                              <1>  %endif
   231                              <1>  %endif
   231                              <1>  %endif
   231 00000119 B81F000000          <1>  mov eax, %1
   231                              <1> 
   231 0000011E CD40                <1>  int 40h
   232                                  
   233                                  	;mov	byte [tcolor], 0Fh
   234 00000120 BE1401D000              	mov	esi, 208*65536+276
   235 00000125 BD[AF060000]            	mov	ebp, txt_red
   236 0000012A E8BD040000               	call	print_text
   237                                  
   238 0000012F E87D040000              	call	waitforkey
   239                                  
   240                                  	; full screen replace color (replace white colors)
   241 00000134 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   242 00000139 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   243 0000013E B30C                    	mov	bl, 0Ch
   244                                  	sys	_video
   244                              <1> 
   244                              <1> 
   244                              <1> 
   244                              <1> 
   244                              <1>  %if %0 >= 2
   244                              <1>  mov ebx, %2
   244                              <1>  %if %0 >= 3
   244                              <1>  mov ecx, %3
   244                              <1>  %if %0 = 4
   244                              <1>  mov edx, %4
   244                              <1>  %endif
   244                              <1>  %endif
   244                              <1>  %endif
   244 00000140 B81F000000          <1>  mov eax, %1
   244                              <1> 
   244 00000145 CD40                <1>  int 40h
   245                                  
   246 00000147 E865040000              	call	waitforkey
   247                                  	
   248                                  	; full screen replace color (replace red colors)
   249 0000014C B90000FF00              	mov	ecx, 0FF0000h ; RED
   250 00000151 29D2                    	sub	edx, edx ; 0 ; BLACK
   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 00000153 B81F000000          <1>  mov eax, %1
   252                              <1> 
   252 00000158 CD40                <1>  int 40h
   253                                  	
   254                                  	; full screen replace color (replace yellow colors)
   255 0000015A B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   256 0000015F BA0000FF00              	mov	edx, 0FF0000h ; RED
   257                                  	;mov	bl, 0Ch
   258                                  	sys	_video
   258                              <1> 
   258                              <1> 
   258                              <1> 
   258                              <1> 
   258                              <1>  %if %0 >= 2
   258                              <1>  mov ebx, %2
   258                              <1>  %if %0 >= 3
   258                              <1>  mov ecx, %3
   258                              <1>  %if %0 = 4
   258                              <1>  mov edx, %4
   258                              <1>  %endif
   258                              <1>  %endif
   258                              <1>  %endif
   258 00000164 B81F000000          <1>  mov eax, %1
   258                              <1> 
   258 00000169 CD40                <1>  int 40h
   259                                  
   260                                  	; now screen color is black and text color is red
   261                                  
   262 0000016B E841040000              	call	waitforkey
   263                                  
   264                                  	; full screen - green color
   265                                  
   266 00000170 B900FF0000              	mov	ecx, 0FF00h ; green 
   267 00000175 BB01020000              	mov	ebx, 0201h ; Full screen, new color
   268                                  	sys	_video
   268                              <1> 
   268                              <1> 
   268                              <1> 
   268                              <1> 
   268                              <1>  %if %0 >= 2
   268                              <1>  mov ebx, %2
   268                              <1>  %if %0 >= 3
   268                              <1>  mov ecx, %3
   268                              <1>  %if %0 = 4
   268                              <1>  mov edx, %4
   268                              <1>  %endif
   268                              <1>  %endif
   268                              <1>  %endif
   268 0000017A B81F000000          <1>  mov eax, %1
   268                              <1> 
   268 0000017F CD40                <1>  int 40h
   269                                  
   270 00000181 C705[0C070000]0000-     	mov	dword [tcolor], 0
   270 00000189 0000               
   271 0000018B BEF000D000              	mov	esi, 208*65536+240
   272 00000190 BD[B3060000]            	mov	ebp, txt_green
   273 00000195 E852040000               	call	print_text
   274                                  
   275 0000019A E812040000              	call	waitforkey
   276                                  
   277                                  	; full screen replace color (replace black colors)
   278 0000019F 29C9                    	sub	ecx, ecx ; 0 ; BLACK
   279 000001A1 BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   280 000001A6 B30C                    	mov	bl, 0Ch
   281                                  	sys	_video
   281                              <1> 
   281                              <1> 
   281                              <1> 
   281                              <1> 
   281                              <1>  %if %0 >= 2
   281                              <1>  mov ebx, %2
   281                              <1>  %if %0 >= 3
   281                              <1>  mov ecx, %3
   281                              <1>  %if %0 = 4
   281                              <1>  mov edx, %4
   281                              <1>  %endif
   281                              <1>  %endif
   281                              <1>  %endif
   281 000001A8 B81F000000          <1>  mov eax, %1
   281                              <1> 
   281 000001AD CD40                <1>  int 40h
   282                                  
   283 000001AF E8FD030000              	call	waitforkey
   284                                  	
   285                                  	; full screen replace color (replace green colors)
   286 000001B4 B900FF0000              	mov	ecx, 0FF00h ; GREEN
   287 000001B9 31D2                    	xor	edx, edx ; 0 ; BLACK
   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 000001BB B81F000000          <1>  mov eax, %1
   289                              <1> 
   289 000001C0 CD40                <1>  int 40h
   290                                  	
   291                                  	; full screen replace color (replace white colors)
   292 000001C2 B9FFFFFF00              	mov	ecx, 0FFFFFFh  ; WHITE
   293 000001C7 BA00FF0000              	mov	edx, 0FF00h ; GREEN 
   294                                  	;mov	bl, 0Ch
   295                                  	sys	_video
   295                              <1> 
   295                              <1> 
   295                              <1> 
   295                              <1> 
   295                              <1>  %if %0 >= 2
   295                              <1>  mov ebx, %2
   295                              <1>  %if %0 >= 3
   295                              <1>  mov ecx, %3
   295                              <1>  %if %0 = 4
   295                              <1>  mov edx, %4
   295                              <1>  %endif
   295                              <1>  %endif
   295                              <1>  %endif
   295 000001CC B81F000000          <1>  mov eax, %1
   295                              <1> 
   295 000001D1 CD40                <1>  int 40h
   296                                  
   297                                  	; now screen color is black and text color is green
   298                                  
   299 000001D3 E8D9030000              	call	waitforkey
   300                                  
   301                                  	; full screen - yellow color
   302                                  
   303 000001D8 B90FF0FF0F              	mov	ecx, 0FFFF00Fh  ; yellow
   304 000001DD BB01020000              	mov	ebx, 0201h ; Full screen, new color
   305                                  	sys	_video
   305                              <1> 
   305                              <1> 
   305                              <1> 
   305                              <1> 
   305                              <1>  %if %0 >= 2
   305                              <1>  mov ebx, %2
   305                              <1>  %if %0 >= 3
   305                              <1>  mov ecx, %3
   305                              <1>  %if %0 = 4
   305                              <1>  mov edx, %4
   305                              <1>  %endif
   305                              <1>  %endif
   305                              <1>  %endif
   305 000001E2 B81F000000          <1>  mov eax, %1
   305                              <1> 
   305 000001E7 CD40                <1>  int 40h
   306                                  
   307                                  	;mov	dword [tcolor], 0
   308 000001E9 BEDE00D000              	mov	esi, 208*65536+222
   309 000001EE BD[B9060000]            	mov	ebp, txt_yellow
   310 000001F3 E8F4030000               	call	print_text
   311                                  
   312 000001F8 E8B4030000              	call	waitforkey
   313                                  
   314                                  	; full screen replace color (replace black colors)
   315 000001FD 31C9                    	xor	ecx, ecx ; 0 ; BLACK
   316 000001FF BAFFFFFF00              	mov	edx, 0FFFFFFh  ; WHITE
   317 00000204 B30C                    	mov	bl, 0Ch
   318                                  	sys	_video
   318                              <1> 
   318                              <1> 
   318                              <1> 
   318                              <1> 
   318                              <1>  %if %0 >= 2
   318                              <1>  mov ebx, %2
   318                              <1>  %if %0 >= 3
   318                              <1>  mov ecx, %3
   318                              <1>  %if %0 = 4
   318                              <1>  mov edx, %4
   318                              <1>  %endif
   318                              <1>  %endif
   318                              <1>  %endif
   318 00000206 B81F000000          <1>  mov eax, %1
   318                              <1> 
   318 0000020B CD40                <1>  int 40h
   319                                  
   320 0000020D E89F030000              	call	waitforkey
   321                                  	
   322                                  	; full screen replace color (replace yellow colors)
   323 00000212 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW
   324 00000217 29D2                    	sub	edx, edx ; 0 ; BLACK
   325                                  	;mov	bl, 0Ch
   326                                  	sys	_video
   326                              <1> 
   326                              <1> 
   326                              <1> 
   326                              <1> 
   326                              <1>  %if %0 >= 2
   326                              <1>  mov ebx, %2
   326                              <1>  %if %0 >= 3
   326                              <1>  mov ecx, %3
   326                              <1>  %if %0 = 4
   326                              <1>  mov edx, %4
   326                              <1>  %endif
   326                              <1>  %endif
   326                              <1>  %endif
   326 00000219 B81F000000          <1>  mov eax, %1
   326                              <1> 
   326 0000021E CD40                <1>  int 40h
   327                                  	
   328                                  	; full screen replace color (replace white colors)
   329 00000220 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE
   330 00000225 BA00FFFF00              	mov	edx, 0FFFF00h ; YELLOW
   331                                  	;mov	bl, 0Ch
   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 0000022A B81F000000          <1>  mov eax, %1
   332                              <1> 
   332 0000022F CD40                <1>  int 40h
   333                                  
   334                                  	; now screen color is black and text color is yellow
   335                                  
   336 00000231 E87B030000              	call	waitforkey
   337                                  
   338                                  	; Full screen copy
   339 00000236 BE[10070000]            	mov	esi, fullscreen_buffer
   340 0000023B 89F7                    	mov	edi, esi
   341                                  
   342                                  	; Black
   343 0000023D B900190000              	mov	ecx, 640*10
   344 00000242 31C0                    	xor	eax, eax ; black
   345 00000244 F3AB                    	rep	stosd
   346                                  
   347                                  	; White
   348 00000246 B9800C0000              	mov	ecx, 640*5
   349 0000024B B8FFFFFF00              	mov	eax, 0FFFFFFh
   350 00000250 F3AB                    	rep	stosd
   351                                  
   352                                  	; Black
   353 00000252 B9800C0000              	mov	ecx, 640*5
   354 00000257 31C0                    	xor	eax, eax ; black
   355 00000259 F3AB                    	rep	stosd
   356                                  
   357                                  	; Blue
   358 0000025B B900130100              	mov	ecx, 640*110
   359 00000260 B0FF                    	mov	al, 0FFh
   360 00000262 F3AB                    	rep	stosd
   361                                  
   362                                  	; Red
   363 00000264 B900130100              	mov	ecx, 640*110
   364 00000269 B80000FF00              	mov	eax, 0FF0000h
   365 0000026E F3AB                    	rep	stosd
   366                                  
   367                                  	; Green
   368 00000270 B900130100              	mov	ecx, 640*110
   369 00000275 B800FF0000              	mov	eax, 0FF00h
   370 0000027A F3AB                    	rep	stosd
   371                                  
   372                                  	; Yellow
   373 0000027C B900130100              	mov	ecx, 640*110
   374 00000281 B800FFFF00              	mov	eax, 0FFFF00h
   375 00000286 F3AB                    	rep	stosd
   376                                  
   377                                  	; Black
   378 00000288 B9800C0000              	mov	ecx, 640*5
   379 0000028D 31C0                    	xor	eax, eax ; black
   380 0000028F F3AB                    	rep	stosd
   381                                  
   382                                  	; White
   383 00000291 B9800C0000              	mov	ecx, 640*5
   384 00000296 B8FFFFFF00              	mov	eax, 0FFFFFFh
   385 0000029B F3AB                    	rep	stosd
   386                                  
   387                                  	; Black
   388 0000029D B900190000              	mov	ecx, 640*10
   389 000002A2 31C0                    	xor	eax, eax ; black
   390 000002A4 F3AB                    	rep	stosd
   391                                  
   392 000002A6 BB00020000              	mov	ebx, 0200h ; Full screen copy
   393                                  	sys	_video
   393                              <1> 
   393                              <1> 
   393                              <1> 
   393                              <1> 
   393                              <1>  %if %0 >= 2
   393                              <1>  mov ebx, %2
   393                              <1>  %if %0 >= 3
   393                              <1>  mov ecx, %3
   393                              <1>  %if %0 = 4
   393                              <1>  mov edx, %4
   393                              <1>  %endif
   393                              <1>  %endif
   393                              <1>  %endif
   393 000002AB B81F000000          <1>  mov eax, %1
   393                              <1> 
   393 000002B0 CD40                <1>  int 40h
   394                                  
   395 000002B2 E8FA020000              	call	waitforkey
   396                                  
   397 000002B7 C705[0C070000]FFFF-     	mov	dword [tcolor], 0FFFFFFh
   397 000002BF FF00               
   398                                  
   399 000002C1 BE2B002B00              	mov	esi, 43*65536+43
   400 000002C6 BD[AA060000]            	mov	ebp, txt_blue
   401 000002CB E81C030000               	call	print_text
   402                                  	
   403 000002D0 E8DC020000              	call	waitforkey
   404                                  
   405 000002D5 BE2B009900              	mov	esi, 153*65536+43
   406 000002DA BD[AF060000]            	mov	ebp, txt_red
   407 000002DF E808030000               	call	print_text
   408                                  	
   409 000002E4 E8C8020000              	call	waitforkey
   410                                  
   411 000002E9 BE2B000701              	mov	esi, 263*65536+43
   412 000002EE BD[B3060000]            	mov	ebp, txt_green
   413 000002F3 E8F4020000               	call	print_text
   414                                  	
   415 000002F8 E8B4020000              	call	waitforkey
   416                                  
   417 000002FD BE2B007501              	mov	esi, 373*65536+43
   418 00000302 BD[B9060000]            	mov	ebp, txt_yellow
   419 00000307 E8E0020000               	call	print_text
   420                                  	
   421 0000030C E8A0020000              	call	waitforkey
   422                                  
   423 00000311 C705[0C070000]0000-     	mov	dword [tcolor], 0
   423 00000319 0000               
   424                                  
   425 0000031B BE2B000701              	mov	esi, 263*65536+43
   426 00000320 BD[B3060000]            	mov	ebp, txt_green
   427 00000325 E8C2020000               	call	print_text
   428                                  	
   429 0000032A E882020000              	call	waitforkey
   430                                  
   431 0000032F BE2B007501              	mov	esi, 373*65536+43
   432 00000334 BD[B9060000]            	mov	ebp, txt_yellow
   433 00000339 E8AE020000               	call	print_text
   434                                  	
   435 0000033E E86E020000              	call	waitforkey
   436                                  
   437                                  	; screen copy and replace window sub functions
   438                                  
   439                                  	; fill white color in 1st 20 rows 
   440                                  	; in user's fullscreen buff
   441 00000343 BF[10070000]            	mov	edi, fullscreen_buffer
   442 00000348 B900320000              	mov	ecx, 20*640
   443 0000034D B8FFFFFF00              	mov	eax, 0FFFFFFh
   444 00000352 F3AB                    	rep	stosd
   445                                   
   446                                  	; fill red color to 440 rows after white rows  
   447 00000354 B9004C0400              	mov	ecx, 440*640
   448 00000359 B80000FF00              	mov	eax, 0FF0000h ; RED
   449 0000035E F3AB                    	rep	stosd
   450                                  
   451                                  	; fill white color in last 20 rows
   452 00000360 B900320000              	mov	ecx, 20*640
   453 00000365 B8FFFFFF00              	mov	eax, 0FFFFFFh
   454 0000036A F3AB                    	rep	stosd
   455                                  
   456                                  	; copy blue block (on screen) to user buffer
   457                                  	; (overwrites red colors partially)
   458 0000036C BF[B0CF0000]            	mov	edi, fullscreen_buffer + ((20*640)+40)*4
   459 00000371 B928001400              	mov	ecx, 20*65536+40 ; column 40, row 20
   460 00000376 BAA0006E00              	mov	edx, 110*65536+160 ; size: 110*160
   461 0000037B BB41020000              	mov	ebx, 0241h ; system to user window copy
   462                                  	;mov	bl, 41h
   463                                  	sys	_video	
   463                              <1> 
   463                              <1> 
   463                              <1> 
   463                              <1> 
   463                              <1>  %if %0 >= 2
   463                              <1>  mov ebx, %2
   463                              <1>  %if %0 >= 3
   463                              <1>  mov ecx, %3
   463                              <1>  %if %0 = 4
   463                              <1>  mov edx, %4
   463                              <1>  %endif
   463                              <1>  %endif
   463                              <1>  %endif
   463 00000380 B81F000000          <1>  mov eax, %1
   463                              <1> 
   463 00000385 CD40                <1>  int 40h
   464                                  
   465                                  	; Replace white color (text) only in blue block
   466                                  	; (blue block starts at row 20)
   467                                  	
   468 00000387 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   469 0000038C 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   470 0000038E BE28001400              	mov	esi, 20*65536+40 ; column 40, row 20
   471 00000393 BFA0006E00              	mov	edi, 110*65536+160 ; size: 110*160 
   472                                  	;mov	ebx, 021Ch ; Replace color in window
   473 00000398 B31C                    	mov	bl, 1Ch
   474                                  	sys	_video
   474                              <1> 
   474                              <1> 
   474                              <1> 
   474                              <1> 
   474                              <1>  %if %0 >= 2
   474                              <1>  mov ebx, %2
   474                              <1>  %if %0 >= 3
   474                              <1>  mov ecx, %3
   474                              <1>  %if %0 = 4
   474                              <1>  mov edx, %4
   474                              <1>  %endif
   474                              <1>  %endif
   474                              <1>  %endif
   474 0000039A B81F000000          <1>  mov eax, %1
   474                              <1> 
   474 0000039F CD40                <1>  int 40h
   475                                  
   476 000003A1 E80B020000              	call	waitforkey
   477                                  
   478                                  	; copy red block (on screen) to user buffer
   479 000003A6 BF[B01B0500]            	mov	edi, fullscreen_buffer + ((130*640)+40)*4
   480 000003AB B928008200              	mov	ecx, 130*65536+40 ; column 40, row 130
   481 000003B0 BA78006E00              	mov	edx, 110*65536+120 ; size: 110*120
   482                                  	;mov	ebx, 0241h ; system to user window copy
   483 000003B5 B341                    	mov	bl, 41h
   484                                  	sys	_video	
   484                              <1> 
   484                              <1> 
   484                              <1> 
   484                              <1> 
   484                              <1>  %if %0 >= 2
   484                              <1>  mov ebx, %2
   484                              <1>  %if %0 >= 3
   484                              <1>  mov ecx, %3
   484                              <1>  %if %0 = 4
   484                              <1>  mov edx, %4
   484                              <1>  %endif
   484                              <1>  %endif
   484                              <1>  %endif
   484 000003B7 B81F000000          <1>  mov eax, %1
   484                              <1> 
   484 000003BC CD40                <1>  int 40h
   485                                  
   486                                  	; Replace white color (text) only in red block
   487                                  	; (red block starts at row 130)
   488                                  	
   489 000003BE B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   490 000003C3 29D2                    	sub	edx, edx ; 0 ; BLACK (new color)
   491 000003C5 BE28008200              	mov	esi, 130*65536+40 ; column 40, row 130
   492 000003CA BF78006E00              	mov	edi, 110*65536+120 ; size: 110*120 
   493                                  	;mov	ebx, 021Ch ; Replace color in window
   494 000003CF B31C                    	mov	bl, 1Ch
   495                                  	sys	_video
   495                              <1> 
   495                              <1> 
   495                              <1> 
   495                              <1> 
   495                              <1>  %if %0 >= 2
   495                              <1>  mov ebx, %2
   495                              <1>  %if %0 >= 3
   495                              <1>  mov ecx, %3
   495                              <1>  %if %0 = 4
   495                              <1>  mov edx, %4
   495                              <1>  %endif
   495                              <1>  %endif
   495                              <1>  %endif
   495 000003D1 B81F000000          <1>  mov eax, %1
   495                              <1> 
   495 000003D6 CD40                <1>  int 40h
   496                                  
   497                                  	; copy yellow block (on screen) to user buffer
   498 000003D8 BF[10B30D00]            	mov	edi, fullscreen_buffer + (350*640)*4
   499 000003DD B900005E01              	mov	ecx, 350*65536+0 ; column 0, row 350
   500 000003E2 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   501                                  	;mov	ebx, 0241h ; system to user window copy
   502 000003E7 B341                    	mov	bl, 41h
   503                                  	sys	_video		
   503                              <1> 
   503                              <1> 
   503                              <1> 
   503                              <1> 
   503                              <1>  %if %0 >= 2
   503                              <1>  mov ebx, %2
   503                              <1>  %if %0 >= 3
   503                              <1>  mov ecx, %3
   503                              <1>  %if %0 = 4
   503                              <1>  mov edx, %4
   503                              <1>  %endif
   503                              <1>  %endif
   503                              <1>  %endif
   503 000003E9 B81F000000          <1>  mov eax, %1
   503                              <1> 
   503 000003EE CD40                <1>  int 40h
   504                                  
   505                                  	; copy green block (on screen) to user buffer
   506 000003F0 BF[10670900]            	mov	edi, fullscreen_buffer + (240*640)*4
   507 000003F5 B90000F000              	mov	ecx, 240*65536+0 ; column 0, row 240
   508 000003FA BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   509                                  	;;mov	ebx, 0241h ; system to user window copy
   510                                  	;mov	bl, 41h
   511                                  	sys	_video
   511                              <1> 
   511                              <1> 
   511                              <1> 
   511                              <1> 
   511                              <1>  %if %0 >= 2
   511                              <1>  mov ebx, %2
   511                              <1>  %if %0 >= 3
   511                              <1>  mov ecx, %3
   511                              <1>  %if %0 = 4
   511                              <1>  mov edx, %4
   511                              <1>  %endif
   511                              <1>  %endif
   511                              <1>  %endif
   511 000003FF B81F000000          <1>  mov eax, %1
   511                              <1> 
   511 00000404 CD40                <1>  int 40h
   512                                  
   513 00000406 E8A6010000              	call	waitforkey
   514                                  
   515                                  	; copy yellow block to red block position
   516                                  	; and green block to blue block position on screen
   517                                  	; (system to system copy)
   518                                  	
   519                                  	; copy yellow block (overwrite red block)
   520 0000040B B900005E01              	mov	ecx, 350*65536 ; column 0, row 350
   521 00000410 BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   522 00000415 BE00008200              	mov	esi, 130*65536
   523                                  	;mov	ebx, 020Dh ; system to system window copy
   524 0000041A B30D                    	mov	bl, 0Dh
   525                                  	sys	_video	
   525                              <1> 
   525                              <1> 
   525                              <1> 
   525                              <1> 
   525                              <1>  %if %0 >= 2
   525                              <1>  mov ebx, %2
   525                              <1>  %if %0 >= 3
   525                              <1>  mov ecx, %3
   525                              <1>  %if %0 = 4
   525                              <1>  mov edx, %4
   525                              <1>  %endif
   525                              <1>  %endif
   525                              <1>  %endif
   525 0000041C B81F000000          <1>  mov eax, %1
   525                              <1> 
   525 00000421 CD40                <1>  int 40h
   526                                  
   527 00000423 E889010000              	call	waitforkey
   528                                  
   529                                  	; copy green block (overwrite blue block)
   530 00000428 B90000F000              	mov	ecx, 240*65536 ; column 0, row 240
   531 0000042D BA80026E00              	mov	edx, 110*65536+640 ; size: 110*640
   532 00000432 BE00001400              	mov	esi, 20*65536
   533                                  	;;mov	ebx, 020Dh ; system to system window copy
   534                                  	;mov	bl, 0Dh
   535                                  	sys	_video	
   535                              <1> 
   535                              <1> 
   535                              <1> 
   535                              <1> 
   535                              <1>  %if %0 >= 2
   535                              <1>  mov ebx, %2
   535                              <1>  %if %0 >= 3
   535                              <1>  mov ecx, %3
   535                              <1>  %if %0 = 4
   535                              <1>  mov edx, %4
   535                              <1>  %endif
   535                              <1>  %endif
   535                              <1>  %endif
   535 00000437 B81F000000          <1>  mov eax, %1
   535                              <1> 
   535 0000043C CD40                <1>  int 40h
   536                                  
   537 0000043E E86E010000              	call	waitforkey
   538                                  
   539                                  	; fill blue block on yellow block position	
   540 00000443 B9FF000000              	mov	ecx, 0FFh
   541 00000448 BA00005E01              	mov	edx, 350*65536+0 
   542 0000044D BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   543                                  	;mov	ebx, 0211h ; new color, window
   544 00000452 B311                    	mov	bl, 11h
   545                                  	sys	_video
   545                              <1> 
   545                              <1> 
   545                              <1> 
   545                              <1> 
   545                              <1>  %if %0 >= 2
   545                              <1>  mov ebx, %2
   545                              <1>  %if %0 >= 3
   545                              <1>  mov ecx, %3
   545                              <1>  %if %0 = 4
   545                              <1>  mov edx, %4
   545                              <1>  %endif
   545                              <1>  %endif
   545                              <1>  %endif
   545 00000454 B81F000000          <1>  mov eax, %1
   545                              <1> 
   545 00000459 CD40                <1>  int 40h
   546                                  
   547 0000045B E851010000              	call	waitforkey
   548                                  
   549                                  	; fill red block on green block position	
   550 00000460 B90000FF00              	mov	ecx, 0FF0000h
   551 00000465 BA0000F000              	mov	edx, 240*65536+0 
   552 0000046A BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   553                                  	;;mov	ebx, 0211h ; new color, window
   554                                  	;mov	bl, 11h
   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 0000046F B81F000000          <1>  mov eax, %1
   555                              <1> 
   555 00000474 CD40                <1>  int 40h
   556                                  
   557 00000476 E836010000              	call	waitforkey
   558                                  
   559                                  	; copy	blocks to system from user's buffer
   560 0000047B BE[CC060000]            	mov	esi, blockdatabuffer ; 32+32 bits
   561 00000480 B9FF000000              	mov	ecx, 0FFh
   562 00000485 BA07000000              	mov	edx, 7 ; 7 blocks
   563                                   	;mov	ebx, 022Dh ; indirect pixel blocks
   564 0000048A B32D                    	mov	bl, 2Dh
   565                                   	sys	_video
   565                              <1> 
   565                              <1> 
   565                              <1> 
   565                              <1> 
   565                              <1>  %if %0 >= 2
   565                              <1>  mov ebx, %2
   565                              <1>  %if %0 >= 3
   565                              <1>  mov ecx, %3
   565                              <1>  %if %0 = 4
   565                              <1>  mov edx, %4
   565                              <1>  %endif
   565                              <1>  %endif
   565                              <1>  %endif
   565 0000048C B81F000000          <1>  mov eax, %1
   565                              <1> 
   565 00000491 CD40                <1>  int 40h
   566                                  
   567 00000493 E819010000              	call	waitforkey
   568                                  
   569                                  	; replace color
   570 00000498 B900FFFF00              	mov	ecx, 0FFFF00h ; YELLOW (current color)
   571 0000049D BAFF000000              	mov	edx, 0FFh ; BLUE (new color)
   572 000004A2 BE00008200              	mov	esi, 130*65536 ; column 0, row 130
   573 000004A7 BF80026E00              	mov	edi, 110*65536+640 ; size: 110*640
   574                                  	;mov	ebx, 021Ch ; Replace color in window
   575 000004AC B31C                    	mov	bl, 1Ch
   576                                  	sys	_video
   576                              <1> 
   576                              <1> 
   576                              <1> 
   576                              <1> 
   576                              <1>  %if %0 >= 2
   576                              <1>  mov ebx, %2
   576                              <1>  %if %0 >= 3
   576                              <1>  mov ecx, %3
   576                              <1>  %if %0 = 4
   576                              <1>  mov edx, %4
   576                              <1>  %endif
   576                              <1>  %endif
   576                              <1>  %endif
   576 000004AE B81F000000          <1>  mov eax, %1
   576                              <1> 
   576 000004B3 CD40                <1>  int 40h
   577                                  
   578 000004B5 E8F7000000              	call	waitforkey
   579                                  
   580                                  	; copy blue block (with 'blue" text)
   581                                  	; from users full screen buffer to system
   582                                  	; (to its old position)
   583                                  	
   584 000004BA B928001400              	mov	ecx, 20*65536+40
   585 000004BF BAA0006E00              	mov	edx, 110*65536+160
   586 000004C4 BE[B0CF0000]            	mov	esi, fullscreen_buffer+((20*640)+40)*4
   587                                  	;mov	ebx, 0210h ; copy from user to sys 
   588 000004C9 B310                    	mov	bl, 10h
   589                                  	sys	_video
   589                              <1> 
   589                              <1> 
   589                              <1> 
   589                              <1> 
   589                              <1>  %if %0 >= 2
   589                              <1>  mov ebx, %2
   589                              <1>  %if %0 >= 3
   589                              <1>  mov ecx, %3
   589                              <1>  %if %0 = 4
   589                              <1>  mov edx, %4
   589                              <1>  %endif
   589                              <1>  %endif
   589                              <1>  %endif
   589 000004CB B81F000000          <1>  mov eax, %1
   589                              <1> 
   589 000004D0 CD40                <1>  int 40h
   590                                  
   591                                  	; copy blue block to usr's buffer again
   592 000004D2 B900001400              	mov	ecx, 20*65536
   593 000004D7 BA80026E00              	mov	edx, 110*65536+640
   594 000004DC BF[10CF0000]            	mov	edi, fullscreen_buffer+(20*640)*4
   595                                  	;mov	ebx, 0241h ; copy from sys to user
   596 000004E1 B341                    	mov	bl, 41h 
   597                                  	sys	_video
   597                              <1> 
   597                              <1> 
   597                              <1> 
   597                              <1> 
   597                              <1>  %if %0 >= 2
   597                              <1>  mov ebx, %2
   597                              <1>  %if %0 >= 3
   597                              <1>  mov ecx, %3
   597                              <1>  %if %0 = 4
   597                              <1>  mov edx, %4
   597                              <1>  %endif
   597                              <1>  %endif
   597                              <1>  %endif
   597 000004E3 B81F000000          <1>  mov eax, %1
   597                              <1> 
   597 000004E8 CD40                <1>  int 40h
   598                                  
   599 000004EA E8C2000000              	call	waitforkey
   600                                  
   601                                  	; fill red block on red block position	
   602 000004EF B90000FF00              	mov	ecx, 0FF0000h  ;RED
   603 000004F4 BA00008200              	mov	edx, 130*65536+0 
   604 000004F9 BE80026E00              	mov	esi, 110*65536+640 ; size: 110*640
   605                                  	;mov	ebx, 0211h ; new color, window
   606 000004FE B311                    	mov	bl, 11h
   607                                  	sys	_video
   607                              <1> 
   607                              <1> 
   607                              <1> 
   607                              <1> 
   607                              <1>  %if %0 >= 2
   607                              <1>  mov ebx, %2
   607                              <1>  %if %0 >= 3
   607                              <1>  mov ecx, %3
   607                              <1>  %if %0 = 4
   607                              <1>  mov edx, %4
   607                              <1>  %endif
   607                              <1>  %endif
   607                              <1>  %endif
   607 00000500 B81F000000          <1>  mov eax, %1
   607                              <1> 
   607 00000505 CD40                <1>  int 40h
   608                                  
   609 00000507 E8A5000000              	call	waitforkey
   610                                  
   611                                  	; copy red block (with 'red" text)
   612                                  	; from users full screen buffer to system
   613                                  	; (to its old position)
   614 0000050C B928008200              	mov	ecx, 130*65536+40
   615 00000511 BA78006E00              	mov	edx, 110*65536+120
   616 00000516 BE[B01B0500]            	mov	esi, fullscreen_buffer+((130*640)+40)*4
   617                                  	;mov	ebx, 0210h ; copy from user to sys 
   618 0000051B B310                    	mov	bl, 10h
   619                                  	sys	_video
   619                              <1> 
   619                              <1> 
   619                              <1> 
   619                              <1> 
   619                              <1>  %if %0 >= 2
   619                              <1>  mov ebx, %2
   619                              <1>  %if %0 >= 3
   619                              <1>  mov ecx, %3
   619                              <1>  %if %0 = 4
   619                              <1>  mov edx, %4
   619                              <1>  %endif
   619                              <1>  %endif
   619                              <1>  %endif
   619 0000051D B81F000000          <1>  mov eax, %1
   619                              <1> 
   619 00000522 CD40                <1>  int 40h
   620                                  
   621                                  	; copy red block to usr's buffer again
   622 00000524 B900008200              	mov	ecx, 130*65536
   623 00000529 BA80026E00              	mov	edx, 110*65536+640
   624 0000052E BF[101B0500]            	mov	edi, fullscreen_buffer+(130*640)*4
   625                                  	;mov	ebx, 0241h ; copy from sys to user 
   626 00000533 B341                    	mov	bl, 41h
   627                                  	sys	_video
   627                              <1> 
   627                              <1> 
   627                              <1> 
   627                              <1> 
   627                              <1>  %if %0 >= 2
   627                              <1>  mov ebx, %2
   627                              <1>  %if %0 >= 3
   627                              <1>  mov ecx, %3
   627                              <1>  %if %0 = 4
   627                              <1>  mov edx, %4
   627                              <1>  %endif
   627                              <1>  %endif
   627                              <1>  %endif
   627 00000535 B81F000000          <1>  mov eax, %1
   627                              <1> 
   627 0000053A CD40                <1>  int 40h
   628                                  
   629 0000053C E870000000              	call	waitforkey
   630                                  
   631                                  	; replace color (full screen)
   632 00000541 B9FFFFFF00              	mov	ecx, 0FFFFFFh ; WHITE (current color)
   633 00000546 31D2                    	xor	edx, edx ; 0 ; BLACK (new color)
   634                                  	;mov	ebx, 020Ch ; Replace color on screen
   635 00000548 B30C                    	mov	bl, 0Ch
   636                                  	sys	_video
   636                              <1> 
   636                              <1> 
   636                              <1> 
   636                              <1> 
   636                              <1>  %if %0 >= 2
   636                              <1>  mov ebx, %2
   636                              <1>  %if %0 >= 3
   636                              <1>  mov ecx, %3
   636                              <1>  %if %0 = 4
   636                              <1>  mov edx, %4
   636                              <1>  %endif
   636                              <1>  %endif
   636                              <1>  %endif
   636 0000054A B81F000000          <1>  mov eax, %1
   636                              <1> 
   636 0000054F CD40                <1>  int 40h
   637                                  
   638 00000551 E85B000000              	call	waitforkey
   639                                  
   640                                  	; copy full screen buffer to screen
   641 00000556 BE[10070000]            	mov	esi, fullscreen_buffer
   642                                  	;mov	ebx, 0200h
   643 0000055B B300                    	mov	bl, 0
   644                                  	sys	_video
   644                              <1> 
   644                              <1> 
   644                              <1> 
   644                              <1> 
   644                              <1>  %if %0 >= 2
   644                              <1>  mov ebx, %2
   644                              <1>  %if %0 >= 3
   644                              <1>  mov ecx, %3
   644                              <1>  %if %0 = 4
   644                              <1>  mov edx, %4
   644                              <1>  %endif
   644                              <1>  %endif
   644                              <1>  %endif
   644 0000055D B81F000000          <1>  mov eax, %1
   644                              <1> 
   644 00000562 CD40                <1>  int 40h
   645                                  
   646                                  	; erase full screen buffer
   647                                  	;mov	ecx, (640*480)*4/4
   648 00000564 B900B00400              	mov	ecx, 640*480
   649 00000569 31C0                    	xor	eax, eax ; 0
   650 0000056B 89F7                    	mov	edi, esi ; fullscreen_buffer
   651 0000056D F3AB                    	rep	stosd
   652                                  
   653 0000056F E83D000000              	call	waitforkey
   654                                  
   655                                  	; copy (full) screen to full screen buffer
   656 00000574 BF[10070000]            	mov	edi, fullscreen_buffer
   657                                  	;mov	ebx, 0240h ; copy from sys to user 
   658 00000579 B340                    	mov	bl, 40h
   659                                  	sys	_video
   659                              <1> 
   659                              <1> 
   659                              <1> 
   659                              <1> 
   659                              <1>  %if %0 >= 2
   659                              <1>  mov ebx, %2
   659                              <1>  %if %0 >= 3
   659                              <1>  mov ecx, %3
   659                              <1>  %if %0 = 4
   659                              <1>  mov edx, %4
   659                              <1>  %endif
   659                              <1>  %endif
   659                              <1>  %endif
   659 0000057B B81F000000          <1>  mov eax, %1
   659                              <1> 
   659 00000580 CD40                <1>  int 40h
   660                                  
   661                                  	; full screen NOT operation
   662                                  	;mov	ebx, 0207h
   663 00000582 B307                    	mov	bl, 07h
   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 00000584 B81F000000          <1>  mov eax, %1
   664                              <1> 
   664 00000589 CD40                <1>  int 40h
   665                                  
   666 0000058B E821000000              	call	waitforkey
   667                                  
   668                                  	; copy full screen buffer to screen
   669 00000590 BE[10070000]            	mov	esi, fullscreen_buffer
   670                                  	;mov	ebx, 0200h
   671 00000595 30DB                    	xor	bl, bl ; 0
   672                                  	sys	_video
   672                              <1> 
   672                              <1> 
   672                              <1> 
   672                              <1> 
   672                              <1>  %if %0 >= 2
   672                              <1>  mov ebx, %2
   672                              <1>  %if %0 >= 3
   672                              <1>  mov ecx, %3
   672                              <1>  %if %0 = 4
   672                              <1>  mov edx, %4
   672                              <1>  %endif
   672                              <1>  %endif
   672                              <1>  %endif
   672 00000597 B81F000000          <1>  mov eax, %1
   672                              <1> 
   672 0000059C CD40                <1>  int 40h
   673                                  	
   674 0000059E E80E000000              	call	waitforkey  
   675                                  		; wait for key stroke before exit
   676                                  terminate:
   677 000005A3 E82C000000              	call	set_text_mode
   678                                  	sys	_exit
   678                              <1> 
   678                              <1> 
   678                              <1> 
   678                              <1> 
   678                              <1>  %if %0 >= 2
   678                              <1>  mov ebx, %2
   678                              <1>  %if %0 >= 3
   678                              <1>  mov ecx, %3
   678                              <1>  %if %0 = 4
   678                              <1>  mov edx, %4
   678                              <1>  %endif
   678                              <1>  %endif
   678                              <1>  %endif
   678 000005A8 B801000000          <1>  mov eax, %1
   678                              <1> 
   678 000005AD CD40                <1>  int 40h
   679                                  halt:
   680 000005AF EBFE                    	jmp	short halt
   681                                  
   682                                  waitforkey:
   683 000005B1 B401                    	mov	ah, 1
   684 000005B3 CD32                    	int	32h
   685 000005B5 740B                    	jz	short getkey
   686 000005B7 FF05[08070000]          	inc	dword [counter]
   687 000005BD 90                      	nop
   688 000005BE 90                      	nop
   689 000005BF 90                      	nop
   690 000005C0 EBEF                    	jmp	short waitforkey
   691                                  getkey:
   692 000005C2 30E4                    	xor	ah, ah
   693 000005C4 CD32                    	int	32h
   694                                  
   695 000005C6 663D032E                	cmp	ax, 2E03h
   696 000005CA 7405                    	je	short _terminate
   697 000005CC 3C1B                    	cmp	al, 1Bh ; ESC key
   698 000005CE 7401                    	je	short _terminate
   699 000005D0 C3                      	retn
   700                                  _terminate:
   701 000005D1 58                      	pop	eax ; return address
   702 000005D2 EBCF                    	jmp	short terminate
   703                                  	
   704                                  set_text_mode:
   705 000005D4 30E4                    	xor    ah, ah
   706 000005D6 B003                    	mov    al, 3                        
   707                                   	;int   10h ; al = 03h text mode, int 10 video
   708 000005D8 CD31                    	int    31h ; TRDOS 386 - Video interrupt
   709 000005DA C3                      	retn
   710                                  
   711                                  print_msg:
   712 000005DB B40E                    	mov	ah, 0Eh
   713 000005DD BB07000000              	mov	ebx, 7
   714                                  	;mov	bl, 7 ; char attribute & color
   715                                  p_next_chr:
   716 000005E2 AC                      	lodsb
   717 000005E3 08C0                    	or	al, al
   718 000005E5 7404                    	jz	short p_retn ; retn	
   719 000005E7 CD31                    	int	31h
   720 000005E9 EBF7                    	jmp	short p_next_chr
   721                                  p_retn:
   722 000005EB C3                      	retn
   723                                  
   724                                  print_text:
   725                                  	; ebp = text address
   726                                  	; esi = row/column position (si = column)
   727                                  p_d_x:
   728                                  	;mov	dh, 0 ; 8x16 system font
   729 000005EC B606                    	mov	dh, 6 ; 32*64 scaled font (base: 8*16 system font) 
   730                                  p_d_x_n:
   731 000005EE 8A5500                  	mov	dl, [ebp]
   732 000005F1 20D2                    	and	dl, dl
   733 000005F3 7419                    	jz	short p_d_x_ok
   734                                  	sys	_video, 020Fh, [tcolor] 
   734                              <1> 
   734                              <1> 
   734                              <1> 
   734                              <1> 
   734                              <1>  %if %0 >= 2
   734 000005F5 BB0F020000          <1>  mov ebx, %2
   734                              <1>  %if %0 >= 3
   734 000005FA 8B0D[0C070000]      <1>  mov ecx, %3
   734                              <1>  %if %0 = 4
   734                              <1>  mov edx, %4
   734                              <1>  %endif
   734                              <1>  %endif
   734                              <1>  %endif
   734 00000600 B81F000000          <1>  mov eax, %1
   734                              <1> 
   734 00000605 CD40                <1>  int 40h
   735 00000607 45                      	inc	ebp
   736 00000608 6683C624                	add	si, 36 ; next char pos
   737 0000060C EBE0                    	jmp	short p_d_x_n
   738                                  p_d_x_ok:
   739 0000060E C3                      	retn
   740                                  
   741                                  program_msg:
   742 0000060F 5452444F5320333836-     	db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Block Operations"
   742 00000618 2076322E302E33202D-
   742 00000621 202827737973766964-
   742 0000062A 656F27292054657374-
   742 00000633 2050726F6772616D20-
   742 0000063C 2D20426C6F636B204F-
   742 00000645 7065726174696F6E73 
   743 0000064E 0D0A                    	db 0Dh, 0Ah
   744 00000650 6279204572646F6761-     	db "by Erdogan Tan - 01/03/2021"
   744 00000659 6E2054616E202D2030-
   744 00000662 312F30332F32303231 
   745                                  	;db 0Dh, 0Ah, 0
   746 0000066B 0D0A0D0A                	db 0Dh, 0Ah, 0Dh, 0Ah
   747 0000066F 507265737320616E79-     	db "Press any key to continue .."
   747 00000678 206B657920746F2063-
   747 00000681 6F6E74696E7565202E-
   747 0000068A 2E                 
   748 0000068B 0D0A                    	db 0Dh, 0Ah	
   749 0000068D 285072657373204553-     	db "(Press ESC to exit) .."
   749 00000696 4320746F2065786974-
   749 0000069F 29202E2E           
   750 000006A3 0D0A                    	db 0Dh, 0Ah
   751 000006A5 0D0A                    	db 0Dh, 0Ah
   752                                  
   753                                  nextline:
   754 000006A7 0D0A00                  	db 0Dh, 0Ah, 0
   755                                  
   756                                  txt_blue:
   757 000006AA 424C554500              	db "BLUE", 0
   758                                  txt_red:
   759 000006AF 52454400                	db "RED", 0
   760                                  txt_green:
   761 000006B3 475245454E00            	db "GREEN", 0
   762                                  txt_yellow:
   763 000006B9 59454C4C4F5700          	db "YELLOW", 0
   764                                  txt_white:
   765 000006C0 574849544500            	db "WHITE", 0
   766                                  txt_black:
   767 000006C6 424C41434B00            	db "BLACK", 0
   768                                  
   769                                  blockdatabuffer:
   770 000006CC 00001400                	dd	20*65536
   771 000006D0 28006E00                	dd	110*65536+40
   772 000006D4 C8008200                	dd	130*65536+200
   773 000006D8 B8016E00                	dd	110*65536+440
   774 000006DC 28008200                	dd	130*65536+40
   775 000006E0 A0006E00                	dd	110*65536+160
   776 000006E4 00005E01                	dd	350*65536
   777 000006E8 80026E00                	dd	110*65536+640
   778 000006EC 28001400                	dd	20*65536+40
   779 000006F0 A0006E00                	dd	110*65536+160
   780 000006F4 0000F000                	dd	240*65536
   781 000006F8 80026E00                	dd	110*65536+640
   782 000006FC C8001400                	dd	20*65536+200
   783 00000700 B8016E00                	dd	110*65536+440
   784 00000704 00                      	db	0		
   785                                  bss:
   786                                  
   787                                  ABSOLUTE bss
   788                                  
   789 00000705 <res 00000003>          alignb 4
   790                                  
   791                                  counter:
   792 00000708 <res 00000004>          	resd 1	
   793                                  
   794                                  bss_start:
   795 0000070C <res 00000004>          tcolor: resd 1
   796                                  
   797                                  fullscreen_buffer:
   798 00000710 <res 0012C000>          	resb 307200*4
   799                                  bss_end:
