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

Last change on this file since 52 was 52, checked in by aitotat, 14 years ago

Changes to Assembly Library:
Completely rewritten line splitting (slower but no need to modify string).
Some changes to string processing functions.
Saved few bytes from CGA detection.

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