commit 8ea9e65aab7aed5d3b92c7deb53bcceb2c3de2d5 Author: Kelvin Sherlock Date: Tue Sep 1 12:00:00 1998 -0400 1.0 diff --git a/ASoft.rez b/ASoft.rez new file mode 100644 index 0000000..f3d8d7e --- /dev/null +++ b/ASoft.rez @@ -0,0 +1,34 @@ +#include "types.rez" +#include "bfish.rez" + + + +resource rVersion(TrVersion) +{ + {1, 0, 0, release, 0}, + $0000, + "AppleSoft Translator", + "by Kelvin Sherlock\nCopyright 1998 Kelvin Sherlock" +}; +resource rComment(TrAbout) +{ + "AppleSoft BASIC BabelFish translator" +}; + +resource rTrData(TrData) +{ + bf320+bf640, + bfCanImport, + {1,0,0,0,0,0,0,0}, + 0, + {0,0,0,0,0,0,0,0} +}; + +read rCodeResource(TrFilter, locked, convert) "Filter"; +read rCodeResource(TrInit, locked, convert) "Init"; + +resource rText(TrImportInfo) +{ + "Import AppleSoft BASIC files.\n\n" + "by Kelvin W. Sherlock." +}; diff --git a/bfish.equ b/bfish.equ new file mode 100644 index 0000000..9697f9a --- /dev/null +++ b/bfish.equ @@ -0,0 +1,43 @@ +offset_ParmCount gequ $00 +offset_Status gequ $02 +offset_MiscFlags gequ $04 +offset_DataKinds gequ $06 +offset_TransNum gequ $0e +offset_UserID gequ $10 +offset_ProgressAction gequ $12 +offset_FullTherm gequ $14 +offset_CurrentTherm gequ $16 +offset_MsgPtr gequ $18 +offset_DataRecordPtr gequ $1c +offset_FilePathPtr gequ $20 +offset_FileNamePtr gequ $24 + + +offset_Text_ActionCode gequ $02 +offset_Text_Length gequ $06 +offset_Text_Ptr gequ $0A +offset_Text_Hnd gequ $0E +offset_Text_FamilyID gequ $12 +offset_Text_FontSize gequ $14 +offset_Text_FontStyle gequ $16 +offset_Text_ForeColor gequ $18 +offset_Text_BackColor gequ $1A + +TrStartUp gequ $9101 +TrShutDown gequ $9102 +TrRead gequ $9103 + + +BFProgress gequ $9018 + + + +bffText gequ 1 + +bfContinue gequ 0 +bfDone gequ $8000 +bfUserAbort gequ $8001 +bfBadFileErr gequ $8002 +bfReadErr gequ $8003 +bfWriteErr gequ $8004 +bfMemErr gequ $8005 diff --git a/bfish.rez b/bfish.rez new file mode 100644 index 0000000..b761298 --- /dev/null +++ b/bfish.rez @@ -0,0 +1,44 @@ +#define rTrData $5472 + +// Flags +#define bf320 $0001 +#define bf640 $0002 +#define bfCanImport $0001 +#define bfCanExport $0001 +#define bfImportOptions $0002 +#define bfExportOptions $0002 + +// DataKinds +#define bffNoData $00 +#define bggText $01 + +//Translator IDs +#define TrVersion $0001 //rVersion +#define TrAbout $0001 //rComment +#define TrCantLauch $0002 + +#define TrData $0001 //rTrData + +#define TrInit $0001 //rCodeResource +#define TrImportOptions $0002 //rCodeResource +#define TrExportOptions $0003 +#define TrFilter $0004 + +#define TrImportInfo $0002 //rText +#define TrExportInfo $0003 //rText + +type rTrData +{ + _mybase_ integer = 0; //revision + _mybase_ integer; //general flags + _mybase_ integer; //Import Flags + array[8] + { + hex byte; //Import Kinds + }; + _mybase_ integer; //Export Flags + array[8] + { + hex byte; //Export Kinds + }; +}; diff --git a/filter.asm b/filter.asm new file mode 100644 index 0000000..78b396c --- /dev/null +++ b/filter.asm @@ -0,0 +1,103 @@ + +; +; BabelFish AppleSoft Translator +; +; by Kelvin W Sherlock September 1998 +; +; + +offset_fType gequ 16 +offset_eof gequ 18 +offset_aType gequ 44 + +BAS_FTYPE gequ $FC +BAS_ATYPE gequ $0801 + +; SFFilter +; +; in stack: +; +; (3) |rtl +; |---- +; (4) |DirEntryRecPtr +; |---- +; (2) |returnval +; |---- +; |......... + +; out stack: +; +; |returnval +; |---- +; |......... + + +; +; Returns 0 if it's not an Applesoft File, or 4 if it is. +; + +SFFilter START + +_d equ 1 +_rtlb equ 3 +DirPtr equ 7 +retval equ 11 + + phb ;even up the stack + phd + tsc + tcd + + stz 2 :-) +; + dey + dey + lda [Ptr +; + + ldy #2 + lda [OutPtr],y + tax + lda [OutPtr] + + stax $7f, is a token, +; byte 0 - eol + +CalcLength START + +_d equ 1 +size equ 3 +_rts equ 7 +Ptr equ 9 + + + pha + pha + phd + tsc + tcd + + stz destination, NOT including the NULL char +; +CopyT START + +_d equ 1 +_rts equ 3 +dest equ 5 +src equ 9 + + phd + tsc + tcd + + ldy #0 + + short m + +loop lda [src],y + beq done + sta [dest],y + iny + bra loop + +done anop + long m + tya + pld + rts + + END + + +; +; Tack 4 0 bytes to the end of a ptr +; a = length of the ptr +; stack (4 bytes) = ptr itself. +Append0 START + +_d equ 1 +_rts equ 3 +Ptr equ 5 + + + tax ;;save + + phd + tsc + tcd + + txa ;;restore + + + clc + adc "), +/* $D0 */ + LIST(" = "), + LIST(" < "), + LIST(" SGN "), + LIST(" INT "), + LIST(" ABS "), + LIST(" USR "), + LIST(" FRE "), + LIST(" SCRN( "), + LIST(" PDL "), + LIST(" POS "), + LIST(" SQR "), + LIST(" RND "), + LIST(" LOG "), + LIST(" EXP "), + LIST(" COS "), + LIST(" SIN "), +/* $E0 */ + LIST(" TAN "), + LIST(" ATN "), + LIST(" PEEK "), + LIST(" LEN "), + LIST(" STR$ "), + LIST(" VAL "), + LIST(" ASC "), + LIST(" CHR$ "), + LIST(" LEFT$ "), + LIST(" RIGHT$ "), + LIST(" MID$ "), +/* $EB */ + LIST(" ???? "), /* these aren't used by AppleSoft */ + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), + LIST(" ???? "), +};