source: buchla-68k/alcyon/getc.s@ ca867c1

Last change on this file since ca867c1 was 7bf3856, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added Alcyon C reference output.

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[7bf3856]1.globl _Cbuffs
2.globl _Stdbufs
3.globl _Stdbuf
4.globl _getc
5.text
6_getc:
7~~getc:
8~ptr=R13
9link R14,#0
10movem.l R6-R7/R13-R13,-(sp)
11~len=R7
12*line 17
13move.l 8(R14),R13
14*line 17
15*line 17
16move.l (R13),R0
17cmp.l 4(R13),R0
18blo L2
19*line 18
20*line 19
21*line 20
22btst #3,12(R13)
23beq L3
24*line 20
25move #-1,R0
26bra L1
27*line 21
28L3:
29*line 22
30and.b #-5,12(R13)
31*line 23
32*line 24
33*line 25
34tst.l 8(R13)
35bne L4
36*line 25
37move.l R13,(sp)
38jsr _getbuff
39*line 26
40L4:
41*line 27
42*line 27
43move 16(R13),(sp)
44move.l 8(R13),-(sp)
45move.b 13(R13),R0
46ext.w R0
47move R0,-(sp)
48jsr _read
49addq.l #6,sp
50move R0,R7
51bgt L5
52*line 28
53*line 29
54tst R7
55bne L10000
56move #8,R0
57bra L10002
58L10000:move #16,R0
59L10002:move.b 12(R13),R1
60or.b R0,R1
61move.b R1,12(R13)
62*line 30
63move #-1,R0
64bra L1
65*line 31
66*line 32
67L5:
68*line 33
69move R7,R0
70ext.l R0
71move.l 8(R13),R1
72move.l R1,(R13)
73add.l R1,R0
74move.l R0,4(R13)
75*line 34
76*line 35
77L2:
78*line 36
79move.l (R13),R8
80move.b (R8),R0
81ext.w R0
82and #255,R0
83add.l #1,(R13)
84bra L1
85L1:tst.l (sp)+
86movem.l (sp)+,R7-R7/R13-R13
87unlk R14
88rts
89.data
Note: See TracBrowser for help on using the repository browser.