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

Last change on this file since 504 was 376, checked in by gregli@…, 13 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

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