Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP display offset #3

Open
diemheych opened this issue Nov 29, 2023 · 13 comments
Open

BMP display offset #3

diemheych opened this issue Nov 29, 2023 · 13 comments

Comments

@diemheych
Copy link

I borrowed your BMP display code and noticed the image was slightly offset. I had to change (50-j) to (49-j) in the line below. Reviewing the code, this looks like it is what it should be (to me anyway :-).

for(byte j=0; j<50; j++) d[j]=~bmp[(129+i*52)+(50-j)]; // INvert and flip

@zooxo
Copy link
Owner

zooxo commented Nov 30, 2023

Glad that I could provide something useful.
That's definitely a bug - thank's for this.
May I ask: Which application do you make?

@diemheych
Copy link
Author

diemheych commented Nov 30, 2023

I ported FORTH to the DM41X, I haven't setup a repository yet but you can see it at: https://youtu.be/jUzSyXVy9bo

BTW, I had to tweak the BMP code further as although it's monochrome it still uses a colour table so you can't invert all BMP files and you need to check the colour table first as the index into the colour table could point to white then black or black then white. Hope that makes sense. Doesn't affect your program as I believe you only load your own BMP files that have the table the same way.

@zooxo
Copy link
Owner

zooxo commented Dec 1, 2023

Looks great - you solved the need of a keyboard very good - I'm a FORTH fan too.

Right now I'm programming some kind of application suite (calculator, spreadsheet, 'powerpoint', text editor,...). Maybe you want to take a look at https://github.com/zooxo/desk42
If I may ask directly: Do you want to share your code to embed a forth app to desk42?
If you are interested I can upload a pgm for you.
I also programmed an aviation app (e6b) for desk42 with big help of Jim Williams - a dedicated pilot in the US.

Btw - when programming my 'powerpoint' I made some documentation to implement BMP files (size: 200x104) - maybe you can use this:

// BMP-FILESIZE = HEADER+INFOHEADER+COLORTABLE+IMAGE = 14+40+8+2912 = 2974 = b9e
//
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ... 14 bytes HEADER
// B, M, -filesize-- -reserved-- -datoffset-
// 42 4d 9e 0b 00 00 00 00 00 00 3e 00 00 00
//
// 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 40 bytes INFOHEADER
// --IH_size-- ---width--- --height--- plans -bpp-
// 28 00 00 00 c8 00 00 00 68 00 00 00 01 00 01 00 - width=200=c8h, height=104=68h
//
// 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
// compression --img_size- -xpixelspm- -ypixelspm- colors_used importantcol
// 00 00 00 00 60 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
//
// 54 55 56 57 58 59 60 61 - 8 bytes COLORTABLE
// -R_G_B-- -R_G_B--
// 00 00 00 00 df f5 cc 00 ... black white/lightgreen
//
// 62 - 2973 ... 2912 bytes IMAGE PIXEL MATRIX (104 lines á 28 bytes = 2912 bytes = b60h)
// ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff 0f00 0000 ... linepixel+pads (to nearest 4-byte boundary)

@diemheych
Copy link
Author

diemheych commented Dec 1, 2023

I don't have a DM42 so would be difficult to use your programs as they keycodes and labels are different unfortunately.

So desk42 isn't available yet? I assume it's a single pgm with it all in one? You mention games but I can't see any in the readme, what games are you looking at?

I plan to put up a repository for DM-FORTH when I get some time.

Is your 35 an emulator or simulator?

Thank you for the BMP info, I think mine is working ok so far, I have tested with several of the standard and additional off images available with colour maps around both ways.

@zooxo
Copy link
Owner

zooxo commented Dec 2, 2023

Hi!

I tried your FORTH on my DM42. Despite warnings (wrong system) it runs properly and stable (good work) - only other keytable. Does it support float calculation? I tried "22 7 / ." - but I got 3 (instead of 3.14). Floating variable support might be essential to run on a calculator.

Did you implement an existing FORTH - which one?

I uploaded the recent version of DESK42 to github.com/zooxo/desk42/diemheych.pgm - if you want to try? Most apps are running (STAX calculator, RAX spreadsheet, E6B aviation, MERGE 2048game, ARENA 3dshooter, HP-35 simulator, CAL calendar, SCORE scoretable).

I programmed 2 games: MERGE ... a 2048 like puzzle game and ARENA ... a simple 3d shooter (just to see what the DM is capable in graphics and when it goes to FPS limits. ARENA runs well at 20 FPS (when on power grid) or 10 FPS (running on battery).

I'm working on DESK42 for almost one year - and need some months for PIC, TXT and FLEX ... and testing.

Regards

@diemheych
Copy link
Author

I receive "not found" for the pgm link above.

The Forth I ported is integer only and a number with a decimal point represents a double. Floating point would be good, I'll have to see how difficult it would be to add.

@zooxo
Copy link
Owner

zooxo commented Dec 4, 2023

It's too bad that your FORTH doesn't support floating number operations.

Which FORTH did you use (gforth, amforth)?

Sorry, the (hopefully) working link is:
https://github.com/zooxo/desk42/diemheych.pgm

If it's still not working please try the link "per hand" - it's there (github zooxo - the desk42 directory). Strange - but as I tried the above link didn't work (but the file is there).

Regards

@diemheych
Copy link
Author

Hi, the link didn't work and it looks like the other copy has now been deleted.

I'm not sure how I will go with the keyboard differences. I might be able to borrow a DM42 though.

The FORTH is a simple, portable C implementation of Jones FORTH from https://gist.github.com/lbruder/10007431.
I started with this for the HP 50G and was confident it would work on the DM41X. Maybe I'll look at different FORTH implementations instead of implementing floating point myself.

@diemheych
Copy link
Author

BTW, how did you create your BMP help files?

@zooxo
Copy link
Owner

zooxo commented Dec 20, 2023

I'm using GIMP - but my version is a bit tricky to save the right black/white-BPM format. I had very bad experiences with Windows/Paint.

Btw I like the clear structure of Leif Bruder's FORTH - unfortunately it doesn't run with float variables. I'll try to stick with zFORTH (when there is time) - hopefully it will fit to the DM's memory restrictions.

@diemheych
Copy link
Author

Which zFORTH repo? I searched and several came up. If it's small with FP I will have a look - thanks

@diemheych
Copy link
Author

BTW, how did you design your font for this? Is there any particular software you used to do this?

@zooxo
Copy link
Owner

zooxo commented Jan 17, 2024

Actually I'm very fast with GIMP (copy, paste) and 'painted' all characters. At this small size it's hard to find a font that gives a good readability.
You might have a look at the long post in the DM forum (googling "useful content for the ultimative offimg"). There you can find an ascii table to copy/paste characters. Finally I developed/painted a complete periodic table of elements on one screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants