Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > import of .txt files KickAss
2013-11-05 19:49
Dr.Science

Registered: Oct 2011
Posts: 41
import of .txt files KickAss

Hi there. Just trying with CrossDev, and I run into a Problem...
Let's say I have a "file.txt" which is a file with some text like this:

Hello Everybody
I am a Little text...

Here Ends the text

No line is >40 chars (to fit C64 Screen). When I Import the file with
.import text "text.txt"

All SPACES and ENTERS are gone. How do I Import a file correctly with KICKASSEMBLER so that it fits the C64 Screen?
Thanks in advance....
2013-11-05 22:11
Slammer

Registered: Feb 2004
Posts: 416
The text import was made for doing scroll texts so it doesn't format the input for a 40x25 screen. Im surprised that your spaces are gone. It worked fine for me like in the scroll text for these productions:

Kick Assembler Easter Egg
GOLC

If you have to import many screens you could implement a macro that does it (Import a binary file and format the output so it suits your needs.)
2013-11-06 11:09
Dr.Science

Registered: Oct 2011
Posts: 41
Sorry - you're right, the SPACES are not gone. It is just, I have not SPACES in each row to fill up to 40chars.

This works:
01234567890123456789012345678901234567890
This is a short text...SPACESPACESPACESPA (<--filled up with SPACE)

This fails:
01234567890123456789012345678901234567890
This is a short text...

Ofcourse it fails, because it has no spaces at the end of the text. (now I see it!)
As I have a LOT of text and screens, I need something automatic. How do all those MAG-EDITORs out there convert their text? Or the guys writing DOCS for games? Any hint?
thanks
2013-11-06 16:42
Cresh

Registered: Jan 2004
Posts: 354
Maybe it has something to do with .txt file encoding?
2013-11-06 18:55
Cruzer

Registered: Dec 2001
Posts: 1048
Do a KickAss script that inserts the missing spaces, or even better, a c64 routine that does it when displaying the text, so it doesn't fill up unnecessarily.
2013-11-06 18:58
chatGPZ

Registered: Dec 2001
Posts: 11386
i'd just use petscii for the text in memory, no need to keep these trailing spaces anywhere, what a waste :)
2013-11-07 07:34
Total Chaos

Registered: Mar 2006
Posts: 74
..well, you could also manipulate the original file, if you run Linux (or unix) AWK is your friend :)

awk '{printf "%-40s\n",$0}' infile.txt > outfile.txt

%-40 = up to column 40 (so it might need to be 39 ;)
\n adds a trailing linebreak
$0 is what char to pad the line with ($0 being space)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
MWR/Visdom
Guests online: 102
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.041 sec.