[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Acos Msg file READER



>>Although I'm no expert, the best way to do it would to learn how ACOS
>>seperates messages, then convert that file to a TXT file and have METAL
>>sort through it like a text file...
>
>Heh... I did a little better. I found some assembly code that Josh did
>for a package for Metal 2.0d5, got it running under 1.09.03, and had
>that do it for me :), and then just added it to the smf. Pretty simple.
>
>The package is online on Tap if anyone wants it...

And the code is here if anyone wants it! :) I'm not sure if it works
or not as I haven't had time to test it.

! Future Vision v5.0d3
! *[ ACOS(tm) Message File Reader ]*
!
! Written by Joshua M. Thompson
! Copyright (c) 1990-93 by Joshua M. Thompson.  All rights reserved
! "ACOS" is a trademark of L&L Productions
 
 
link_sys
 gosub Cleanup:run "1/maintenance","main"
link_term
 gosub Cleanup:run "1/main","term0"
link_clear
 gosub Cleanup:run "1/startup","clear"
link_clock
 gosub Cleanup:run "1/main","TimeOut"
 
Cleanup
 close #4:return
 
CrashRecover
 goto link_sys
 
SetTraps
 trap modem=6 goto link_term
 trap syserr goto SystemCrash
 trap clock(1) goto link_clock
 trap clock(5) goto link_term
 return
 
! Header variables:
!
! (NOTE : A "block" in a message file is 128 bytes long)
!
! MSG(0) = # of bitmap blocks in this file
! MSG(1) = # of directory blocks in this file
! MSG(2) = Blocks in use
! MSG(3) = Messages in file
! MSG(4) = Value of last message in file
! MSG(5) = File position of beginning of bitmap
! MSG(6) = File position of beginning of directory
! MSG(7) = File position of beginning of data area
 
enter global
 gosub SetTraps
 gosub MsgFileUtils
 goto link_sys
 
MsgFileUtils
 hdr=temp+512
 gosub SetMsgFile:if msg$="" return
 clear vid
]menu
 ? "
\C_41
\C_8\IACOS Message File Utility\P\C_8
 
Current File : "msg$"
 
(1). Add a message              [n/a]
(2). Deallocate a message       [n/a]
(3). Remove a message           [n/a]
(4). Extract a message
(5). Info on a message
(6). Compact file               [n/a]
(7). Info on the current file
(8). Convert to SMF
(9). Set current file
 
(Q). Quit
\C_41
 
Selection [ 1-9, Q ]: ";
]loop
 get i$
 if i$=cr$ ? "<<":close #4:return
 if i$="Q" ? "Quit":close #4:return
 i=val(i$):if (i<1) or (i>9) goto ]loop
 on i gosub ]loop,]loop,]loop,ExtractMsg,InfoOnMsg,]loop, ->
            InfoOnMsgFile,ConvertToSMF,SetMsgFile
 goto ]menu
 
ExtractMsg
 gosub GetMsgNumber:if not msg return
]getNum
 input mode("U/") (cr"Enter output filename : ";) len(63) of$
 if of$="" return
 long if filesize(of$)
    ? cr"File exists...overwrite (Y/[N])? ";:get i$
    if i$<>"Y" ? "No":pop if:goto ]getNum:else ? "Yes"
 end if
 ? cr"** Extracting message...";
 ext #133,#4,msg,of$
 gosub ProdosError:goto PressReturn
 
InfoOnMsgFile
 ? cr"Message File Statistics:
 
Blocks in file bit-map....... "msg(0)"
Blocks in file directory..... "msg(1)"
Blocks currently in use...... "msg(2)"
Messages in this file........ "msg(3)"
Value of last message........ "msg(4)"
 
File position of bit-map..... "msg(5)"
File position of directory... "msg(6)"
File position of data area... "msg(7)
 goto PressReturn
 
InfoOnMsg
 gosub GetMsgNumber:if not msg return
 gosub GetDirEntry
 mark=msg(7)+((msg-1)*128)
 ? cr"Message #"msg" of "msg(3)"
 
    Starting block number : "start"
    Starting file address : "hexstr$(mark)"
 
Value of user field (dec) : "msgv"
Value of user field (hex) : "hexstr$(msgv)"
Value of user field (bin) : "bitstr$(msgv)
 goto PressReturn
 
ConvertToSMF
 input mode("U/") (cr"Enter output filename : ";) len(63) of$
 if of$="" return
 long if filesize(of$)
    ? cr"File exists...overwrite (Y/[N])? ";:get i$
    if i$<>"Y" ? "No":pop if:goto ConvertToSMF:else ? "Yes"
 end if
 ? cr"Preserve message values ([Y]/N)? ";:get i$
 if i$="N" ? "No":abcd=0:else ? "Yes":abcd=1
 ? cr"** Creating output file...";
 delete of$
 msg=3:f$=of$:x=msg(1)*32:smf_create(f$,x):smf_open(msg,f$):gosub
ProdosError
 ? "** Converting messages: [00000]";
 for bltn=1 to msg(3)
    ? "\^H\^H\^H\^H\^H\^H"right$("0000"+str$(bltn),5)"]";
    ext #133,#4,bltn,edd$
    open #1,edd$:append #1:? #1,null$;:close #1
    msgv=0
    if abcd pushvar msg:msg=bltn:gosub GetDirEntry:pullvar msg
    smf_allocate(msg,bltn,filesize(edd$)):smf_write(msg,bltn,edd$)
    smf_user(msg,bltn)=msgv
 next
 smf_close(msg)
 ? "\^H\^H\^H\^H\^H\^HDone!]"cr:goto PressReturn
 
SetMsgFile
 input mode("U/") (cr"Filename : ";) len(63) msg$
 if msg$="" return
 close #4
 long if filesize(msg$)=0
    ? cr"The specified file doesn't exist...create it ([Y]/N)? ";
    get i$
    if i$="N" ? "No":pop if:goto SetMsgFile
    ? "Yes"cr(2)" Enter maximum capacity : " len(5) x
    if (x<32) or (x>1024) x=256
    ? cr"Creating file...";
    x==/32
    delete msg$:create msg$,6:open #4,msg$
    mclear hdr to 0 for 8:mclear temp to 0 for 128
    pokebyte hdr,x:pokebyte hdr+1,x:bsave #4,hdr,8
    for y=1 to x*2
       bsave #4,temp,128
    next
    gosub ProdosError:close #4:pop if:goto SetMsgFile0
 end if
 open #4,msg$:bload #4,hdr,8
SetMsgFile0
 msg(0)=peekbyte(hdr):msg(1)=peekbyte(hdr+1)
 msg(2)=peekword(hdr+2):msg(3)=peekword(hdr+4):msg(4)=peekword(hdr+6)
 msg(5)=8:msg(6)=msg(5)+(msg(0)*128):msg(7)=msg(6)+(msg(1)*128)
 return
 
GetMsgNumber
 msg=0
 input mode("0") (cr"Enter message number [ 1-"msg(3)" ]: ";) i$
 if i$="" return
 x=val(i$):if (x<1) or (x>msg(3)) ? cr"Invalid message number.":else
msg=x
 return
 
! Returns the directory information on message number MSG.
! Exits with starting block number in START and value in MSGV
 
GetDirEntry
 filemark(4)=msg(6)+((msg-1)*4):bload #4,temp,4
 msgv=peekword(temp):start=peekword(temp+2)
 return
 
 
Here is the external that goes with it..I just re-compiled this, so I
don't
know if it works 100% :) Haven't had time to test it!
 
FiLeStArTfIlEsTaR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