Augment tinyjpeg so that we can decode straight into the buffer;
[syslinux.git] / strecpy.inc
blob1fc53e966deb56ab848a8fc91c9e7f9e5ed8d77c
2 ; strecpy: Copy DS:SI -> ES:DI up to and including a null byte;
3 ;          on exit SI and DI point to the byte *after* the null byte.
4 ;          BP holds a pointer to the first byte beyond the end of the
5 ;          target buffer; return with CF=1 if target buffer overflows;
6 ;          the output is still zero-terminated.
8                 section .text
10 strecpy:
11                 push ax
12                 push bp
13                 dec bp
14                 dec bp
15 .loop:          lodsb
16                 stosb
17                 and al,al       ; CF=0
18                 jz .done
19                 cmp bp,di       ; CF set if BP < DI
20                 jnc .loop
22                 ; Zero-terminate overflow string
23                 mov al,0        ; Avoid changing flags
24                 stosb
25 .done:
26                 pop bp
27                 pop ax
28                 ret