/[projet1]/public/pc/tools/osdk/main/Osdk/_final_/lib2/gpchar.s
Defence Force logotype

Contents of /public/pc/tools/osdk/main/Osdk/_final_/lib2/gpchar.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations)
Sun Aug 10 18:19:54 2014 UTC (5 years, 6 months ago) by dbug
File size: 1021 byte(s)


1 ;
2 ; input char from keyboard
3 ;
4 _getchar
5 jsr $023B
6 bpl _getchar ; loop until char available
7 tax
8 jsr $0238 ; echo char
9 lda #0
10 rts
11
12 ;
13 ; putchar(c)
14 ;
15 _putchar
16 ldy #0
17 lda (sp),y
18 putchar
19 cmp #$0A
20 bne putchar2
21 pha
22 ldx #$0D
23 jsr $0238
24 pla
25 putchar2
26 tax
27 jmp $0238
28
29
30 ;
31 ; puts(char *string)
32 ;
33 _puts
34 ldy #0
35 lda (sp),y
36 sta tmp
37 iny
38 lda (sp),y
39 sta tmp+1
40 ldy #0
41 putsloop
42 lda (tmp),y
43 beq endputs
44 jsr putchar
45 iny
46 bne putsloop
47 inc tmp+1
48 jmp putsloop
49 endputs
50 lda #$0A
51 jmp putchar
52
53 ;
54 ; gets(char buf[])
55 ;
56 _gets
57 ldy #0
58 lda (sp),y
59 sta tmp
60 iny
61 lda (sp),y
62 sta tmp+1
63 gets
64 ldy #0
65
66 getsloop
67 jsr $023B
68 cmp #$0D
69 beq endgets
70 cmp #$20
71 bcc getsloop
72 cmp #$7f
73 beq backspace
74 cpy #$ff
75 beq getsloop
76 sta (tmp),y
77 iny
78 echochar
79 tax
80 jsr $0238
81 jmp getsloop
82 backspace
83 cpy #0
84 beq getsloop
85 dey
86 jmp echochar
87 endgets
88 lda #$0A
89 jsr putchar
90 lda #0
91 sta (tmp),y
92 ldx tmp
93 lda tmp+1
94 rts

  ViewVC Help
Powered by ViewVC 1.1.26