Jump to content
IGNORED

Another converting files into data for assembler thread...


Recommended Posts

I use MAC/65 Assembler on the Atari.

 

This time I have a GR.7 screen from MAD Studio, it supplies the data file and the BASIC source code to load this which works fine:

 

10 GRAPHICS 7+16
20 CLOSE #1
30 OPEN #1,4,0,"H1:SCREEN01.GR7"
40 SCR=PEEK(88)+PEEK(89)*256
50 FOR I=0 TO 3839
60 GET #1,BYTE
70 POKE SCR+I,BYTE
80 NEXT I

...

 

MAC/65 will not import (enter) the SCREEN01.GR7 file, tried various modes, also tried converting end of line using Memopad. Sounds like it goes through the motions but nothing, or truncated record if EOL changed - guess as one big block of data.

 

For a long winded workaround, I loaded the file in BASIC, did a Binary Save from DOS, and then I have someone else's BASIC utilis that convert this to a string and then to data statements -or - I could use my Byte Buster Utility

 

I did also try a BLOAD in MAC/65 which brings the data in ok, but this is only from the command prompt (not part of the assemble)

 

Is there another file conversion utility?

or

I did ponder if it was possible to load a dummy data file into assember, then bload the screen01.gr7 somewhere else in RAM and then write a program to copy the bytes over the existing data statements - then I could save the file?

or

some other (better) way of doing this e.g. in BASIC?

 

Hope this makes sense :-o

Thanks :)

  • Like 2
Link to comment
Share on other sites

Raw data can't be imported into Mac-65 so easily.

 

Another possibility is you could just alter the Basic program to generate source code with .BYTE directives.

 

Mac-65 can live without line numbers so you don't need to worry there.

You could even give the program some intelligence - .BYTE with quoted text can handle most byte codes except $9B which is Return.

To get such codes you just close off the quote then put ,$9B in the output.

 

Alternately you could do .DBYTE which is less efficient than Ascii strings but more efficient than single bytes.

 

Or you could generate a binary load file but the disadvantage there is that it becomes fixed location.

Link to comment
Share on other sites

Here's a program I got off a web site. It's an analog program to convert a data file into basic DATA statements. Should be easy enough to fix to turn the data into .BYTE statements instead. Works with either a plain data file or a binary loadfile. I patched it up to work with Basic XE, but there's nothing special about, so it should be easy enough to turn back into normal Basic.

BOFFO.bas

  • Like 3
Link to comment
Share on other sites

Here's a program I got off a web site. It's an analog program to convert a data file into basic DATA statements. Should be easy enough to fix to turn the data into .BYTE statements instead. Works with either a plain data file or a binary loadfile. I patched it up to work with Basic XE, but there's nothing special about, so it should be easy enough to turn back into normal Basic.

Thanks but!... after changing the EndOfLine chars with Memopad this (listed) copy also has lowercase text so won't import, I did try pasting the text into altirra which gets around this but there are other spurious characters giving errors - I'm guessing it's been reformatted on a PC editor perhaps (or BASIC/XE did it?)

 

Has anyone got another copy of BOFFO, it's on Analog Disk #24 (not findable!)? Don't make me type it in!

 

 

Also looking for other data manipulation programs from the past if anyone has any - I guess each programmer had a bunch of their own stashed away.

Link to comment
Share on other sites

10 TRAP 40000:? "}ASSEMBLY-TO-BASIC DATA CONVERTOR":? "By Tom Hudson, ANALOG Computing"
20 DIM FILE$(15),FI$(17),D$(1),HX$(16),DH$(1),CK$(1),OD$(1),ODMSG$(6):HX$="0123456789ABCDEF"
30 POSITION 2,5:? "œœ  ÏBJ/ÄATA file";:INPUT OD$:IF OD$="O" THEN ODMSG$="OBJECT":GOTO 60
40 IF OD$<>"D" THEN 30
50 ODMSG$="  DATA"
60 POSITION 2,7:? "œœ";ODMSG$;" filename";:INPUT FILE$:TRAP 120:IF LEN(FILE$)=1 THEN 90
70 IF FILE$(2,2)=":" THEN FI$=FILE$:GOTO 100
80 IF FILE$(3,3)=":" THEN FI$=FILE$:GOTO 100
90 FI$="D:":FI$(3)=FILE$
100 OPEN #1,4,0,FI$:IF OD$="O" THEN GET #1,BYTE:GET #1,BYTE2:IF BYTE<>255 OR BYTE2<>255 THEN 130
110 GOTO 150
120 ? FILE$;" INVALID FILE,";:GOTO 140
130 ? FILE$;" NOT OBJ FILE,";
140 ? " PRESS ÒÅÔÕÒÎ";:INPUT D$:CLOSE #1:GOTO 60
150 POSITION 2,9:? "œœ BASIC filename";:INPUT FILE$
160 TRAP 200:IF FILE$(2,2)=":" THEN FI$=FILE$:GOTO 190
170 IF FILE$(3,3)=":" THEN FI$=FILE$:GOTO 190
180 FI$="D:":FI$(3)=FILE$
190 OPEN #2,8,0,FI$:GOTO 210
200 ? FILE$;" INVALID FILE, PRESS ÒÅÔÕÒÎ";:INPUT D$:CLOSE #2:GOTO 150
210 POSITION 2,11:? "œœStarting lineno";:TRAP 210:INPUT LINE:TOTAL=0
220 POSITION 2,13:? "œœ Line increment";:TRAP 220:INPUT INC
230 POSITION 2,15:? "œœ    Äecimal/Èex";:INPUT DH$:IF DH$<>"D" AND DH$<>"H" THEN 230
240 POSITION 2,17:? "œœ Bytes per line";:TRAP 240:INPUT BLIN
250 POSITION 2,19:? "œœ Checksum (Y/N)";:INPUT CK$:IF CK$<>"Y" AND CK$<>"N" THEN 250
260 COUNT=0:TRAP 420
270 IF OD$="D" THEN LA=0:HA=65535:TOTLEN=65536:TLC=-1:GOTO 310
280 GET #1,LO1:GET #1,HI1:GET #1,LO2:GET #1,HI2:LA=LO1+HI1*256:HA=LO2+HI2*256:TOTLEN=HA-LA+1:TLC=-1
290 IF HA=737 AND LA=736 THEN 420
300 IF COUNT>0 AND LA<>LL+1 THEN ? "}ýÅÒÒÏÒ¡¡¡ MEMORY NOT CONTIGUOUS!":END 
310 LL=HA:IF TOTAL>0 THEN 330
320 X=-999
330 TLC=TLC+1:IF TLC=TOTLEN THEN 270
340 GET #1,BYTE:TOTAL=TOTAL+1:COUNT=COUNT+1:GNDTOT=GNDTOT+BYTE:IF CK$="Y" AND GNDTOT>999 THEN GNDTOT=GNDTOT-1000
350 IF X=-999 THEN ? #2;LINE;" DATA ";:LINE=LINE+INC:X=0
360 IF DH$="D" AND X>0 AND X<BLIN THEN ? #2;",";
370 X=X+1:IF DH$="H" THEN BH=INT(BYTE/16):BL=BYTE-(BH*16) #2;HX$(BH+1,BH+1);HX$(BL+1,BL+1);:GOTO 390
380 ? #2;BYTE;
390 IF X<BLIN THEN 330
400 IF CK$="N" THEN ? #2:GOTO 320
410 ? #2;",";GNDTOT:GOTO 320
420 IF PEEK(195)<>136 AND PEEK(195)<>0 THEN ? "}ýABNORMAL TERMINATION (ERROR ";PEEK(195);")":END 
430 IF CK$="N" OR X=-999 THEN 490
440 IF DH$="D" THEN 470
450 ? #2;"00";:TOTAL=TOTAL+1:X=X+1:IF X<BLIN THEN 450
460 GOTO 480
470 ? #2;",0";:TOTAL=TOTAL+1:X=X+1:IF X<BLIN THEN 470
480 ? #2;",";GNDTOT
490 ? #2:? #2;LINE;" REM * ";TOTAL;" BYTES":CLOSE #1:CLOSE #2:END 

BOFFO.BAS

 

Listing for importing into Altirra or the BAS for direct use.

Edited by rdea6
  • Like 3
Link to comment
Share on other sites

:thumbsup:

OK, more or less getting there:

 

BOFFO.BAS file on the post above works... (the listing doesn't paste in as it has those spurious chars (which are inverse chars and control codes for text positioning).

 

... great for anyone using BASIC: tried it with both a DATA file (the MAD Studio graphics screen) and an OBJect file too.

 

BUT it generates lines of data with no spacing if you take the HEX option, so assembler users will need to select DECIMAL output which has the commer separated values, might try and tweak this ;-)

 

BOFFO was part of Tom Hudson's Assember Boot Camp.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...