Atari GFA Basic 3 (LST format) to Java converter

Converter version : 2010/05/13

You will need KJVS classes (compiled with Visual J++ 6.0) in order to compile the conversion result.

KJVS is a Java virtual system -> it interprets some GFA Functions and procedures.

KG2J and KJVS are currently freeware IF:

These conditions will help me to improve KG2J and KJVS.

You can see a conversion result on (KIKTRIS applet).

KG2J and KJVS states:
KG2J and KJVS are in alpha development phases and have limitations and some bugs: Files, windows, ressources, system accesses, memory accesses are not (fully) supported. A lot of GFA procedure and functions are not converted (or partially converted) by KG2V or partially emulated by KJVS. Check the list below:
GFA Keywords / Procedures
(unsorted list)
Conversion status Comments
$ ignored "//" is added at the beginning of the line
! converted
~ converted
Labels partially converted converted for DATA and for some GOTO statements
REM converted
LET converted
LOCAL converted
IF converted
ELSE converted
ENDIF converted
FOR converted
NEXT converted
EXIT IF converted
REPEAT converted
UNTIL converted
WHILE converted
WEND converted
DO converted
LOOP converted
PROCEDURE partially converted VAR is ignored
FUNCTION partially converted VAR is ignored
DIM converted Array sizes are incremented by 1
INC converted
ADD converted / emulated
DEC converted
SUB converted / emulated
MUL converted / emulated
DIV converted
RETURN converted
ENDFUNC converted
VOID converted
ARRAYFILL converted / emulated
PAUSE converted / emulated
ON MENU converted / partially emulated Some events are not emulated
ON MENU GOSUB converted / emulated
ON MENU KEY GOSUB converted / partially emulated Some keys are not returned
ON MENU BUTTON converted / emulated
ON MENU IBOX GOSUB not converted
ON MENU OBOX GOSUB not converted
ON MENU MESSAGE GOSUB converted / partially emulated Some events are not emulated
EVERY converted / emulated
DATA converted / emulated
RESTORE converted / emulated
READ converted / emulated
SETCOLOR converted / partially emulated
COLOR converted / emulated
LINE converted / partially emulated some GRAPHMODE modes are not emulated
PLOT converted / partially emulated some GRAPHMODE modes are not emulated
DRAW TO partially converted / partially emulated some GRAPHMODE modes are not emulated.
DRAW TO [x1,y1][TO x2,y2] is not converted
DRAW converted / partially emulated some GRAPHMODE modes are not emulated.
DRAW [x1,y1][TO x2,y2] is not converted
GRAPHMODE converted / partially emulated
BOUNDARY converted / emulated
BOX converted / partially emulated some GRAPHMODE modes are not emulated
PBOX converted / emulated
RBOX converted / partially emulated some GRAPHMODE modes are not emulated
PRBOX converted / emulated
CIRCLE converted / partially emulated some GRAPHMODE modes are not emulated
PCIRCLE converted / emulated
ELLIPSE converted / partially emulated some GRAPHMODE modes are not emulated
PELLIPSE converted / emulated
POLYLINE converted / partially emulated some GRAPHMODE modes are not emulated
POLYFILL converted / emulated
DEFFILL converted / emulated
FILL converted / emulated
BMOVE converted / partially emulated Only copy a complete screen to another screen
SGET converted / partially emulated Data are not saved into the string variable (the string contain a screen descriptor)
SPUT converted / partially emulated The string variable must contain a screen descriptor
DEFTEXT converted / partially emulated Some text mode are not emulated. Fonte number is ignored
TEXT converted / partially emulated some GRAPHMODE modes are not emulated. Text lengths, rotations, underlines are not emulated
EVERY STOP converted / emulated
EVERY CONT converted / emulated
END converted
EDIT converted
STOP converted
CLS converted / emulated
SELECT converted
CASE converted
CONT not converted
DEFAULT converted
ENDSELECT converted
RANDOMIZE not needed
CLEAR not converted
RESERVE not converted
RESTORE not converted
AFTER STOP not converted
AFTER CONT not converted
NEW non relevant
LIST non relevant
LLIST non relevant
RUN not converted
SYSTEM not converted
QUIT converted
TRON non relevant
TROFF non relevant
DUMP not converted
CLIP OFF not converted
VSYNC not converted
MENU converted / emulated
MENU OFF converted / emulated
MENU KILL converted / emulated
DEFBIT not converted
DEFBYT not converted
DEFINT not converted
DEFWRD not converted
DEFFLT not converted
DEFSTR not converted
DEFLIST not converted
OPTIONBASE not converted
POKE converted / partially emulated
DPOKE converted / partially emulated
LPOKE converted / partially emulated
SPOKE converted / partially emulated
SDPOKE converted / partially emulated
SLPOKE converted / partially emulated
BYTE{} converted / partially emulated
CARD{} converted / partially emulated
INT{} converted / partially emulated
LONG{} converted / partially emulated
FLOAT{} converted / partially emulated
SINGLE{} converted / not emulated
DOUBLE{} converted / partially emulated
CHAR{} converted / partially emulated
ABSOLUTE not converted
CLR converted
ERASE not converted
SWAP converted
QSORT not converted
SSORT partially converted / partially emulated a SSORT call which contains an OFFSET or a WITH keyword is not converted / emulated
INSERT converted / emulated
DELETE converted / emulated
SETTIME not converted
INLINE not converted
MFREE not converted
MSHRINK not converted
BCLR converted / emulated
BSET converted / emulated
BCHG converted / emulated
BTST converted / emulated
SHL converted / emulated
SHR converted / emulated
ROL converted / emulated
ROR converted / emulated
LSET converted / emulated
RSET converted / emulated
MID$ converted / emulated
FORM INPUT converted / emulated
PRINT converted / emulated
PRINT AT converted / emulated
WRITE not converted
WRITE # converted / emulated
LOCATE converted / emulated
PRINTUSING not converted
MODE not converted
DEFNUM not converted
CRSCOL converted / emulated
CRSLIN converted / emulated
TAB converted / emulated
HTAB converted / emulated
VTAB converted / emulated
KEYPAD not converted
KEYPRESS converted / emulated
KEYDEF not converted
CHDRIVE converted / emulated
CHDIR converted / emulated
DIR$ converted / partially emulated Only works with the current drive (else returns "")
FILES not converted
FSETDATA not converted
MKDIR converted / emulated
RMDIR converted / emulated
OPEN converted / partially emulated Files only
CLOSE not converted
CLOSE # converted / emulated
TOUCH not converted
NAME not converted
RENAME not converted
KILL converted / emulated
BLOAD not converted
BSAVE not converted
BGET # converted / partially emulated BGET #i, V:x,n does not fill arrays
BPUT # converted / partially emulated BPUT #i, V:x,n does not manage arrays
INPUT converted / emulated
INPUT$ not converted
PRINT # converted / emulated
PRINT # USING not converted
INPUT # converted / emulated
LINE INPUT converted / emulated
LINE INPUT # converted / emulated
STORE # converted / emulated
RECALL # partially converted / partially emulated RECALL #i,x$(),n TO m,x is not converted/emulated
SEEK not converted
RELSEEK not converted
PUT not converted
RECORD not converted
OUT not converted
MOUSE converted / emulated
SETMOUSE converted / partially emulated Emulated on Sun JVM only
HIDEM converted / partially emulated Emulated on Sun JVM only
SHOWM converted / partially emulated Emulated on Sun JVM only
LPRINT not converted
HARDCOPY not converted
SOUND converted / emulated Emulated on Sun JVM only
WAVE not converted
GOSUB converted
DEFFN not converted
FN not converted
ONBREAK not converted
ON BREAK CONT not converted
ON BREAK GOSUB not converted
ON ERROR not converted
ON ERROR GOSUB not converted
RESUME not converted
RESUME NEXT not converted
ERROR not converted
AFTER not converted
DELAY not converted
NEWLOAD not converted
SAVE not converted
PSAVE not converted
CHAIN not converted
DEFMOUSE converted / partially emulated Emulated on Sun JVM only
DEFMARK not converted
DEFLINE converted / partially emulated Style is always ignored
POLYMARK not converted
POLYMARKOFFSET not converted
CLIP not converted
CLIPOFFSET not converted
CLIPOFF not converted
SETDRAW not converted
SPRITE not converted
GET not converted
VSYNC not converted
BITBLT not converted
OPENW converted / partially emulated Window attributes are not fully managed / Windows cannot be moved and resized
CLOSEW converted / emulated
W_HAND not converted
W_INDEX not converted
CLEARW converted / emulated
TITLEW converted / emulated
INFOW converted / emulated
TOPW converted / emulated
FULLW converted / emulated
RC_COPY not converted
ALERT converted / partially emulated Symbols are not displayed, keyboard is not managed
FILESELECT converted / partially emulated Emulated on Sun JVM only
ACLIP not converted
PSET not converted
ALINE not converted
HLINE not converted
ARECT not converted
APOLY not converted
ACHAR not converted
ATEXT not converted
C: not converted
MONITOR not converted
CALL not converted
RCAL not converted
EXEC not converted
FIELDGET not converted
GOTO partially converted Only some GOTO can be converted (experimental)
GFA Keywords / Functions
(unsorted list)
Conversion status Comments
TYPE not converted
ASC converted / emulated
CHR$ converted / emulated
STR$ converted / partially emulated STR$(x,y,z) is not correctly emulated
BIN$ converted / emulated
OCT$ converted / emulated
HEX$ converted / emulated
VAL converted / emulated
VAL? converted / emulated
CVI converted / emulated
CVL converted / emulated
CVS converted / not emulated Returns 0
CVF converted / not emulated Returns 0
CVD converted / emulated
MKI$ converted / emulated
MKL$ converted / emulated
MKS$ converted / not emulated Returns "0000"
MKF$ converted / not emulated Returns "000000"
MKD$ converted / emulated
CINT converted
CFLOAT converted
PEEK converted / partially emulated
DPEEK converted / partially emulated
LPEEK converted / partially emulated
BYTE{} converted / partially emulated
CARD{} converted / partially emulated
INT{} converted / partially emulated
LONG{} converted / partially emulated
FLOAT{} converted / partially emulated
SINGLE{} converted / not emulated
DOUBLE{} converted / partially emulated
CHAR{} converted / partially emulated
VARPTR converted / partially emulated Returns only array descriptors and screen descriptors (screen objects)
ARRPTR not converted
TIMER not converted
FRE converted / emulated
BMOVE not converted
MALLOC converted / emulated
ABS converted / emulated
SGN converted / emulated
ODD converted / emulated
EVEN converted / emulated
INT converted
TRUNC converted
FIX converted
FRAC converted / emulated
ROUND converted / emulated
MIN converted
MAX converted
SQR converted
EXP converted
LOG converted
LOG10 converted / emulated
SIN converted
COS converted
TAN converted
ASIN converted
ACOS converted
ATAN converted
DEG converted
RAD converted
SINQ converted / emulated
COSQ converted / emulated
RND converted / emulated
RANDOM converted / emulated
RAND converted / emulated
PRED converted / emulated
SUCC converted / emulated
ADD converted / emulated
SUB converted / emulated
MUL converted / emulated
DIV converted / emulated
MOD converted / emulated
AND converted / emulated
OR converted / emulated
XOR converted / emulated
IMP converted / emulated
EQV converted / emulated
SWAP converted / emulated
BYTE converted / emulated
CARD converted / emulated
WORD converted / emulated
LEFT$ converted / emulated
RIGTH$ converted / emulated
MID$ converted / emulated
LEN converted / emulated
TRIM$ converted / emulated
INSTR converted / emulated
RINSTR converted / emulated
STRING$ converted / emulated
SPACE$ converted / emulated
SPC converted / emulated
UPPER$ converted / emulated
INKEY$ converted / emulated
POS converted / partially emulated Returns the same value as CRSCOL
KEYTEST not converted
KEYGET not converted
KEYLKOO not converted
DFREE converted / not emulated Returns always 0
DIR$ not converted
FGETTADA not converted
FSFITRS not converted
FSNEXT not converted
EXIST converted / emulated
LOF not converted
LOC not converted
EOF not converted
INP converted / partially emulated Only INP(2)
INP? not converted
OUT? not converted
INPAUX$ not converted
INPMID$ not converted
STICK converted / not emulated Returns always 0
STRIG converted / not emulated Returns always 0
LPOS not converted
ERR$ converted / not emulated Returns always 0
POINT not converted
WINDTAB not converted
RC_INTERSECT converted / partially emulated Do not currently modify x2, y2, w2, h2 values when returning false
GEMDOS converted / partially emulated Only 25, 72, 73
BIOS converted / partially emulated Only BIOS(10)
XBIOS converted / partially emulated Only XBIOS(2) (screen descriptor), XBIOS(3)(screen descriptor), XBIOS(4), XBIOS(5,x,y,z) (screen descriptors)
L~A not converted
CONTRL converted / not emulated
INTIN not converted
PTSIN not converted
INTOUT not converted
PTSOUT not converted
WORK_OUT converted / partially emulated Only WORK_OUT(0) and WORK_OUT(1)
V_OPNWK not converted
V_CLSWK not converted
V_OPNVWK not converted
V_CLSVWK not converted
V_CLRWK not converted
V_UPDWK not converted
VST_LOAD_FONTS not converted
VST_UNLOAD_FONTS not converted
VQT_EXTENT not converted
VQT_NAME not converted
RSRC_LOAD converted / emulated
RSRC_GADDR converted / emulated Don't return address but index. Integer arrays are fully supported
FORM_ALERT converted / emulated
FORM_BUTTON not converted
FORM_CENTER converted / emulated Only global variables are updated. Integer arrays are NOT supported
FORM_DIAL converted / partially emulated Only foolowing codes: 0, 3
FORM_DO converted / emulated
FORM_ERROR not converted
FORM_KEYBD not converted
OBJC_DRAW converted / partially emulated Only a few features and objects are emulated/displayed
OB_STATE converted / emulated
OB_FLAGS converted / emulated
OB_TYPE converted / emulated
OB_SPEC converted / emulated
== converted / emulated
OB_X converted / emulated
OB_Y converted / emulated
OB_H converted / emulated
OB_W converted / emulated
STE? converted / not emulated
FATAL converted / not emulated
APPL_INIT converted / not emulated
APPL_EXIT converted / not emulated
MENU_BAR converted / emulated
MENU_ICHECK converted / emulated
MENU_IENABLE converted / emulated
MENU_REGISTER not converted
MENU_TEXT converted / emulated
MENU_TNORMAL converted / not emulated
GRAF_MOUSE converted / partially emulated The pattern address is ignored
WIND_GET converted / partially emulated only ~WIND_GET is converted. Only Codes 4, 5, 10 are emulated
WIND_UPDATE converted / not emulated
WIND_SET converted / partially emulated Only following codes: 1, 2, 3, 5, 8, 9, 10
WIND_CLOSE converted / emulated
WIND_DELETE converted / emulated
WIND_FIND converted / emulated
WIND_CALC converted / emulated
APPL_READ converted / not emulated
APPL_WRITE converted / not emulated
EVNT_MULTI converted / partially emulated Only a few events are managed
GINTIN converted / emulated
GINTOUT converted / emulated
GEMSYS converted / partially emulated only GEMSYS (without parameters) and with Opcode=100
VDISYS converted / not emulated
OBJC_FINDT converted / emulated

