diff --git a/kernel/trunk/blkdev/fdc.inc b/kernel/trunk/blkdev/fdc.inc index 6b4e438d32..1a1efd6e67 100644 --- a/kernel/trunk/blkdev/fdc.inc +++ b/kernel/trunk/blkdev/fdc.inc @@ -41,8 +41,8 @@ save_image: jne unnecessary_save_image mov [FDD_Track],0 ; Цилиндр mov [FDD_Head],0 ; Сторона - mov [FDD_Sector],1 ; Сектор - mov esi,0x100000 + mov [FDD_Sector],1 ; Сектор + mov esi,RAMDISK call SeekTrack save_image_1: push esi @@ -57,7 +57,7 @@ save_image_1: cmp [FDD_Sector],19 jne save_image_1 mov [FDD_Sector],1 - inc [FDD_Head] + inc [FDD_Head] cmp [FDD_Head],2 jne save_image_1 mov [FDD_Head],0 diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index 5c5a44b8da..75f4e835b7 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -12,8 +12,8 @@ calculatefatchain: pushad - mov esi,0x100000+512 - mov edi,0x280000 + mov esi,RAMDISK+512 + mov edi,RAMDISK_FAT fcnew: mov eax,dword [esi] @@ -38,7 +38,7 @@ calculatefatchain: add edi,16 add esi,12 - cmp edi,0x280000+2856*2 ;2849 clusters + cmp edi,RAMDISK_FAT+2856*2 ;2849 clusters jnz fcnew popad @@ -49,8 +49,8 @@ restorefatchain: ; restore fat chain pushad - mov esi,0x280000 - mov edi,0x100000+512 + mov esi,RAMDISK_FAT + mov edi,RAMDISK+512 fcnew2: mov eax,dword [esi] @@ -66,11 +66,11 @@ restorefatchain: ; restore fat chain add edi,6 add esi,8 - cmp edi,0x100000+512+4278 ;4274 bytes - all used FAT + cmp edi,RAMDISK+512+4278 ;4274 bytes - all used FAT jb fcnew2 - mov esi,0x100000+512 ; duplicate fat chain - mov edi,0x100000+512+0x1200 + mov esi,RAMDISK+512 ; duplicate fat chain + mov edi,RAMDISK+512+0x1200 mov ecx,1069 ;4274/4 cld rep movsd @@ -88,7 +88,7 @@ ramdisk_free_space: push eax ebx ecx - mov edi,0x280000 ;start of FAT + mov edi,RAMDISK_FAT ;start of FAT xor ax,ax ;Free cluster=0x0000 in FAT xor ebx,ebx ;counter mov ecx,2849 ;2849 clusters @@ -202,7 +202,7 @@ fileread: sub ecx,edx fr_do1: shl ebx,9 - mov esi,0x100000+512*19 + mov esi,RAMDISK+512*19 add esi,ebx shl ecx,7 cld @@ -246,7 +246,7 @@ fileread: add eax,31 ;bootsector+2*fat+filenames shl eax,9 ;*512 - add eax,0x100000 ;image base + add eax,RAMDISK ;image base mov ebx,[esp+8] mov ecx,512 ;[esp+4] @@ -260,7 +260,7 @@ fileread: frfl7: dec dword [esp+16] frfl8: - movzx eax,word [edi*2+0x280000] ; find next cluster from FAT + movzx eax,word [edi*2+RAMDISK_FAT] ; find next cluster from FAT mov edi,eax cmp edi,4095 ;eof - cluster jz frnoread2 @@ -326,7 +326,7 @@ filedelete: frnewd: shl edi,1 ;find next cluster from FAT - add edi,0x280000 + add edi,RAMDISK_FAT movzx eax,word [edi] mov [edi],word 0x0 ;clear fat chain cluster mov edi,eax @@ -375,7 +375,7 @@ filesave: push eax ebx ecx edx esi edi - mov edi,0x100000+512*18+512 ;Point at directory + mov edi,RAMDISK+512*18+512 ;Point at directory mov edx,224 +1 ; find an empty spot for filename in the root dir l20ds: @@ -407,7 +407,7 @@ mov [edi+24],ax ; date call get_time_for_file ; from FAT32.INC mov [edi+22],ax ; time ; End - mov edi,0x280000 ;pointer to first cluster + mov edi,RAMDISK_FAT ;pointer to first cluster mov ecx,2849 cld frnewds: @@ -423,7 +423,7 @@ mov [edi+22],ax ; time pusha ; move save to floppy cluster add ebx,31 shl ebx,9 - add ebx,0x100000 + add ebx,RAMDISK mov eax,[esp+32+16] mov ecx,512 call memmove @@ -458,7 +458,7 @@ mov [edi+22],ax ; time ;by Mihasik ;IN: eax - pointer to filename OUT: filestring+11 in edi or notZero in flags and fnf in eax,ebx - mov edi,0x100000+512*18+512 ;Point at directory + mov edi,RAMDISK+512*18+512 ;Point at directory cld rd_newsearch: mov esi,eax @@ -467,7 +467,7 @@ mov [edi+22],ax ; time je rd_ff add cl,21 add edi,ecx - cmp edi,0x100000+512*33 + cmp edi,RAMDISK+512*33 jb rd_newsearch mov eax,5 ;if file not found - eax=5 xor ebx,ebx @@ -902,12 +902,12 @@ bdfe_to_fat_entry: ret ramdisk_root_first: - mov edi, 0x100000+512*19 + mov edi, RAMDISK+512*19 clc ret ramdisk_root_next: add edi, 0x20 - cmp edi, 0x100000+512*33 + cmp edi, RAMDISK+512*33 cmc ret @@ -932,7 +932,7 @@ ramdisk_notroot_next_sector: push [rd_prev_sector] pop [rd_prev_prev_sector] mov [rd_prev_sector], ecx - mov ecx, [ecx*2+0x280000] + mov ecx, [ecx*2+RAMDISK_FAT] and ecx, 0xFFF cmp ecx, 2849 jae ramdisk_notroot_first.err2 @@ -945,7 +945,7 @@ ramdisk_notroot_first: cmp eax, 2849 jae .err shl eax, 9 - lea edi, [eax+(31 shl 9)+0x100000] + lea edi, [eax+(31 shl 9)+RAMDISK] clc ret .err2: @@ -962,20 +962,20 @@ ramdisk_root_next_write: ramdisk_notroot_extend_dir: pusha xor eax, eax - mov edi, 0x280000 + mov edi, RAMDISK_FAT mov ecx, 2849 repnz scasw jnz .notfound mov word [edi-2], 0xFFF - sub edi, 0x280000 + sub edi, RAMDISK_FAT shr edi, 1 dec edi mov eax, [esp+28] mov ecx, [eax] - mov [0x280000+ecx*2], di + mov [RAMDISK_FAT+ecx*2], di mov [eax], edi shl edi, 9 - add edi, (31 shl 9)+0x100000 + add edi, (31 shl 9)+RAMDISK mov [esp], edi xor eax, eax mov ecx, 128 @@ -1079,7 +1079,7 @@ fs_RamdiskRead: jae .eof lea eax, [edi+31] ; bootsector+2*fat+filenames shl eax, 9 ; *512 - add eax, 0x100000 ; image base + add eax, RAMDISK ; image base ; now eax points to data of cluster sub ebx, 512 jae .skip @@ -1097,7 +1097,7 @@ fs_RamdiskRead: pop ecx xor ebx, ebx .skip: - movzx edi, word [edi*2+0x280000] ; find next cluster from FAT + movzx edi, word [edi*2+RAMDISK_FAT] ; find next cluster from FAT jmp .new .eof: mov ebx, edx @@ -1168,7 +1168,7 @@ fs_RamdiskReadFolder: .main_loop: mov edi, eax shl edi, 9 - add edi, 0x100000 + add edi, RAMDISK push eax .l1: call fat_get_name @@ -1184,7 +1184,7 @@ fs_RamdiskReadFolder: jz .done jns @f ; read next sector from FAT - mov eax, [(eax-31-1)*2+0x280000] + mov eax, [(eax-31-1)*2+RAMDISK_FAT] and eax, 0xFFF cmp eax, 0xFF8 jae .done @@ -1193,7 +1193,7 @@ fs_RamdiskReadFolder: @@: mov edi, eax shl edi, 9 - add edi, 0x100000 + add edi, RAMDISK push eax .do_bdfe: inc dword [edx+8] ; new file found @@ -1213,7 +1213,7 @@ fs_RamdiskReadFolder: jz .done jns @f ; read next sector from FAT - mov eax, [(eax-31-1)*2+0x280000] + mov eax, [(eax-31-1)*2+RAMDISK_FAT] and eax, 0xFFF cmp eax, 0xFF8 jae .done @@ -1993,7 +1993,7 @@ fs_RamdiskWrite: @@: mov eax, edi shl eax, 9 - add eax, 0x100000+31*512+0x200 + add eax, RAMDISK+31*512+0x200 sub eax, ebx mov ebx, eax mov eax, edx @@ -2004,7 +2004,7 @@ fs_RamdiskWrite: pop ecx jz .ret .next_cluster: - movzx edi, word [edi*2+0x280000] + movzx edi, word [edi*2+RAMDISK_FAT] jmp .write_loop ramdisk_extend_file.zero_size: @@ -2024,7 +2024,7 @@ ramdisk_extend_file: @@: sub ecx, 0x200 jbe @f - mov eax, [eax*2+0x280000] + mov eax, [eax*2+RAMDISK_FAT] and eax, 0xFFF jz .fat_err cmp eax, 0xFF8 @@ -2037,7 +2037,7 @@ ramdisk_extend_file: ret @@: push eax - mov eax, [eax*2+0x280000] + mov eax, [eax*2+RAMDISK_FAT] and eax, 0xFFF cmp eax, 0xFF8 pop eax @@ -2047,7 +2047,7 @@ ramdisk_extend_file: push eax edi mov edi, eax shl edi, 9 - lea edi, [edi+0x100000+31*512+0x200+ecx] + lea edi, [edi+RAMDISK+31*512+0x200+ecx] neg ecx xor eax, eax rep stosb @@ -2056,7 +2056,7 @@ ramdisk_extend_file: pop ecx ; now do extend push edx esi - mov esi, 0x280000+2*2 ; start scan from cluster 2 + mov esi, RAMDISK_FAT+2*2 ; start scan from cluster 2 mov edx, 2847 ; number of clusters to scan .extend_loop: cmp [edi+28], ecx @@ -2075,12 +2075,12 @@ ramdisk_extend_file: mov word [edi-2], 0xFFF mov esi, edi mov edx, ecx - sub edi, 0x280000 + sub edi, RAMDISK_FAT shr edi, 1 dec edi ; now edi=new cluster test eax, eax jz .first_cluster - mov [0x280000+eax*2], di + mov [RAMDISK_FAT+eax*2], di jmp @f .first_cluster: pop eax ; eax->direntry @@ -2089,7 +2089,7 @@ ramdisk_extend_file: @@: push edi shl edi, 9 - add edi, 0x100000+31*512 + add edi, RAMDISK+31*512 xor eax, eax mov ecx, 512/4 rep stosd @@ -2186,21 +2186,21 @@ fs_RamdiskSetFileEnd: @@: sub eax, 0x200 jbe @f - movzx ecx, word [0x280000+ecx*2] + movzx ecx, word [RAMDISK_FAT+ecx*2] jmp @b @@: ; zero data at the end of last sector push ecx mov edi, ecx shl edi, 9 - lea edi, [edi+0x100000+31*512+eax+0x200] + lea edi, [edi+RAMDISK+31*512+eax+0x200] mov ecx, eax neg ecx xor eax, eax rep stosb pop ecx ; terminate FAT chain - lea ecx, [0x280000+ecx+ecx] + lea ecx, [RAMDISK_FAT+ecx+ecx] push dword [ecx] mov word [ecx], 0xFFF pop ecx @@ -2213,7 +2213,7 @@ fs_RamdiskSetFileEnd: ; mark all clusters as free cmp ecx, 0xFF8 jae .deleted - lea ecx, [0x280000+ecx+ecx] + lea ecx, [RAMDISK_FAT+ecx+ecx] push dword [ecx] and word [ecx], 0 pop ecx @@ -2334,7 +2334,7 @@ fs_RamdiskExecute: mov edx, [eax+4] ; cluster lea esi, [edx+31] shl esi, 9 - add esi, 0x100000 + add esi, RAMDISK mov ecx, 512/4 rep movsd mov ecx, [eax] @@ -2348,7 +2348,7 @@ fs_RamdiskExecute: pop eax @@: mov [eax], ecx - mov dx, [edx*2+0x280000] + mov dx, [edx*2+RAMDISK_FAT] mov [eax+4], dx ; high word is already zero popad xor eax, eax diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index b03949eb11..6684bcd9b1 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -333,7 +333,7 @@ if lang eq ru ; End set VGA russian font else if lang eq et mov bp,ET_FNT-10000h ; ET_FNT1 - mov bx,1000h ; + mov bx,1000h ; mov cx,255 ; 256 symbols mov dx,0h ; 0 - position of first symbol mov ax,1100h @@ -835,7 +835,7 @@ else if lang eq et ja @f mov [time_str+9-0x10000], ' ' mov [time_str+10-0x10000],' ' -@@: +@@: else ; wait 5/4/3/2 seconds, 1 second cmp al, 1 @@ -982,8 +982,8 @@ end if mov eax,[es:di+0x28] mov [es:0x9018],eax ; ---- vbe voodoo - BytesPerScanLine equ 0x10 - mov ax, [es:di+BytesPerScanLine] + BytesPerLine equ 0x10 + mov ax, [es:di+BytesPerLine] mov [es:0x9001],ax ; BPP mov al,byte [es:di+0x19] diff --git a/kernel/trunk/boot/rdload.inc b/kernel/trunk/boot/rdload.inc index 7182855426..e0fd730804 100644 --- a/kernel/trunk/boot/rdload.inc +++ b/kernel/trunk/boot/rdload.inc @@ -82,13 +82,13 @@ read_image: mov eax, hdsysimage mov ebx, 1474560/512 - mov ecx, 0x100000 + mov ecx, RAMDISK mov esi, 0 mov edi, 12 call file_read - ret + ret -image_retrieved db 0 +image_retrieved db 0 counter_of_partitions db 0 no_sys_on_hd: yes_sys_on_hd: diff --git a/kernel/trunk/boot/shutdown.inc b/kernel/trunk/boot/shutdown.inc index 13b5bea8b0..6ae25c081f 100644 --- a/kernel/trunk/boot/shutdown.inc +++ b/kernel/trunk/boot/shutdown.inc @@ -52,7 +52,7 @@ system_shutdown: ; shut down the system lea esi,[eax+220] ; x end sub eax,220 ; x start - mov ebx,[0xfe04] + mov ebx,[ScreenHeight] shr ebx,1 mov [shutdownpos],ebx lea ebp,[ebx+105] ; y end diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index dce234eadb..28c4b4a1d2 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -146,21 +146,26 @@ TASK_EVENT equ (OS_BASE+0x0003020) mouseunder equ (OS_BASE+0x0006900) FLOPPY_BUFF equ (OS_BASE+0x0008000) -ACTIVE_PROC_STACK equ (OS_BASE+0x000A400) +ACTIVE_PROC_STACK equ (OS_BASE+0x000A400) ;unused idts equ (OS_BASE+0x000B100) WIN_STACK equ (OS_BASE+0x000C000) WIN_POS equ (OS_BASE+0x000C400) FDD_BUFF equ (OS_BASE+0x000D000) -FDD_DATA equ (OS_BASE+0x000D000) +;unused ? only one reference ENABLE_TASKSWITCH equ (OS_BASE+0x000E000) + PUTPIXEL equ (OS_BASE+0x000E020) GETPIXEL equ (OS_BASE+0x000E024) + +;unused ? only one reference BANK_SWITCH equ (OS_BASE+0x000E030) +;unused ? store mousepointer MOUSE_PICTURE equ (OS_BASE+0x000F200) + MOUSE_VISIBLE equ (OS_BASE+0x000F204) -XY_TEMP equ (OS_BASE+0x000F300) +WIN_TEMP_XY equ (OS_BASE+0x000F300) KEY_COUNT equ (OS_BASE+0x000F400) KEY_BUFF equ (OS_BASE+0x000F401) @@ -168,9 +173,13 @@ BTN_COUNT equ (OS_BASE+0x000F500) BTN_BUFF equ (OS_BASE+0x000F501) CPU_FREQ equ (OS_BASE+0x000F600) + +;unused ? no active references MOUSE_PORT equ (OS_BASE+0x000F604) +;unused PS2_CHUNK equ (OS_BASE+0x000FB00) + MOUSE_X equ (OS_BASE+0x000FB0A) MOUSE_Y equ (OS_BASE+0x000FB0C) @@ -181,14 +190,17 @@ MOUSE_DOWN equ (OS_BASE+0x000FB44) X_UNDER equ (OS_BASE+0x000FB4A) Y_UNDER equ (OS_BASE+0x000FB4C) ScreenBPP equ (OS_BASE+0x000FBF1) + +;unused ? only one reference MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF) + LFBAddress equ (OS_BASE+0x000FE80) MEM_AMOUNT equ (OS_BASE+0x000FE8C) ;LFBSize equ (OS_BASE+0x02f9050) -SCR_X_SIZE equ (OS_BASE+0x000FE00) -SCR_Y_SIZE equ (OS_BASE+0x000FE04) -SCR_BYTES_PER_LINE equ (OS_BASE+0x000FE08) +ScreenWidth equ (OS_BASE+0x000FE00) +ScreenHeight equ (OS_BASE+0x000FE04) +BytesPerScanLine equ (OS_BASE+0x000FE08) SCR_MODE equ (OS_BASE+0x000FE0C) BTN_ADDR equ (OS_BASE+0x000FE88) @@ -201,12 +213,14 @@ MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) DONT_SWITCH equ (OS_BASE+0x000FFFF) -STACK_TOP equ (OS_BASE+0x003EC00) +TMP_STACK_TOP equ 0x003EC00 FONT_II equ (OS_BASE+0x003EC00) FONT_I equ (OS_BASE+0x003F600) -DISK_DATA equ (OS_BASE+0x0040000) +DRIVE_DATA equ (OS_BASE+0x0040000) SLOT_BASE equ (OS_BASE+0x0080000) + +;unused TMP_BUFF equ (OS_BASE+0x0090000) VGABasePtr equ (OS_BASE+0x00A0000) @@ -214,7 +228,10 @@ VGABasePtr equ (OS_BASE+0x00A0000) RAMDISK equ (OS_BASE+0x0100000) RAMDISK_FAT equ (OS_BASE+0x0280000) FLOPPY_FAT equ (OS_BASE+0x0282000) + +; unused? SB16_Status equ (OS_BASE+0x02B0000) + BUTTON_INFO equ (OS_BASE+0x02C0000) RESERVED_PORTS equ (OS_BASE+0x02D0000) IRQ_SAVE equ (OS_BASE+0x02E0000) @@ -222,7 +239,10 @@ SYS_VAR equ (OS_BASE+0x02f0000) IMG_BACKGROUND equ (OS_BASE+0x0300000) WinMapAddress equ (OS_BASE+0x0460000) display_data equ (OS_BASE+0x0460000) + +;unused ? HD_CACHE equ (OS_BASE+0x0600000) + stack_data_start equ (OS_BASE+0x0700000) eth_data_start equ (OS_BASE+0x0700000) stack_data equ (OS_BASE+0x0704000) @@ -230,7 +250,7 @@ stack_data_end equ (OS_BASE+0x071ffff) VMODE_BASE equ (OS_BASE+0x0760000) resendQ equ (OS_BASE+0x0770000) -;skin_data equ (OS_BASE+0x0778000) +skin_data equ (OS_BASE+0x0778000) tss_data equ (OS_BASE+0x780000) diff --git a/kernel/trunk/core/sched.inc b/kernel/trunk/core/sched.inc index 792b63223b..cae8711ea2 100644 --- a/kernel/trunk/core/sched.inc +++ b/kernel/trunk/core/sched.inc @@ -22,14 +22,14 @@ irq0: call updatecputimes .nocounter: - cmp [0xffff], byte 1 + cmp [DONT_SWITCH], byte 1 jne .change_task mov al,0x20 ; send End Of Interrupt signal mov dx,0x20 out dx,al - mov [0xffff], byte 0 + mov [DONT_SWITCH], byte 0 restore_ring3_context iret @@ -79,7 +79,7 @@ change_task: test eax, eax ; the same task -> skip switch jnz .return @@: - mov [0xffff],byte 1 + mov [DONT_SWITCH],byte 1 call do_change_task .return: diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index ff0f60d607..a24316b719 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -361,7 +361,7 @@ irqhandler: shl esi,6 ; 1 add esi,irq00read ; 1 shl edi,12 ; 1 - add edi,0x2E0000 + add edi,IRQ_SAVE mov ecx,16 mov [check_idle_semaphore],5 @@ -461,8 +461,6 @@ clear_application_table_status: ret - - sys_resize_app_memory: ; eax = 1 - resize ; ebx = new amount of memory @@ -477,84 +475,6 @@ sys_resize_app_memory: .no_application_mem_resize: ret -if 0 -get_app_params: - - push eax - - cmp [0x90000+6],word '00' - jne no_00_header - - mov eax,[0x90000+12] - mov [app_start],eax - mov eax,[0x90000+16] - mov [app_i_end],eax - mov eax,[0x90000+20] - mov [app_mem],eax -; \begin{diamond}[20.08.2006] -; sanity check (functions 19,58 load app_i_end bytes and that must -; fit in allocated memory to prevent kernel faults) - cmp eax,[app_i_end] - jb no_01_header -; \end{diamond}[20.08.2006] - shr eax,1 - sub eax,0x10 - mov [app_esp],eax - mov eax,[0x90000+24] - mov [app_i_param],eax - mov [app_i_icon],dword 0 - - pop eax - clc - ret - - no_00_header: - - - cmp [0x90000+6],word '01' - jne no_01_header - - mov eax,[0x90000+12] - mov [app_start],eax - mov eax,[0x90000+16] - mov [app_i_end],eax - mov eax,[0x90000+20] - mov [app_mem],eax -; \begin{diamond}[20.08.2006] - cmp eax,[app_i_end] - jb no_01_header -; \end{diamond}[20.08.2006] - mov eax,[0x90000+24] - mov [app_esp],eax - mov eax,[0x90000+28] - mov [app_i_param],eax - mov eax,[0x90000+32] - mov [app_i_icon],eax - - pop eax - clc - ret - - no_01_header: - - pop eax - stc - ret - -uglobal -; new_process_place dd 0x0 -; app_start dd 0x0 -; app_i_end dd 0x0 -; app_mem dd 0x0 -; app_esp dd 0x0 -; app_i_param dd 0x0 -; app_i_icon dd 0x0 -; app_mem_pos dd 0x0 -endg - -end if - - sys_threads: ; eax=1 create thread @@ -637,8 +557,8 @@ term9: frstor [eax] @@: - mov [0xf400],byte 0 ; empty keyboard buffer - mov [0xf500],byte 0 ; empty button buffer + mov [KEY_COUNT],byte 0 ; empty keyboard buffer + mov [BTN_COUNT],byte 0 ; empty button buffer ; remove defined hotkeys @@ -677,7 +597,7 @@ term9: mov ecx,esi ; remove buttons bnewba2: - mov edi,[0xfe88] + mov edi,[BTN_ADDR] mov eax,edi cld movzx ebx,word [edi] @@ -827,7 +747,7 @@ term9: rmpr0: - mov esi,[0x2d0000] + mov esi,[RESERVED_PORTS] cmp esi,0 je rmpr9 @@ -836,7 +756,7 @@ term9: mov edi,esi shl edi,4 - add edi,0x2d0000 + add edi,RESERVED_PORTS cmp edx,[edi] je rmpr4 @@ -857,7 +777,7 @@ term9: cld rep movsb - dec dword [0x2d0000] + dec dword [RESERVED_PORTS] jmp rmpr0 @@ -898,8 +818,8 @@ term9: xor esi, esi call redrawscreen - mov [0xfff4],byte 0 ; no mouse background - mov [0xfff5],byte 0 ; draw mouse + mov [MOUSE_BACKGROUND],byte 0 ; no mouse background + mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse mov [application_table_status],0 mov esi,process_terminated diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index 77b5a3e506..3d05099a8b 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -284,6 +284,14 @@ test_app_header: mov ecx,[APP_HEADER_01.start] mov [ebx+0x08], ecx ;app_eip mov edx,[APP_HEADER_01.mem_size] + +; \begin{diamond}[20.08.2006] +; sanity check (functions 19,58 load app_i_end bytes and that must +; fit in allocated memory to prevent kernel faults) + cmp edx,[APP_HEADER_01.i_end] + jb .fail +; \end{diamond}[20.08.2006] + mov [ebx+0x10], edx ;app_mem mov ecx,[APP_HEADER_01.stack_top] mov [ebx+0x0C], ecx ;app_esp @@ -1029,9 +1037,9 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov [ecx+0],dword 0 mov [ecx+4],dword 0 - mov eax,[SCR_X_SIZE] + mov eax,[ScreenWidth] mov [ecx+8],eax - mov eax,[SCR_Y_SIZE] + mov eax,[ScreenHeight] mov [ecx+12],eax mov edi,[slot] diff --git a/kernel/trunk/detect/commouse.inc b/kernel/trunk/detect/commouse.inc index 77967e06cf..13c1de7176 100644 --- a/kernel/trunk/detect/commouse.inc +++ b/kernel/trunk/detect/commouse.inc @@ -19,12 +19,12 @@ Detect_COM_Mouse: shl eax,2 mov [irq_owner+eax],byte 1 - inc dword [0x2d0000] - mov edi,[0x2d0000] + inc dword [RESERVED_PORTS] + mov edi,[RESERVED_PORTS] shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x3f0 - mov [0x2d0000+edi+8],dword 0x3ff + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0x3f0 + mov [RESERVED_PORTS+edi+8],dword 0x3ff popa mov esi,boot_setmouse_type+22 @@ -33,20 +33,20 @@ Detect_COM_Mouse: sub [COMPortBaseAddr],100h call MSMouseSearch cmp AL,'M' - jne @f + jne @f mov [com2_mouse_detected],1 pusha mov eax,3 shl eax,2 mov [irq_owner+eax],byte 1 - - inc dword [0x2d0000] - mov edi,[0x2d0000] + + inc dword [RESERVED_PORTS] + mov edi,[RESERVED_PORTS] shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x2f0 - mov [0x2d0000+edi+8],dword 0x2ff + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0x2f0 + mov [RESERVED_PORTS+edi+8],dword 0x2ff popa mov esi,boot_setmouse_type+44 @@ -77,14 +77,14 @@ MouseSearch: add DX,3 mov AL,00000010b out DX,AL - ; Запретить все прерывания + ; Запретить все прерывани mov DX,[COMPortBaseAddr] inc DX mov AL,0 out DX,AL -; Проверить, что устройство подключено и является +; Проверить, что устройство подключено и являетс ; мышью типа MSMouse - ; Отключить питание мыши и прерывания + ; Отключить питание мыши и прерывани mov DX,[COMPortBaseAddr] add DX,4 ;регистр управления модемом mov AL,0 ;сбросить DTR, RTS и OUT2 @@ -95,14 +95,14 @@ dT_1: dec ecx cmp ecx,0 jne dT_1 - mov ecx,0xffff + mov ecx,0xffff ; Включить питание мыши mov AL,11b ;установить DTR и RTS out DX,AL - ; Очистить регистр данных + ; Очистить регистр данных mov DX,[COMPortBaseAddr] in AL,DX -; Цикл опроса порта +; Цикл опроса порта WaitData: ; Ожидать еще 10 "тиков" dec ecx diff --git a/kernel/trunk/detect/dev_fd.inc b/kernel/trunk/detect/dev_fd.inc index 753844d716..84cba7a4f8 100644 --- a/kernel/trunk/detect/dev_fd.inc +++ b/kernel/trunk/detect/dev_fd.inc @@ -4,8 +4,8 @@ ; автор Mario79 ;*************************************************** xor eax,eax - mov edi,0x40000 - mov ecx,16384 + mov edi,DRIVE_DATA + mov ecx,16384 cld rep stosd @@ -17,4 +17,4 @@ wait_cmos: cmp cx,0 jne wait_cmos in al,0x71 - mov [0x40000],al + mov [DRIVE_DATA],al diff --git a/kernel/trunk/drivers/ensoniq.asm b/kernel/trunk/drivers/ensoniq.asm new file mode 100644 index 0000000000..d2509025a8 --- /dev/null +++ b/kernel/trunk/drivers/ensoniq.asm @@ -0,0 +1,1381 @@ + +;alpha version + +format MS COFF + + +include 'proc32.inc' + +DEBUG equ 1 + +REMAP_IRQ equ 0 + +;irq 0,1,2,8,12,13 недоступны +; FEDCBA9876543210 +VALID_IRQ equ 1100111011111000b +ATTCH_IRQ equ 0000111010101000b + +IRQ_LINE equ 0 + +CPU_FREQ equ 2600d + +BIT0 EQU 0x00000001 +BIT1 EQU 0x00000002 +BIT2 EQU 0x00000004 +BIT3 EQU 0x00000008 +BIT4 EQU 0x00000010 +BIT5 EQU 0x00000020 +BIT6 EQU 0x00000040 +BIT7 EQU 0x00000080 +BIT8 EQU 0x00000100 +BIT9 EQU 0x00000200 +BIT10 EQU 0x00000400 +BIT11 EQU 0x00000800 +BIT12 EQU 0x00001000 +BIT13 EQU 0x00002000 +BIT14 EQU 0x00004000 +BIT15 EQU 0x00008000 +BIT16 EQU 0x00010000 +BIT17 EQU 0x00020000 +BIT18 EQU 0x00040000 +BIT19 EQU 0x00080000 +BIT20 EQU 0x00100000 +BIT21 EQU 0x00200000 +BIT22 EQU 0x00400000 +BIT23 EQU 0x00800000 +BIT24 EQU 0x00100000 +BIT25 EQU 0x02000000 +BIT26 EQU 0x04000000 +BIT27 EQU 0x08000000 +BIT28 EQU 0x10000000 +BIT29 EQU 0x20000000 +BIT30 EQU 0x40000000 +BIT31 EQU 0x80000000 + +VID_INTEL equ 0x8086 +VID_NVIDIA equ 0x10DE + +CTRL_ICH equ 0x2415 +CTRL_ICH0 equ 0x2425 +CTRL_ICH2 equ 0x2435 +CTRL_ICH3 equ 0x2445 +CTRL_ICH4 equ 0x24C5 +CTRL_ICH5 equ 0x24D5 +CTRL_ICH6 equ 0x266E +CTRL_ICH7 equ 0x27DE + +CTRL_NFORCE equ 0x01B1 +CTRL_NFORCE2 equ 0x006A +CTRL_NFORCE3 equ 0x00DA + + +PCM_OUT_BDL equ 0x10 ; PCM out buffer descriptors list +PCM_OUT_CR_REG equ 0x1b ; PCM out Control Register +PCM_OUT_LVI_REG equ 0x15 ; PCM last valid index +PCM_OUT_SR_REG equ 0x16 ; PCM out Status register +PCM_OUT_PIV_REG equ 0x1a +PCM_OUT_CIV_REG equ 0x14 ; PCM out current index + +PCM_IN_CR_REG equ 0x0b ; PCM in Control Register +MC_IN_CR_REG equ 0x2b ; MIC in Control Register +RR equ BIT1 ; reset registers. Nukes all regs + +CODEC_MASTER_VOL_REG equ 0x02 +CODEC_AUX_VOL equ 0x04 ; +CODEC_PCM_OUT_REG equ 18h ; PCM output volume +CODEC_EXT_AUDIO_REG equ 28h ; extended audio +CODEC_EXT_AUDIO_CTRL_REG equ 2ah ; extended audio control +CODEC_PCM_FRONT_DACRATE_REG equ 2ch ; PCM out sample rate +CODEC_PCM_SURND_DACRATE_REG equ 2eh ; surround sound sample rate +CODEC_PCM_LFE_DACRATE_REG equ 30h ; LFE sample rate + +GLOB_CTRL equ 0x2C ; Global Control +CTRL_STAT equ 0x30 ; Global Status +CTRL_CAS equ 0x34 ; Codec Access Semiphore + +CAS_FLAG equ 0x01 ; Codec Access Semiphore Bit + +CTRL_ST_CREADY equ BIT8+BIT9+BIT28 ; Primary Codec Ready + +CTRL_ST_RCS equ 0x00008000 ; Read Completion Status + +CTRL_CNT_CRIE equ BIT4+BIT5+BIT6 ; Codecs Resume Interrupt Enable +CTRL_CNT_AC_OFF equ 0x00000008 ; ACLINK Off +CTRL_CNT_WARM equ 0x00000004 ; AC97 Warm Reset +CTRL_CNT_COLD equ 0x00000002 ; AC97 Cold Reset +CTRL_CNT_GIE equ 0x00000001 ; GPI Interrupt Enable + +CODEC_REG_POWERDOWN equ 0x26 +CODEC_REG_ST equ 0x26 + +DEV_PLAY equ 1 +DEV_STOP equ 2 +DEV_CALLBACK equ 3 +DEV_SET_BUFF equ 4 +DEV_NOTIFY equ 5 +DEV_SET_MASTERVOL equ 6 +DEV_GET_MASTERVOL equ 7 +DEV_GET_INFO equ 8 + +struc AC_CNTRL ;AC controller base class +{ .bus dd ? + .devfn dd ? + + .vendor dd ? + .dev_id dd ? + .pci_cmd dd ? + .pci_stat dd ? + + .codec_io_base dd ? + .codec_mem_base dd ? + + .ctrl_io_base dd ? + .ctrl_mem_base dd ? + .cfg_reg dd ? + .int_line dd ? + + .vendor_ids dd ? ;vendor id string + .ctrl_ids dd ? ;hub id string + + .buffer dd ? + + .notify_pos dd ? + .notify_task dd ? + + .lvi_reg dd ? + .ctrl_setup dd ? + .user_callback dd ? + .codec_read16 dd ? + .codec_write16 dd ? + + .ctrl_read8 dd ? + .ctrl_read16 dd ? + .ctrl_read32 dd ? + + .ctrl_write8 dd ? + .ctrl_write16 dd ? + .ctrl_write32 dd ? +} + +struc CODEC ;Audio Chip base class +{ + .chip_id dd ? + .flags dd ? + .status dd ? + + .ac_vendor_ids dd ? ;ac vendor id string + .chip_ids dd ? ;chip model string + + .shadow_flag dd ? + dd ? + + .regs dw ? ; codec registers + .reg_master_vol dw ? ;0x02 + .reg_aux_out_vol dw ? ;0x04 + .reg_mone_vol dw ? ;0x06 + .reg_master_tone dw ? ;0x08 + .reg_beep_vol dw ? ;0x0A + .reg_phone_vol dw ? ;0x0C + .reg_mic_vol dw ? ;0x0E + .reg_line_in_vol dw ? ;0x10 + .reg_cd_vol dw ? ;0x12 + .reg_video_vol dw ? ;0x14 + .reg_aux_in_vol dw ? ;0x16 + .reg_pcm_out_vol dw ? ;0x18 + .reg_rec_select dw ? ;0x1A + .reg_rec_gain dw ? ;0x1C + .reg_rec_gain_mic dw ? ;0x1E + .reg_gen dw ? ;0x20 + .reg_3d_ctrl dw ? ;0X22 + .reg_page dw ? ;0X24 + .reg_powerdown dw ? ;0x26 + .reg_ext_audio dw ? ;0x28 + .reg_ext_st dw ? ;0x2a + .reg_pcm_front_rate dw ? ;0x2c + .reg_pcm_surr_rate dw ? ;0x2e + .reg_lfe_rate dw ? ;0x30 + .reg_pcm_in_rate dw ? ;0x32 + dw ? ;0x34 + .reg_cent_lfe_vol dw ? ;0x36 + .reg_surr_vol dw ? ;0x38 + .reg_spdif_ctrl dw ? ;0x3A + dw ? ;0x3C + dw ? ;0x3E + dw ? ;0x40 + dw ? ;0x42 + dw ? ;0x44 + dw ? ;0x46 + dw ? ;0x48 + dw ? ;0x4A + dw ? ;0x4C + dw ? ;0x4E + dw ? ;0x50 + dw ? ;0x52 + dw ? ;0x54 + dw ? ;0x56 + dw ? ;0x58 + dw ? ;0x5A + dw ? ;0x5C + dw ? ;0x5E + .reg_page_0 dw ? ;0x60 + .reg_page_1 dw ? ;0x62 + .reg_page_2 dw ? ;0x64 + .reg_page_3 dw ? ;0x66 + .reg_page_4 dw ? ;0x68 + .reg_page_5 dw ? ;0x6A + .reg_page_6 dw ? ;0x6C + .reg_page_7 dw ? ;0x6E + dw ? ;0x70 + dw ? ;0x72 + dw ? ;0x74 + dw ? ;0x76 + dw ? ;0x78 + dw ? ;0x7A + .reg_vendor_id_1 dw ? ;0x7C + .reg_vendor_id_2 dw ? ;0x7E + + + .reset dd ? ;virual + .set_master_vol dd ? +} + +struc CTRL_INFO +{ .pci_cmd dd ? + .irq dd ? + .glob_cntrl dd ? + .glob_sta dd ? + .codec_io_base dd ? + .ctrl_io_base dd ? + .codec_mem_base dd ? + .ctrl_mem_base dd ? + .codec_id dd ? +} + +struc IOCTL +{ .handle dd ? + .io_code dd ? + .input dd ? + .inp_size dd ? + .output dd ? + .out_size dd ? +} + +virtual at 0 + IOCTL IOCTL +end virtual + +EVENT_NOTIFY equ 0x00000200 + +OS_BASE equ 0; 0x80400000 +new_app_base equ 0x60400000; 0x01000000 +PROC_BASE equ OS_BASE+0x0080000 + +public START +public STOP +public service_proc + +extrn AttachIntHandler +extrn SysMsgBoardStr +extrn PciApi +extrn PciRead32 +extrn PciRead8 +extrn PciWrite8 +extrn AllocKernelSpace +extrn MapPage +extrn RegService +extrn KernelAlloc +extrn GetPgAddr +extrn GetCurrentTask + +section '.flat' code readable align 16 + +START: + if DEBUG + mov esi, msgInit + call SysMsgBoardStr + end if + + call detect_controller + test eax, eax + jz .fail + + if DEBUG + mov esi,[ctrl.vendor_ids] + call SysMsgBoardStr + mov esi, [ctrl.ctrl_ids] + call SysMsgBoardStr + + end if + + call init_controller + test eax, eax + jz .fail + + if DEBUG + mov esi, msgInitCodec + call SysMsgBoardStr + end if + + call init_codec + test eax, eax + jz .fail + + if DEBUG + mov esi, [codec.ac_vendor_ids] + call SysMsgBoardStr + + mov esi, [codec.chip_ids] + call SysMsgBoardStr + end if + + call reset_controller + call setup_codec + + mov esi, msgPrimBuff + call SysMsgBoardStr + + call create_primary_buff + +; if REMAP_IRQ + +; call get_LPC_bus +; cmp eax, -1 +; jz .fail + +; mov [lpc_bus], 0 ;eax +; call remap_irq +; end if + + mov eax, VALID_IRQ + mov ebx, [ctrl.int_line] + mov esi, msgInvIRQ + bt eax, ebx + jnc .fail + mov eax, ATTCH_IRQ + mov esi, msgAttchIRQ + bt eax, ebx + jnc .fail + + stdcall AttachIntHandler, ebx, ac97_irq + stdcall RegService, sz_sound_srv, service_proc + ret +.fail: + if DEBUG + mov esi, msgFail + call SysMsgBoardStr + end if + xor eax, eax +STOP: + ret + +handle equ IOCTL.handle +io_code equ IOCTL.io_code +input equ IOCTL.input +inp_size equ IOCTL.inp_size +output equ IOCTL.output +out_size equ IOCTL.out_size + +align 4 +proc service_proc stdcall, ioctl:dword + + mov edi, [ioctl] + mov eax, [edi+io_code] + cmp eax, DEV_PLAY + jne @F + if DEBUG + mov esi, msgPlay + call SysMsgBoardStr + end if + call play + ret +@@: + cmp eax, DEV_STOP + jne @F + if DEBUG + mov esi, msgStop + call SysMsgBoardStr + end if + call stop + ret +@@: + cmp eax, DEV_CALLBACK + jne @F + mov ebx, [edi+input] + stdcall set_callback, [ebx] + ret +@@: + cmp eax, DEV_SET_MASTERVOL + jne @F + mov ebx, [edi+input] + stdcall set_master_vol, [ebx] + ret +@@: + cmp eax, DEV_GET_MASTERVOL + jne @F + mov ebx, [edi+output] + test ebx, ebx + jz .fail + + stdcall get_master_vol, ebx + ret +@@: + cmp eax, DEV_GET_INFO + jne @F + mov ebx, [edi+output] + stdcall get_dev_info, ebx + ret +@@: +.fail: + xor eax, eax + ret +endp + +restore handle +restore io_code +restore input +restore inp_size +restore output +restore out_size + + +align 4 +proc remap_irq ;for Intel chipsets ONLY !!! + mov eax, VALID_IRQ + bt eax, IRQ_LINE + jnc .exit + + mov edx, 0x4D0 + in ax,dx + bts ax, IRQ_LINE + out dx, aX + + stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE + mov [ctrl.int_line], IRQ_LINE + +.exit: + ret +endp + +align 4 +proc ac97_irq + +; if DEBUG +; mov esi, msgIRQ +; call SysMsgBoardStr +; end if + + mov edx, PCM_OUT_CR_REG + mov al, 0x14 + call [ctrl.ctrl_write8] + + mov ax, 0x1c + mov edx, PCM_OUT_SR_REG + call [ctrl.ctrl_write16] + + mov edx, PCM_OUT_CIV_REG + call [ctrl.ctrl_read8] + + and eax, 0x1F + cmp eax, [civ_val] + je .skip + + mov [civ_val], eax + dec eax + and eax, 0x1F + mov [ctrl.lvi_reg], eax + + mov edx, PCM_OUT_LVI_REG + call [ctrl.ctrl_write8] + + mov edx, PCM_OUT_CR_REG + mov ax, 0x1D + call [ctrl.ctrl_write8] + + mov eax, [civ_val] + add eax, 2 + and eax, 31 + mov ebx, dword [buff_list+eax*4] + + cmp [ctrl.user_callback], 0 + je @f + + stdcall [ctrl.user_callback], ebx +@@: + ret + +.skip: + mov edx, PCM_OUT_CR_REG + mov ax, 0x1D + call [ctrl.ctrl_write8] + ret +endp + +align 4 +proc create_primary_buff + + stdcall KernelAlloc, 0x10000 + mov [ctrl.buffer], eax + + mov edi, eax + mov ecx, 0x10000/4 + xor eax, eax + cld + rep stosd + + stdcall GetPgAddr, [ctrl.buffer] + + mov ebx, 0xC0002000 + mov ecx, 4 + mov edi, pcmout_bdl +@@: + mov [edi], eax + mov [edi+4], ebx + + mov [edi+32], eax + mov [edi+4+32], ebx + + mov [edi+64], eax + mov [edi+4+64], ebx + + mov [edi+96], eax + mov [edi+4+96], ebx + + mov [edi+128], eax + mov [edi+4+128], ebx + + mov [edi+160], eax + mov [edi+4+160], ebx + + mov [edi+192], eax + mov [edi+4+192], ebx + + mov [edi+224], eax + mov [edi+4+224], ebx + + add eax, 0x4000 + add edi, 8 + loop @B + + mov edi, buff_list + mov eax, [ctrl.buffer] + mov ecx, 4 +@@: + mov [edi], eax + mov [edi+16], eax + mov [edi+32], eax + mov [edi+48], eax + mov [edi+64], eax + mov [edi+80], eax + mov [edi+96], eax + mov [edi+112], eax + + add eax, 0x4000 + add edi, 4 + loop @B + + mov ecx, pcmout_bdl + stdcall GetPgAddr, ecx + and ecx, 0xFFF + add eax, ecx + + mov edx, PCM_OUT_BDL + call [ctrl.ctrl_write32] + + mov eax, 16 + mov [ctrl.lvi_reg], eax + mov edx, PCM_OUT_LVI_REG + call [ctrl.ctrl_write8] + + ret +endp + +align 4 +proc detect_controller + locals + last_bus dd ? + bus dd ? + devfn dd ? + endl + + xor eax, eax + mov [bus], eax + inc eax + call PciApi + cmp eax, -1 + je .no_pci + + mov [last_bus], eax + +.next_bus: + and [devfn], 0 +.next_dev: + stdcall PciRead32, [bus], [devfn], dword 0 + test eax, eax + jz .next + cmp eax, -1 + je .next + + mov edi, devices +@@: + mov ebx, [edi] + test ebx, ebx + jz .next + + cmp eax, ebx + je .found + add edi, 12 + jmp @B + +.next: inc [devfn] + cmp [devfn], 256 + jb .next_dev + mov eax, [bus] + inc eax + mov [bus], eax + cmp eax, [last_bus] + jna .next_bus + xor eax, eax + ret +.found: + mov ebx, [bus] + mov [ctrl.bus], ebx + + mov ecx, [devfn] + mov [ctrl.devfn], ecx + + mov edx, eax + and edx, 0xFFFF + mov [ctrl.vendor], edx + shr eax, 16 + mov [ctrl.dev_id], eax + + mov ebx, [edi+4] + mov [ctrl.ctrl_ids], ebx + mov esi, [edi+8] + mov [ctrl.ctrl_setup], esi + + cmp ebx, VID_INTEL + jne @F + mov [ctrl.vendor_ids], msg_Intel + ret +@@: + cmp ebx, VID_NVIDIA + jne @F + mov [ctrl.vendor_ids], msg_NVidia +@@: + cmp ebx, 0x1274 + jne @F + mov [ctrl.vendor_ids], msgEnsoniq + ret +@@: + mov [ctrl.vendor_ids], 0 ;something wrong ? + ret +.no_pci: + mov esi, msgPCI + call SysMsgBoardStr +.err: + xor eax, eax + ret +endp + +align 4 +proc get_LPC_bus ;for Intel chipsets ONLY !!! + locals + last_bus dd ? + bus dd ? + endl + + xor eax, eax + mov [bus], eax + inc eax + call [PciApi] + cmp eax, -1 + je .err + + mov [last_bus], eax +.next_bus: + stdcall PciRead32, [bus], dword 0xF8, dword 0 + test eax, eax + jz .next + cmp eax, -1 + je .next + + cmp eax, 0x24D08086 + je .found +.next: + mov eax, [bus] + inc eax + cmp eax, [last_bus] + mov [bus], eax + jna .next_bus +.err: + xor eax, eax + dec eax + ret +.found: + mov eax, [bus] + ret +endp + +align 4 +proc init_controller + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 + mov ebx, eax + and eax, 0xFFFF + mov [ctrl.pci_cmd], eax + shr ebx, 16 + mov [ctrl.pci_stat], ebx + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 + and eax,0xFFFE + mov [ctrl.codec_io_base], eax + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 + and eax, 0xFFC0 + mov [ctrl.ctrl_io_base], eax + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18 + mov [ctrl.codec_mem_base], eax + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C + mov [ctrl.ctrl_mem_base], eax + + stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C + and eax, 0xFF + mov [ctrl.int_line], eax + + stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41 + and eax, 0xFF + mov [ctrl.cfg_reg], eax + + call [ctrl.ctrl_setup] + xor eax, eax + inc eax + ret +endp + +align 4 +proc set_ICH + mov [ctrl.codec_read16], codec_io_r16 ;virtual + mov [ctrl.codec_write16], codec_io_w16 ;virtual + + mov [ctrl.ctrl_read8 ], ctrl_io_r8 ;virtual + mov [ctrl.ctrl_read16], ctrl_io_r16 ;virtual + mov [ctrl.ctrl_read32], ctrl_io_r32 ;virtual + + mov [ctrl.ctrl_write8 ], ctrl_io_w8 ;virtual + mov [ctrl.ctrl_write16], ctrl_io_w16 ;virtual + mov [ctrl.ctrl_write32], ctrl_io_w32 ;virtual + ret +endp + +PG_SW equ 0x003 +PG_NOCACHE equ 0x018 + +align 4 +proc set_ICH4 + stdcall AllocKernelSpace, dword 0x2000 + mov edi, eax + stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE + mov [ctrl.codec_mem_base], edi + add edi, 0x1000 + stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE + mov [ctrl.ctrl_mem_base], edi + + mov [ctrl.codec_read16], codec_mem_r16 ;virtual + mov [ctrl.codec_write16], codec_mem_w16 ;virtual + + mov [ctrl.ctrl_read8 ], ctrl_mem_r8 ;virtual + mov [ctrl.ctrl_read16], ctrl_mem_r16 ;virtual + mov [ctrl.ctrl_read32], ctrl_mem_r32 ;virtual + + mov [ctrl.ctrl_write8 ], ctrl_mem_w8 ;virtual + mov [ctrl.ctrl_write16], ctrl_mem_w16 ;virtual + mov [ctrl.ctrl_write32], ctrl_mem_w32 ;virtual + ret +endp + +align 4 +proc reset_controller + + xor eax, eax + mov edx, PCM_IN_CR_REG + call [ctrl.ctrl_write8] + + mov edx, PCM_OUT_CR_REG + call [ctrl.ctrl_write8] + + mov edx, MC_IN_CR_REG + call [ctrl.ctrl_write8] + + mov eax, RR + mov edx, PCM_IN_CR_REG + call [ctrl.ctrl_write8] + + mov edx, PCM_OUT_CR_REG + call [ctrl.ctrl_write8] + + mov edx, MC_IN_CR_REG + call [ctrl.ctrl_write8] + + ret +endp + +align 4 +proc init_codec + locals + counter dd ? + endl + + call reset_codec + and eax, eax + jz .err + + xor edx, edx ;ac_reg_0 + call [ctrl.codec_write16] + + xor eax, eax + mov edx, CODEC_REG_POWERDOWN + call [ctrl.codec_write16] + + mov [counter], 200 ; total 200*5 ms = 1s +.wait: + mov edx, CODEC_REG_POWERDOWN + call [ctrl.codec_read16] + and eax, 0x0F + cmp eax, 0x0F + jz .ready + + mov eax, 5000 ; wait 5 ms + call StallExec + sub [counter] , 1 + jnz .wait +.err: + xor eax, eax ; timeout error + ret +.ready: + call detect_codec + + xor eax, eax + inc eax + ret +endp + +align 4 +proc reset_codec + mov edx, GLOB_CTRL + call [ctrl.ctrl_read32] + + test eax, 0x02 + jz .cold + + call warm_reset + jnc .ok +.cold: + call cold_reset + jnc .ok + + if DEBUG + mov esi, msgCFail + call SysMsgBoardStr + end if + xor eax, eax ; timeout error + ret +.ok: + if DEBUG + mov esi, msgResetOk + call SysMsgBoardStr + end if + + xor eax, eax + inc eax + ret +endp + +align 4 +proc warm_reset + locals + counter dd ? + endl + + mov eax, 0x06 + mov edx, GLOB_CTRL + call [ctrl.ctrl_write32] + + if DEBUG + mov esi, msgWarm + call SysMsgBoardStr + end if + + mov [counter], 10 ; total 10*100 ms = 1s +.wait: + mov eax, 100000 ; wait 100 ms + call StallExec + + mov edx, GLOB_CTRL + call [ctrl.ctrl_read32] + test eax, 4 + jz .ok + sub [counter], 1 + jnz .wait + + if DEBUG + mov esi, msgWRFail + call SysMsgBoardStr + end if + + stc + ret +.ok: + mov edx, CTRL_STAT + call [ctrl.ctrl_read32] + and eax, CTRL_ST_CREADY + jz .fail + clc + ret +.fail: + stc + ret +endp + +align 4 +proc cold_reset + locals + counter dd ? + endl + + xor eax, eax + mov edx, GLOB_CTRL + call [ctrl.ctrl_write32] + + if DEBUG + mov esi, msgCold + call SysMsgBoardStr + end if + + mov eax, 1000000 ; wait 1 s + call StallExec + + mov eax, 2 + mov edx, GLOB_CTRL + call [ctrl.ctrl_write32] + + mov [counter], 10 ; total 10*100 ms = 1s +.wait: + mov eax, 100000 ; wait 100 ms + call StallExec + + mov edx, GLOB_CTRL + call [ctrl.ctrl_read32] + test eax, 4 + jz .ok + sub [counter], 1 + jnz .wait + + if DEBUG + mov esi, msgCRFail + call SysMsgBoardStr + end if + stc + ret +.ok: + mov edx, CTRL_STAT + call [ctrl.ctrl_read32] + and eax, CTRL_ST_CREADY + jz .fail + clc + ret +.fail: + stc + ret +endp + +align 4 +proc play + + mov eax, 16 + mov [ctrl.lvi_reg], eax + mov edx, PCM_OUT_LVI_REG + call [ctrl.ctrl_write8] + + mov edx, PCM_OUT_CR_REG + mov ax, 0x1D + call [ctrl.ctrl_write8] + ret +endp + +align 4 +proc stop + mov edx, PCM_OUT_CR_REG + mov ax, 0x14 + call [ctrl.ctrl_write8] + + mov eax, 16 + mov [ctrl.lvi_reg], eax + mov edx, PCM_OUT_LVI_REG + call [ctrl.ctrl_write8] + + ret +endp + +align 4 +proc get_dev_info stdcall, p_info:dword + virtual at esi + CTRL_INFO CTRL_INFO + end virtual + + mov esi, [p_info] + mov eax, [ctrl.int_line] + mov ebx, [ctrl.codec_io_base] + mov ecx, [ctrl.ctrl_io_base] + mov edx, [ctrl.codec_mem_base] + mov edi, [ctrl.ctrl_mem_base] + + mov [CTRL_INFO.irq], eax + mov [CTRL_INFO.codec_io_base], ebx + mov [CTRL_INFO.ctrl_io_base], ecx + mov [CTRL_INFO.codec_mem_base], edx + mov [CTRL_INFO.ctrl_mem_base], edi + + mov eax, [codec.chip_id] + mov [CTRL_INFO.codec_id], eax + + mov edx, GLOB_CTRL + call [ctrl.ctrl_read32] + mov [CTRL_INFO.glob_cntrl], eax + + mov edx, CTRL_STAT + call [ctrl.ctrl_read32] + mov [CTRL_INFO.glob_sta], eax + + mov ebx, [ctrl.pci_cmd] + mov [CTRL_INFO.pci_cmd], ebx + + ret +endp + +align 4 +proc set_callback stdcall, handler:dword + mov eax, [handler] + mov [ctrl.user_callback], eax + ret +endp + +align 4 +proc codec_read stdcall, ac_reg:dword ; reg = edx, reval = eax + + mov edx, [ac_reg] + + mov ebx, edx + shr ebx, 1 + bt [codec.shadow_flag], ebx + jc .use_shadow + + call [ctrl.codec_read16] ;change edx !!! + mov ecx, eax + + mov edx, CTRL_STAT + call [ctrl.ctrl_read32] + test eax, CTRL_ST_RCS + jz .read_ok + + mov edx, CTRL_STAT + call [ctrl.ctrl_write32] + xor eax,eax + not eax ;timeout + ret +.read_ok: + mov edx, [ac_reg] + mov [codec.regs+edx], cx + bts [codec.shadow_flag], ebx + mov eax, ecx + ret +.use_shadow: + movzx eax, word [codec.regs+edx] + ret +endp + +align 4 +proc codec_write stdcall, ac_reg:dword + push eax + call check_semafore + and eax, eax + jz .err + pop eax + + mov esi, [ac_reg] + mov edx, esi + call [ctrl.codec_write16] + mov [codec.regs+esi], ax + shr esi, 1 + bts [codec.shadow_flag], esi + ret +.err: + pop eax + ret +endp + +align 4 +proc codec_check_ready + + mov edx, CTRL_ST + call [ctrl.ctrl_read32] + and eax, CTRL_ST_CREADY + jz .not_ready + + xor eax, wax + inc eax + ret + +align 4 +.not_ready: + xor eax, eax + ret +endp + +align 4 +proc check_semafore + local counter:DWORD + + mov [counter], 100 +.l1: + mov edx, CTRL_CAS + call [ctrl.ctrl_read8] + and eax, CAS_FLAG + jz .ok + + mov eax, 1 + call StallExec + sub [counter], 1 + jnz .l1 + xor eax, eax + ret +align 4 +.ok: + xor eax,eax + inc eax + ret +endp + +align 4 +proc StallExec + push ecx + push edx + push ebx + push eax + + mov ecx, CPU_FREQ + mul ecx + mov ebx, eax ;low + mov ecx, edx ;high + rdtsc + add ebx, eax + adc ecx,edx +@@: + rdtsc + sub eax, ebx + sbb edx, ecx + jb @B + + pop eax + pop ebx + pop edx + pop ecx + ret +endp + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; CONTROLLER IO functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +align 4 +proc codec_io_r16 + add edx, [ctrl.codec_io_base] + in ax, dx + ret +endp + +align 4 +proc codec_io_w16 + add edx, [ctrl.codec_io_base] + out dx, ax + ret +endp + +align 4 +proc ctrl_io_r8 + add edx, [ctrl.ctrl_io_base] + in al, dx + ret +endp + +align 4 +proc ctrl_io_r16 + add edx, [ctrl.ctrl_io_base] + in ax, dx + ret +endp + +align 4 +proc ctrl_io_r32 + add edx, [ctrl.ctrl_io_base] + in eax, dx + ret +endp + +align 4 +proc ctrl_io_w8 + add edx, [ctrl.ctrl_io_base] + out dx, al + ret +endp + +align 4 +proc ctrl_io_w16 + add edx, [ctrl.ctrl_io_base] + out dx, ax + ret +endp + +align 4 +proc ctrl_io_w32 + add edx, [ctrl.ctrl_io_base] + out dx, eax + ret +endp + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; MEMORY MAPPED IO (os depended) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +align 4 +proc codec_mem_r16 + add edx, [ctrl.codec_mem_base] + mov ax, word [edx] + ret +endp + +align 4 +proc codec_mem_w16 + add edx, [ctrl.codec_mem_base] + mov word [edx], ax + ret +endp + +align 4 +proc ctrl_mem_r8 + add edx, [ctrl.ctrl_mem_base] + mov al, [edx] + ret +endp + +align 4 +proc ctrl_mem_r16 + add edx, [ctrl.ctrl_mem_base] + mov ax, [edx] + ret +endp + +align 4 +proc ctrl_mem_r32 + add edx, [ctrl.ctrl_mem_base] + mov eax, [edx] + ret +endp + +align 4 +proc ctrl_mem_w8 + add edx, [ctrl.ctrl_mem_base] + mov [edx], al + + ret +endp + +align 4 +proc ctrl_mem_w16 + add edx, [ctrl.ctrl_mem_base] + mov [edx], ax + ret +endp + +align 4 +proc ctrl_mem_w32 + add edx, [ctrl.ctrl_mem_base] + mov [edx], eax + ret +endp + + +include "codec.inc" + +align 4 +devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH + dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH + dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH + dd (CTRL_ICH3 shl 16)+VID_INTEL,msg_ICH3,set_ICH + dd (CTRL_ICH4 shl 16)+VID_INTEL,msg_ICH4,set_ICH4 + dd (CTRL_ICH5 shl 16)+VID_INTEL,msg_ICH5,set_ICH4 + dd (CTRL_ICH6 shl 16)+VID_INTEL,msg_ICH6,set_ICH4 + dd (CTRL_ICH7 shl 16)+VID_INTEL,msg_ICH7,set_ICH4 + + dd (CTRL_NFORCE shl 16)+VID_NVIDIA,msg_NForce, set_ICH + dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA,msg_NForce2,set_ICH + dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH + dd (0x5000 shl 16)+0x1274,msgEnsoniq,set_ICH + + dd 0 ;terminator + +msg_ICH db 'Intel ICH', 13,10, 0 +msg_ICH0 db 'Intel ICH0', 13,10, 0 +msg_ICH2 db 'Intel ICH2', 13,10, 0 +msg_ICH3 db 'Intel ICH3', 13,10, 0 +msg_ICH4 db 'Intel ICH4', 13,10, 0 +msg_ICH5 db 'Intel ICH5', 13,10, 0 +msg_ICH6 db 'Intel ICH6', 13,10, 0 +msg_ICH7 db 'Intel ICH7', 13,10, 0 +msg_Intel db 'Intel Corp. ', 0 + +msg_NForce db 'NForce', 13,10, 0 +msg_NForce2 db 'NForce 2', 13,10, 0 +msg_NForce3 db 'NForce 3', 13,10, 0 +msg_NVidia db 'NVidea', 0 + +msgEnsoniq db 'Ensonic 1371',0 + +szKernel db 'KERNEL', 0 +sz_sound_srv db 'SOUND',0 + +msgInit db 'detect hardware...',13,10,0 +msgPCI db 'PCI accsess not supported',13,10,0 +msgFail db 'device not found',13,10,0 +msgAttchIRQ db 'IRQ line not supported', 13,10, 0 +msgInvIRQ db 'IRQ line not assigned or invalid', 13,10, 0 +msgPlay db 'start play', 13,10,0 +msgStop db 'stop play', 13,10,0 +msgNotify db 'call notify',13,10,0 +msgIRQ db 'AC97 IRQ', 13,10,0 +msgInitCtrl db 'init controller',13,10,0 +msgInitCodec db 'init codec',13,10,0 +msgPrimBuff db 'create primary buffer',13,10,0 +msgReg db 'set service handler',13,10,0 +msgOk db 'service installed',13,10,0 +msgCold db 'cold reset',13,10,0 +msgWarm db 'warm reset',13,10,0 +msgWRFail db 'warm reset failed',13,10,0 +msgCRFail db 'cold reset failed',13,10,0 +msgCFail db 'codec not ready',13,10,0 +msgResetOk db 'reset complete',13,10,0 + +section '.data' data readable writable align 16 + +pcmout_bdl rq 32 +buff_list rd 32 + +codec CODEC +ctrl AC_CNTRL + +lpc_bus rd 1 +civ_val rd 1 + + diff --git a/kernel/trunk/fs/fat12.inc b/kernel/trunk/fs/fat12.inc index c9b58633aa..6931e888c2 100644 --- a/kernel/trunk/fs/fat12.inc +++ b/kernel/trunk/fs/fat12.inc @@ -219,7 +219,7 @@ frfl7_1: frfl8_1: mov edi,[n_sector] shl edi,1 ;find next cluster from FAT - add edi,0x282000 + add edi,FLOPPY_FAT mov eax,[edi] and eax,4095 mov edi,eax @@ -333,7 +333,7 @@ calculatefatchain_flp: pushad mov esi,FLOPPY_BUFF - mov edi,0x282000 + mov edi,FLOPPY_FAT fcnew_1: mov eax,dword [esi] @@ -361,7 +361,7 @@ calculatefatchain_flp: add edi,4 add esi,12 - cmp edi,0x282000+2856*2 ;2849 clusters + cmp edi,FLOPPY_FAT+2856*2 ;2849 clusters jnz fcnew_1 popad @@ -471,7 +471,7 @@ unnecessary_flp_fat_save: restorefatchain_flp: ; restore fat chain pushad - mov esi,0x282000 + mov esi,FLOPPY_FAT mov edi,FLOPPY_BUFF fcnew2_1: @@ -574,7 +574,7 @@ fifoundd_2_1: movzx edi, word [edi+0xf] ;edi = cluster frnewd_1: shl edi,1 ;find next cluster from FAT - add edi,0x282000 + add edi,FLOPPY_FAT mov eax,[edi] mov [edi],word 0x0 ;clear fat chain cluster and eax,4095 @@ -783,7 +783,7 @@ frnewds_2: add ebx,1 mov edi,ebx ; find free cluster in FAT shl edi,1 - add edi,0x282000 + add edi,FLOPPY_FAT mov eax,[edi] and eax,4095 jnz frnewds_2 @@ -937,7 +937,7 @@ adr1_analyze_flp: mov eax,[clust_tmp_flp] shl eax,1 ;find next cluster from FAT - add eax,0x282000 + add eax,FLOPPY_FAT mov eax,[eax] and eax,4095 cmp eax,0x0ff8 @@ -999,7 +999,7 @@ avanti: mov eax,[clust_tmp_flp] shl eax,1 ;find next cluster from FAT - add eax,0x282000 + add eax,FLOPPY_FAT mov eax,[eax] and eax,4095 cmp eax,0x0ff8 @@ -1013,8 +1013,8 @@ avanti: mov eax,[clust_tmp_flp] shl eax,1 ;find next cluster from FAT - add eax,0x282000 - sub edi,0x282000 + add eax,FLOPPY_FAT + sub edi,FLOPPY_FAT mov [eax],di pusha @@ -1061,7 +1061,7 @@ check_new_flp: add ebx,1 mov edi,ebx ; find free cluster in FAT shl edi,1 - add edi,0x282000 + add edi,FLOPPY_FAT mov eax,[edi] and eax,4095 cmp eax,0x0 @@ -1179,7 +1179,7 @@ flp_notroot_next_sector: pop [fd_prev_prev_sector] add ecx, 31 mov [fd_prev_sector], ecx - mov ecx, [(ecx-31)*2+0x282000] + mov ecx, [(ecx-31)*2+FLOPPY_FAT] and ecx, 0xFFF cmp ecx, 2849 jae flp_notroot_first.err2 @@ -1229,17 +1229,17 @@ flp_notroot_extend_dir: ; find free cluster in FAT pusha xor eax, eax - mov edi, 0x282000 + mov edi, FLOPPY_FAT mov ecx, 2849 repnz scasw jnz .notfound mov word [edi-2], 0xFFF ; mark as last cluster - sub edi, 0x282000 + sub edi, FLOPPY_FAT shr edi, 1 dec edi mov eax, [esp+28] mov ecx, [eax] - mov [0x282000+ecx*2], di + mov [FLOPPY_FAT+ecx*2], di mov [eax], edi xor eax, eax mov edi, FDD_BUFF @@ -1372,7 +1372,7 @@ fs_FloppyRead: pop ecx xor ebx, ebx .skip: - movzx edi, word [edi*2+0x282000] + movzx edi, word [edi*2+FLOPPY_FAT] jmp .new .done: mov ebx, edx @@ -1468,7 +1468,7 @@ fs_FloppyReadFolder: jz .done jns @f ; read next sector from FAT - mov eax, [(eax-31-1)*2+0x282000] + mov eax, [(eax-31-1)*2+FLOPPY_FAT] and eax, 0xFFF cmp eax, 0xFF8 jae .done @@ -1500,7 +1500,7 @@ fs_FloppyReadFolder: jz .done jns @f ; read next sector from FAT - mov eax, [(eax-31-1)*2+0x282000] + mov eax, [(eax-31-1)*2+FLOPPY_FAT] and eax, 0xFFF cmp eax, 0xFF8 jae .done @@ -2195,7 +2195,7 @@ fs_FloppyWrite: jz .done .skip: .next_cluster: - movzx edi, word [edi*2+0x282000] + movzx edi, word [edi*2+FLOPPY_FAT] sub esi, 0x200 jae @f xor esi, esi @@ -2225,7 +2225,7 @@ floppy_extend_file: @@: sub ecx, 0x200 jbe @f - mov eax, [eax*2+0x282000] + mov eax, [eax*2+FLOPPY_FAT] and eax, 0xFFF jz .fat_err cmp eax, 0xFF8 @@ -2238,7 +2238,7 @@ floppy_extend_file: ret @@: push eax - mov eax, [eax*2+0x282000] + mov eax, [eax*2+FLOPPY_FAT] and eax, 0xFFF cmp eax, 0xFF8 pop eax @@ -2249,7 +2249,7 @@ floppy_extend_file: pop ecx ; now do extend push edx esi - mov esi, 0x282000+2*2 ; start scan from cluster 2 + mov esi, FLOPPY_FAT+2*2 ; start scan from cluster 2 mov edx, 2847 ; number of clusters to scan .extend_loop: cmp [edi+28], ecx @@ -2269,12 +2269,12 @@ floppy_extend_file: mov word [edi-2], 0xFFF mov esi, edi mov edx, ecx - sub edi, 0x282000 + sub edi, FLOPPY_FAT shr edi, 1 dec edi ; now edi=new cluster test eax, eax jz .first_cluster - mov [0x282000+eax*2], di + mov [FLOPPY_FAT+eax*2], di jmp @f .first_cluster: pop eax ; eax->direntry @@ -2429,7 +2429,7 @@ fs_FloppySetFileEnd: .next_cluster: sub dword [esp+12], 0x200 jbe .expand_done - movzx edi, word [0x282000+edi*2] + movzx edi, word [FLOPPY_FAT+edi*2] jmp .zero_loop .expand_done: pop eax ecx ecx edi edi @@ -2444,13 +2444,13 @@ fs_FloppySetFileEnd: @@: sub eax, 0x200 jbe @f - movzx ecx, word [0x282000+ecx*2] + movzx ecx, word [FLOPPY_FAT+ecx*2] jmp @b @@: ; we will zero data at the end of last sector - remember it push ecx ; terminate FAT chain - lea ecx, [0x282000+ecx+ecx] + lea ecx, [FLOPPY_FAT+ecx+ecx] push dword [ecx] mov word [ecx], 0xFFF pop ecx @@ -2464,7 +2464,7 @@ fs_FloppySetFileEnd: ; mark all clusters as free cmp ecx, 0xFF8 jae .deleted - lea ecx, [0x282000+ecx+ecx] + lea ecx, [FLOPPY_FAT+ecx+ecx] push dword [ecx] and word [ecx], 0 pop ecx @@ -2642,7 +2642,7 @@ fs_FloppyExecute: @@: mov [eax], ecx mov edx, [eax+4] - mov dx, [edx*2+0x282000] + mov dx, [edx*2+FLOPPY_FAT] mov [eax+4], dx ; high word is already zero popad xor eax, eax diff --git a/kernel/trunk/fs/fs.inc b/kernel/trunk/fs/fs.inc index a1088fea96..676cf56ae0 100644 --- a/kernel/trunk/fs/fs.inc +++ b/kernel/trunk/fs/fs.inc @@ -579,7 +579,7 @@ LBA_read_ramdisk: mov esi,eax shl esi,9 - add esi,0x100000 + add esi,RAMDISK mov ecx,512/4 ; cld rep movsd diff --git a/kernel/trunk/fs/fs_lfn.inc b/kernel/trunk/fs/fs_lfn.inc index 8a65ee6885..0ac6f0b4a6 100644 --- a/kernel/trunk/fs/fs_lfn.inc +++ b/kernel/trunk/fs/fs_lfn.inc @@ -552,30 +552,30 @@ fs_HasRamdisk: ret fs_HasFloppy: - cmp byte [0x40000], 0 + cmp byte [DRIVE_DATA], 0 setnz al ret fs_HasHd0: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 11000000b cmp al, 01000000b setz al ret fs_HasHd1: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00110000b cmp al, 00010000b setz al ret fs_HasHd2: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00001100b cmp al, 00000100b setz al ret fs_HasHd3: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00000011b cmp al, 00000001b setz al @@ -583,25 +583,25 @@ fs_HasHd3: ;******************************************************* fs_HasCd0: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 11000000b cmp al, 10000000b setz al ret fs_HasCd1: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00110000b cmp al, 00100000b setz al ret fs_HasCd2: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00001100b cmp al, 00001000b setz al ret fs_HasCd3: - mov al, [0x40001] + mov al, [DRIVE_DATA+1] and al, 00000011b cmp al, 00000010b setz al @@ -624,15 +624,15 @@ fs_NextRamdisk: ret fs_NextFloppy: -; we have /fd/1 iff (([0x40000] and 0xF0) != 0) and /fd/2 iff (([0x40000] and 0x0F) != 0) - test byte [0x40000], 0xF0 +; we have /fd/1 iff (([DRIVE_DATA] and 0xF0) != 0) and /fd/2 iff (([DRIVE_DATA] and 0x0F) != 0) + test byte [DRIVE_DATA], 0xF0 jz .no1 test eax, eax jnz .no1 inc eax ret ; CF cleared .no1: - test byte [0x40000], 0x0F + test byte [DRIVE_DATA], 0x0F jz .no2 cmp al, 2 jae .no2 @@ -657,7 +657,7 @@ fs_NextHd3: push 3 fs_NextHd: pop ecx - movzx ecx, byte [0x40002+ecx] + movzx ecx, byte [DRIVE_DATA+2+ecx] cmp eax, ecx jae fs_NextFloppy.no2 inc eax diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index 62bbd1a61e..3f1fb9aea2 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -237,7 +237,7 @@ sys_button: and ecx,0xffff - mov edi,[0xfe88] + mov edi,[BTN_ADDR] movzx eax,word [edi] cmp eax,max_buttons jge noaddbutt @@ -286,7 +286,7 @@ remove_button: rnewba2: - mov edi,[0xfe88] + mov edi,[BTN_ADDR] mov eax,edi movzx ebx,word [edi] inc bx @@ -456,7 +456,7 @@ negativebutton: checkbuttons: - cmp [0xfb40],byte 0 ; mouse buttons pressed + cmp [BTN_DOWN],byte 0 ; mouse buttons pressed jnz @f ret @@: @@ -464,7 +464,7 @@ checkbuttons: pushad xor esi, esi - mov edi, [0xfe88] + mov edi, [BTN_ADDR] movzx edx, word [edi] test edx, edx jne @f @@ -534,7 +534,7 @@ checkbuttons: mov ecx, [ebx+WDATA.box.left] ; window x start movzx edx,word [eax+4] ; button x start add edx,ecx - mov cx,[0xfb0a] + mov cx,[MOUSE_X] cmp edx,ecx jg buttonnewcheck @@ -550,7 +550,7 @@ checkbuttons: mov ecx, [ebx+WDATA.box.top] ; window y start movzx edx,word [eax+8] ; button y start add edx,ecx - mov cx,[0xfb0c] + mov cx,[MOUSE_Y] cmp edx,ecx jg buttonnewcheck @@ -569,7 +569,7 @@ checkbuttons: mov bx,[eax+2] ; button id : bits 00-16 push ebx - mov [0xfb44],byte 1 ; no mouse down checks + mov [MOUSE_DOWN],byte 1 ; no mouse down checks call find_pressed_button_frames call negativebutton @@ -584,13 +584,13 @@ checkbuttons: call stack_handler popad - cmp [0xfb40],byte 0 ; mouse buttons pressed ? + cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? jnz cbwaitmouseup popad call negativebutton - mov [0xfff4],byte 0 ; no mouse background - mov [0xfff5],byte 0 ; draw mouse + mov [MOUSE_BACKGROUND],byte 0 ; no mouse background + mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse ;..................................... start 2/2 : modified by vhanla ............................. ; check coordinates jmp afterbuttonid @@ -605,7 +605,7 @@ checkbuttons: mov ecx, [ebx+WDATA.box.left] ; window x start movzx edx,word [eax+4] ; button x start add edx,ecx - mov cx,[0xfb0a] + mov cx,[MOUSE_X] cmp edx,ecx jg no_on_button ;if we release the pointer out of the button area @@ -621,7 +621,7 @@ checkbuttons: mov ecx, [ebx+WDATA.box.top] ; window y start movzx edx,word [eax+8] ; button y start add edx,ecx - mov cx,[0xfb0c] + mov cx,[MOUSE_Y] cmp edx,ecx jg no_on_button @@ -630,16 +630,16 @@ checkbuttons: cmp ecx,edx jg no_on_button popa - mov [0xf500],byte 1 ; no of buttons in buffer + mov [BTN_COUNT],byte 1 ; no of buttons in buffer pop ebx - mov [0xf501],ebx ; lets put the button id in buffer + mov [BTN_BUFF],ebx ; lets put the button id in buffer push ebx pusha jmp yes_on_button no_on_button: - mov [0xf500],byte 0 ; no of buttons in buffer + mov [BTN_COUNT],byte 0 ; no of buttons in buffer yes_on_button: - mov [0xfb44],byte 0 ; mouse down -> do not draw + mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw popa pop ebx popa diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 9a5f9639e2..f3a1e6e023 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -530,7 +530,7 @@ get_event_for_app: mov eax, [TASK_COUNT] cmp eax,edx jne no_eventoccur2x - cmp [0xf400],byte 0 + cmp [KEY_COUNT],byte 0 je no_eventoccur2x eventoccur2: popad @@ -549,7 +549,7 @@ get_event_for_app: ;mov edi,[TASK_BASE] ; BUTTON IN BUFFER test [edi+TASKDATA.event_mask],dword 4 jz no_eventoccur3 - cmp [0xf500],byte 0 + cmp [BTN_COUNT],byte 0 je no_eventoccur3 mov ecx, [CURRENT_TASK] movzx edx, word [WIN_STACK+ecx*2] @@ -557,7 +557,7 @@ get_event_for_app: cmp eax,edx jnz no_eventoccur3 popad - mov eax,[0xf501] + mov eax,[BTN_BUFF] cmp eax,65535 je no_event_1 mov eax,3 @@ -565,7 +565,7 @@ get_event_for_app: no_event_1: mov [window_minimize],1 - mov [0xf500],byte 0 + mov [BTN_COUNT],byte 0 xor eax, eax ret @@ -589,7 +589,7 @@ get_event_for_app: ;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW test [edi+TASKDATA.event_mask],dword 16 jz no_eventoccur5 - cmp [0xfff0],byte 2 + cmp [REDRAW_BACKGROUND],byte 2 jnz no_eventoccur5 popad mov eax,5 @@ -647,7 +647,7 @@ get_event_for_app: cmp dword [edi+TASKDATA.event_mask], 0xFFFF jbe no_events - mov esi,0x2e0000 ; IRQ'S AND DATA + mov esi,IRQ_SAVE ; IRQ'S AND DATA mov ebx,0x00010000 xor ecx, ecx irq_event_test: diff --git a/kernel/trunk/gui/font.inc b/kernel/trunk/gui/font.inc index cd62e2dac6..8b2a949311 100644 --- a/kernel/trunk/gui/font.inc +++ b/kernel/trunk/gui/font.inc @@ -36,7 +36,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) jnz .font2 pushad mov esi, 9 - lea ebp, [0x3F600+8*edx+edx] + lea ebp, [FONT_I+8*edx+edx] .symloop1: mov dl, byte [ebp] or dl, 1 shl 6 @@ -69,7 +69,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) .font2: pushad add edx, edx - lea ebp, [0x3EC00+4*edx+edx+1] + lea ebp, [FONT_II+4*edx+edx+1] push 9 movzx esi, byte [ebp-1] .symloop2: diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index 155a2ab466..f25a4995bd 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -1,6 +1,6 @@ include "skindata.inc" -skin_data = 0x00778000 +;skin_data = 0x00778000 load_skin_file: ; eax = filename @@ -355,7 +355,7 @@ drawwindow_IV: jne no_skin_add_button ;* close button - mov edi,[0xfe88] + mov edi,[BTN_ADDR] movzx eax,word [edi] cmp eax,1000 jge no_skin_add_button @@ -394,7 +394,7 @@ drawwindow_IV: mov [eax],bx ;* minimize button - mov edi,[0xfe88] + mov edi,[BTN_ADDR] movzx eax,word [edi] cmp eax,1000 jge no_skin_add_button diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index 4db6e3142d..9e8d1a8f03 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -169,7 +169,7 @@ pushad inc edx ; get WinMap start - mov edi, [0xFE00] ; screen_sx + mov edi, [ScreenWidth] ; screen_sx inc edi imul edi, ebx add edi, eax @@ -189,7 +189,7 @@ pushad pop edx pop ecx - add edi, [0xFE00] + add edi, [ScreenWidth] inc edi sub edi, ecx dec edx @@ -230,7 +230,7 @@ pushad ; get WinMap start -> ebp push eax - mov eax, [0xFE00] ; screen_sx + mov eax, [ScreenWidth] ; screen_sx inc eax imul eax, ebx add eax, [esp] @@ -292,7 +292,7 @@ pushad jb .ff_new_x sub ebp, [ff_xsz] add ebp, [ff_x] - add ebp, [0xFE00] ; screen.x + add ebp, [ScreenWidth] ; screen.x inc ebp inc ebx cmp ebx, [ff_ysz] @@ -349,9 +349,9 @@ display_settings: redraw_screen_direct: mov [dlx],dword 0 mov [dly],dword 0 - mov eax,[0xfe00] + mov eax,[ScreenWidth] mov [dlxe],eax - mov eax,[0xfe04] + mov eax,[ScreenHeight] mov [dlye],eax mov eax,window_data call redrawscreen @@ -427,10 +427,10 @@ display_settings: movsx ebx,word[esp+16] cmp eax,ebx jge .lp1 - or eax,eax;[0xFE00] + or eax,eax;[ScreenWidth] jl @f mov [screen_workarea.left],eax - @@: cmp ebx,[0xFE00] + @@: cmp ebx,[ScreenWidth] jg .lp1 mov [screen_workarea.right],ebx .lp1: movsx eax,word[esp+24+2] @@ -440,14 +440,14 @@ display_settings: or eax,eax;[0xFE04] jl @f mov [screen_workarea.top],eax - @@: cmp ebx,[0xFE04] + @@: cmp ebx,[ScreenHeight] jg .lp2 mov [screen_workarea.bottom],ebx .lp2: call repos_windows mov eax, 0 mov ebx, 0 - mov ecx, [0xfe00] - mov edx, [0xfe04] + mov ecx, [ScreenWidth] + mov edx, [ScreenHeight] call calculatescreen ; jmp redraw_screen_direct .exit: @@ -498,8 +498,8 @@ display_settings: pushad mov eax, 0 mov ebx, 0 - mov ecx, [0xfe00] - mov edx, [0xfe04] + mov ecx, [ScreenWidth] + mov edx, [ScreenHeight] call calculatescreen popad mov dword[esp+32+36],0 @@ -517,7 +517,7 @@ display_settings: repos_windows: mov ecx,[TASK_COUNT] mov edi,0x20*2 - mov byte[0x0000fff0],1 + mov byte[REDRAW_BACKGROUND],1 dec ecx jge @f ret @@ -543,7 +543,7 @@ repos_windows: ret .lp2: mov eax,[edi+WDATA.box.left] add eax,[edi+WDATA.box.width] - mov ebx,[0x0000fe00] + mov ebx,[ScreenWidth] ; inc ebx cmp eax,ebx jle .lp4 @@ -555,7 +555,7 @@ repos_windows: mov [edi+WDATA.box.left],ebx .lp4: mov eax,[edi+WDATA.box.top] add eax,[edi+WDATA.box.height] - mov ebx,[0x0000fe04] + mov ebx,[ScreenHeight] ; inc ebx cmp eax,ebx jle .lp6 @@ -586,7 +586,7 @@ check_window_position: mov esi,ecx ; check x pos add esi,eax - cmp esi,[0xfe00] + cmp esi,[ScreenWidth] jbe x_pos_ok mov [edi+WDATA.box.left],dword 0 xor eax, eax @@ -594,7 +594,7 @@ check_window_position: mov esi,edx ; check y pos add esi,ebx - cmp esi,[0xfe04] + cmp esi,[ScreenHeight] jbe y_pos_ok mov [edi+WDATA.box.top],dword 0 mov ebx,0 @@ -602,17 +602,17 @@ check_window_position: mov esi,ecx ; check x size add esi,eax - cmp esi,[0xfe00] + cmp esi,[ScreenWidth] jbe x_size_ok - mov ecx,[0xfe00] + mov ecx,[ScreenWidth] mov [edi+WDATA.box.width],ecx x_size_ok: mov esi,edx ; check y size add esi,ebx - cmp esi,[0xfe04] + cmp esi,[ScreenHeight] jbe y_size_ok - mov edx,[0xfe04] + mov edx,[ScreenHeight] mov [edi+WDATA.box.height],edx y_size_ok: @@ -634,8 +634,8 @@ sys_window_mouse: cmp [new_window_starting],eax jb swml1 - mov [0xfff4],byte 0 ; no mouse background - mov [0xfff5],byte 0 ; draw mouse + mov [MOUSE_BACKGROUND],byte 0 ; no mouse background + mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse mov [new_window_starting],eax @@ -958,8 +958,8 @@ windowactivate: mov [ebx*2 + WIN_POS], si jmp waloop2 wacont2: - mov [0xf400], byte 0 ; empty keyboard buffer - mov [0xf500], byte 0 ; empty button buffer + mov [KEY_COUNT], byte 0 ; empty keyboard buffer + mov [BTN_COUNT], byte 0 ; empty button buffer popad ret @@ -1053,7 +1053,7 @@ waredraw: ; if redraw necessary at activate jz .do_not_draw popad - mov [0xfb44], byte 1 ; do draw mouse + mov [MOUSE_DOWN], byte 1 ; do draw mouse call windowactivate ; update screen info @@ -1078,7 +1078,7 @@ waredraw: ; if redraw necessary at activate popad mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app - mov [0xfb44],byte 0 ; mouse down checks + mov [MOUSE_DOWN],byte 0 ; mouse down checks ret @@ -1087,9 +1087,9 @@ waredraw: ; if redraw necessary at activate popad call windowactivate - mov [0xfb44],byte 0 ; mouse down checks - mov [0xfff4],byte 0 ; no mouse background - mov [0xfff5],byte 0 ; draw mouse + mov [MOUSE_DOWN],byte 0 ; mouse down checks + mov [MOUSE_BACKGROUND],byte 0 ; no mouse background + mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse ret @@ -1156,7 +1156,7 @@ restore_minimized_window: add edx, [edi+WDATA.box.height] call calculatescreen .done: - mov [0xfff4],byte 0 ; no mouse under + mov [MOUSE_BACKGROUND],byte 0 ; no mouse under .skip_redrawings: popfd ret @@ -1186,7 +1186,7 @@ checkwindows: .continue: .no_minimizing: - cmp [0xfb40],byte 0 ; mouse buttons pressed ? + cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? jne .mouse_buttons_pressed popad ret @@ -1212,8 +1212,8 @@ checkwindows: test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED jnz cwloop - movzx eax, word [0xfb0a] - movzx ebx, word [0xfb0c] + movzx eax, word [MOUSE_X] + movzx ebx, word [MOUSE_Y] cmp ecx, eax jae cwloop @@ -1292,7 +1292,7 @@ checkwindows: mov [latest_window_touch], ecx mov [latest_window_touch_delta], edx - mov cl, [0xfb40] ; save for shade check + mov cl, [BTN_DOWN] ; save for shade check mov [do_resize], cl no_emulation_righ_button: mov ecx, [edi + WDATA.box.left] @@ -1312,8 +1312,8 @@ checkwindows: sub eax, ecx sub ebx, edx - mov esi, [0xfb0a] - mov [0xf300], esi + mov esi, [MOUSE_X] + mov [WIN_TEMP_XY], esi pushad ; wait for putimages to finish ; mov eax,5 @@ -1340,19 +1340,19 @@ checkwindows: call drawwindowframes mov [reposition],0 - mov [0xfb44],byte 1 ; no reaction to mouse up/down + mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down ; move window newchm: - mov [0xfff5],byte 1 + mov [DONT_DRAW_MOUSE],byte 1 call checkidle call checkVga_N13 - mov [0xfff4],byte 0 + mov [MOUSE_BACKGROUND],byte 0 call [draw_pointer] @@ -1360,12 +1360,12 @@ checkwindows: call stack_handler popad - mov esi,[0xf300] - cmp esi,[0xfb0a] + mov esi,[WIN_TEMP_XY] + cmp esi,[MOUSE_X] je cwb - mov cx,[0xfb0a] - mov dx,[0xfb0c] + mov cx,[MOUSE_X] + mov dx,[MOUSE_Y] sub cx,ax sub dx,bx @@ -1374,8 +1374,8 @@ checkwindows: call drawwindowframes - mov ax,[0xfe00] - mov bx,[0xfe04] + mov ax,[ScreenWidth] + mov bx,[ScreenHeight] cmp [do_resize_from_corner],1 je no_new_position @@ -1415,7 +1415,7 @@ checkwindows: ;add edx,0x80000 ; process base at 0x80000+ lea edx, [SLOT_BASE + edx*8] - movzx eax,word [0xfb0a] + movzx eax,word [MOUSE_X] cmp eax,[edi + WDATA.box.left] jb nnepx sub eax,[edi + WDATA.box.left] @@ -1428,7 +1428,7 @@ checkwindows: call get_rolledup_height mov ebx,eax - movzx eax,word [0xfb0c] + movzx eax,word [MOUSE_Y] cmp eax,[edi + WDATA.box.top] jb nnepy sub eax,[edi + WDATA.box.top] @@ -1448,14 +1448,14 @@ checkwindows: pop ax call drawwindowframes - mov esi,[0xfb0a] - mov [0xf300],esi + mov esi,[MOUSE_X] + mov [WIN_TEMP_XY],esi cwb: - cmp [0xfb40],byte 0 + cmp [BTN_DOWN],byte 0 jne newchm ; new position done - mov [0xfff5],byte 1 + mov [DONT_DRAW_MOUSE],byte 1 mov cl,0 test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED jnz @f @@ -1566,16 +1566,16 @@ checkwindows: mov eax,[edi+WDATA.box.top] ; check Y inside screen add eax,[edi+WDATA.box.height] - cmp eax,[0xfe04] + cmp eax,[ScreenHeight] jbe no_window_sizing mov eax,[edi+WDATA.box.left] ; check X inside screen add eax,[edi+WDATA.box.width] - cmp eax,[0xfe00] + cmp eax,[ScreenWidth] jbe no_window_sizing - mov eax,[0xfe00] + mov eax,[ScreenWidth] sub eax,[edi+WDATA.box.width] mov [edi+WDATA.box.left],eax - mov eax,[0xfe04] + mov eax,[ScreenHeight] sub eax,[edi+WDATA.box.height] mov [edi+WDATA.box.top],eax call set_window_clientbox @@ -1586,7 +1586,7 @@ checkwindows: cmp [reposition],0 je retwm - mov [0xfff5],byte 1 ; no mouse + mov [DONT_DRAW_MOUSE],byte 1 ; no mouse push eax ebx ecx edx @@ -1615,7 +1615,7 @@ checkwindows: mov ecx,100 ; wait to avoid mouse residuals waitre2: - mov [0xfff5],byte 1 + mov [DONT_DRAW_MOUSE],byte 1 call checkidle cmp [edi+WDATA.fl_redraw],0 jz retwm @@ -1623,9 +1623,9 @@ checkwindows: retwm: - mov [0xfff5],byte 0 ; mouse pointer - mov [0xfff4],byte 0 ; no mouse under - mov [0xfb44],byte 0 ; react to mouse up/down + mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer + mov [MOUSE_BACKGROUND],byte 0 ; no mouse under + mov [MOUSE_DOWN],byte 0 ; react to mouse up/down mov esi,window_moved call sys_msg_board_str diff --git a/kernel/trunk/hid/keyboard.inc b/kernel/trunk/hid/keyboard.inc index 9826459167..d384047fdc 100644 --- a/kernel/trunk/hid/keyboard.inc +++ b/kernel/trunk/hid/keyboard.inc @@ -267,12 +267,12 @@ irq1: .scancode: mov bl, ch .dowrite: - movzx eax,byte[0xF400] + movzx eax,byte[KEY_COUNT] cmp al,120 jae .exit.irq1 inc eax - mov [0xF400],al - mov [0xF400+eax],bl + mov [KEY_COUNT],al + mov [KEY_COUNT+eax],bl .exit.irq1: mov [check_idle_semaphore],5 diff --git a/kernel/trunk/hid/m_com1.inc b/kernel/trunk/hid/m_com1.inc index 193b00caae..f1b63f6d01 100644 --- a/kernel/trunk/hid/m_com1.inc +++ b/kernel/trunk/hid/m_com1.inc @@ -61,7 +61,7 @@ check_mouse_data_com1: shr ah,5 and ah,1 add al,ah - mov [0xfb40],al + mov [BTN_DOWN],al mov [mouse_active],1 ; Прибавить перемещение по X к координате X mov AL,[FirstByte] @@ -69,21 +69,21 @@ check_mouse_data_com1: or AL,[SecondByte] cbw call mouse_acceleration_com1 - add AX,[0xFB0A] ;[XCoordinate] + add AX,[MOUSE_X] ;[XCoordinate] ; Курсор не должен выходить за левую или ; правую границу экрана js @@X1 - cmp AX,[0xFE00] ;ScreenLength + cmp AX,[ScreenWidth] ;ScreenLength jb @@X2 ; Установить координату X по правой границе - mov AX,[0xFE00] ;ScreenLength-1 + mov AX,[ScreenWidth] ;ScreenLength-1 dec ax jmp @@X2 @@X1: ; Установить координату X по левой границе xor AX,AX @@X2: - mov [0xFB0A],AX ;[XCoordinate] + mov [MOUSE_X],AX ;[XCoordinate] ; Прибавить перемещение по Y к координате Y mov AL,[FirstByte] and AL,00001100b @@ -91,21 +91,21 @@ check_mouse_data_com1: or AL,[ThirdByte] cbw call mouse_acceleration_com1 - add AX,[0xFB0C] ;[YCoordinate] + add AX,[MOUSE_Y] ;[YCoordinate] ; Курсор не должен выходить за верхнюю или ; нижнюю границу экрана js @@Y1 - cmp AX,[0xFE04] ;ScreenHeigth + cmp AX,[ScreenHeight] ;ScreenHeigth jb @@Y2 ; Установить координату X по нижней границе - mov AX,[0xFE04] ;ScreenHeigth-1 + mov AX,[ScreenHeight] ;ScreenHeigth-1 dec ax jmp @@Y2 @@Y1: ; Установить координату X по верхней границе xor AX,AX @@Y2: - mov [0xFB0C],AX ;[YCoordinate] + mov [MOUSE_Y],AX ;[YCoordinate] mov eax,[timer_ticks] mov [timer_ticks_com],eax jmp @@EndMouseInterrupt diff --git a/kernel/trunk/hid/m_com2.inc b/kernel/trunk/hid/m_com2.inc index a84b5663c6..6c33f1b90c 100644 --- a/kernel/trunk/hid/m_com2.inc +++ b/kernel/trunk/hid/m_com2.inc @@ -61,7 +61,7 @@ check_mouse_data_com2: shr ah,5 and ah,1 add al,ah - mov [0xfb40],al + mov [BTN_DOWN],al mov [mouse_active],1 ; Прибавить перемещение по X к координате X mov AL,[FirstByte_1] @@ -69,21 +69,21 @@ check_mouse_data_com2: or AL,[SecondByte_1] cbw call mouse_acceleration_com2 - add AX,[0xFB0A] ;[XCoordinate] + add AX,[MOUSE_X] ;[XCoordinate] ; Курсор не должен выходить за левую или ; правую границу экрана js @@X1_1 - cmp AX,[0xFE00] ;ScreenLength + cmp AX,[ScreenWidth] ;ScreenLength jb @@X2_1 ; Установить координату X по правой границе - mov AX,[0xFE00] ;ScreenLength-1 + mov AX,[ScreenWidth] ;ScreenLength-1 dec ax jmp @@X2_1 @@X1_1: ; Установить координату X по левой границе xor AX,AX @@X2_1: - mov [0xFB0A],AX ;[XCoordinate] + mov [MOUSE_X],AX ;[XCoordinate] ; Прибавить перемещение по Y к координате Y mov AL,[FirstByte_1] and AL,00001100b @@ -91,21 +91,21 @@ check_mouse_data_com2: or AL,[ThirdByte_1] cbw call mouse_acceleration_com2 - add AX,[0xFB0C] ;[YCoordinate] + add AX,[MOUSE_Y] ;[YCoordinate] ; Курсор не должен выходить за верхнюю или ; нижнюю границу экрана js @@Y1_1 - cmp AX,[0xFE04] ;ScreenHeigth + cmp AX,[ScreenHeight] ;ScreenHeigth jb @@Y2_1 ; Установить координату X по нижней границе - mov AX,[0xFE04] ;ScreenHeigth-1 + mov AX,[ScreenHeight] ;ScreenHeigth-1 dec ax jmp @@Y2_1 @@Y1_1: ; Установить координату X по верхней границе xor AX,AX @@Y2_1: - mov [0xFB0C],AX ;[YCoordinate] + mov [MOUSE_Y],AX ;[YCoordinate] mov eax,[timer_ticks] mov [timer_ticks_com_1],eax jmp @@EndMouseInterrupt_1 diff --git a/kernel/trunk/hid/m_ps2.inc b/kernel/trunk/hid/m_ps2.inc index 460d27385f..09d50779c9 100644 --- a/kernel/trunk/hid/m_ps2.inc +++ b/kernel/trunk/hid/m_ps2.inc @@ -42,13 +42,13 @@ check_mouse_data_ps2: ; Записать новое значение байта состояния кнопок mov al,[FirstByte_2] ;[0xfb01] and eax,3 - mov [0xfb40],al + mov [BTN_DOWN],al mov [mouse_active],1 ; Вычислить новую X-координату курсора ; Занести в AX перемещение по X mov AH,0 ;дублируем знак во все разряды AH mov AL,[FirstByte_2] - test AL,10000b + test AL,10000b jz @@M0 mov AH,0FFh ; Занести в AL младший байт @@ -57,18 +57,18 @@ check_mouse_data_ps2: call mouse_acceleration_ps2 ; Вычислить новое значение координаты ; курсора по X - add AX,[0xFB0A] ;[XCoordinate] + add AX,[MOUSE_X] ;[XCoordinate] cmp AX,0 jge @@M1 mov AX,0 jmp @@M2 @@M1: - cmp AX,[0xFE00] ;ScreenLength + cmp AX,[ScreenWidth] ;ScreenLength jl @@M2 - mov AX,[0xFE00] ;ScreenLength-1 + mov AX,[ScreenWidth] ;ScreenLength-1 dec ax @@M2: - mov [0xFB0A],AX ;[XCoordinate] + mov [MOUSE_X],AX ;[XCoordinate] ; Вычисляем новую Y-координату курсора ; Занести в AX перемещение по Y @@ -84,19 +84,19 @@ check_mouse_data_ps2: ; Вычислить новое значение координаты курсора ; по Y (Y-координата мыши PS/2 направлена ; противоположно экранной) - neg AX - add AX,[0xFB0C] ;[YCoordinate] + neg AX + add AX,[MOUSE_Y] ;[YCoordinate] cmp AX,0 jge @@M4 mov AX,0 jmp @@M5 @@M4: - cmp AX,[0xFE04] ;ScreenHeigth + cmp AX,[ScreenHeight] ;ScreenHeigth jl @@M5 - mov AX,[0xFE04] ;ScreenHeigth-1 + mov AX,[ScreenHeight] ;ScreenHeigth-1 dec ax @@M5: - mov [0xFB0C],AX ;[YCoordinate] + mov [MOUSE_Y],AX ;[YCoordinate] ; Показать курсор в новой позиции mov eax,[timer_ticks] @@ -106,7 +106,7 @@ check_mouse_data_ps2: ; Обнаружен сбой в порядке передачи информации от мыши @@Error_2: mov [MouseByteNumber_2],0 -; Нормальное завершение прерывания +; Нормальное завершение прерывани @@EndMouseInterrupt_2: call ready_for_next_irq_1 ret @@ -129,7 +129,7 @@ mouse_acceleration_ps2: ;*********************************************** Wait8042BufferEmpty: ; push CX -; mov CX,0FFFFh ;задать число циклов ожидания +; mov CX,0FFFFh ;задать число циклов ожидани ;@@kb: ; in AL,64h ;получить статус ; test AL,10b ;буфер i8042 свободен? @@ -138,7 +138,7 @@ Wait8042BufferEmpty: push ecx xor ecx,ecx @@: - in al,64h + in al,64h test al,00000010b loopnz @b pop ecx @@ -150,8 +150,8 @@ Wait8042BufferEmpty: ;* ОЖИДАНИЕ ПОСТУПЛЕНИЯ ДАННЫХ ОТ МЫШИ * ;*************************************** WaitMouseData: -; push CX -; mov CX,0FFFFh ;задать число циклов ожидания +; push CX +; mov CX,0FFFFh ;задать число циклов ожидани ;@@mouse: ; in AL,64h ;опросить регистр статуса ; test AL,100000b ;данные поступили? @@ -160,11 +160,11 @@ WaitMouseData: push ecx mov ECX,0FFFFh @@: - in al,64h + in al,64h test al,100000b loopz @b pop ecx ;Если при выходе из подпрограммы установлен ;флаг ZF - ошибка - ret + ret diff --git a/kernel/trunk/hid/mousedrv.inc b/kernel/trunk/hid/mousedrv.inc index 78db2485dc..73eb81f5da 100644 --- a/kernel/trunk/hid/mousedrv.inc +++ b/kernel/trunk/hid/mousedrv.inc @@ -43,8 +43,8 @@ draw_mouse_under: cmp [set_hw_cursor], 0 jz @F pushad - movzx eax,word [0xfb4a] - movzx ebx,word [0xfb4c] + movzx eax,word [X_UNDER] + movzx ebx,word [Y_UNDER] stdcall [hw_restore], eax, ebx popad ret @@ -54,8 +54,8 @@ draw_mouse_under: xor edx,edx align 4 mres: - movzx eax,word [0xfb4a] - movzx ebx,word [0xfb4c] + movzx eax,word [X_UNDER] + movzx ebx,word [Y_UNDER] add eax,ecx add ebx,edx push ecx @@ -90,14 +90,14 @@ save_draw_mouse: jz @F pushad - mov [0xfb4a],ax - mov [0xfb4c],bx - movzx eax,word [0xfb0c] - movzx ebx,word [0xfb0a] + mov [X_UNDER],ax + mov [Y_UNDER],bx + movzx eax,word [MOUSE_Y] + movzx ebx,word [MOUSE_X] push eax push ebx - mov ecx, [0xfe00] + mov ecx, [ScreenWidth] inc ecx mul ecx movzx edx, byte [display_data+ebx+eax] @@ -123,8 +123,8 @@ save_draw_mouse: @@: pushad ; save & draw - mov [0xfb4a],ax - mov [0xfb4c],bx + mov [X_UNDER],ax + mov [Y_UNDER],bx push eax push ebx mov ecx,0 @@ -141,14 +141,14 @@ drm: add ebx,edx push ecx call getpixel - mov [0xfb30],ecx + mov [COLOR_TEMP],ecx pop ecx mov eax,edx shl eax,6 shl ecx,2 add eax,ecx add eax,mouseunder - mov ebx,[0xfb30] + mov ebx,[COLOR_TEMP] mov [eax],ebx pop ecx mov edi,edx ; y cycle @@ -157,13 +157,13 @@ drm: mov esi, edi add edi, esi add edi, esi ; *3 - add edi,[0xf200] ; we have our str address + add edi,[MOUSE_PICTURE] ; we have our str address mov esi, edi add esi, 16*24*3 push ecx - mov ecx, [0xfb30] + mov ecx, [COLOR_TEMP] call combine_colors - mov [0xfb10], ecx + mov [MOUSE_COLOR_MEM], ecx pop ecx pop edx pop ecx @@ -172,7 +172,7 @@ drm: add eax,ecx ; we have x coord+cycle add ebx,edx ; and y coord+cycle push ecx - mov ecx, [0xfb10] + mov ecx, [MOUSE_COLOR_MEM] mov edi, 1 call [putpixel] pop ecx @@ -260,7 +260,7 @@ combine_colors: __sys_disable_mouse: - cmp dword [0xf204],dword 0 + cmp dword [MOUSE_VISIBLE],dword 0 je @f ret @@: @@ -270,9 +270,9 @@ __sys_disable_mouse: mov edx,[CURRENT_TASK] shl edx,5 add edx,window_data - movzx eax, word [0xfb0a] - movzx ebx, word [0xfb0c] - mov ecx,[0xfe00] + movzx eax, word [MOUSE_X] + movzx ebx, word [MOUSE_Y] + mov ecx,[ScreenWidth] inc ecx imul ecx,ebx add ecx,eax @@ -284,7 +284,7 @@ __sys_disable_mouse: movzx ebx, byte [ecx+16] cmp eax,ebx je yes_mouse_disable - mov ebx,[0xfe00] + mov ebx,[ScreenWidth] inc ebx imul ebx,10 add ecx,ebx @@ -299,8 +299,8 @@ yes_mouse_disable: mov edx,[CURRENT_TASK] shl edx,5 add edx,window_data - movzx eax, word [0xfb0a] - movzx ebx, word [0xfb0c] + movzx eax, word [MOUSE_X] + movzx ebx, word [MOUSE_Y] mov ecx,[edx+0] ; mouse inside the area ? add eax,14 cmp eax,ecx @@ -318,12 +318,12 @@ yes_mouse_disable: cmp ebx,ecx jg no_mouse_disable disable_m: - cmp dword [0xf204],dword 0 + cmp dword [MOUSE_VISIBLE],dword 0 jne no_mouse_disable cli call draw_mouse_under sti - mov [0xf204],dword 1 + mov [MOUSE_VISIBLE],dword 1 no_mouse_disable: popad ret @@ -345,11 +345,11 @@ __sys_draw_pointer: mov [MouseTickCounter],eax pop eax pushad - cmp dword [0xf204],dword 0 ; mouse visible ? + cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ? je chms00 - mov [0xf204], dword 0 - movzx ebx,word [0xfb0c] - movzx eax,word [0xfb0a] + mov [MOUSE_VISIBLE], dword 0 + movzx ebx,word [MOUSE_Y] + movzx eax,word [MOUSE_X] cli call save_draw_mouse sti @@ -357,10 +357,10 @@ nodmu2: popad ret chms00: - movzx ecx,word [0xfb4a] - movzx edx,word [0xfb4c] - movzx ebx,word [0xfb0c] - movzx eax,word [0xfb0a] + movzx ecx,word [X_UNDER] + movzx edx,word [Y_UNDER] + movzx ebx,word [MOUSE_Y] + movzx eax,word [MOUSE_X] cmp eax,ecx jne redrawmouse cmp ebx,edx diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index d95aa9dce2..65d27057fc 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -298,26 +298,26 @@ B32: mov al, [0x2F0000+0x901F] ; DMA writing mov [allow_dma_write], al mov al,[0x2f0000+0x9000] ; bpp - mov [0xFBF1],al + mov [ScreenBPP],al movzx eax,word [0x2f0000+0x900A] ; X max dec eax - mov [0xfe00],eax + mov [ScreenWidth],eax mov [screen_workarea.right],eax movzx eax,word [0x2f0000+0x900C] ; Y max dec eax - mov [0xfe04],eax + mov [ScreenHeight],eax mov [screen_workarea.bottom],eax movzx eax,word [0x2f0000+0x9008] ; screen mode - mov [0xFE0C],eax + mov [SCR_MODE],eax mov eax,[0x2f0000+0x9014] ; Vesa 1.2 bnk sw add - mov [0xE030],eax - mov [0xfe08],word 640*4 ; Bytes PerScanLine - cmp [0xFE0C],word 0x13 ; 320x200 + mov [BANK_SWITCH],eax + mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine + cmp [SCR_MODE],word 0x13 ; 320x200 je @f - cmp [0xFE0C],word 0x12 ; VGA 640x480 + cmp [SCR_MODE],word 0x12 ; VGA 640x480 je @f mov ax,[0x2f0000+0x9001] ; for other modes - mov [0xfe08],ax + mov [BytesPerScanLine],ax @@: ; GRAPHICS ADDRESSES @@ -334,30 +334,30 @@ B32: ;no_d_lfb: mov [LFBAddress],eax - cmp [0xfe0c],word 0100000000000000b + cmp [SCR_MODE],word 0100000000000000b jge setvesa20 - cmp [0xfe0c],word 0x13 + cmp [SCR_MODE],word 0x13 je v20ga32 - mov [0xe020],dword Vesa12_putpixel24 ; Vesa 1.2 + mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2 mov [0xe024],dword Vesa12_getpixel24 - cmp [0xfbf1],byte 24 + cmp [ScreenBPP],byte 24 jz ga24 - mov [0xe020],dword Vesa12_putpixel32 + mov [PUTPIXEL],dword Vesa12_putpixel32 mov [0xe024],dword Vesa12_getpixel32 ga24: jmp v20ga24 setvesa20: - mov [0xe020],dword Vesa20_putpixel24 ; Vesa 2.0 + mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0 mov [0xe024],dword Vesa20_getpixel24 - cmp [0xfbf1],byte 24 + cmp [ScreenBPP],byte 24 jz v20ga24 v20ga32: - mov [0xe020],dword Vesa20_putpixel32 + mov [PUTPIXEL],dword Vesa20_putpixel32 mov [0xe024],dword Vesa20_getpixel32 v20ga24: - cmp [0xfe0c],word 0x12 ; 16 C VGA 640x480 + cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480 jne no_mode_0x12 - mov [0xe020],dword VGA_putpixel + mov [PUTPIXEL],dword VGA_putpixel mov [0xe024],dword Vesa20_getpixel32 no_mode_0x12: @@ -512,13 +512,13 @@ include 'vmodeld.inc' mov esi,char xor ebx,ebx mov ecx,2560;26000 - mov edx,0x3F600;0x37000 + mov edx,FONT_I call fs_RamdiskRead mov esi,char2 xor ebx,ebx mov ecx,2560;26000 - mov edx,0x3EC00;0x30000 + mov edx,FONT_II call fs_RamdiskRead mov esi,boot_fonts @@ -680,7 +680,7 @@ include 'vmodeld.inc' call _rdtsc sub eax,ecx shl eax,2 - mov [0xf600],eax ; save tsc / sec + mov [CPU_FREQ],eax ; save tsc / sec mov ebx, 1000000 div ebx mov [stall_mcs], eax @@ -696,14 +696,14 @@ include 'vmodeld.inc' ; PALETTE FOR 320x200 and 640x480 16 col - cmp [0xfe0c],word 0x12 + cmp [SCR_MODE],word 0x12 jne no_pal_vga mov esi,boot_pal_vga call boot_log call paletteVGA no_pal_vga: - cmp [0xfe0c],word 0x13 + cmp [SCR_MODE],word 0x13 jne no_pal_ega mov esi,boot_pal_ega call boot_log @@ -782,7 +782,7 @@ first_app_found: mov esi,boot_tasking call boot_log - mov [0xe000],byte 1 ; multitasking enabled + ; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled ; UNMASK ALL IRQ'S @@ -935,32 +935,32 @@ reserve_irqs_ports: ; RESERVE PORTS mov edi,1 ; 0x00-0x2d - mov [0x2d0000],edi + mov [RESERVED_PORTS],edi shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x0 - mov [0x2d0000+edi+8],dword 0x2d + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0x0 + mov [RESERVED_PORTS+edi+8],dword 0x2d - inc dword [0x2d0000] ; 0x30-0x4d - mov edi,[0x2d0000] + inc dword [RESERVED_PORTS] ; 0x30-0x4d + mov edi,[RESERVED_PORTS] shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x30 - mov [0x2d0000+edi+8],dword 0x4d + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0x30 + mov [RESERVED_PORTS+edi+8],dword 0x4d - inc dword [0x2d0000] ; 0x50-0xdf - mov edi,[0x2d0000] + inc dword [RESERVED_PORTS] ; 0x50-0xdf + mov edi,[RESERVED_PORTS] shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x50 - mov [0x2d0000+edi+8],dword 0xdf + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0x50 + mov [RESERVED_PORTS+edi+8],dword 0xdf - inc dword [0x2d0000] ; 0xe5-0xff - mov edi,[0x2d0000] + inc dword [RESERVED_PORTS] ; 0xe5-0xff + mov edi,[RESERVED_PORTS] shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0xe5 - mov [0x2d0000+edi+8],dword 0xff + mov [RESERVED_PORTS+edi+0],dword 1 + mov [RESERVED_PORTS+edi+4],dword 0xe5 + mov [RESERVED_PORTS+edi+8],dword 0xff ; cmp [0xf604],byte 2 ; com1 mouse -> 0x3f0-0x3ff @@ -1011,10 +1011,10 @@ set_variables: mov ecx,0x100 ; flush port 0x60 .fl60: in al,0x60 loop .fl60 - mov [0xfcff],byte 0 ; mouse buffer - mov [0xf400],byte 0 ; keyboard buffer - mov [0xf500],byte 0 ; button buffer -; mov [0xfb0a],dword 100*65536+100 ; mouse x/y + mov [MOUSE_BUFF_COUNT],byte 0 ; mouse buffer + mov [KEY_COUNT],byte 0 ; keyboard buffer + mov [BTN_COUNT],byte 0 ; button buffer +; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y push eax mov ax,[0x2f0000+0x900c] @@ -1022,12 +1022,12 @@ set_variables: shl eax,16 mov ax,[0x2f0000+0x900A] shr ax,1 - mov [0xfb0a],eax + mov [MOUSE_X],eax pop eax mov byte [SB16_Status],0 ; Minazzi Paolo mov [display_data-12],dword 1 ; tiled background - mov [0xfe88],dword 0x2C0000 ; address of button list + mov [BTN_ADDR],dword BUTTON_INFO ; address of button list ;!! IP 04.02.2005: mov [next_usage_update], 100 @@ -1038,12 +1038,12 @@ set_variables: ;* mouse centered - start code- Mario79 mouse_centered: push eax - mov eax,[0xFE00] + mov eax,[ScreenWidth] shr eax,1 - mov [0xFB0A],ax - mov eax,[0xFE04] + mov [MOUSE_X],ax + mov eax,[ScreenHeight] shr eax,1 - mov [0xFB0C],ax + mov [MOUSE_Y],ax pop eax ret ;* mouse centered - end code- Mario79 @@ -1055,7 +1055,7 @@ sys_outport: mov edi,ebx ; separate flag for read / write and ebx,65535 - mov ecx,[0x2d0000] + mov ecx,[RESERVED_PORTS] test ecx,ecx jne sopl8 mov [esp+36],dword 1 @@ -1070,7 +1070,7 @@ sys_outport: mov esi,ecx shl esi,4 - add esi,0x2d0000 + add esi,RESERVED_PORTS cmp edx,[esi+0] jne sopl2 cmp ebx,[esi+4] @@ -1725,15 +1725,15 @@ readmousepos: ja msset jmp [mousefn+eax*4] msscreen: - mov eax,[0xfb0a] + mov eax,[MOUSE_X] shl eax,16 - mov ax,[0xfb0c] + mov ax,[MOUSE_Y] mov [esp+36],eax ret mswin: - mov eax,[0xfb0a] + mov eax,[MOUSE_X] shl eax,16 - mov ax,[0xfb0c] + mov ax,[MOUSE_Y] mov esi,[TASK_BASE] mov bx, word [esi-twdw+WDATA.box.left] shl ebx,16 @@ -1749,7 +1749,7 @@ mswin: mov [esp+36],eax ret msbutton: - movzx eax,byte [0xfb40] + movzx eax,byte [BTN_DOWN] mov [esp+36],eax ret msset: @@ -1935,7 +1935,7 @@ sysfn_shutdown: ; 18.1 = BOOT mov eax,[TASK_COUNT] add eax,2 mov [shutdown_processes],eax - mov [0xFF00],al + mov [SYS_SHUTDOWN],al and dword [esp+36], 0 ret uglobal @@ -2020,7 +2020,7 @@ sysfn_getidletime: ; 18.4 = GET IDLETIME ret sysfn_getcpuclock: ; 18.5 = GET TSC/SEC - mov eax,[0xf600] + mov eax,[CPU_FREQ] mov [esp+36], eax ret @@ -2074,7 +2074,7 @@ sysfn_getdiskinfo: ; 18.11 = get disk info table mov edi,[TASK_BASE] mov edi,[edi+TASKDATA.mem_start] add edi,ecx - mov esi,0x40000 + mov esi,DRIVE_DATA ret full_table: cmp ebx,2 @@ -2141,9 +2141,9 @@ sysfn_mouse_acceleration: ; 18.19 = set/get mouse features .set_pointer_position: cmp ebx,4 ; set mouse pointer position jnz .end - mov [0xFB0C],cx ;y + mov [MOUSE_Y],cx ;y ror ecx,16 - mov [0xFB0A],cx ;x + mov [MOUSE_X],cx ;x rol ecx,16 .end: ret @@ -2255,7 +2255,7 @@ sys_background: and edx,0xFF000000 ;255*256*256*256 and ecx,0x00FFFFFF ;255*256*256+255*256+255 add edx,ecx - mov [ebx+0x300000],edx + mov [ebx+IMG_BACKGROUND],edx ; mov [bgrchanged],1 ret nosb2: @@ -2267,7 +2267,7 @@ draw_background_temp: ; je nosb31 ;draw_background_temp: ; mov [bgrchanged],1 ;0 - mov [0xfff0],byte 1 + mov [REDRAW_BACKGROUND],byte 1 mov [background_defined], 1 nosb31: ret @@ -2296,7 +2296,7 @@ draw_background_temp: cmp ecx, 0x160000-16 ja .fin ; add edi, 0x300000 - add ebx, 0x300000 + add ebx, IMG_BACKGROUND mov ecx, edx cmp ecx, 0x160000-16 ja .fin @@ -2329,7 +2329,7 @@ sys_getbackground: mov edx,0x160000-16 cmp edx,ebx jbe nogb2 - mov eax, [ebx+0x300000] + mov eax, [ebx+IMG_BACKGROUND] and eax, 0xFFFFFF mov [esp+36],eax ret @@ -2353,21 +2353,21 @@ sys_getkey: mov edx,[TASK_COUNT] cmp ecx,edx jne .finish - cmp [0xf400],byte 0 + cmp [KEY_COUNT],byte 0 je .finish - movzx eax,byte [0xf401] + movzx eax,byte [KEY_BUFF] shl eax,8 push eax - dec byte [0xf400] - and byte [0xf400],127 - movzx ecx,byte [0xf400] + dec byte [KEY_COUNT] + and byte [KEY_COUNT],127 + movzx ecx,byte [KEY_COUNT] add ecx,2 ; mov esi,0xf402 ; mov edi,0xf401 ; cld ; rep movsb - mov eax, 0xF402 - mov ebx, 0xF401 + mov eax, KEY_BUFF+1 + mov ebx, KEY_BUFF call memmove pop eax .ret_eax: @@ -2402,12 +2402,12 @@ sys_getbutton: mov edx, [TASK_COUNT] ; less than 256 processes cmp ecx,edx jne .exit - movzx eax,byte [0xf500] + movzx eax,byte [BTN_COUNT] test eax,eax jz .exit - mov eax,[0xf501] + mov eax,[BTN_BUFF] shl eax,8 - mov [0xf500],byte 0 + mov [BTN_COUNT],byte 0 mov [esp+36],eax .exit: ret @@ -2623,7 +2623,7 @@ sys_redrawstat: sys_newba2: - mov edi,[0xfe88] + mov edi,[BTN_ADDR] cmp [edi],dword 0 ; empty button list ? je end_of_buttons_away @@ -2666,9 +2666,9 @@ sys_redrawstat: add edx,draw_data-CURRENT_TASK mov [edx+RECT.left], 0 mov [edx+RECT.top], 0 - mov eax,[0xfe00] + mov eax,[ScreenWidth] mov [edx+RECT.right],eax - mov eax,[0xfe04] + mov eax,[ScreenHeight] mov [edx+RECT.bottom],eax mov edi,[TASK_BASE] @@ -2979,8 +2979,8 @@ sys_set_window: call calculatescreen pop edx ecx ebx eax - mov [0xf400],byte 0 ; empty keyboard buffer - mov [0xf500],byte 0 ; empty button buffer + mov [KEY_COUNT],byte 0 ; empty keyboard buffer + mov [BTN_COUNT],byte 0 ; empty button buffer newd: mov [edi+WDATA.fl_redraw],byte 0 ; no redraw @@ -3108,9 +3108,9 @@ sys_window_move: xor esi,esi call redrawscreen - mov [0xfff5],byte 0 ; mouse pointer - mov [0xfff4],byte 0 ; no mouse under - mov [0xfb44],byte 0 ; react to mouse up/down + mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer + mov [MOUSE_BACKGROUND],byte 0 ; no mouse under + mov [MOUSE_DOWN],byte 0 ; react to mouse up/down mov ecx,10 ; wait 1/10 second .wmrl3: @@ -3132,13 +3132,13 @@ sys_window_move: ; call change_task ; mov [draw_data+32+0],dword 0 ; mov [draw_data+32+4],dword 0 -; mov eax,[0xfe00] +; mov eax,[ScreenWidth ; mov ebx,[0xfe04] ; mov [draw_data+32+8],eax ; mov [draw_data+32+12],ebx ; call drawbackground ; mov [0xfff0],byte 0 -; mov [0xfff4],byte 0 +; mov [MOUSE_BACKGROUND],byte 0 ;temp_nobackgr: ; ret @@ -3258,7 +3258,7 @@ ret checkpixel: push eax edx - mov edx,[0xfe00] ; screen x size + mov edx,[ScreenWidth] ; screen x size inc edx imul edx, ebx mov dl, [eax+edx+display_data] ; lea eax, [...] @@ -3308,38 +3308,38 @@ checkmisc: mouse_not_active: - cmp [0xfff0],byte 0 ; background update ? + cmp [REDRAW_BACKGROUND],byte 0 ; background update ? jz nobackgr cmp [background_defined], 0 jz nobackgr - mov [0xfff0],byte 2 + mov [REDRAW_BACKGROUND],byte 2 call change_task mov [draw_data+32 + RECT.left],dword 0 mov [draw_data+32 + RECT.top],dword 0 - mov eax,[0xfe00] - mov ebx,[0xfe04] + mov eax,[ScreenWidth] + mov ebx,[ScreenHeight] mov [draw_data+32 + RECT.right],eax mov [draw_data+32 + RECT.bottom],ebx call drawbackground - mov [0xfff0],byte 0 - mov [0xfff4],byte 0 + mov [REDRAW_BACKGROUND],byte 0 + mov [MOUSE_BACKGROUND],byte 0 nobackgr: ; system shutdown request - cmp [0xFF00],byte 0 + cmp [SYS_SHUTDOWN],byte 0 je noshutdown mov edx,[shutdown_processes] sub dl,2 - cmp [0xff00],dl + cmp [SYS_SHUTDOWN],dl jne no_mark_system_shutdown mov edx,0x3040 - movzx ecx,byte [0xff00] + movzx ecx,byte [SYS_SHUTDOWN] add ecx,5 markz: mov [edx+TASKDATA.state],byte 3 @@ -3350,9 +3350,9 @@ checkmisc: call [disable_mouse] - dec byte [0xff00] + dec byte [SYS_SHUTDOWN] - cmp [0xff00],byte 0 + cmp [SYS_SHUTDOWN],byte 0 je system_shutdown noshutdown: @@ -3491,7 +3491,7 @@ calculatebackground: ; background mov [display_data-8],dword 4 ; size x mov [display_data-4],dword 2 ; size y - mov edi, 0x300000 ; set background to black + mov edi, IMG_BACKGROUND ; set background to black xor eax, eax mov ecx, 0x0fff00 / 4 cld @@ -3502,7 +3502,7 @@ calculatebackground: ; background mov ecx,0x15ff00 / 4 rep stosd - mov byte [0xFFF0], 0 ; do not draw background! + mov byte [REDRAW_BACKGROUND], 0 ; do not draw background! ret @@ -3709,7 +3709,7 @@ get_irq_data: mov ebx,eax shl ebx,12 - add ebx,0x2e0000 + add ebx,IRQ_SAVE mov eax,[ebx] mov ecx,1 test eax,eax @@ -3784,7 +3784,7 @@ r_f_port_area: ja rpal1 cmp ecx,65536 jae rpal1 - mov esi,[0x2d0000] + mov esi,[RESERVED_PORTS] test esi,esi ; no reserved areas ? je rpal2 cmp esi,255 ; max reserved @@ -3792,7 +3792,7 @@ r_f_port_area: rpal3: mov edi,esi shl edi,4 - add edi,0x2d0000 + add edi,RESERVED_PORTS cmp ebx,[edi+8] ja rpal4 cmp ecx,[edi+4] @@ -3840,11 +3840,11 @@ r_f_port_area: popad ; end enable io map sti - mov edi,[0x2d0000] + mov edi,[RESERVED_PORTS] add edi,1 - mov [0x2d0000],edi + mov [RESERVED_PORTS],edi shl edi,4 - add edi,0x2d0000 + add edi,RESERVED_PORTS mov esi,[TASK_BASE] mov esi,[esi+TASKDATA.pid] mov [edi],esi @@ -3858,7 +3858,7 @@ free_port_area: pushad - mov esi,[0x2d0000] ; no reserved areas ? + mov esi,[RESERVED_PORTS] ; no reserved areas ? test esi,esi je frpal2 mov edx,[TASK_BASE] @@ -3866,7 +3866,7 @@ free_port_area: frpal3: mov edi,esi shl edi,4 - add edi,0x2d0000 + add edi,RESERVED_PORTS cmp edx,[edi] jne frpal4 cmp ebx,[edi+4] @@ -3890,7 +3890,7 @@ free_port_area: cld rep movsb - dec dword [0x2d0000] + dec dword [RESERVED_PORTS] popad @@ -3960,12 +3960,12 @@ reserve_free_irq: drawbackground: inc [mouse_pause] - cmp [0xfe0c],word 0x12 + cmp [SCR_MODE],word 0x12 je dbrv20 dbrv12: - cmp [0xfe0c],word 0100000000000000b + cmp [SCR_MODE],word 0100000000000000b jge dbrv20 - cmp [0xfe0c],word 0x13 + cmp [SCR_MODE],word 0x13 je dbrv20 call vesa12_drawbackground dec [mouse_pause] @@ -4015,12 +4015,12 @@ sys_putimage: sys_putimage_bpp: ; call [disable_mouse] ; this will be done in xxx_putimage ; mov eax, vga_putimage - cmp [0xfe0c], word 0x12 + cmp [SCR_MODE], word 0x12 jz @f ;.doit mov eax, vesa12_putimage - cmp [0xfe0c], word 0100000000000000b + cmp [SCR_MODE], word 0100000000000000b jae @f - cmp [0xfe0c], word 0x13 + cmp [SCR_MODE], word 0x13 jnz .doit @@: mov eax, vesa20_putimage @@ -4114,12 +4114,12 @@ __sys_drawbar: .forced: inc [mouse_pause] ; call [disable_mouse] - cmp [0xfe0c],word 0x12 + cmp [SCR_MODE],word 0x12 je dbv20 sdbv20: - cmp [0xfe0c],word 0100000000000000b + cmp [SCR_MODE],word 0100000000000000b jge dbv20 - cmp [0xfe0c],word 0x13 + cmp [SCR_MODE],word 0x13 je dbv20 call vesa12_drawbar dec [mouse_pause] @@ -4244,7 +4244,7 @@ kb_cmd: setmouse: ; set mousepicture -pointer ; ps2 mouse enable - mov [0xf200],dword mousepointer + mov [MOUSE_PICTURE],dword mousepointer cli ; mov bl,0xa8 ; enable mouse cmd @@ -4596,9 +4596,9 @@ sys_gs: ; direct screen access cmp eax,1 ; resolution jne no_gs1 - mov eax,[0xfe00] + mov eax,[ScreenWidth] shl eax,16 - mov ax,[0xfe04] + mov ax,[ScreenHeight] add eax,0x00010001 mov [esp+36],eax ret @@ -4606,14 +4606,14 @@ sys_gs: ; direct screen access cmp eax,2 ; bits per pixel jne no_gs2 - movzx eax,byte [0xfbf1] + movzx eax,byte [ScreenBPP] mov [esp+36],eax ret no_gs2: cmp eax,3 ; bytes per scanline jne no_gs3 - mov eax,[0xfe08] + mov eax,[BytesPerScanLine] mov [esp+36],eax ret no_gs3: @@ -4709,9 +4709,9 @@ align 4 syscall_getscreensize: ; GetScreenSize - movzx eax,word[0xfe00] + movzx eax,word[ScreenWidth] shl eax,16 - mov ax,[0xfe04] + mov ax,[ScreenHeight] mov [esp+36],eax ret @@ -4749,7 +4749,7 @@ syscall_writeramdiskfile: ; WriteRamdiskFile align 4 syscall_getpixel: ; GetPixel - mov ecx,[0xfe00] + mov ecx,[ScreenWidth] inc ecx xor edx,edx div ecx diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 4d5db32ca0..78826037f7 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -426,11 +426,11 @@ destroy_cursor: align 4 proc init_cursors - cmp [0xfe0c],word 0x13 + cmp [SCR_MODE],word 0x13 jbe .fail movzx eax, byte [ScreenBPP] - mov ebx, [SCR_BYTES_PER_LINE] + mov ebx, [BytesPerScanLine] cmp eax, 32 jne @F sub ebx, 128 @@ -456,8 +456,8 @@ proc init_cursors stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM mov [def_cursor], eax - mov ecx, [SCR_X_SIZE] - mov edx, [SCR_Y_SIZE] + mov ecx, [ScreenWidth] + mov edx, [ScreenHeight] inc ecx inc edx mov [scr_width], ecx diff --git a/kernel/trunk/video/vesa12.inc b/kernel/trunk/video/vesa12.inc index 7627b67e2c..9dfdbd3598 100644 --- a/kernel/trunk/video/vesa12.inc +++ b/kernel/trunk/video/vesa12.inc @@ -32,9 +32,9 @@ ; modified by Mario79 ;set_bank: ;cli -;cmp al,[0xfff2] +;cmp al,[BANK_RW] ;je retsb -;mov [0xfff2],al +;mov [BANK_RW],al ;push dx ;mov dx,3D8h ;out dx,al @@ -50,9 +50,9 @@ set_bank: pushfd cli -cmp al,[0xfff2] +cmp al,[BANK_RW] je retsb -mov [0xfff2],al +mov [BANK_RW],al push ax push dx push cx @@ -132,9 +132,9 @@ ret ; ;set_bank: ;cli -;cmp al,[0xfff2] +;cmp al,[BANK_RW] ;je retsb -;mov [0xfff2],al +;mov [BANK_RW],al ;push ax ;push dx ;mov dx,3CEh @@ -160,9 +160,9 @@ ret ;set_bank: ; cli -; cmp al,[0xfff2] +; cmp al,[BANK_RW] ; je retsb -; mov [0xfff2],al +; mov [BANK_RW],al ; push ax ; push dx ; mov ah,al @@ -216,7 +216,7 @@ vesa12_drawbackground: push eax push ebx - mov esi,0x300000 + mov esi,IMG_BACKGROUND cmp [WinMapAddress-12],dword 1 ; tiled background jne no_vesa12_tiled_bgr @@ -247,7 +247,7 @@ vesa12_drawbackground: imul eax,dword [WinMapAddress-8] xor edx,edx - mov ecx,[0xfe00] + mov ecx,[ScreenWidth] inc ecx div ecx @@ -255,7 +255,7 @@ vesa12_drawbackground: mov eax,ebx imul eax,dword [WinMapAddress-4] xor edx,edx - mov ecx,[0xfe04] + mov ecx,[ScreenHeight] inc ecx div ecx mov ebx,eax @@ -278,7 +278,7 @@ vesa12_drawbackground: add esi,eax add esi,eax add esi,eax - add esi,0x300000 + add esi,IMG_BACKGROUND pop ebx pop eax @@ -288,20 +288,20 @@ vesa12_drawbackground: pusha mov esi,eax mov edi,ebx - mov eax,[0xfe00] + mov eax,[ScreenWidth] add eax,1 mul ebx add eax,esi add eax,WinMapAddress cmp [eax],byte 1 jnz v12nbgp - mov eax,[0xfe08] + mov eax,[BytesPerScanLine] mov ebx,edi mul ebx add eax,esi add eax,esi add eax,esi - cmp [0xFBF1],byte 24 + cmp [ScreenBPP],byte 24 jz v12bgl3 add eax,esi @@ -310,13 +310,13 @@ vesa12_drawbackground: push ebx push eax - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,16 call set_bank pop eax and eax,65535 - add eax,0xa0000 + add eax,VGABasePtr pop ebx mov [eax],cx @@ -369,19 +369,19 @@ vesa12_drawbar: add ebx,[ecx-twdw+WDATA.box.top] push eax mov eax,ebx ; y - mov ebx,[0xfe08] + mov ebx,[BytesPerScanLine] mul ebx pop ecx add eax,ecx ; x add eax,ecx add eax,ecx - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x start + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start jz dbpi2412 add eax,ecx dbpi2412: - add eax,[0xfe80] + add eax,[LFBAddress] mov edi,eax ; x size @@ -390,7 +390,7 @@ vesa12_drawbar: mov ecx,eax add ecx,eax add ecx,eax - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x size + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size jz dbpi24312 add ecx,eax @@ -410,10 +410,10 @@ vesa12_drawbar: cmp ecx,0 jnz dbcblimitlset12 mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] - cmp ecx,[0xfe00] + cmp ecx,[ScreenWidth] jnz dbcblimitlset12 mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] - cmp ecx,[0xfe04] + cmp ecx,[ScreenHeight] jnz dbcblimitlset12 pop ecx pop eax @@ -428,7 +428,7 @@ vesa12_drawbar: dbcblimitlno12: - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? jz dbpi24bit12 jmp dbpi32bit12 @@ -458,7 +458,7 @@ dbpi24bit12: xor edx,edx mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] mov ebx,3 div ebx add eax,WinMapAddress @@ -481,11 +481,11 @@ dbpi24bit12: push edi mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,16 call set_bank and edi,0xffff - add edi,0xa0000 + add edi,VGABasePtr mov eax,[esp+8+3*4+16+4+4] stosw shr eax,16 @@ -523,7 +523,7 @@ dbpi24bit12: pop ecx pop edi pop ebx - add edi,[0xfe08] + add edi,[BytesPerScanLine] dec ebx jz dbnonewpi12 jmp dbnewpi12 @@ -550,7 +550,7 @@ dbpi24bit12: push ecx mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,2 add eax,WinMapAddress mov ebx,[CURRENT_TASK] @@ -572,11 +572,11 @@ dbpi24bit12: push edi mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,16 call set_bank and edi,0xffff - add edi,0xa0000 + add edi,VGABasePtr mov eax,[esp+8+3*4+16+4+4] stosw shr eax,16 @@ -615,7 +615,7 @@ dbpi24bit12: pop ecx pop edi pop ebx - add edi,[0xfe08] + add edi,[BytesPerScanLine] dec ebx jz nodbnewpi3212 jmp dbnewpi3212 @@ -631,14 +631,14 @@ Vesa12_putpixel24: mov edi,eax ; x mov eax,ebx ; y lea edi,[edi+edi*2] - mov ebx,[0xfe08] + mov ebx,[BytesPerScanLine] mul ebx add edi,eax mov eax,edi shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov eax,[esp+28] stosw shr eax,16 @@ -653,14 +653,14 @@ Vesa12_putpixel32: mov edi,eax ; x mov eax,ebx ; y shl edi,2 - mov ebx,[0xfe08] + mov ebx,[BytesPerScanLine] mul ebx add edi,eax mov eax,edi shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov ecx,[esp+28] mov [edi],ecx sti @@ -672,14 +672,14 @@ Vesa12_getpixel24: mov edi,eax ; x mov eax,ebx ; y lea edi,[edi+edi*2] - mov ebx,[0xfe08] + mov ebx,[BytesPerScanLine] mul ebx add edi,eax mov eax,edi shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov ecx,[edi] and ecx,255*256*256+255*256+255 sti @@ -691,7 +691,7 @@ Vesa12_getpixel32: mov edi,eax ; x mov eax,ebx ; y shl edi,2 - mov ebx,[0xfe08] + mov ebx,[BytesPerScanLine] xor edx,edx mul ebx add edi,eax @@ -699,7 +699,7 @@ Vesa12_getpixel32: shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov ecx,[edi] and ecx,255*256*256+255*256+255 sti @@ -736,18 +736,18 @@ vesa12_putimage: add ebx,[ecx-twdw+WDATA.box.top] push eax mov eax,ebx ; y - mul dword [0xfe08] + mul dword [BytesPerScanLine] pop ecx add eax,ecx ; x add eax,ecx add eax,ecx - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? - x start + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start jz pi2412 add eax,ecx pi2412: - add eax,[0xfe80] + add eax,[LFBAddress] mov edi,eax ; x size @@ -766,10 +766,10 @@ vesa12_putimage: cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 jnz dbcblimitlset212 mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] - cmp ecx,[0xfe00] + cmp ecx,[ScreenWidth] jnz dbcblimitlset212 mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] - cmp ecx,[0xfe04] + cmp ecx,[ScreenHeight] jnz dbcblimitlset212 pop ecx push 0 @@ -782,7 +782,7 @@ vesa12_putimage: dbcblimitlno212: - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? jnz pi32bit12 pi24bit12: @@ -794,7 +794,7 @@ vesa12_putimage: push ebx mov edx,edi - sub edx,[0xfe80] + sub edx,[LFBAddress] mov ebx,3 div ebx add edx,WinMapAddress @@ -818,12 +818,12 @@ vesa12_putimage: push edi push eax mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,16 call set_bank pop eax and edi,0xffff - add edi,0xa0000 + add edi,VGABasePtr mov [edi],ax shr eax,16 mov [edi+2],al @@ -843,7 +843,7 @@ vesa12_putimage: pop ecx pop edi - add edi,[0xfe08] + add edi,[BytesPerScanLine] add esi,[esp+32] dec ebx jnz newpi12 @@ -864,7 +864,7 @@ vesa12_putimage: push ebx mov edx,edi - sub edx,[0xfe80] + sub edx,[LFBAddress] shr edx,2 add edx,WinMapAddress mov ebx,[CURRENT_TASK] @@ -887,12 +887,12 @@ vesa12_putimage: push edi push eax mov eax,edi - sub eax,[0xfe80] + sub eax,[LFBAddress] shr eax,16 call set_bank pop eax and edi,0xffff - mov [edi+0xa0000],eax + mov [edi+VGABasePtr],eax pop edi imp32no12: @@ -909,7 +909,7 @@ vesa12_putimage: pop ecx pop edi - add edi,[0xfe08] + add edi,[BytesPerScanLine] dec ebx jnz newpi3212 @@ -923,7 +923,7 @@ vesa12_putimage: vesa12_read_screen_pixel: and eax,0x3FFFFF - cmp [0xfbf1],byte 24 ; 24 or 32 bpp ? + cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? jz v12rsp24 mov edi,eax shl edi,2 @@ -931,7 +931,7 @@ vesa12_read_screen_pixel: shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov eax,[edi] and eax,0x00ffffff ret @@ -942,7 +942,7 @@ vesa12_read_screen_pixel: shr eax,16 call set_bank and edi,65535 - add edi,0xa0000 + add edi,VGABasePtr mov eax,[edi] and eax,0x00ffffff ret diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 95398b4cbe..ba1982acd8 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -17,12 +17,12 @@ ; If you're planning to write your own video driver I suggest ; you replace the VESA12.INC file and see those instructions. -ScreenWidth equ 0xfe00 -ScreenHeight equ 0xfe04 -BytesPerScanLine equ 0xfe08 -LFBAddress equ 0xfe80 -ScreenBPP equ 0xfbf1 -WinMapAddress equ 0x460000 +;ScreenWidth equ 0xfe00 +;ScreenHeight equ 0xfe04 +;BytesPerScanLine equ 0xfe08 +;LFBAddress equ 0xfe80 +;ScreenBPP equ 0xfbf1 +;WinMapAddress equ 0x460000 @@ -333,7 +333,7 @@ __sys_putpixel: mov [esp+32-8],ecx .noneg: ; OK to set pixel - call dword [0xe020] ; call the real put_pixel function + call dword [PUTPIXEL] ; call the real put_pixel function .exit: popad @@ -930,7 +930,7 @@ vesa20_drawbackground_tiled: mov ebx,[esp+8] ; ebx:=B*3 mul ebx ; add esi,eax ; - mov eax,[esi+0x300000] + mov eax,[esi+IMG_BACKGROUND] and eax,0xffffff xchg edi, ebp @@ -1066,7 +1066,7 @@ shl ecx,16 mov cx,dx imul eax, [esp+8] ;8 add esi,eax -mov eax,[esi+0x300000] +mov eax,[esi+IMG_BACKGROUND] push eax ror ecx,16 xor eax,eax @@ -1079,7 +1079,7 @@ div ebx cmp eax,5 pop eax jb @f -mov ebx,[esi+0x300000+3] +mov ebx,[esi+IMG_BACKGROUND+3] call overlapping_of_points @@: push eax @@ -1097,7 +1097,7 @@ jb @f mov ebx,[display_data-8] shl ebx,1 add ebx,[display_data-8] -add ebx,0x300000 +add ebx,IMG_BACKGROUND add ebx,esi mov ebx,[ebx] call overlapping_of_points diff --git a/kernel/trunk/video/vga.inc b/kernel/trunk/video/vga.inc index 78499552da..9fe840db9a 100644 --- a/kernel/trunk/video/vga.inc +++ b/kernel/trunk/video/vga.inc @@ -122,14 +122,14 @@ endg checkVga_N13: - cmp [0xfe0c],dword 0x13 + cmp [SCR_MODE],dword 0x13 jne @f ; cnvl: pushad cmp [EGA_counter],1 je novesal - mov ecx,[0xfb0a] + mov ecx,[MOUSE_X] cmp ecx,[novesachecksum] jne novesal popad @@ -151,7 +151,7 @@ checkVga_N13: sub eax,100 imul eax,640*4 add ecx,eax - movzx eax,word [0xfb0a] + movzx eax,word [MOUSE_X] cmp eax,160 jge m13l1 mov eax,160 @@ -163,9 +163,9 @@ checkVga_N13: sub eax,160 shl eax,2 add ecx,eax - mov esi,[0xfe80] + mov esi,[LFBAddress] add esi,ecx - mov edi,0xa0000 + mov edi,VGABasePtr mov edx,200 mov ecx,320 cld @@ -197,11 +197,11 @@ checkVga_N13: VGA_drawbackground: ; draw all - cmp [0xfe0c],dword 0x12 + cmp [SCR_MODE],dword 0x12 jne .end pushad - mov esi,[0xfe80] - mov edi,0xa0000 + mov esi,[LFBAddress] + mov edi,VGABasePtr mov ebx,640/32 ; 640*480/(8*4) mov edx,480 @@: @@ -322,11 +322,11 @@ VGA_putpixel: lea ebx,[ebx+ebx*4] ; умножение на 5 lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) mov edi,edx - add edi, [0xfe80] ; + LFB address + add edi, [LFBAddress] ; + LFB address mov [edi], eax ; write to LFB for Vesa2.0 shr edx,5 ; change BytesPerPixel to 1/8 mov edi,edx - add edi, 0x0a0000 ; address of pixel in VGA area + add edi, VGABasePtr ; address of pixel in VGA area and ecx,0x07 ; bit no. (modulo 8) pushfd ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) @@ -373,7 +373,7 @@ VGA_putpixel: VGA__putimage: ; ecx = size [x|y] ; edx = coordinates [x|y] - cmp [0xfe0c],dword 0x12 + cmp [SCR_MODE],dword 0x12 jne @f pushad rol edx,16 @@ -393,7 +393,7 @@ VGA_draw_bar: ; ebx cy ; ecx xe ; edx ye - cmp [0xfe0c],dword 0x12 + cmp [SCR_MODE],dword 0x12 jne @f pushad sub ecx,eax @@ -418,10 +418,10 @@ VGA_draw_bar_1: lea ebx,[ebx+ebx*4] ; умножение на 5 lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) mov esi,ebx - add esi, [0xfe80] ; + LFB address + add esi, [LFBAddress] ; + LFB address shr ebx,5 ; change BytesPerPixel to 1/8 mov edi,ebx - add edi, 0x0a0000 ; address of pixel in VGA area + add edi, VGABasePtr ; address of pixel in VGA area mov ebx,ecx shr ebx,5 inc ebx diff --git a/kernel/trunk/vmodeint.inc b/kernel/trunk/vmodeint.inc index fed819ca3f..ffda6510e6 100644 --- a/kernel/trunk/vmodeint.inc +++ b/kernel/trunk/vmodeint.inc @@ -16,7 +16,7 @@ endg cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS jne .no_vmode_drv_access - pushd [0x0000fe00] [0x0000fe04] + pushd [ScreenWidth] [ScreenHeight] popd [old_screen_height] [old_screen_width] or eax,-1 ; If driver is absent then eax does not change call 0x760100 ; Entry point of video driver @@ -26,20 +26,20 @@ endg ; mov [esp+28],edx mov eax,[old_screen_width] mov ebx,[old_screen_height] - sub eax,[0x0000fe00] + sub eax,[ScreenWidth] jnz @f - sub ebx,[0x0000fe04] + sub ebx,[ScreenHeight] jz .resolution_wasnt_changed jmp .lp1 - @@: sub ebx,[0x0000fe04] + @@: sub ebx,[ScreenHeight] .lp1: sub [screen_workarea.right],eax sub [screen_workarea.bottom],ebx call repos_windows mov eax, 0 mov ebx, 0 - mov ecx, [0xfe00] - mov edx, [0xfe04] + mov ecx, [ScreenWidth] + mov edx, [ScreenHeight] call calculatescreen .resolution_wasnt_changed: