OK, he conseguido las fuentes, dime que tienes ahora mismo, el xelector normal?
;; Traystate3.asm
%include "header.asm"
kernel_thunk:
HalReadSMBusValue: dd 0x80000000 + 45
HalReturnToFirmware: dd 0x80000000 + 49
HalWriteSMBusValue: dd 0x80000000 + 50
LaunchDataPage: dd 0x80000000 + 164
MmAllocateContiguousMemory: dd 0x80000000 + 165
MmPersistContiguousMemory: dd 0x80000000 + 178
dd 0 ; end of table
align 4
start: cld
fan: push word 000Ah ; speed 10-50 (00Ah-032h) Puesto a minimo (000A)
push byte 0
push byte 6 ; fan_register
push byte 20h ; pic_address
call dword [HalWriteSMBusValue]
push byte 1
push byte 0
push byte 5 ; fan_mode
push byte 20h ; pic_address
call dword [HalWriteSMBusValue]
;----------------------------------------
mov eax,tray_data1 ; get tray state
push eax
push byte 0
push byte 3
push byte 20h
call dword [HalReadSMBusValue]
cmp byte [tray_data1], 10h ; 10h = open, anything else is closed
je short .t_opn
mov eax, 000Fh ; ORANGE led "closed". Cambiado a verde (000F)
call set_led ; go set it
jmp short do_xbe ; normal boot tray_data2 is zero
;----------------------------------------
.t_opn mov eax,00FFh ; RED led $F0 "open for now". Cambiado a naranja (00FF)
call set_led ; go set it
;-------
mov eax,0x1FFFFFFF
dly_0 dec eax
jnz short dly_0 ; ~ 1 sec
;----------------------------------------
push byte 1 ; close tray
push byte 0
push byte 0Ch ; tray_mode
push byte 20h ; pic_address
call dword [HalWriteSMBusValue]
;----------------------------------------
TS_lp: mov eax,0x01FFFFFF
dly_1 dec eax
jnz short dly_1 ; ~ 1/15 sec
;-------
mov eax, tray_data2 ; read after tray is closed
push eax
push byte 0
push byte 3
push byte 20h
call dword [HalReadSMBusValue]
;-------
cmp byte [tray_data2],40h ; 40h = no disk
je short do_xbe ; Bandeja cerrada, va al dash primario
cmp byte [tray_data2],60h ; 60h = game disk
jne short do_xbe ; Bandeja abierta, al cerrarse va al dash alternativo haya o no haya un metido disco
; jne short TS_lp ; Bandeja abierta, al cerrarse va al dash alternativo siempre y cuando no haya un disco
;-------
mov eax, 00EBh ; Orange Red Orange Green
call set_led ; change it (xmas tree) and boot Cdrom
mov esi,[LaunchDataPage]
mov ebx,[esi]
jmp short go_cd ; boot cd default.xbe. Si el disco no está firmado con la key Habibi salta el error 21
;----------------------------------------
do_xbe: mov esi,[LaunchDataPage]
mov edi,0x0100 ; bytes to hold xbe path ?????
mov ebx,[esi]
test ebx,ebx
jnz .memok
push edi
call dword [MmAllocateContiguousMemory]
mov ebx,eax
mov [esi],eax
.memok: push byte 1
push edi
push ebx
call dword [MmPersistContiguousMemory]
mov edi,ebx
xor eax,eax
mov ecx,0x0100 ; bytes to zero ?????
rep stosd
or dword [ebx],byte -1
mov [ebx+4],eax
lea edi,[ebx+8]
cmp byte [tray_data2],0h ; if zero tray was closed at boot
je short bt_nm ; boot normal
lea esi,[xbestr_nd]
push byte XBESTRLEN_ND ; boot no disk xbe
jmp short go_xbe
;-------
bt_nm lea esi,[xbestr]
push byte XBESTRLEN
go_xbe pop ecx
rep movsb
go_cd push byte 2
call dword [HalReturnToFirmware]
.inf: jmp short .inf
;----------------------------------------
set_led:
push eax ; must be dword size
push byte 0
push byte 8 ; led_register
push byte 20h ; pic_address
call dword [HalWriteSMBusValue]
push byte 1
push byte 0
push byte 7 ; led_mode
push byte 20h ; pic_address
call dword [HalWriteSMBusValue]
ret
;--------------------------------------------------------------------------------------
tray_data1 dd 0 ; put tray data here (yes, it's in the code section)
tray_data2 dd 0 ; 2nd read if tray was open at boot (after close)
align 16
xbestr db '\Device\Harddisk0\Partition2\xodash\data;close.xbe',0
times 31 db 0 ;;
XBESTRLEN equ $-xbestr
align 16
xbestr_nd db '\Device\Harddisk0\Partition2\xodash\data;open.xbe',0
times 5 db 0 ;; > patch back
XBESTRLEN_ND equ $-xbestr_nd
;--------------------------------------------------------------------------------------
%include "footer.asm"