; txt.z80 - convert text file to executable program ; Derived from Eric Gans' update to txt.z80 Version 50 ; Revisor/Date/Version Lee Bradley/3 Aug 90/Version 52 ; eliminated bios call, adjusted stacks sizes, eliminated a few labels, etc. ; changed bdos call 1 to call 6. fixed the way the dots ... work. Thanks go ; to Howard Goldstein for these improvements! newst equ 180h org 100h ld (oldst),sp ld sp,newst ld hl,newst ; b=0,c=2 (reg b tracks cr's, reg c used in bdos conout call later) ld bc,2 loop: push hl ld a,(hl) cp 26 jr z,exit res 7,a ; kill hi bit cp '~' ; force page break jr z,page cp 13 ; count cr's jr nz,conout inc b ld a,b cp 23 ld a,13 ; get back cr jr c,conout ; line >= 23 page: ld c,9 ld de,dots ; ... call 5 getkey: ld c,6 ; get key via direct console i/o ld e,0ffh ; get (not put) call 5 or a jr z,getkey ; loop til char received cp 3 ; ^C to exit jr z,exit ld c,9 ld de,bksps call 5 ; back up to line beginning ; b=0,c=2 (re-initialize cr ctr and re-load reg c with conout code) ld bc,2 pop hl inc hl ; get past lf inc hl jr loop conout: push bc ld e,a ; reg c has a 2 in it already (conout) call 5 pop bc pop hl inc hl jr loop exit: ld sp,(oldst) ret dots: db 13,10,' ... ','$' bksps: db 8,8,8,8,8,'$' oldst: ds 2 ; save area for ccp sp db 'Smaller''s Better' ; don't make this any longer! end