source: xtideuniversalbios/trunk/Assembly_Library/Src/LibraryTests.asm @ 125

Last change on this file since 125 was 125, checked in by aitotat, 13 years ago

Changes to Assembly Library:

  • Cursor coordinates no longer change when clearing menu title or information area.
File size: 16.4 KB
RevLine 
[41]1; File name     :   LibraryTests.asm
2; Project name  :   Assembly Library
3; Created date  :   27.6.2010
[67]4; Last update   :   7.12.2010
[41]5; Author        :   Tomi Tilli
6; Description   :   Tests for Assembly Library.
7;                   This file should not be included when using the library on
8;                   some other project.     
9
10; Include .inc files
11%define INCLUDE_MENU_DIALOGS
12%include "AssemblyLibrary.inc"  ; Assembly Library. Must be included first!
13
14
15; Section containing code
16SECTION .text
17
18; Program first instruction.
19ORG 100h                        ; Code starts at offset 100h (DOS .COM)
20Start:
21    jmp     LibraryTests_Start
22
23; Include library sources
24%include "AssemblyLibrary.asm"
25
26
27;--------------------------------------------------------------------
28; Program start
29;--------------------------------------------------------------------
30ALIGN JUMP_ALIGN
31LibraryTests_Start: 
32    CALL_DISPLAY_LIBRARY InitializeDisplayContext
[67]33    mov     ax, SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE
34    CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
[41]35
[46]36    ;call   LibraryTests_Sort
[45]37    ;call   LibraryTests_ForDisplayLibrary
[41]38    ;call   LibraryTests_ForKeyboardLibrary
[46]39    call    LibraryTests_ForMenuLibrary
[41]40
41    ; Exit to DOS
42    ;mov        ax, CURSOR_XY(1, 1)
43    ;CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
44    CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware
45    mov     ax, 4C00h           ; Exit to DOS
46    int     21h
47
48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49ALIGN JUMP_ALIGN
50LibraryTests_ForMenuLibrary:
51    mov     [cs:g_dialogInputOutput+DIALOG_INPUT.fszTitle+2], cs
52    mov     [cs:g_dialogInputOutput+DIALOG_INPUT.fszItems+2], cs
53    mov     [cs:g_dialogInputOutput+DIALOG_INPUT.fszInfo+2], cs
54
55    mov     bx, .MenuEventHandler
56    call    MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
57    ret
58
59ALIGN JUMP_ALIGN
60.MenuEventHandler:
61    jmp     [cs:bx+.rgfnMenuEvents]
62.NotHandled:
63    clc     ; Not handled so clear
64    ret
65
66ALIGN JUMP_ALIGN
67.InitializeMenu:
68    mov     WORD [si+MENUINIT.wItems], 51
69    mov     BYTE [si+MENUINIT.bWidth], 40
70    mov     BYTE [si+MENUINIT.bHeight], 20
71    mov     BYTE [si+MENUINIT.bTitleLines], TEST_MENU_TITLE_LINES
72    mov     BYTE [si+MENUINIT.bInfoLines], TEST_MENU_INFO_LINES
[52]73    mov     WORD [si+MENUINIT.wHighlightedItem], 1
[60]74   
75    mov     ax, 10000 / 55  ; 10 seconds
76    CALL_MENU_LIBRARY StartSelectionTimeoutWithTicksInAX
[41]77    stc
78    ret
79
80ALIGN JUMP_ALIGN
81.RefreshTitle:
82    mov     si, .szMenuTitle
83    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
84    stc
85    ret
86.szMenuTitle:
[48]87    db      "Simple test program for Assembly Library. Can be used to find bugs.",NULL
[41]88
89ALIGN JUMP_ALIGN
90.RefreshInformation:
91    push    bp
92    mov     bp, sp
93    mov     si, .szInfoTitle
94    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
95    pop     bp
96    stc
97    ret
98.szInfoTitle:
[52]99    db      "Information line 1,",LF,CR,
[125]100    db      "Information line 2. Auto splitter should split this very long line.",NULL
[41]101
102ALIGN JUMP_ALIGN
103.RefreshItemFromCX:
104    cmp     cx, TEST_MENU_VALID_ITEMS
105    jb      SHORT .PrintKnownItem
106
107    push    bp
108    mov     si, .szItem
109    mov     bp, sp
110    push    cx              ; Item index
111    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
112    pop     bp
113    stc
114    ret
115.szItem:
116    db  "This is item %d.",NULL
117.PrintKnownItem:
118    mov     si, cx
119    shl     si, 1
120    mov     si, [cs:si+.rgszItems]
121    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
122    stc
123    ret
124
125ALIGN JUMP_ALIGN
126.ItemSelectedFromCX:
127    push    cs
128    pop     ds
129    cmp     cx, TEST_MENU_VALID_ITEMS
130    jae     SHORT .ReturnWithoutHandling
131    mov     bx, cx
132    shl     bx, 1
133    jmp     [bx+.rgfnSelectionHandler]
134.ReturnWithoutHandling:
135    stc
136    ret
137
138ALIGN WORD_ALIGN
139.rgfnSelectionHandler:
[58]140    dw      .ExitMenuByItem
[41]141    dw      .ToggleTitle
142    dw      .ToggleInfo
143    dw      .ShowMessageDialogWithUnformattedText
144    dw      .AskWordFromUser
145    dw      .AskStringFromUser
146    dw      .AskSelectionFromUser
147    dw      .AskFileFromUser
148    dw      .TestProgressBar
149
150
151ALIGN JUMP_ALIGN
[58]152.ExitMenuByItem:
[41]153    CALL_MENU_LIBRARY Close
[58]154.ExitMenuByMenuLibrary:
[41]155    stc
156    ret
157
158ALIGN JUMP_ALIGN
159.ToggleTitle:
160    mov     al, [bp+MENUINIT.bTitleLines]
161    xor     al, TEST_MENU_TITLE_LINES
162    CALL_MENU_LIBRARY SetTitleHeightFromAL
163    jmp     SHORT .RefreshMenuWindow
164ALIGN JUMP_ALIGN
165.ToggleInfo:
166    mov     al, [bp+MENUINIT.bInfoLines]
167    xor     al, TEST_MENU_INFO_LINES
168    CALL_MENU_LIBRARY SetInformationHeightFromAL
169.RefreshMenuWindow:
[60]170    ;CALL_MENU_LIBRARY RestartTimeout
[41]171    CALL_MENU_LIBRARY RefreshWindow
172    stc
173    ret
174
175ALIGN JUMP_ALIGN
176.ShowMessageDialogWithUnformattedText:
177    mov     di, g_szVeryLongString
178    jmp     .ShowDialogWithStringInCSDI
179
180ALIGN JUMP_ALIGN
181.AskWordFromUser:
182    mov     si, g_dialogInputOutput
183    mov     BYTE [si+WORD_DIALOG_IO.bNumericBase], 10
184    mov     WORD [si+WORD_DIALOG_IO.wMin], 10
185    mov     WORD [si+WORD_DIALOG_IO.wMax], 20
186    CALL_MENU_LIBRARY GetWordWithIoInDSSI
187
188    mov     ax, [si+WORD_DIALOG_IO.wReturnWord]
189    mov     di, g_szBuffer
190    call    .FormatWordFromAXtoStringBufferInCSDI
191    call    .ShowDialogWithStringInCSDI
192    stc
193    ret
194
195ALIGN JUMP_ALIGN
196.AskStringFromUser:
197    mov     si, g_dialogInputOutput
198    mov     WORD [si+STRING_DIALOG_IO.fnCharFilter], NULL
199    mov     WORD [si+STRING_DIALOG_IO.wBufferSize], 17
200    mov     WORD [si+STRING_DIALOG_IO.fpReturnBuffer], g_szBuffer
201    mov     [si+STRING_DIALOG_IO.fpReturnBuffer+2], cs
202    CALL_MENU_LIBRARY GetStringWithIoInDSSI
203
204    mov     di, g_szBuffer
205    call    .ShowDialogWithStringInCSDI
206    stc
207    ret
208
209ALIGN JUMP_ALIGN
210.AskSelectionFromUser:
211    mov     si, g_dialogInputOutput
212    mov     WORD [si+DIALOG_INPUT.fszItems], .szSelections
213    CALL_MENU_LIBRARY GetSelectionToAXwithInputInDSSI
214
215    mov     di, g_szBuffer
216    call    .FormatWordFromAXtoStringBufferInCSDI
217    call    .ShowDialogWithStringInCSDI
218    stc
219    ret
220.szSelections:
221    db      "Cancel",LF
222    db      "Yes",LF
223    db      "No",NULL
224
225ALIGN JUMP_ALIGN
226.AskFileFromUser:
227    mov     si, g_dialogInputOutput
[50]228    mov     WORD [si+FILE_DIALOG_IO.fszItemBuffer], g_szBuffer
[41]229    mov     BYTE [si+FILE_DIALOG_IO.bDialogFlags], FLG_FILEDIALOG_DIRECTORY | FLG_FILEDIALOG_NEW | FLG_FILEDIALOG_DRIVES
230    mov     BYTE [si+FILE_DIALOG_IO.bFileAttributes], FLG_FILEATTR_DIRECTORY | FLG_FILEATTR_ARCHIVE
231    mov     WORD [si+FILE_DIALOG_IO.fpFileFilterString], .szAllFiles
232    mov     [si+FILE_DIALOG_IO.fpFileFilterString+2], cs
233    CALL_MENU_LIBRARY GetFileNameWithIoInDSSI
234    cmp     BYTE [g_dialogInputOutput+FILE_DIALOG_IO.bUserCancellation], TRUE
235    je      SHORT .FileSelectionCancelled
236
237    mov     di, g_dialogInputOutput + FILE_DIALOG_IO.szFile
238    call    .ShowDialogWithStringInCSDI
239.FileSelectionCancelled:
240    stc
241    ret
242.szAllFiles:
243    db      "*.*",NULL
244
245
246ALIGN JUMP_ALIGN
247.FormatWordFromAXtoStringBufferInCSDI:
248    push    bp
249    push    di
250    mov     si, di
251    xchg    cx, ax
252    CALL_DISPLAY_LIBRARY PushDisplayContext
253
254    mov     bx, cs
255    mov     ax, si
256    CALL_DISPLAY_LIBRARY SetCharacterPointerFromBXAX
[45]257    mov     bl, ATTRIBUTES_NOT_USED
[41]258    mov     ax, BUFFER_OUTPUT_WITH_CHAR_ONLY
[45]259    CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
[41]260    lea     ax, [si+STRING_BUFFER_SIZE]
261    CALL_DISPLAY_LIBRARY SetCharacterOutputParameterFromAX
262
263    mov     si, .szFormatWord
264    mov     bp, sp
265    push    cx
266    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
267    mov     al, NULL
268    CALL_DISPLAY_LIBRARY PrintCharacterFromAL   ; Terminate buffer with NULL
269
270    CALL_DISPLAY_LIBRARY PopDisplayContext
271    pop     di
272    pop     bp
273    ret
274.szFormatWord:
275    db      "Integer %d selected!",NULL
276
277
278ALIGN JUMP_ALIGN
279.ShowDialogWithStringInCSDI:
280    push    cs
281    pop     ds
282    mov     si, g_dialogInputOutput
283    mov     WORD [si+DIALOG_INPUT.fszItems], di
284    CALL_MENU_LIBRARY DisplayMessageWithInputInDSSI
285    stc
286    ret
287
288
289ALIGN JUMP_ALIGN
290.TestProgressBar:
291    push    cs
292    pop     ds
293    mov     si, g_dialogInputOutput
294    mov     WORD [si+PROGRESS_DIALOG_IO.wCurrentProgressValue], 0
295    mov     WORD [si+PROGRESS_DIALOG_IO.wMaxProgressValue], 500
296    mov     WORD [si+PROGRESS_DIALOG_IO.wMinProgressValue], 0
297    mov     WORD [si+PROGRESS_DIALOG_IO.fnTaskWithParamInDSSI], .ProgressTaskWithParamInDSSI
298    mov     ax, 500         ; Counter for progress task
299    CALL_MENU_LIBRARY StartProgressTaskWithIoInDSSIandParamInDXAX
300    stc
301    ret
302
303ALIGN JUMP_ALIGN
304.ProgressTaskWithParamInDSSI:
305    mov     ax, 50000                   ; 50 millisec delay
306    call    Delay_MicrosecondsFromAX
307    dec     si
308    CALL_MENU_LIBRARY SetUserDataFromDSSI
309    mov     ax, 500
310    sub     ax, si
311    push    si
312    CALL_MENU_LIBRARY SetProgressValueFromAX
313    pop     si
314    test    si, si
315    jnz     .ProgressTaskWithParamInDSSI
316    ret
317   
318   
319
320ALIGN WORD_ALIGN
321.rgfnMenuEvents:
[58]322    dw      .InitializeMenu         ; .InitializeMenuinitToDSSI
323    dw      .ExitMenuByMenuLibrary  ; .ExitMenu
324    dw      .NotHandled             ; .IdleProcessing
325    dw      .NotHandled             ; .ItemHighlightedFromCX
326    dw      .ItemSelectedFromCX     ; .ItemSelectedFromCX
327    dw      .NotHandled             ; .KeyStrokeInDX
328    dw      .RefreshTitle           ; .RefreshTitle
329    dw      .RefreshInformation     ; .RefreshInformation
330    dw      .RefreshItemFromCX      ; .RefreshItemFromCX
[41]331
332.rgszItems:
333    dw      .szExitMenu
334    dw      .szToggleTitle
335    dw      .szToggleInfo
336    dw      .szShowMessage
337    dw      .szAskWord
338    dw      .szAskString
339    dw      .szAskSelection
340    dw      .szAskFile
341    dw      .szTestProgress
342.szExitMenu:    db  "Exit menu",NULL
343.szToggleTitle: db  "Toggle title",NULL
344.szToggleInfo:  db  "Toggle information",NULL
345.szShowMessage: db  "Display unformatted message",NULL
346.szAskWord:     db  "Input word",NULL
347.szAskString:   db  "Input string",NULL
348.szAskSelection:db  "Display selection dialog",NULL
349.szAskFile:     db  "Display file dialog",NULL
350.szTestProgress:db  "Display progress bar",NULL
351TEST_MENU_VALID_ITEMS           EQU     9
352TEST_MENU_TITLE_LINES           EQU     2
353TEST_MENU_INFO_LINES            EQU     3
354
355
356
357;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
358ALIGN JUMP_ALIGN
359LibraryTests_ForKeyboardLibrary:
360    mov     ax, CURSOR_XY(0, 6)
361    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
362    call    ReadUnsignedDecimalInteger
363    call    ReadHexadecimalWord
364    ret
365
366
367ReadUnsignedDecimalInteger:
368    mov     si, .szEnterUnsignedWord
369    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
370    CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware    ; Move hardware cursor
371
372    mov     bx, 10          ; Numeric base
373    call    Keyboard_ReadUserInputtedWordWhilePrinting
374
375    mov     si, .szWordEntered
376    mov     bp, sp
377    push    ax
378    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
379    ret
380.szWordEntered:
381    db  ". Word entered: %u",LF,CR,NULL
382.szEnterUnsignedWord:
383    db  "Enter unsigned word: ",NULL
384
385
386ReadHexadecimalWord:
387    mov     si, .szEnterHexadecimalWord
388    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
389    CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware    ; Move hardware cursor
390
391    mov     bx, 16          ; Numeric base
392    call    Keyboard_ReadUserInputtedWordWhilePrinting
393
394    mov     si, .szWordEntered
395    mov     bp, sp
396    push    ax
397    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
398    ret
399.szWordEntered:
400    db  ". Word entered: %x",LF,CR,NULL
401.szEnterHexadecimalWord:
402    db  "Enter hexadecimal word: ",NULL
403
404
405
406;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
407ALIGN JUMP_ALIGN
408LibraryTests_ForDisplayLibrary:
409    CALL_DISPLAY_LIBRARY PushDisplayContext
410    call    PrintHorizontalRuler
411    call    PrintVerticalRuler
[44]412   
413    mov     al, COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
414    CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL
[41]415
416    mov     ax, CURSOR_XY(0, 1)
417    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
418    call    PrintFormattedStrings
419
420    CALL_DISPLAY_LIBRARY PopDisplayContext
421    ret
422
423
424PrintHorizontalRuler:
425    mov     ax, CURSOR_XY(0, 0)
426    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
427    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
428    eMOVZX  cx, al
429    mov     bx, 10<<8           ; Divider 10 to BH
430.ColumnNumberLoop:
431    eMOVZX  ax, bl              ; Column index to AX (0...79)
432    div     bh                  ; AH = 0...9, AL = attribute
433    mov     dx, ax
434    inc     ax                  ; Increment attribute for non-black foreground
435    CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL
436    xchg    ax, dx
437    mov     al, '0'
438    add     al, ah              ; AL = '0'...'9'
439    CALL_DISPLAY_LIBRARY PrintCharacterFromAL
440    inc     bx                  ; Increment column index
441    loop    .ColumnNumberLoop
442    ret
443
444
445PrintVerticalRuler:
446    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
447    eMOVZX  cx, ah              ; Number of rows to CX
448    dec     ax                  ; Last column
449    xor     ah, ah
450    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
451
452    dec     cx                  ; Decrement rows to print last row outside loop
453    mov     bx, 10<<8           ; BH = 10 (divider), BL = 0 (row index)
454    mov     si, .szVerticalRulerCharacter
455.RowNumberLoop:
456    call    .PrintRowNumberFromBL
457    inc     bx                  ; Increment row index
458    loop    .RowNumberLoop
459
460    ; Last row
461    mov     si, .szLastVerticalRulerCharacter
462.PrintRowNumberFromBL:
463    eMOVZX  ax, bl              ; Row index to AX (0...24)
464    div     bh                  ; AH = 0...9, AL = attribute
465    add     al, COLOR_GRAY      ; Start from color GRAY
466    mov     bp, sp              ; Prepare BP for string formatting
467    push    ax                  ; Push attribute
468    eMOVZX  ax, ah
469    push    ax                  ; Push row index
470    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
471    ret
472
473.szVerticalRulerCharacter:
474    db  "%A%u",LF,NULL
475.szLastVerticalRulerCharacter:
476    db  "%A%u",NULL
477
478
479PrintFormattedStrings:
480    call    .PrintIntegers
481    call    .PrintHexadecimals
482    call    .PrintCharacters
483    call    .PrintStrings
484    call    .RepeatChar
485    ret
486
487.PrintIntegers:
488    mov     si, .szIntegers
489    mov     bp, sp
490    ePUSH_T ax, COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLACK)
491    ePUSH_T ax, -32768
492    ePUSH_T ax, -1
493    ePUSH_T ax, 0
494    ePUSH_T ax, 1
495    ePUSH_T ax, 65535
496    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
497    ret
498.szIntegers:
[44]499    db  "Integers -32768, -1, 0, 1, 65535:          %A|%6-d|%6-d|%6-d|%6-d|%6-u|",LF,CR,NULL
[41]500
501.PrintHexadecimals:
502    mov     si, .szHexadecimals
503    mov     bp, sp
504    ePUSH_T ax, COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLACK)
505    ePUSH_T ax, 0CACAh
506    ePUSH_T ax, 0FFFFh
507    ePUSH_T ax, 0
508    ePUSH_T ax, 5A5Ah
509    ePUSH_T ax, 0A5A5h
510    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
511    ret
512.szHexadecimals:
[44]513    db  "Hexadecimals CACAh, FFFFh, 0, 5A5Ah, A5A5h:%A|%6-x|%6-x|%6-x|%6-x|%6-x|",LF,CR,NULL
[41]514
515.PrintCharacters:
516    mov     si, .szCharacters
517    mov     bp, sp
518    ePUSH_T ax, COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLACK)
519    ePUSH_T ax, 'a'
520    ePUSH_T ax, 'B'
521    ePUSH_T ax, 'c'
522    ePUSH_T ax, 'D'
523    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
524    ret
525.szCharacters:
526    db  "Characters a, B, c, D, percent:            %A|%6c|%6c|%6c|%6c|%6%|",LF,CR,NULL
527
528.PrintStrings:
529    mov     si, .szStrings
530    mov     bp, sp
531    ePUSH_T ax, COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLACK)
532    ePUSH_T ax, .szCSSI
533    ePUSH_T ax, .szFar
534    push    cs
535    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
536    ret
537.szStrings:
538    db  "Strings ",'"',"Hello CSSI",'"'," and ",'"',"Far",'"',":            %A|%20s|%13S|",LF,CR,NULL
539.szCSSI:
540    db  "Hello CSSI",NULL
541.szFar:
542    db  "Far",NULL
543   
544.RepeatChar:
545    mov     si, .szRepeat
546    mov     bp, sp
547    ePUSH_T ax, COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLACK)
548    ePUSH_T ax, '-'
549    ePUSH_T ax, 36
550    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
551    ret
552.szRepeat:
553    db  "Repeating character '-':                   %A%t",LF,CR,NULL
554
555
[45]556;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
557LibraryTests_Sort:
558    call    .PrintWords
559    push    cs
560    pop     ds
561    mov     si, .rgwItems
562    mov     dx, 7
563    mov     cx, 2
564    mov     bx, .Comparator
565    call    Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
566    call    .PrintWords
567    ret
568
569
570.Comparator:
571    push    ax
572    mov     ax, [si]
[46]573    DISPLAY_DEBUG_CHARACTER 'I'
574    DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY ax, 16
575    DISPLAY_DEBUG_CHARACTER ','
576    DISPLAY_DEBUG_WORD_AND_WAIT_ANY_KEY [es:di], 16
577    DISPLAY_DEBUG_CHARACTER ' '
[45]578    cmp     ax, [es:di]
579    pop     ax
580    ret
581
582.PrintWords:
583    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
584    mov     cx, 7
585    push    cs
586    pop     ds
587    mov     si, .rgwItems
[46]588    mov     bx, 16
[45]589.Loop:
590    lodsw
591    CALL_DISPLAY_LIBRARY PrintSignedWordFromAXWithBaseInBX
592    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
593    loop    .Loop
594    ret
595
596
597.rgwItems:
[46]598    dw      '['
599    dw      'n'
600    dw      '5'
601    dw      '.'
602    dw      ']'
603    dw      'a'
604    dw      'A'
[45]605
606
607
[41]608; Section containing initialized data
609;SECTION .data
610
611g_szDialogTitle:
612    db      "This is a generic title for all dialogs.",NULL
613g_szDialogInfo:
614    db      "This is a generic information for all dialogs.",NULL
615g_szVeryLongString:
616    db      "This is a very long string containing multiple lines of text. This is needed "
617    db      "so scroll bars and message dialog can be tested. This string does not use "
618    db      "formatting so it should be simple to display this correctly. This string "
[52]619    db      "does, however, use newline characters. Lets change line right now!",LF,CR,
[41]620    db      "Well did it work? Let's try line feed alone",LF,"Well? "
[52]621    db      "Now two LFs:",LF,LF,"What happened? "
[41]622    db      "We could also see what two spaces does _  _. There was two spaces between "
623    db      "underscores. Lets try three this time _   _. Well, did they work correctly? "
[52]624    db      "Too bad that LF, CR and BS (backspace) are the only supported control "
625    db      "characters. Others don't either work or they break line splitting. "
[41]626    db      "This is the last sentence of this long string!",NULL
627
628g_dialogInputOutput:
629istruc DIALOG_INPUT
630    at  DIALOG_INPUT.fszTitle,  dw  g_szDialogTitle
631    at  DIALOG_INPUT.fszInfo,   dw  g_szDialogInfo
632iend
633    times   20  db  0
634
635
636; Section containing uninitialized data
637SECTION .bss
638
639STRING_BUFFER_SIZE          EQU     100
640g_szBuffer:
Note: See TracBrowser for help on using the repository browser.