More compatibility with the old QuickBasic

Post your requests and ideas on the future development of mikroBasic for AVR.
Post Reply
Author
Message
Tess
Posts: 49
Joined: 27 Dec 2006 18:49

More compatibility with the old QuickBasic

#1 Post by Tess » 18 Mar 2007 10:55

If it's possible, i wish more compatibility with quickbasic (microsoft).
For whom don't know quickbasic, please take a look at this page :

http://www.qbasicnews.com/qboho/qck-9997.shtml



I don't know wether you'll be subject to royalties... but if you don't, what are the things i wish to use :

1) I think in the future, we will use more screens and bigger screens because their costs will decrease (oled...) and the power (mips) of the AVRs and PICs (both 8bits, 16 and 32 bits chips) will increase.

Today, we can use a "VGA" screen : http://www.tvterminal.de/index.html#english

and a Color LCD 320x240

http://www.avrfreaks.net/index.php?modu ... pe=project

And here, with an EPSON's composant, we should be able to display texts or graphics in 800x600 or 1024x762 in 16 or 24bits in depth colors !
http://www.epson-electronics.de/cgi-bin ... yOid:-8467

(search S1D13505 in epson site)

So i wish a Qbasic module.

Here are some propositions :

-----------------------------------------------------

SCREEN - a graphics statement that sets the specifications for the
display screen

Syntax
SCREEN [mode] [,[colorswitch]][,[apage]][,[vpage]]


Argument Description mode An integer (or a byte) constant or expression indicating the screen mode.
00 : display on USART (0x = non screen)
01 : display on Software UART
10 : display on LCD 4 BITS (1x = LCD)
11 : display on LCD 8 BITS
12 : display on LCD CUSTOM
20 : display on GLCD Standard (2x = GLCD)
21 : display on GLCD T6963C
22 : display on GLCD SPI
3x : display on OLED
4x : display on VESA SCreen (VGA, SuperVGA, etc...)
320x240 8bits
320x240 16bits
320x320 16bits
640x240 4 greyscale
640x480 1 bit
640x480 4 bits
640x480 8 bits
640x480 16 bits
640x480 32 bits
800x600 16 bits
1024x762 32 bits
5x : 3D


colorswitch A byte witch determines whether color is displayed.
0 : Black & white
X : images are in color

In screen modes 00 : 1 = USART1, 2 = USART2
In screen modes 01 : nibble1 = RX pin, nibble2 = TX pin
In screen modes 10 to 2F, colorswitch is ignored.

apage A numeric expression that is the number of the screen
page that text output or graphics commands write to.
See Adapters and Displays for the number of pages
available for each graphics adapter.
In screen modes 00 : nibble1 = code baudrate, nibble2 = 0
In screen modes 01 : nibble1 = code baudrate, nibble2 = inverted

vpage A numeric expression that is the number of the screen
page being displayed.
In screen modes 01 : PORT
-----------------------------------------------------------------------------------
COLOR - a graphics statement that selects display colors

SCREEN Mode 0x Syntax: COLOR is ignored
SCREEN Mode 1x, 2x Syntax: COLOR (foreground[0,1])
0 = white on black, 1 = black on white
SCREEN Mode 3x and above Syntax: COLOR (foreground, background,blink)


-------------------------------------------------------------------------------

CLS

LOCATE position of the cursor

CURSOR display cursor
CURSOR on|off

