Thursday, July 22, 2010

Too deep

As promised, here is the assembly library initialization function:
LORI_init PROC FAR
MOV BX,8000h
CALL C_06B4
TEST AX,AX
JNZ C_0783 ;return
MOV [D_279C],AX
MOV [D_279C+2],BX
;
MOV BX,4000h
CALL C_06B4
TEST AX,AX
JNZ C_0783 ;return
MOV [LORI_data],AX
MOV [LORI_data+2],BX
;
MOV BX,1B58h
CALL C_06B4
TEST AX,AX
JNZ C_0783 ;return
MOV [D_2798],AX
MOV [D_2798+2],BX
;
MOV BX,4000h
CALL C_06B4
TEST AX,AX
JNZ C_0783 ;return
MOV [D_27A0],AX
MOV [D_27A0+2],BX
;
CALL C_06A0 ;setGraphicMode
CALL FAR PTR C_35C2_157C ;initializeInt8
CALL C_06CA ;initializeInt9
CALL C_067B ;init table D_6870
CALL C_0657 ;init table D_6970
CALL C_0784 ;checkCpuSpeed
XOR AX,AX
C_0783: ;--
RET
LORI_init ENDP

As you can see, the function C_06B4 discussed in the previous post is called 4 times, and the returned values (segment address of the allocated space) stored to some variables.
Those zones will be used to load the resource files mainly.
Then the interrupt vectors for timer and keyboard interrupt are initialized, screen mode is set to graphic (320x200 4 color pixels, uh uh), the cpu speed is computed (and this will be used for ... wave sound rendering !!!), and other initializations take place.

Well, I think we may have gone too deep in the code already, so from next time, I guess we will stay on the C code level.

As to why the function labeled initializeInt8 is called through a far pointer (32 bits as opposed to near 16 bits), I am still puzzled. Anyone has an idea ?

No comments: