gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/targets/z80/msxdos/bdos_gets.s
1 .include "global.s"
2
3 .title "gets"
4 .module gets
5
6 .area _CODE
7
8 _gets::
9 pop hl
10 pop de
11 push de
12 push hl
13 push de
14 ld c, #63 ; limit input to 64 bytes including trailing zero
15 ; that match with internal buffer in scanf()
16 1$:
17 push bc
18 push de
19 CALL_BDOS #_CONIN
20 pop de
21 pop bc
22 cp #0x0d ; CR
23 jp z, 2$
24 cp #0x05 ; EOF
25 jp z, 2$
26 ld (de), a
27 inc de
28 dec c
29 jp nz, 1$
30 2$:
31 xor a
32 ld (de), a
33 pop hl
34 ret
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.