CURSORXY [row][,[column]
idem LOCATE

PRINT

PRINT USING

COM(n) ON|OFF|STOP

HEX$

OPEN (File I/O) Statement Details

OPEN "COMn: optlist1 optlist2" [FOR mode] AS [#]filenum [LEN=reclen]

COMn [speed][,[parity] [,[data][,[stop]]]]

PRINT #, PRINT # USING - file I/O statements that write data to a
sequential file
etc...

Tess

Tess
Posts: 49
Joined: 27 Dec 2006 18:49

#2 Post by Tess » 18 Mar 2007 11:00

I began to create a "module" name QBasic.abas
This module is made for the easyavr4 and for an atmega16

Save this module in your hard drive
x:\...Mikroelektronika\mikrobasic for avr\uses\

To use this module in a project, add this, above main: include "QBasic"

You can use SCREEN_LCD to display something on the lcd
SCREEN_GLCD to display something on the glcd
etc...
You can use CLS, LOCATE, CURSORXY, PRINTQ, CURSOR_ON, CURSOR_OFF

There are maybe some bugs ? ...

Please feel free to modify this module and to add what you want ! ! !
The mikroelektronika team can use it, add, modify add to this as update and what ever they want ...


Here is the module

'
'* Project name:
' QBasic
'* Author:
' MESALIKO, Mars 2007.
'* Description:
' More Compatibility with QUICKBASIC.
'* Test configuration:
' MCU: ATmega16
' Dev.Board: Easy AVR 4
' Oscillator: External, 8 MHz
'* NOTES:
' Please feel free to complete this module for different
' easyboard and AVR
'
' Tested and ok : SCREEN_LCD, SCREEN_GLCD
'
' Literals : SCREEN LOCATE CURSORXY PRINTQ CLS
' CURSOR_ON CURSOR_OFF


module QBasic


dim QX,QY as byte 'col & line on the screen

implements


'*----------------------------------*
'* SCREEN *
'*----------------------------------*

sub procedure SCREEN_LCD 'lcd 4 bits standard
#DEFINE QSCREEN_LCD
Lcd_Init(PORTD, 6, 4, PORTA, LCD_HI_NIBBLE)
end sub

sub procedure SCREEN_LCD8 'lcd 8 bits
'8bits as Hitachi HD44780 controller
#DEFINE QSCREEN_LCD8
DDRD.5 = 1 ' put RW on GND --> PORTD.5=0
PORTD.5 = 0 ' to work on GLCD connector
Lcd8_Init(PORTD, 6, 4, PORTA)
end sub

sub procedure SCREEN_LCD4_CUSTOM(dim byref Qdata_lat as byte, dim Qdb3, Qdb2, Qdb1, Qdb0 as byte, dim byref Qctrl_lat as byte, dim Qrs, Qctrl_rw, Qenable as byte)
#DEFINE QSCREEN_LCD4_CUSTOM
Lcd4_Custom_Init(Qdata_lat, Qdb3, Qdb2, Qdb1, Qdb0, Qctrl_lat, Qrs, Qctrl_rw, Qenable)
end sub

sub procedure SCREEN_GLCD
#DEFINE QSCREEN_GLCD
Glcd_Init(PORTD, 2, 3, 4, 5, 7, 6, PORTA)
Glcd_Set_Font(font5x7,5,8,32)
end sub

'sub procedure SCREEN_USART_1
'To Do
'end sub

'sub procedure SCREEN_USART_2
'To Do
'end sub


sub procedure LOCATE(dim qqx,qqy as byte ) 'cursor's coordonnates
QX=qqx
QY=qqy
end sub

sub procedure CURSOXY(dim qqx,qqy as byte ) 'same as LOCATE
QX=qqx
QY=qqy
end sub

sub procedure PRINTQ(dim byref QSTRING as string[21]) 'Unfortunatly print is yet a literal
'so i choose to use PRINTQ
#IFDEF QSCREEN_LCD THEN
Lcd_Out(QX,QY,QSTRING)
#ENDIF

#IFDEF QSCREEN_LCD8 THEN
Lcd8_Out(QX,QY,QSTRING)
#ENDIF

#IFDEF QSCREEN_LCD4_CUSTOM THEN
Lcd4_custom_Out(QX,QY,QSTRING)
#ENDIF

#IFDEF QSCREEN_GLCD THEN
Glcd_Write_Text(QSTRING, QX, QY, 2) '0,1 OR 2
#ENDIF

end sub

sub procedure CLS
#IFDEF QSCREEN_LCD THEN
Lcd_Cmd(Lcd_Clear)
#ENDIF

#IFDEF QSCREEN_LCD8 THEN
Lcd8_Cmd(Lcd_Clear)
#ENDIF

#IFDEF QSCREEN_LCD4_CUSTOM THEN
Lcd4_custom_Cmd(Lcd_Clear)
#ENDIF

#IFDEF QSCREEN_GLCD THEN
Glcd_Fill(0x00)
#ENDIF

end sub

sub procedure CURSOR_OFF
#IFDEF QSCREEN_LCD THEN
Lcd_Cmd(LCD_CURSOR_OFF)
#ENDIF

#IFDEF QSCREEN_LCD8 THEN
Lcd8_Cmd(LCD_CURSOR_OFF)
#ENDIF

#IFDEF QSCREEN_LCD4_CUSTOM THEN
Lcd4_custom_Cmd(LCD_CURSOR_OFF)
#ENDIF

'no cursor off for glcd

end sub

sub procedure CURSOR_ON
#IFDEF QSCREEN_LCD THEN
Lcd_Cmd(LCD_UNDERLINE_ON)
'Lcd_Cmd(LCD_BLINK_CURSOR_ON)
#ENDIF

#IFDEF QSCREEN_LCD8 THEN
Lcd8_Cmd(LCD_UNDERLINE_ON)
'Lcd8_Cmd(LCD_BLINK_CURSOR_ON)
#ENDIF

#IFDEF QSCREEN_LCD4_CUSTOM THEN
Lcd4_custom_Cmd(LCD_UNDERLINE_ON)
'Lcd4_custom_Cmd(LCD_BLINK_CURSOR_ON)
#ENDIF

'no cursor on for glcd

end sub

'
'
'*************************************************************
'TO DO IN THE FUTURE ...
'
'SCREEN - a graphics statement that sets the specifications for the
' display screen
'
'Syntax
' SCREEN [mode] [,[colorswitch]][,[apage]][,[vpage]]
'
'
' Argument Description
' mode An integer (or a byte) constant or expression indicating the
' screen mode.
' 00 : display on USART (0x = non screen)
' 01 : display on Software UART
' 10 : display on LCD 4 BITS (1x = LCD)
' 11 : display on LCD 8 BITS
' 12 : display on LCD CUSTOM
' 20 : display on GLCD Standard (2x = GLCD)
' 21 : display on GLCD T6963C
' 22 : display on GLCD SPI
' 3x : display on OLED
' 4x : display on VESA SCreen (VGA, SuperVGA, etc...)
' 320x240 8bits
' 320x240 16bits
' 320x320 16bits
' 640x240 4 greyscale
' 640x480 1 bit
' 640x480 4 bits
' 640x480 8 bits
' 640x480 16 bits
' 640x480 32 bits
' 800x600 16 bits
' 1024x762 32 bits
' 5x : 3D
'
'
' colorswitch A byte witch determines whether color is displayed.
' 0 : Black & white
' X : images are in color
'
' In screen modes 00 : 1 = USART1, 2 = USART2
' In screen modes 01 : nibble1 = RX pin, nibble2 = TX pin
' In screen modes 10 to 2F, colorswitch is ignored.
'
' apage A numeric expression that is the number of the screen
' page that text output or graphics commands write to.
' See Adapters and Displays for the number of pages
' available for each graphics adapter.
' In screen modes 00 : nibble1 = code baudrate, nibble2 = 0
' In screen modes 01 : nibble1 = code baudrate, nibble2 = inverted
'
' vpage A numeric expression that is the number of the screen
' page being displayed.
' In screen modes 01 : PORT
'*******************************************************
'sub procedure SCREEN (QBMODE, QBCOLORSWITCH, QBAPAGE, QBVPAGE AS BYTE)
'case QBMODE

'end sub





end.

And here is a example

'
'* Project name:
' QB_Compat
'* Author:
' Tess, March 2007.
'* Description:
' More compatibility with the old Quick Basic.
'* Test configuration:
' MCU: ATmega16
' Dev.Board: Easy AVR 4
' Oscillator: External, 8 MHz
' Ext. Modules: LCD, glcd
' SW: mikroBasic for AVR 4.0
'* NOTES:
'
program QB_Compat

include "QBasic"

main:
'screen_lcd 'init lcd standard
Screen_glcd 'init glcd standard
cls 'clear screen
locate(1,1) 'cursor at x,y
printQ("test") 'print "test"
'Unfortunatly PRINT is yet a literal so i choose to create PRINTQ

end.

Tess

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#3 Post by zristic » 19 Mar 2007 08:19

We follow your work.

tammyphilip
Posts: 1
Joined: 10 Aug 2016 11:34

Re: More compatibility with the old QuickBasic

#4 Post by tammyphilip » 10 Aug 2016 11:38

I have saved this module Qbasic in my hard drive
x:\...Mikroelektronika\mikrobasic for avr\uses\

followed your instruction- To use this module in a project, add this, above main: include "QBasic" . All worked perfect. Thnaks.

Post Reply

Return to “mikroBasic for AVR Wish List”