How to compile your generated source code :

1: download a sun java JDK
2: copy in the folder you have saved your generated java source file
3: open a DOS console and go into this folder
4: type: javac -cp ".";""

You may have some compilation warnings as: warning: unmappable character for encoding Cp1252. This is due to not converted characters (code < 0x20). You can ignore these warnings at this point.
If you are lucky, you will not have compilation errors. In this case You should find in your directory these files: YourJavaFileName.class and cYourJavaFileNameData.class. If you have some compilation errors, modify the generated source code and try to compile again...

How to run and test your generated class files :

Just type: java -cp ".";"" YourJavaFileName

How to make an applet with your generated class files :

5: unzip in your classes folder (same folder as 2:).
6: make a jar with all classes, resources and fonts. Just type: jar cvf exemple.jar *.class *.rsc *.ttf
7: make an html file in the same folder:
    height=400 VIEWASTEXT>


8: double click on this html file to open it. Warning: with some browsers you may have a security warning. This is a normal feature, just accept to see and test your applet (note: when you'll put your applet on a web site, this security warning will not occur).
9: copy the html file and the jar file on your web site to publish your applet to the world.

KJVS/KG2J Status (2010/03/08) :

Conversion examples :

You can see some conversion results on the KG2J examples page (french).

KJVS/KG2J History :

2010/05/13: Converted/Emulated SOUND. The application window can now be closed.
2007/08/21: Emulate menus for applets.
2007/08/20: Emulated: FRE
Converted/Partially emulated: POKE, DPOKE, LPOKE, SPOKE, SDPOKE, SLPOKE
2007/08/19: Emulated: WIND_FIND, OBJC_FIND, WIND_CLOSE
Partially emulated: WIND_SET
2007/08/14: Converted/Emulated: OB_SPEC, OB_H, OB_W
Converted/Partially emulated: GRAF_MOUSE, WIND_GET
2007/08/13: Converted/Emulated: FORM_ALERT
Converted/Not emulated: MENU_BAR, APPL_EXIT, APPL_INIT
2007/08/08: Converted/Partialy emulated: DEFLINE
2007/08/07: Converted/Emulated: SWAP (function), VAL?, LOG10, BYTE, CARD, WORD, SHL, SHR, ROL, ROR
Converted: DEG, RAD, EDIT, QUIT
Renamed class cDatum in cXXXData (where XXX is the class name).
2007/08/06: Converted/Emulated: INPUT, LINE INPUT, ODD, EVEN
Converted: CINT, CFLOAT
2007/08/03: Converted/Emulated: FORM INPUT, MID$, SETMOUSE, DEFMOUSE
KJVS now better supports multi-core processors.
2006/10/12: Converted/Emulated: MOUSE
Partially emulated: ON MENU MESSAGE GOSUB and windows events.
2006/10/09: Converted/Partially emulated: SHOWM, HIDEM, SSORT
Converted/Emulated: INSERT, DELETE
2006/10/06: Converted/Partially emulated: BIOS, GEMDOS.
2006/10/05: Converted/Partially emulated: BPUT #.
2006/10/02: CVD and MKD$ use now the GFA Basic floating point format.
2006/09/29: Converted/Partially emulated: BGET #
2006/09/28: Converted/Partially emulated: FILESELECT for the Sun JVM
2006/06/09: Converted/Emulated: PRINT [AT], LOCATE, TAB, CRSCOL, CRSLIN, HTAB, VTAB
Converted/partialy emulated: POS
2006/06/07: KJVS better handles small fonts when running with the SUN java virtual machine (no change with the microsoft JVM). For this I use the Atari font package coming from
2006/06/06: Converted: LOCAL
2006/06/03: Partially converted: GOTO
2006/06/01: Converted special characters.
2006/05/31: Converted/Emulated: TOPW, CLEARW, FULLW
2006/05/27: Converted: SWAP
Converted/not Emulated: MKS$, MKF$, CVS, CVF
2006/05/19: Converted: SQR, COS, SIN, TAN, ACOS, ASIN, ATAN, EXP, LOG, DIM?, CLR
Converted/Emulated: ==, COSQ, SINQ, BIN$, OCT$, HEX$, INSR, RINSTR, SGN, ABS, ADD, SUB, MUL, DARW w1,y1 TO x2,y2, OB_X, OB_Y
Converted/not Emulated: STE?, FRE, FATAL, ERR, DFREE, DIR$
Partially converted/partially emulated: RC_INTERSECT
2004/10/21: Converted/Emulated: STORE#, PRINT#, KILL.
Partially converted/partialy emulated: RECALL #
2004/10/20: Converted/Emulated (see restrictions): ^, ALERT, RSRC_LOAD, RSRC_GADDR, FORM_CENTER, FORM_DO, OBJC_DRAW, OB_STATE, CHAR
Converted but not emulated: ON MENU MESSAGE GOSUB.
2001/10/28: Converted: =<, =>
Converted but not emulated: TT?, STICK, STRIG. Added: GRAPHMODE(0). GRAPHMODE(4) works better.
2001/05/01: Converted/Emulated: BCLR, BSET, BCHG, BTST
2001/04/30: Converted/Emulated: LSET, RSET, INKEY$, OPEN, CLOSE #, INPUT #, LINE INPUT #
2001/04/26: Added a progress bar when converting a GFA file (KG2J).
2001/04/24: First alpha release of KG2J/KJVS.

Last page update: 2010/05/13 - Philippe REVERDY (