BLUESTONE 32-BIT COMPILER VERSION 1.0 Bluestone is a liitle project written by Bluestone, to provide programmers with an alternative language to making games. This is a only a subset of the final version and was released to get peoples reaction. Its is totally free and no credit need to mentiond to me, but if it would be nice to mention Tran and Matt Pritchard. There are many bugs in this program so wait for the final version. The final version will include: Our own dos extender A text editor A graphics and sound editor Able to do units More graphics and sound libraries. NOTE: The dos extender that was used is Tran's (a.k.a. Thomas Pytel) PMODE 3.0 Mode X routines by Matt Pritchard EMAIL: s9403567@cougar.vut.edu.au if you cant contact be at that address you can try haychman@break.com.au THE SYNTAX: Bluestone language is very similar to pascal with the following exceptions: 1. '=' is used for as assignment operator and boolean operator 2. No units 3. the last statement in CASE mustn't end with a ';' 4. OFFSET ( name ) return the relative pointer to name & - bitwise and | - bitwise or ^ - bitwise xor and - ligical and or - logical or 5. INCLUDE 'filename' tells the compiler to find the file and compile as if it was part of the source 6. INTERRUPT decleration statement eg interrupt name; begin endl . . . begin setirqvect ( offset (name) ); OVERVIEW OF THE VARIABLES/FUNTIONS AVAILABLE: PMODE commands: code32a : dword; ; pointer to the start of pmode pspa : dword; ; pointer to the pspa region in memory inkey[128] :byte; ; Non-sticky keyboard table. This is an 80h byte table for the status of any key on the keyboard. Whenever a key is pressed, the byte in this table at the offset of the keys scan code will be set to a non-zero value. When that key is released, the byte will be set back to zero. kbhit:byte ; Keyboard status: 0=no key hit, 1=key hit available. ; must be reseted procedure initvrt ( pointer to procedure) ; links timer interrupt to the procedure procedure resetvrt ; reset timer interrupt function getrel ( physical pointer) ; Convert physical pointer to realative pointer function getphsys ( realative pointer) ; Convert realative pointer to physical pointer function getlomem ( amount ) ; allocates amount number of memory in conventional memory ; returns -1 if error ; else returns pointer to the memory function gethimem ( amount ) ; allocates amount number of memory in xms memory ; returns -1 if error ; else returns pointer to the memory function getanymem ( amount ) ; allocates amount number of memory in conventinal or xms memory ; returns -1 if error ; else returns pointer to the memory function getirq ( irq no. ) ; returns addrees to irq no procedure setirq ( irq no., pointer to interrupt ) ; make irq no call address function getirqmask ( irq no. ) ; returns mask value of irq no procedure setirq ( irq no., value ) ; set irqmask to value function write( pointer to null string ) ; displays a string onto the video screen function writeln( pointer to null string ) ; displays a string with carriage return onto the video screen function length( pointer to null string ) ; return length of a string funtion random ( number ) ; retunr a random number between 0 and number -1 procedure mode13 ; puts you in vga mode 13h procedure mode03 ; put you in text mode FILE commands: function openfile (pointer to null-terminated string):word function createfile (pointer to null-terminated string):word returns the handle to the open file procedure readfile (pointer to memory to read to, amount to read, handle) procedure writefile (pointer to memory to read from, amount to read, handle) procedure seekfile (position of file, handle) procedure closefile (handle) function filesize (handle) MODEX commands: ( As written my Matt Pritchard ) ;====================================================== ;set_vga_modex% (modetype%, maxxpos%, maxypos%, pages%) ;====================================================== ; ; sets up the specified version of mode x. allows for ; the setup of multiple video pages, and a virtual ; screen which can be larger than the displayed screen ; (which can then be scrolled a pixel at a time) ; ; entry: modetype = desired screen resolution (0-7) ; ; 0 = 320 x 200, 4 pages max, 1.2:1 aspect ratio ; 1 = 320 x 400, 2 pages max, 2.4:1 aspect ratio ; 2 = 360 x 200, 3 pages max, 1.35:1 aspect ratio ; 3 = 360 x 400, 1 page max, 2.7:1 aspect ratio ; 4 = 320 x 240, 3 pages max, 1:1 aspect ratio ; 5 = 320 x 480, 1 page max, 2:1 aspect ratio ; 6 = 360 x 240, 3 pages max, 1.125:1 aspect ratio ; 7 = 360 x 480, 1 page max, 2.25:1 aspect ratio ; ; maxxpos = the desired virtual screen width ; maxypos = the desired virtual screen height ; pages = the desired # of video pages ; ; exit: 0 = failure / -1= success ; ;================== ;set_modex% (mode%) ;================== ; ; quickie mode set - sets up mode x to default configuration ; ; entry: modetype = desired screen resolution (0-7) ; (see set_vga_modex for list) ; ; exit: 0 = failure / -1= success ; ;============================ ;clear_vga_screen (colornum%) ;============================ ; ; clears the active display page ; ; entry: colornum = color value to fill the page with ; ;=================================== ;set_point (xpos%, ypos%, colornum%) ;=================================== ; ; plots a single pixel on the active display page ; ; entry: xpos = x position to plot pixel at ; ypos = y position to plot pixel at ; colornum = color to plot pixel with ; ;========================== ;read_point% (xpos%, ypos%) ;========================== ; ; read the color of a pixel from the active display page ; ; entry: xpos = x position of pixel to read ; ypos = y position of pixel to read ; ;====================================================== ;fill_block (xpos1%, ypos1%, xpos2%, ypos2%, colornum%) ;====================================================== ; ; fills a rectangular block on the active display page ; ; entry: xpos1 = left x position of area to fill ; ypos1 = top y position of area to fill ; xpos2 = right x position of area to fill ; ypos2 = bottom y position of area to fill ; colornum = color to fill area with ; ;===================================================== ;draw_line (xpos1%, ypos1%, xpos2%, ypos2%, colornum%) ;===================================================== ; ; draws a line on the active display page ; ; entry: xpos1 = x position of first point on line ; ypos1 = y position of first point on line ; xpos2 = x position of last point on line ; ypos2 = y position of last point on line ; colornum = color to draw line with ; ;================================================= ;set_dac_register (register%, red%, green%, blue%) ;================================================= ; ; sets a single (rgb) vga palette register ; ; entry: register = the dac # to modify (0-255) ; red = the new red intensity (0-63) ; green = the new green intensity (0-63) ; blue = the new blue intensity (0-63) ; ;==================================================== ;get_dac_register (register%, var red, var green%, var blue%) ;==================================================== ; ; reads the rgb values of a single vga palette register ; ; entry: register = the dac # to read (0-255) ; red = offset to red variable in ds ; green = offset to green variable in ds ; blue = offset to blue variable in ds ; ; exit: the values of the integer variables red, ; green, and blue are set to the values ; taken from the specified dac register. ; ;=========================================================== ;load_dac_registers (seg paldata, startreg%, endreg%, sync%) ;=========================================================== ; ; sets a block of vga palette registers ; ; entry: paldata = far pointer to block of palette data ; startreg = first register # in range to set (0-255) ; endreg = last register # in range to set (0-255) ; sync = wait for vertical retrace flag (boolean) ; ; notes: paldata is a lifar array of 3 byte palette values ; in the order: red (0-63), green (0-63), blue (0-63) ; ;==================================================== ;read_dac_registers (seg paldata, startreg%, endreg%) ;==================================================== ; ; reads a block of vga palette registers ; ; entry: paldata = far pointer to block to store palette data ; startreg = first register # in range to read (0-255) ; endreg = last register # in range to read (0-255) ; ; notes: paldata is a lifar array of 3 byte palette values ; in the order: red (0-63), green (0-63), blue (0-63) ; ;========================= ;set_active_page (pageno%) ;========================= ; ; sets the active display page to be used for future drawing ; ; entry: pageno = display page to make active ; (values: 0 to number of pages - 1) ; ;================ ;get_active_page% ;================ ; ; returns the video page # currently used for drawing ; ; entry: no parameters are passed ; ; exit: current video page used for drawing ; ;=============================== ;set_display_page (displaypage%) ;=============================== ; ; sets the currently visible display page. ; when called this routine syncronizes the display ; to the vertical blank. ; ; entry: pageno = display page to show on the screen ; (values: 0 to number of pages - 1) ; ; ;================= ;get_display_page% ;================= ; ; returns the video page # currently displayed ; ; entry: no parameters are passed ; ; exit: current video page being displayed ; ;======================================= ;set_window (displaypage%, xpos%, ypos%) ;======================================= ; ; since a logical screen can be larger than the physical ; screen, scrolling is possible. this routine sets the ; upper left corner of the screen to the specified pixel. ; also sets the display page to simplify combined page ; flipping and scrolling. when called this routine ; syncronizes the display to the vertical blank. ; ; entry: displaypage = display page to show on the screen ; xpos = # of pixels to shift screen right ; ypos = # of lines to shift screen down ; ;============= ;get_x_offset% ;============= ; ; returns the x coordinate of the pixel currently display ; in the upper left corner of the display ; ; entry: no parameters are passed ; ;============= ;get_y_offset% ;============= ; ; returns the y coordinate of the pixel currently display ; in the upper left corner of the display ; ; entry: no parameters are passed ; ;============ ;sync_display ;============ ; ; pauses the computer until the next vertical retrace starts ; ; entry: no parameters are passed ; ;================================================== ;gprintc (charnum%, xpos%, ypos%, colorf%, colorb%) ;================================================== ; ; draws an ascii text character using the currently selected ; 8x8 font on the active display page. it would be a simple ; exercise to make this routine process variable height fonts. ; ; entry: charnum = ascii character # to draw ; xpos = x position to draw character at ; ypos = y position of to draw character at ; colorf = color to draw text character in ; colorb = color to set background to ; ;========================================== ;tgprintc (charnum%, xpos%, ypos%, colorf%) ;========================================== ; ; transparently draws an ascii text character using the ; currently selected 8x8 font on the active display page. ; ; entry: charnum = ascii character # to draw ; xpos = x position to draw character at ; ypos = y position of to draw character at ; colorf = color to draw text character in ; ;=============================================================== ;print_str (seg string, maxlen%, xpos%, ypos%, colorf%, colorb%) ;=============================================================== ; ; routine to quickly print a null terminated ascii string on the ; active display page up to a maximum length. ; ; entry: string = far pointer to ascii string to print ; maxlen = # of characters to print if no null found ; xpos = x position to draw text at ; ypos = y position of to draw text at ; colorf = color to draw text in ; colorb = color to set background to ; ;================================================================ ;tprint_str (seg string, maxlen%, xpos%, ypos%, colorf%, colorb%) ;================================================================ ; ; routine to quickly transparently print a null terminated ascii ; string on the active display page up to a maximum length. ; ; entry: string = far pointer to ascii string to print ; maxlen = # of characters to print if no null found ; xpos = x position to draw text at ; ypos = y position of to draw text at ; colorf = color to draw text in ; ;=========================================== ;set_display_font(seg fontdata, fontnumber%) ;=========================================== ; ; allows the user to specify their own font data for ; wither the lower or upper 128 characters. ; ; entry: fontdata = far pointer to font bitmaps ; fontnumber = which half of set this is ; = 0, lower 128 characters ; = 1, upper 128 characters ; ;====================================================== ;draw_bitmap (seg image, xpos%, ypos%, width%, hieght ) ;====================================================== ; ; draws a variable sized graphics bitmap such as a ; picture or an icon on the current display page in ; mode x. the bitmap is stored in a lifar byte array ; corresponding to (0,0) (1,0), (2,0) .. (width, height) ; this is the same lifar manner as mode 13h graphics. ; ; entry: image = far pointer to bitmap data ; xpos = x position to place upper left pixel at ; ypos = y position to place upper left pixel at ; width = width of the bitmap in pixels ; height = height of the bitmap in pixels ; ; ;======================================================= ;tdraw_bitmap (seg image, xpos%, ypos%, width%, hieght) ;======================================================= ; ; transparently draws a variable sized graphics bitmap ; such as a picture or an icon on the current display page ; in mode x. pixels with a value of 0 are not drawn, ; leaving the previous "background" contents intact. ; ; the bitmap format is the same as for the draw_bitmap function. ; ; entry: image = far pointer to bitmap data ; xpos = x position to place upper left pixel at ; ypos = y position to place upper left pixel at ; width = width of the bitmap in pixels ; height = height of the bitmap in pixels ; ; ;================================== ;copy_page (sourcepage%, destpage%) ;================================== ; ; duplicate on display page onto another ; ; entry: sourcepage = display page # to duplicate ; destpage = display page # to hold copy ; ;========================================================================== ;copy_bitmap (sourcepage%, x1%, y1%, x2%, y2%, destpage%, destx1%, desty1%) ;========================================================================== ; ; copies a bitmap image from one display page to another ; this routine is limited to copying images with the same ; plane alignment. to work: (x1 mod 4) must = (destx1 mod 4) ; copying an image to the same page is supported, but results ; may be defined when the when the rectangular areas ; (x1, y1) - (x2, y2) and (destx1, desty1) - ; (destx1+(x2-x1), desty1+(y2-y1)) overlap... ; no paramter checking to done to insure that ; x2 >= x1 and y2 >= y1. be careful... ; ; entry: sourcepage = display page # with source image ; x1 = upper left xpos of source image ; y1 = upper left ypos of source image ; x2 = lower right xpos of source image ; y2 = lower right ypos of source image ; destpage = display page # to copy image to ; destx1 = xpos to copy ul corner of image to ; desty1 = ypos to copy ul corner of image to ; procedure splitscreen (positon)