Rev 1145 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6699 | clevermous | 1 | format PE console 0.8 |
836 | diamond | 2 | include 'proc32.inc' |
6699 | clevermous | 3 | include '../../../../import.inc' |
836 | diamond | 4 | |
5 | start: |
||
6699 | clevermous | 6 | invoke con_set_title, caption |
836 | diamond | 7 | |
8 | ; C-equivalent of the following code: |
||
9 | ; for (;;) |
||
10 | ; { |
||
11 | ; con_write_asciiz("Enter string (empty for exit): "); |
||
1145 | diamond | 12 | ; if (!con_gets(s,256)) break; |
836 | diamond | 13 | ; if (s[0] == '\n') break; |
14 | ; con_write_asciiz("You entered: "); |
||
15 | ; con_write_asciiz(s); |
||
16 | ; } |
||
17 | mainloop: |
||
18 | push str1 |
||
19 | call [con_write_asciiz] |
||
20 | push 256 |
||
21 | push s |
||
22 | call [con_gets] |
||
1145 | diamond | 23 | test eax, eax |
24 | jz done |
||
836 | diamond | 25 | cmp [s], 10 |
26 | jz done |
||
27 | push str2 |
||
28 | call [con_write_asciiz] |
||
29 | push s |
||
30 | call [con_write_asciiz] |
||
31 | jmp mainloop |
||
32 | done: |
||
33 | push 1 |
||
34 | call [con_exit] |
||
35 | exit: |
||
36 | xor eax, eax |
||
37 | ret |
||
38 | |||
6699 | clevermous | 39 | |
836 | diamond | 40 | align 4 |
6699 | clevermous | 41 | data import |
42 | library console, 'console.dll' |
||
43 | import console, \ |
||
44 | con_set_title, 'con_set_title', \ |
||
45 | con_write_asciiz, 'con_write_asciiz', \ |
||
46 | con_exit, 'con_exit', \ |
||
47 | con_gets, 'con_gets' |
||
48 | end data |
||
836 | diamond | 49 | |
50 | caption db 'Console test - gets()',0 |
||
51 | str1 db 'Enter string (empty for exit): ',0 |
||
52 | str2 db 'You entered: ',0 |
||
53 | |||
54 | s rb 256 |