12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- gets(s, z) {
- i;
- while(1) {
- if (i >= z-1)
- break;
- c = getc();
- if (c < 0 || c == '\n')
- break;
- s[i++] = c;
- }
- s[i] = 0;
- return s;
- }
- getc() {
- c;
- asm("in {c}");
- return c;
- }
- putc(c) {
- asm("out {c}");
- }
- putd(n) {
- asm("mov {n} Z");
- }
- puts(s) {
- for (i=0;s[i];i++)
- putc(s[i]);
- }
- nl() {
- putc('\n');
- }
|