English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 01 March 2021, 11:29   #1
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Blitz Basic to ASCII converter

Sorry if this is the wrong place to post this...

I made a Blitz Basic to ASCII converter in C. I know there are some already but none seemed to meet my requirements of being simple and portable. This code should compile for any OS, it only uses C standard libraries.

https://github.com/kuro68k/bb2ascii

With thanks to Richard Dare for the list of tokens I borrowed for this project from his GPL code.

If you want a binary there is a Windows release at the link above, otherwise you can build it for your OS using GCC or probably any reasonably modern compiler.
zero is offline  
Old 01 March 2021, 21:54   #2
clenched
Registered User
 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
C:\bb2>main quikasm.bb2 q.txt
Code:
Unknown token: 0xBE10
Unknown token: 0xBE10
Unknown token: 0x8026*
Unknown token: 0x8026*
Unknown token: 0x80CD
Unknown token: 0x80CE
Unknown token: 0x80CE
Unknown token: 0x80CE
Unknown token: 0x80CE
Unknown token: 0xFFFF
* When saving in Blitz:
0x8026 is the token for Ds but it is omitted in the tokens.h file. Probably more.
The case differs Shared SHARED. Other stuff.
Still does a good job to get a quick overview of the bulk of program.
Full comparison q.txt (yours) QA.TXT (Blitz ASCII)

Code:
Comparing files C:\BB2\q.txt and C:\BB2\QA.TXT
***** C:\BB2\q.txt
Statement putcurr{c}
Shared lines()
Poke.l lines(0)-40,c
***** C:\BB2\QA.TXT
Statement putcurr{c}
SHARED lines()
Poke.l lines(0)-40,c
*****

***** C:\BB2\q.txt
Function getcurr{}
Shared lines()
Function Return Peek.l(lines(0)-40)
***** C:\BB2\QA.TXT
Function getcurr{}
SHARED lines()
Function Return Peek.l(lines(0)-40)
*****

***** C:\BB2\q.txt
          loaddone
          Free  0:WindowInput 0
          If dcp Then Gosub refall
***** C:\BB2\QA.TXT
          loaddone
          Free File 0:WindowInput 0
          If dcp Then Gosub refall
*****

***** C:\BB2\q.txt
          PopItem lines()
          Free  0:BitMapOutput 0
        Else
***** C:\BB2\QA.TXT
          PopItem lines()
          Free File 0:BitMapOutput 0
        Else
*****

***** C:\BB2\q.txt
;
thedregs:.l 16
;
dumpregs:.l 16
;
***** C:\BB2\QA.TXT
;
thedregs:Ds.l 16
;
dumpregs:Ds.l 16
;
*****

***** C:\BB2\q.txt
Function$ ch{}
Shared lz$,p
p+1:Function Return Mid$(lz$,p,1)
***** C:\BB2\QA.TXT
Function$ ch{}
SHARED lz$,p
p+1:Function Return Mid$(lz$,p,1)
*****

***** C:\BB2\q.txt
Statement putcw{k}
Shared c,tcl
Poke.w c,k:c+2:tcl+2
***** C:\BB2\QA.TXT
Statement putcw{k}
SHARED c,tcl
Poke.w c,k:c+2:tcl+2
*****

***** C:\BB2\q.txt
Statement putcl{k}
Shared c,tcl
Poke.l c,k:c+4:tcl+4
***** C:\BB2\QA.TXT
Statement putcl{k}
SHARED c,tcl
Poke.l c,k:c+4:tcl+4
*****

***** C:\BB2\q.txt
Statement putrw{k}
Shared r(),rl(),np
Poke.w r(np),k:r(np)+2:rl(np)+2
***** C:\BB2\QA.TXT
Statement putrw{k}
SHARED r(),rl(),np
Poke.w r(np),k:r(np)+2:rl(np)+2
*****

***** C:\BB2\q.txt
Statement putrl{k}
Shared r(),rl(),np
Poke.l r(np),k:r(np)+4:rl(np)+4
***** C:\BB2\QA.TXT
Statement putrl{k}
SHARED r(),rl(),np
Poke.l r(np),k:r(np)+4:rl(np)+4
*****

***** C:\BB2\q.txt
    For k=0 To 15
    If j  k Then ex(0)  (15-k)
    Next
***** C:\BB2\QA.TXT
    For k=0 To 15
    If j BitTst k Then ex(0) BitSet (15-k)
    Next
*****

***** C:\BB2\q.txt
c$=ch{}:If NOT rn{c$} Then Goto aser4
k+Asc(c$)-48:c$=ch{}:ex(np)  k:Return

***** C:\BB2\QA.TXT
c$=ch{}:If NOT rn{c$} Then Goto aser4
k+Asc(c$)-48:c$=ch{}:ex(np) BitSet k:Return

*****

***** C:\BB2\q.txt
    For k2=j To k
    ex(np)  k2
    Next
***** C:\BB2\QA.TXT
    For k2=j To k
    ex(np) BitSet k2
    Next
*****

***** C:\BB2\q.txt
    For k2=k To j
    ex(np)  k2
    Next
***** C:\BB2\QA.TXT
    For k2=k To j
    ex(np) BitSet k2
    Next
*****

Last edited by clenched; 01 March 2021 at 22:06.
clenched is offline  
Old 01 March 2021, 22:49   #3
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
I used Richard's token list, if you can suggest what any of the others are and add them, or just make a list and I'll do it.

It's enough to get my sources readable anyway :-)
zero is offline  
Old 01 March 2021, 23:12   #4
clenched
Registered User
 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
Actually there is a Tokenlist.bb that would supposedly do that job. It doesn't compile for me. The ????? tells me something is missing.

pubname$=Par$(1)
If ????? (0,pubname$)=0
pubname$="Workbench"
????? 0,pubname$
EndIf
clenched is offline  
Old 01 March 2021, 23:57   #5
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
I don't know, it's years since I've done any Blitz code... Apparently there is a tool called "stripper" that can do it, available from http://www.blitz-2000.co.uk/

If you can send over the .bb and ASCII versions of any files with missing tokens I can add a bit of debug output and add them.
zero is offline  
Old 02 March 2021, 11:37   #6
clenched
Registered User
 
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
It would be a mammoth undertaking to try to cover every token. We've just seen Blitz its self doesn't understand every one missing from deflibs.

Suggestion and tip:
Instead of leaving missing tokens blank, substitute ????? the way Blitz does. Then text editor search could spot errors rather than having to compare listings.

This little batch file mimics a drag and drop. Just drag file over the bblist.bat icon. My text editor pops a message whenever another application modifies the file and asks reload? So there is no clutter of files. Also convenient dragging from zip lha etc and a dozen fold faster than extracting/loading into Blitz.

bblist.bat
Code:
cd %~dp0
bb2ascii %1 dummy.txt
REM pause
REM unREM above if error messages are important
clenched is offline  
Old 02 March 2021, 11:47   #7
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
I just made a change to print "??XXXX??" for unknown tokens, where XXXX is the hexadecimal code.
zero is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blitz basic] How much amiga-blitz friendly is this? saimon69 Coders. Blitz Basic 105 21 April 2022 19:45
New PC Project: Blitz Source Converter BippyM Coders. Blitz Basic 12 06 April 2020 01:34
Blitz basic 2 Help Havie Coders. Blitz Basic 30 08 September 2013 09:15
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 18:15
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:20.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09766 seconds with 15 queries