Retro Game & PC/매뉴얼 팁 작업

C64 convert basic code to text

smores 2015. 2. 19. 06:59

http://www.lemon64.com/forum/viewtopic.php?t=43151&sid=9684971ee85fe0ec905c762723cf4f3e


his is what I do, load my basic program, then after it loads, I type: 

Code:

OPEN 1, 8, 2, "0:filename, S, W" : CMD1 : LIST 
PRINT#1 : CLOSE 1 


This will save a text version of the file as "filename" in your d64, then I use DirMaster to drag the text file out of the d64 image onto my desktop (or wherever), DM is located here: 




위의 방법을 VICE 에서 테스트하니 잘 된다. 헌데 MESS에선 안됨. DEVICE NOT READ 에러인가 뭔가 나옴. CCS도 실패.


D64 이미지 안의 파일을 윈도우즈로 추출해 내기 위해 잘 알려진 툴로는 DirMaster가 있는데 예전에 소개한 바 있다. 그 당시에는 Virtualbox WinXP 에서 잘 되었었는데 다시 해보니 무슨 에러가... 대신 도스용 64COPY (Norton Commander 비슷함) 사용해서 파일을 D64 이미지에 넣고 뺄 수 있다. 그 외에 GUI에서 쓰고 싶으면 DismImagery64라는 윈도우 프로그램도 있다. 역시 Virtualbox XP 에서 테스트 해 보았고 잘 됨을 확인. 그래서 이 글에는 DirMaster 대신 사용할 만한 D64 툴들 및 blank image (실제로는 베이식 연습 파일 몇개 들어 있음) 를 첨부해 놓는다.


한편 위의 방법으로 추출해 낸 텍스트 파일의 경우 C64 내에서의 소스에서는 라인피드를 0xd 를 쓰는 것 같은데 이것이 PC에서는 줄넘김이 되질 않는다. 그래서 다음과 같은 간단한 C++ 코드로 컨버전을 해 줄수 있다.


#include <iostream>

#include <string>

#include <cstdio>

using namespace std;


void main()

{

  FILE *fin,*fout;

  string filename;

  cout << "input file name: ";

  cin >> filename;


  fin = fopen(filename.c_str(),"rb");

  fout = fopen((filename+".txt").c_str(),"wt");

  while(1)

  {

    unsigned char c;

    c = fgetc(fin);

    if (feof(fin)) break;

    if (c!=0xd)

      fputc(c,fout);

    else

      fprintf(fout,"\n");

  }


  fclose(fin);

  fclose(fout);

}


--------------------------------------------

첨부 파일들

--------------------------------------------


0d.cpp


0d.exe


64cpy203-dos.zip


blank.d64


DiskImagery64-0.7-1(XP).exe