Git Product home page Git Product logo

Comments (9)

bkg2018 avatar bkg2018 commented on June 18, 2024

Hello, the sequence for graphic line is <esc>[# not <esc>[?#, and you have to put numeric values. Beware that in Microsoft BASIC, PRINT will insert a space before numeric values, so you have to convert them to raw string using str$(), and separating print arguments with ; is better than adding strings (because of limited string space and garbage collection when out of space) so, if x0, y0 and x1, y1 are variables with your coordinates you put them in a sequence like print chr$(27);"[#";str$(x0);";";str$(y0);";";str$(x1);";";str$(y1);"l";

Be sure to end your print with a ; to avoid a carriage return. And use integer variables for your X and Y, or str$() will put in decimal parts, which will confuse PiGfx at this moment and end the escape sequence prematurely. (I think integer variables can be used by suffixing the name with %.)

You will find the list of supported code here

EDIT: I just checked and the nascom Basic has no specific suffix for integer variables. All numeric variables are single precision with up to 7 decimal digits.

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

from pigfx.

bkg2018 avatar bkg2018 commented on June 18, 2024

I checked and found that STR$() inserts a space before the number too, while print inserts a space beffore and after any numeric value. So to send pure numbers with no space I had to use MID$(STR$(number),2). This is rather annoying but any space will end the escape sequence. Maybe I'll fix that so it's easier to send sequences, but it could have side efffects.

I did a little program to display lines of colors, in 640x480. This will show you how to send sequences to draw lines. Because of some line length limitation I had to break the drawline sequence in two lines : this is easy if you don't forget to end PRINT with a semi-colon ';'. I also end with a 70GOTO70 to avoid breaking the graphics at the end of the program. Just hit Ctrl+C to break away from the endless loop when you're tired of looking at your screen.

9 REM switch to 640x480
10 E$=CHR$(27):PRINTE$;"[=2H";
20 X=0
30 FOR Y=0 TO 479
39 REM set color: <ESC>[38;5;<n>m
40 PRINT E$;"[38;5;";MID$(STR$(Y AND 255),2);"m";
49 REM draw line: <ESC>[#<x0>;<y0>;<x1>;<y1>l
50 PRINT E$;"[#";MID$(STR$(X),2);";";MID$(STR$(Y),2);";";
51 PRINT MID$(STR$(639-X),2);";";MID$(STR$(Y),2);"l";
60 NEXT Y
70 GOTO 70

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

Sorry I did not see this response, just finished my build and will give a try.. also running cpm3 and BBC basic right now, lots of flexibility with BBC basic including in line assembaly.. so hoping to get some software out to test show this solution off..

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

so I ran the code and this is what I get
https://www.dropbox.com/s/hpu5lnojgjyxe7v/20190306_204558.mp4?dl=0

from pigfx.

bkg2018 avatar bkg2018 commented on June 18, 2024

Nice video, it helps to see what happens.

I see the Pi starts fine with the 8x16 font (30 lines of text in 640x480). The difference is you run the test program in CP/M MBASIC, while I was using the ROM basic directly from SCMonitor.

The change of mode doesn't even clear the screen, so obviously something is different in the way both BASICs send their PRINT to the terminal, or maybe it's in CP/M serial driver. My first immediate guess would be that MBASIC or CP/M interprets or intercepts the ESC code or the ESC sequences it doesn't handle. But I have to check that. Most printers of the CP/M era used various control characters so it would have seriously handicaped all softwares.

I will check this as soon as possible.

At worst we could use a useless-as-possible code like CHR$(255) or whatever, which probably neither CP/M nor BASIC would take the risk to intercept. Not sure it would be the greatest idea though, VT100 and related terminals also use characters in the 128+ codes for technical drawing, foreign code pages or whatever.

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

Basic 4.7b loaded from eeprom source and it works https://www.dropbox.com/s/a2xvuei1tv7d37o/20190307_074931.mp4?dl=0

from pigfx.

huskeyw avatar huskeyw commented on June 18, 2024

9 REM switch to 640x480
10 E$=CHR$(27):PRINTE$;"[=2H";
20 X = INT(RND(1)*639)+1 : Y = INT(RND(1)*478)+1
30 CO = INT(RND(1)*254)+1
35 X1 = INT(RND(1)*639)+1 : Y1 = INT(RND(1)*478)+1
39 REM set color: [38;5;m
40 PRINT E$;"[38;5;";MID$(STR$(CO),2);"m";
49 REM draw line: [#;;;l
50 PRINT E$;"[#";MID$(STR$(X),2);";";MID$(STR$(Y),2);";";
51 PRINT MID$(STR$(X1),2);";";MID$(STR$(Y1),2);"l";
60 GOTO 20
this creates random lines and color.. maybe not the best ways as I guessed on color and lines numbers.. but it works

from pigfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.