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

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

Changes to Assembly Library:
Added functions to clear Menu Title and Information areas.
Implemented automatic line change when writing Menu Title and Information areas.
CGA snow related functions have been moved to CgaSnow.asm.
Keyboard input functions no longer produce beep for backspace.

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