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

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

Changes to Assembly Library:

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