Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ; --------------------------------------------------------------------------
  2. ; FILE: TConsole.Asm
  3. ; DATE: September 21, 2008
  4. ; --------------------------------------------------------------------------
  5.  
  6. ; --------------------------------------------------------------------------
  7. ; CRAM3AS
  8. ; --------------------------------------------------------------------------
  9. align PROC_ALIGN
  10. TConsole_Cram3Asterisks:
  11.     mcLoad8bitsToReg32 ecx, 181
  12.     call    TConsole_Cram
  13.     ret
  14.  
  15. ; --------------------------------------------------------------------------
  16. ; CRAMSHP
  17. ; --------------------------------------------------------------------------
  18. align PROC_ALIGN
  19. TConsole_CramShip:
  20.     mcLoadGameDataPtr ebx
  21.     mcLoadMember al, TREKDATA.SHIP
  22.  
  23.     mcOnRegEqu al, CHAR_ENTERPRISE, .good_ship
  24.     mcOnRegEqu al, CHAR_FQUEENE, .crappy_ship
  25.     ret
  26.  
  27. .good_ship:
  28.     push    144
  29.     jmp     .dump
  30.  
  31. .crappy_ship:
  32.     push    145
  33.  
  34. .dump:
  35.     pop     ecx
  36.     call    TConsole_Cram
  37.     ret
  38.  
  39. ; --------------------------------------------------------------------------
  40. align PROC_ALIGN
  41. TConsole_ScrollUp:
  42.     pushad
  43.  
  44.     mov     ebx, [glb_pConsole]
  45.     mov     edi, ebx
  46.     lea     esi, [edi + TLine.size]
  47.     mov     ecx, TConsole.cons_LastRow
  48.     rep     movsb
  49.  
  50.     lea     edi, [ebx + TConsole.cons_LastRow]
  51.     mcZeroBits eax
  52.     mov     ecx, TLine.size
  53.     rep     stosb
  54.  
  55.     mcStoreMember TConsole.cons_CaretColumn, eax
  56.  
  57.     mov     esi, eax
  58.     call    TApp_RefreshMainWndRect
  59.  
  60.     mov     al, 0Dh
  61.     call    TLog_DumpChar
  62.     mov     al, 0Ah
  63.     call    TLog_DumpChar
  64.  
  65.     popad
  66.     ret
  67.  
  68. ; --------------------------------------------------------------------------
  69. align PROC_ALIGN
  70. TConsole_RefreshCaretLine:
  71.     mcBeginLocals RECT.size
  72.  
  73.     mov     esi, esp
  74.     invoke  GetClientRect, [glb_MainWnd], esi
  75.  
  76.     mov     eax, [esi + RECT.rc_Bottom]
  77.     sub     eax, dword [glb_CharSize + SIZE.size_Height]
  78.     dec     eax
  79.     mov     [esi + RECT.rc_Top], eax
  80.  
  81.     call    TApp_RefreshMainWndRect
  82.  
  83.     mcEndLocals RECT.size
  84.     ret
  85.  
  86. ; --------------------------------------------------------------------------
  87. align PROC_ALIGN
  88. TConsole_Backspace:
  89.     mov     ebx, [glb_pConsole]
  90.     cmp     [ebx + TConsole.cons_CaretColumn], 0
  91.     je      .done
  92.  
  93.     dec     [ebx + TConsole.cons_CaretColumn]
  94.     mcZeroBits eax
  95.     call    TConsole_PutChar
  96.  
  97.     dec     [ebx + TConsole.cons_CaretColumn]
  98.     call    TConsole_RefreshCaretLine
  99.  
  100. .done:
  101.     ret
  102.  
  103. ; --------------------------------------------------------------------------
  104. ; Input:
  105. ;   AL = character code
  106. ; --------------------------------------------------------------------------
  107. align PROC_ALIGN
  108. TConsole_PutChar:
  109.     mov     ebx, [glb_pConsole]
  110.     cmp     [ebx + TConsole.cons_CaretColumn], CONSOLE_LAST_COL
  111.     jae     .done
  112.  
  113.     mcLoadMember ecx, TConsole.cons_CaretColumn
  114.     inc     [ebx + TConsole.cons_CaretColumn]
  115.     imul    ecx, TCharacter.size
  116.     lea     edi, [ebx + ecx + TConsole.cons_LastRow]
  117.  
  118.     mcLoadMember edx, TConsole.cons_ActiveColor
  119.     mov     [edi + TCharacter.char_Symbol], al
  120.     mov     [edi + TCharacter.char_Attribute], dl
  121.  
  122.     pushad
  123.     call    TLog_DumpChar
  124.     popad
  125.  
  126. .done:
  127.     ret
  128.  
  129. ; --------------------------------------------------------------------------
  130. ; Input:
  131. ;   CL = index of color
  132. ; --------------------------------------------------------------------------
  133. align PROC_ALIGN
  134. TConsole_SetAttr:
  135.     cmp     cl, CONSOLE_ATTRS
  136.     jae     .done
  137.  
  138.     and     ecx, 0FFh
  139.     push    ebx
  140.     mov     ebx, [glb_pConsole]
  141.     mcStoreMember TConsole.cons_ActiveColor, ecx
  142.     pop     ebx
  143.  
  144. .done:
  145.     ret
  146.  
  147. ; --------------------------------------------------------------------------
  148. align PROC_ALIGN
  149. TConsole_SetGameMsgAttr:
  150.     mov     cl, ATTR_GAME_MSG
  151.     call    TConsole_SetAttr
  152.     ret
  153.  
  154. ; --------------------------------------------------------------------------
  155. align PROC_ALIGN
  156. TConsole_SetCrewMsgAttr:
  157.     mov     cl, ATTR_CREW_MSG
  158.     call    TConsole_SetAttr
  159.     ret
  160.  
  161. ; --------------------------------------------------------------------------
  162. ; Input:
  163. ;   AL = character code
  164. ;   CL = number of characters
  165. ; --------------------------------------------------------------------------
  166. align PROC_ALIGN
  167. TConsole_RepeatChar:
  168.     and     ecx, 0FFh
  169.  
  170. .next:
  171.     push    ecx
  172.     call    TConsole_PutChar
  173.     pop     ecx
  174.     loop    .next
  175.     ret
  176.  
  177. ; --------------------------------------------------------------------------
  178. ; Input:
  179. ;   CL = number of characters
  180. ; --------------------------------------------------------------------------
  181. align PROC_ALIGN
  182. TConsole_RepeatBlank:
  183.     mov     al, CHAR_BLANK
  184.     call    TConsole_RepeatChar
  185.     ret
  186.  
  187. ; --------------------------------------------------------------------------
  188. ; Input:
  189. ;   CL = number of characters
  190. ; --------------------------------------------------------------------------
  191. align PROC_ALIGN
  192. TConsole_RepeatAsterisk:
  193.     mov     al, CHAR_ASTERISK
  194.     call    TConsole_RepeatChar
  195.     ret
  196.  
  197. ; --------------------------------------------------------------------------
  198. ; SUBROUTINE CRAM from original FORTRAN source
  199. ; --------------------------------------------------------------------------
  200. ; Input:
  201. ;   ECX = index of the message table
  202. ; --------------------------------------------------------------------------
  203. align PROC_ALIGN
  204. TConsole_Cram:
  205.     call    TMsgTable_GetItem
  206.     mcZeroBits eax
  207.  
  208. .get_char:
  209.     lodsb
  210.     mcOnRegZero eax, .done
  211.  
  212.     call    TConsole_PutChar
  213.     jmp     .get_char
  214.  
  215. .done:
  216.     ret
  217.  
  218. ; --------------------------------------------------------------------------
  219. ; Input:
  220. ;   ESI = UNICODE text
  221. ; --------------------------------------------------------------------------
  222. align PROC_ALIGN
  223. TConsole_CramWide:
  224.     mcZeroBits eax
  225.  
  226. .get_char:
  227.     lodsw
  228.     mcOnRegZero eax, .done
  229.  
  230.     call    TConsole_PutChar
  231.     jmp     .get_char
  232.  
  233. .done:
  234.     ret
  235.  
  236. ; --------------------------------------------------------------------------
  237. ; Input:
  238. ;   ESI = ANSI text
  239. ; --------------------------------------------------------------------------
  240. align PROC_ALIGN
  241. TConsole_CramAnsi:
  242.     mcZeroBits eax
  243.  
  244. .get_char:
  245.     lodsb
  246.     mcOnRegZero eax, .done
  247.  
  248.     call    TConsole_PutChar
  249.     jmp     .get_char
  250.  
  251. .done:
  252.     ret
  253.  
  254. ; --------------------------------------------------------------------------
  255. ; Input:
  256. ;   ECX = index of the message table
  257. ;   DL = field width
  258. ; --------------------------------------------------------------------------
  259. align PROC_ALIGN
  260. TConsole_CramString:
  261.     movzx   edx, dl
  262.     call    TMsgTable_GetLength
  263.  
  264.     cmp     eax, edx
  265.     jae     .cram_and_exit
  266.  
  267.     sub     edx, eax
  268.     push    edx
  269.     call    TConsole_Cram
  270.  
  271.     pop     ecx
  272.     call    TConsole_RepeatBlank
  273.     ret
  274.  
  275. .cram_and_exit:
  276.     call    TConsole_Cram
  277.     ret
  278.  
  279. ; --------------------------------------------------------------------------
  280. ; Input:
  281. ;   CL = 1-based device index (like DEV_IMPULSE_ENGINES)
  282. ; --------------------------------------------------------------------------
  283. align PROC_ALIGN
  284. TConsole_CramDevice:
  285.     movzx   ecx, cl
  286.     add     ecx, 59
  287.     call    TConsole_Cram
  288.     ret
  289.  
  290. ; --------------------------------------------------------------------------
  291. ; CRAMEN
  292. ; --------------------------------------------------------------------------
  293. ; Input:
  294. ;   AL = object symbol
  295. ; --------------------------------------------------------------------------
  296. align PROC_ALIGN
  297. TConsole_CramEnemy:
  298.     pushad
  299.  
  300.     mov     edi, glb_ObjectMap
  301.     mcLoad8bitsToReg32 ecx, 9
  302.     mov     edx, edi
  303.     repne   scasb
  304.     jne     .done
  305.  
  306. .cram_it:
  307.     sub     edi, edx
  308.     lea     ecx, [edi + 202]
  309.     call    TConsole_Cram
  310.  
  311. .done:
  312.     popad
  313.     ret
  314.  
  315. ; --------------------------------------------------------------------------
  316. ; CRMSENA
  317. ; --------------------------------------------------------------------------
  318. ; Input:
  319. ;   AL = X coordinate
  320. ;   DL = Y coordinate
  321. ;   CL = 1 for "QUADRANT", 2 for "SECTOR", 0 for none
  322. ;   BL = Enemy character
  323. ; --------------------------------------------------------------------------
  324. align PROC_ALIGN
  325. TConsole_CramEnemyAt:
  326.     push    eax ecx edx
  327.  
  328.     mov     al, bl
  329.     call    TConsole_CramEnemy
  330.  
  331.     mov     ecx, 257
  332.     call    TConsole_Cram
  333.  
  334.     pop     edx ecx eax
  335.     call    TConsole_CramLoc
  336.     ret
  337.  
  338. ; --------------------------------------------------------------------------
  339. ; Input:
  340. ;   AL = sector X coordinate
  341. ;   DL = sector Y coordinate
  342. ; --------------------------------------------------------------------------
  343. align PROC_ALIGN
  344. TConsole_CramEnemyAtEx:
  345.     push    ebx
  346.     call    TArray_QuadPtr
  347.     mov     bl, [ebx]
  348.     mov     cl, 2
  349.     call    TConsole_CramEnemyAt
  350.     pop     ebx
  351.     ret
  352.  
  353. ; --------------------------------------------------------------------------
  354. ; Input:
  355. ;   EAX = Int32 value to print
  356. ;   CL = field width or zero (value is padded with blanks on the left side)
  357. ; --------------------------------------------------------------------------
  358. virtual at 0
  359. loc19:
  360.     .bufInt32 CHARS 12
  361.     .nWidth COUNT ?
  362.     .size = $
  363. end virtual
  364. ; --------------------------------------------------------------------------
  365. align PROC_ALIGN
  366. TConsole_CramIntWidth:
  367.     mcBeginLocals loc19.size
  368.  
  369.     movzx   ecx, cl
  370.     mcStoreLocal loc19.nWidth, ecx
  371.  
  372.     mcLoadLocalRef edi, loc19.bufInt32
  373.     call    TFormat_Int32
  374.  
  375.     cmp     [esp + loc19.nWidth], 0
  376.     je      .dump
  377.  
  378.     cmp     [esp + loc19.nWidth], ecx
  379.     jbe     .dump
  380.  
  381.     sub     ecx, [esp + loc19.nWidth]
  382.     neg     ecx
  383.     call    TConsole_RepeatBlank
  384.  
  385. .dump:
  386.     mcLoadLocalRef esi, loc19.bufInt32
  387.     mcZeroBits eax
  388.  
  389. .next:
  390.     lodsb
  391.     mcOnRegZero eax, .done
  392.     call    TConsole_PutChar
  393.     jmp     .next
  394.  
  395. .done:
  396.     mcEndLocals loc19.size
  397.     ret
  398.  
  399. ; --------------------------------------------------------------------------
  400. ; Input:
  401. ;   EAX = Int32 value to print
  402. ; --------------------------------------------------------------------------
  403. align PROC_ALIGN
  404. TConsole_CramInt:
  405.     pushad
  406.     mcZeroBits ecx
  407.     call    TConsole_CramIntWidth
  408.     popad
  409.     ret
  410.  
  411. ; --------------------------------------------------------------------------
  412. ; Input:
  413. ;   ECX = message table index
  414. ;   EAX = Int32 value to print
  415. ; --------------------------------------------------------------------------
  416. align PROC_ALIGN
  417. TConsole_CramSinglePlural:
  418.     push    eax ecx
  419.     call    TConsole_CramInt
  420.  
  421.     mov     al, CHAR_BLANK
  422.     call    TConsole_PutChar
  423.  
  424.     pop     ecx
  425.     call    TConsole_Cram
  426.  
  427.     pop     eax
  428.     cmp     al, 1
  429.     je      .done
  430.  
  431.     mov     al, 'S'
  432.     call    TConsole_PutChar
  433.  
  434. .done:
  435.     ret
  436.  
  437. ; --------------------------------------------------------------------------
  438. ; Input:
  439. ;   AL = X coordinate
  440. ;   DL = Y coordinate
  441. ;   CL = KEY (1 - print "QUADRANT", 2 - print "SECTOR")
  442. ; --------------------------------------------------------------------------
  443. virtual at 0
  444. loc21:
  445.     .nIX INT32 ?
  446.     .nIY INT32 ?
  447.     .size = $
  448. end virtual
  449. ; --------------------------------------------------------------------------
  450. align PROC_ALIGN
  451. TConsole_CramLoc:
  452.     mcBeginLocals loc21.size
  453.  
  454.     movzx   eax, al
  455.     movzx   edx, dl
  456.     mcStoreLocal loc21.nIX, eax
  457.     mcStoreLocal loc21.nIY, edx
  458.  
  459.     mcOnRegZero cl, .print_values
  460.  
  461.     add     cl, 56
  462.     movzx   ecx, cl
  463.     call    TConsole_Cram
  464.  
  465. .print_values:
  466.     mov     al, CHAR_BLANK
  467.     call    TConsole_PutChar
  468.  
  469.     mcLoadLocal eax, loc21.nIX
  470.     call    TConsole_CramInt
  471.  
  472.     mcLoad8bitsToReg32 ecx, 59
  473.     call    TConsole_Cram
  474.  
  475.     mcLoadLocal eax, loc21.nIY
  476.     call    TConsole_CramInt
  477.  
  478.     mcEndLocals loc21.size
  479.     ret
  480.  
  481. ; --------------------------------------------------------------------------
  482. ; Input:
  483. ;   ST(0) = value to print
  484. ;   CL = precision
  485. ;   DL = field width or zero
  486. ; --------------------------------------------------------------------------
  487. virtual at 0
  488. loc20:
  489.     .bufDouble CHARS 16
  490.     .nWidth COUNT ?
  491.     .size = $
  492. end virtual
  493. ; --------------------------------------------------------------------------
  494. align PROC_ALIGN
  495. TConsole_CramFloatWidth:
  496.     mcBeginLocals loc20.size
  497.  
  498.     movzx   edx, dl
  499.     mcStoreLocal loc20.nWidth, edx
  500.  
  501.     mcLoadLocalRef edi, loc20.bufDouble
  502.     call    TFormat_Double
  503.  
  504.     cmp     [esp + loc20.nWidth], 0
  505.     je      .dump
  506.  
  507.     cmp     [esp + loc20.nWidth], ecx
  508.     jbe     .dump
  509.  
  510.     sub     ecx, [esp + loc20.nWidth]
  511.     neg     ecx
  512.     call    TConsole_RepeatBlank
  513.  
  514. .dump:
  515.     mcLoadLocalRef esi, loc20.bufDouble
  516.     mcZeroBits eax
  517.  
  518. .next:
  519.     lodsb
  520.     mcOnRegZero eax, .done
  521.     call    TConsole_PutChar
  522.     jmp     .next
  523.  
  524. .done:
  525.     mcEndLocals loc20.size
  526.     ret
  527.  
  528. ; --------------------------------------------------------------------------
  529. ; Input:
  530. ;   ST(0) = value to print
  531. ;   CL = precision
  532. ; --------------------------------------------------------------------------
  533. align PROC_ALIGN
  534. TConsole_CramFloat:
  535.     pushad
  536.     mcZeroBits edx
  537.     call    TConsole_CramFloatWidth
  538.     popad
  539.     ret
  540.  
  541. ; --------------------------------------------------------------------------
  542. ; SUBROUTINE PROUT from original FORTRAN source
  543. ; --------------------------------------------------------------------------
  544. ; Input:
  545. ;   ECX = index of the message table
  546. ; --------------------------------------------------------------------------
  547. align PROC_ALIGN
  548. TConsole_Prout:
  549.     push    ecx
  550.     call    TConsole_Cram
  551.     call    TConsole_ScrollUp
  552.     pop     ecx
  553.     ret
  554.  
  555. ; --------------------------------------------------------------------------
  556. ; Input:
  557. ;   CL = number of lines to skip
  558. ; --------------------------------------------------------------------------
  559. align PROC_ALIGN
  560. TConsole_Skip:
  561.     movzx   ecx, cl
  562.  
  563. .skipping:
  564.     push    ecx
  565.     call    TConsole_ScrollUp
  566.     pop     ecx
  567.     loop    .skipping
  568.     ret
  569.  
  570. ; --------------------------------------------------------------------------
  571. ; Input:
  572. ;   ECX = index of the message table
  573. ; --------------------------------------------------------------------------
  574. align PROC_ALIGN
  575. TConsole_ProutGameMsg:
  576.     push    ecx
  577.     call    TConsole_SetGameMsgAttr
  578.     pop     ecx
  579.     call    TConsole_Prout
  580.     ret
  581.  
  582. ; --------------------------------------------------------------------------
  583. ; Input:
  584. ;   CL = index of color
  585. ; Output:
  586. ;   EAX = COLORREF at the specified index
  587. ; --------------------------------------------------------------------------
  588. align PROC_ALIGN
  589. TConsole_GetColorAtIndex:
  590.     mcLoadRGB eax, 255, 0, 0
  591.     cmp     cl, CONSOLE_ATTRS
  592.     jae     .done
  593.  
  594.     and     ecx, 0FFh
  595.     mov     ebx, [glb_pConsole]
  596.     mov     eax, [ebx + 4*ecx + TConsole.cons_Attributes]
  597.  
  598. .done:
  599.     ret
  600.  
  601. ; --------------------------------------------------------------------------
  602. ; Input:
  603. ;   EDX = HDC
  604. ;   EAX = Y coordinate
  605. ;   ESI = address of TLine structure
  606. ;   ECX = number of lines left in the loop
  607. ; --------------------------------------------------------------------------
  608. virtual at 0
  609. loc2:
  610.     .hDC HDC ?
  611.     .yText INT32 ?
  612.     .xText INT32 ?
  613.     .pTChar PTCharacter ?
  614.     .rgbNow COLORREF ?
  615.     .strOneChar WCHARS 2
  616.     .nLinesLeft COUNT ?
  617.     .rect_Caret rb RECT.size
  618.     .size = $
  619. end virtual
  620. ; --------------------------------------------------------------------------
  621. align PROC_ALIGN
  622. TConsole_DrawLine:
  623.     mcBeginLocals loc2.size
  624.  
  625.     mcStoreLocal loc2.nLinesLeft, ecx
  626.     mcStoreLocal loc2.hDC, edx
  627.     mcStoreLocal loc2.yText, eax
  628.     mcStoreLocal loc2.pTChar, esi
  629.  
  630.     mcZeroBits eax
  631.     mcStoreLocal loc2.rgbNow, eax
  632.     inc     eax
  633.     mcStoreLocal loc2.xText, eax
  634.  
  635. .load_char:
  636.     mcLoadLocal esi, loc2.pTChar
  637.     cmp     [esi + TCharacter.char_Symbol], 0
  638.     je      .draw_caret
  639.  
  640.     movzx   eax, [esi + TCharacter.char_Symbol]
  641.     mov     [esp + loc2.strOneChar], ax
  642.  
  643.     mov     cl, [esi + TCharacter.char_Attribute]
  644.     call    TConsole_GetColorAtIndex
  645.  
  646.     mcLoadLocal edi, loc2.hDC
  647.     cmp     [esp + loc2.rgbNow], eax
  648.     je      .draw_char
  649.  
  650.     mcStoreLocal loc2.rgbNow, eax
  651.     invoke  SetTextColor, edi, eax
  652.  
  653. .draw_char:
  654.     mov     ebx, esp
  655.     lea     esi, [ebx + loc2.strOneChar]
  656.  
  657.     invoke  TextOut, edi, \
  658.             [ebx + loc2.xText], \
  659.             [ebx + loc2.yText], esi, 1
  660.  
  661.     add     [ebx + loc2.pTChar], TCharacter.size
  662.  
  663.     mov     eax, dword [glb_CharSize + SIZE.size_Width]
  664.     add     [ebx + loc2.xText], eax
  665.     jmp     .load_char
  666.  
  667. .draw_caret:
  668.     cmp     [esp + loc2.nLinesLeft], 1
  669.     jne     .done
  670.     ;
  671.     ; Paint a rectangular caret
  672.     ;
  673.     mov     ebx, esp
  674.     mcLoadMemberRef edi, loc2.rect_Caret
  675.     mcLoadMember edx, loc2.xText
  676.     mcLoadMember eax, loc2.yText
  677.     mov     [edi + RECT.rc_Left], edx
  678.     mov     [edi + RECT.rc_Top], eax
  679.  
  680.     mov     esi, glb_CharSize
  681.     add     edx, [esi + SIZE.size_Width]
  682.     add     eax, [esi + SIZE.size_Height]
  683.     mov     [edi + RECT.rc_Right], edx
  684.     mov     [edi + RECT.rc_Bottom], eax
  685.  
  686.     mov     cl, ATTR_PROMPT_VALUE
  687.     call    TConsole_GetColorAtIndex
  688.  
  689.     invoke  CreateSolidBrush, eax
  690.     mov     esi, eax
  691.     mcLoadLocal edx, loc2.hDC
  692.     mcLoadLocalRef edi, loc2.rect_Caret
  693.     inc     [edi + RECT.rc_Left]
  694.     inc     [edi + RECT.rc_Right]
  695.     invoke  FillRect, edx, edi, eax
  696.     invoke  DeleteObject, esi
  697.  
  698. .done:
  699.     mcEndLocals loc2.size
  700.     ret
  701.  
  702. ; --------------------------------------------------------------------------
  703. ; Input:
  704. ;   EDX = HDC
  705. ; --------------------------------------------------------------------------
  706. virtual at 0
  707. loc3:
  708.     .hDC HDC ?
  709.     .yText INT32 ?
  710.     .pLineOfChars PTLine ?
  711.     .nLines COUNT ?
  712.     .size = $
  713. end virtual
  714. ; --------------------------------------------------------------------------
  715. align PROC_ALIGN
  716. TConsole_DrawAllLines:
  717.     mcBeginLocals loc3.size
  718.  
  719.     mcStoreLocal loc3.hDC, edx
  720.  
  721.     mcLoad1 eax
  722.     mcStoreLocal loc3.yText, eax
  723.  
  724.     mov     ebx, [glb_pConsole]
  725.     mcStoreLocal loc3.pLineOfChars, ebx
  726.  
  727.     mcLoad8bitsToReg32 ecx, CONSOLE_ROWS
  728.     mcStoreLocal loc3.nLines, ecx
  729.  
  730. .paint_row:
  731.     mcLoadLocal edx, loc3.hDC
  732.     mcLoadLocal eax, loc3.yText
  733.     mcLoadLocal esi, loc3.pLineOfChars
  734.     mcLoadLocal ecx, loc3.nLines
  735.     call    TConsole_DrawLine
  736.  
  737.     add     [esp + loc3.pLineOfChars], TLine.size
  738.  
  739.     mov     eax, dword [glb_CharSize + SIZE.size_Height]
  740.     add     [esp + loc3.yText], eax
  741.  
  742.     dec     [esp + loc3.nLines]
  743.     jnz     .paint_row
  744.  
  745.     mcEndLocals loc3.size
  746.     ret
  747.  
  748. ; --------------------------------------------------------------------------
  749. align PROC_ALIGN
  750. TConsole_Create:
  751.     invoke  HeapAlloc, [glb_Allocator], HEAP_NO_SERIALIZE, TConsole.size
  752.     mov     [glb_pConsole], eax
  753.  
  754.     mov     edi, eax
  755.     mov     ecx, TConsole.size
  756.     mcZeroBits eax
  757.     push    edi
  758.     rep     stosb
  759.     pop     esi
  760.     ;
  761.     ; Init palette
  762.     ;
  763.     lea     edi, [esi + TConsole.cons_Attributes]
  764.  
  765.     mcLoadRGB eax, 128, 191, 255
  766.     stosd ; ATTR_GAME_MSG
  767.  
  768.     mcLoadRGB eax, 255, 255, 206
  769.     stosd ; ATTR_CREW_MSG
  770.  
  771.     mcLoadRGB eax, 94, 174, 174
  772.     stosd ; ATTR_KLINGON
  773.  
  774.     mcLoadRGB eax, 0, 176, 0
  775.     stosd ; ATTR_ROMULAN
  776.  
  777.     mcLoadRGB eax, 192, 192, 192
  778.     stosd ; ATTR_COSMOS
  779.  
  780.     mcLoadRGB eax, 255, 255, 255
  781.     stosd ; ATTR_SHIP
  782.  
  783.     mcLoadRGB eax, 255, 255, 0
  784.     stosd ; ATTR_STAR
  785.  
  786.     mcLoadRGB eax, 6, 131, 255
  787.     stosd ; ATTR_BASE
  788.  
  789.     mcLoadRGB eax, 128, 128, 64
  790.     stosd ; ATTR_THOLIAN
  791.  
  792.     mcLoadRGB eax, 128, 128, 128
  793.     stosd ; ATTR_BLACK_HOLE
  794.  
  795.     mcLoadRGB eax, 230, 211, 157
  796.     stosd ; ATTR_PLANET
  797.  
  798.     mcLoadRGB eax, 0, 128, 255
  799.     stosd ; ATTR_REPORT_TEXT
  800.  
  801.     mcLoadRGB eax, 62, 158, 255
  802.     stosd ; ATTR_REPORT_VALUE
  803.  
  804.     mcLoadRGB eax, 248, 108, 41
  805.     stosd ; ATTR_GALAXY_EDGE
  806.  
  807.     mcLoadRGB eax, 149, 255, 202
  808.     stosd ; ATTR_SHIP_QUAD
  809.  
  810.     mcLoadRGB eax, 174, 194, 247
  811.     stosd ; ATTR_SCANNED_QUAD
  812.  
  813.     mcLoadRGB eax, 218, 191, 5
  814.     stosd ; ATTR_SCAN_SCALE
  815.  
  816.     mcLoadRGB eax, 255, 170, 170
  817.     stosd ; ATTR_HIT_DAMAGE
  818.  
  819.     mcLoadRGB eax, 181, 181, 106
  820.     stosd ; ATTR_WEB
  821.  
  822.     mcLoadRGB eax, 46, 170, 43
  823.     stosd ; ATTR_COND_GREEN
  824.  
  825.     mcLoadRGB eax, 255, 255, 130
  826.     stosd ; ATTR_COND_YELLOW
  827.  
  828.     mcLoadRGB eax, 255, 73, 64
  829.     stosd ; ATTR_COND_RED
  830.  
  831.     mcLoadRGB eax, 0, 155, 0
  832.     stosd ; ATTR_PROMPT_TEXT
  833.  
  834.     mcLoadRGB eax, 73, 231, 69
  835.     stosd ; ATTR_PROMPT_VALUE
  836.  
  837.     ret
  838.  
  839. ; --- EOF ---
  840.