| |
Angel of Death
Registered: Apr 2008 Posts: 211 |
ascii to petscii quick and dirty
Was looking for a nifty little program to convert an ascii text into petscii and save me an hour or so of retyping a text.
Couldn't get petcat to do what i wanted and furthermore ran into this : ASCII <--> PETSCII Converter for Windows.
After a nice LOL I decided to cook up some quick'n dirty routine myself.
* = $1000
start
lda #$0e
jsr $e536
lda #14
jsr $ffd2
ldx #$00
-
lda text,x
jsr convert
sta $0400,x
inx
cpx #(ndtext-text)
bne -
loop
inc $07e7
jmp loop
convert
sta temp
lda #%00100000
bit temp
bvc nobit6
beq nobit5
lda temp
and #%10011111
rts
nobit5
nobit6
lda temp
rts
temp
.byte $00
text
.text "This is a test text."
ndtext
Also not much to look at but by running the text through this an hour of re-typing became 5 minutes of editing.
Do your worst with it...
|
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
and petcat wouldnt do it ... how? |
| |
Angel of Death
Registered: Apr 2008 Posts: 211 |
Probably didn't do it right.
used command line : petcat -text -o text.prg -- text.txt (and without the -text arg)
it worked so far that it converted the file, got the CR's and the LF's right but mixed up the letters with capitals.
And just what I said. I couldn't get it to do what I wanted. Stopped trying when I got a spark of brightness how to do it in MC.
But if you can tell me what I did wrong then using petcat will be even quicker. (lazy bastard that is me :) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
$ echo "abcABC" > test.txt
$ petcat -text -o text.prg -- test.txt
$ hex text.prg
0000 41 42 43 61 62 63 0a ABCabc.
$ hex test.txt
0000 61 62 63 41 42 43 0a abcABC.
works exactly like it should? *shrug* |
| |
Angel of Death
Registered: Apr 2008 Posts: 211 |
That was indeed the result I got. But I was looking for:
0000 01 02 03 41 42 43 abcABC
And now I know where I took the wrong turn.
I wasn't looking for Petscii but for screencodes I could 'poke' directly into screenmem. That is something completely different. (duh)
Thanks for clearing that up!
(hmmm maybe an idea for another tool)
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
:) indeed. it would also be something petcat could/should support. but considering how extremely ugly the petcat code is..... someone else can look at it =P |
| |
WVL
Registered: Mar 2002 Posts: 902 |
btw, since it seems that you're using 64tass, you can also do it this way :
.enc screen ;set text encoding to screencodes
.text "blablabla" ;<- just your text
.enc none ;back to normal encoding scheme
I hope you don't get a FFFFUUUUU-moment now :) Nowadays the first line of code in almost all of my sourcecodes is .enc screen ;) |
| |
Angel of Death
Registered: Apr 2008 Posts: 211 |
@WVL I know that but I wanted to feed it into a c64 native wordprocessor I always use. (and coded)
If it was just to include in a piece of code I would have used the .enc pseudo-op.
@groepaz *nods* then don't touch it! :)
btw. Thanks everyone for the fast reply... |