China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 23:14
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » [Repost] Displaying 24-bit BMP image files View 1,625 Replies 6
Original Poster Posted 2003-11-13 00:00 ·  中国 江西 吉安 电信
初级用户
Credits 182
Posts 27
Joined 2003-11-12 00:00
22-year member
UID 12731
Gender Male
Status Offline
Floor 2 Posted 2004-02-11 00:00 ·  中国 辽宁 沈阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
Awesome! I admire it! Need to find the gap!
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 3 Posted 2004-03-12 00:00 ·  中国 广东 深圳 罗湖区 电信
中级用户
★★
Credits 223
Posts 52
Joined 2004-03-07 00:00
22-year member
UID 19481
Gender Male
Status Offline
I'm just learning. Can this be compiled and used just like this?
Floor 4 Posted 2004-03-15 00:00 ·  中国 上海 静安区 电信
初级用户
Credits 150
Posts 15
Joined 2004-03-05 00:00
22-year member
UID 19256
Gender Male
Status Offline
BASIC?? Awesome? This is still my first time seeing someone code this in BASIC. Before, I thought BASIC didn't have this kind of capability!
Floor 5 Posted 2004-03-18 00:00 ·  中国 湖南 长沙 电信
初级用户
Credits 123
Posts 6
Joined 2004-02-05 00:00
22-year member
UID 16763
Gender Male
Status Offline
BASIC can do a lot more, it's just that our skills have limited it
Floor 6 Posted 2004-03-19 00:00 ·  中国 上海 联通
初级用户
Credits 182
Posts 27
Joined 2003-11-12 00:00
22-year member
UID 12731
Gender Male
Status Offline
Hey, I still have to say this: relying on BASIC alone makes it impossible to write really ideal programs; you still have to learn assembly language. Borrow assembly's low-level capabilities, QB or C's convenience for writing and editing programs, and take cues from the structural forms of other visual languages, and under DOS you can still write some pretty good stuff.
Floor 7 Posted 2006-06-04 20:35 ·  中国 湖南 长沙 雨花区 电信
中级用户
★★
Credits 282
Posts 126
Joined 2006-05-17 22:29
20-year member
UID 55724
Status Offline
Principles:
1. Access the VGA palette registers to get/set the palette:

OUT &H3C8, Loops
OUT &H3C9, ASC(MID$(Change$, Loops * 3 + 1, 1)) - 35
OUT &H3C9, ASC(MID$(Change$, Loops * 3 + 2, 1)) - 35
OUT &H3C9, ASC(MID$(Change$, Loops * 3 + 3, 1)) - 35


2. Understand the BMP file format.

3. Use the error diffusion algorithm with dithering to draw true-color images. Generally, books on "Computer Graphics" all explain the error diffusion algorithm. The key is this line:

IF PixelBlue >= PixelArray(PixelArraySearch, 1) - ColorDif AND PixelBlue = PixelArray(PixelArraySearch, 2) - ColorDif AND PixelGreen = PixelArray(PixelArraySearch, 3) - ColorDif AND PixelRed = (ColorPalette(Loops, 3) - Movement) AND PixelBlue = (ColorPalette(Loops, 2) - Movement) AND PixelGreen = (ColorPalette(Loops, 1) - Movement) AND PixelRed 3 THEN




What do these things have to do with assembly?
The most important things in learning assembly are learning computer architecture and instruction optimization.
But to write actual programs, what you mainly need is this knowledge:
1. Hardware interface programming. For example, this program accesses VGA registers (you can use the in and out instructions in assembly; QB just turns them into functions)
2. Understand file formats, and know how data is stored, so you can process it
3. To write graphics code, there are professional "Computer Graphics" books you can refer to; algorithm issues are unrelated to the programming language in the first place

As long as you learn those three things above, you can write this kind of program in any programming language. By that point, assembly optimization becomes necessary.



Recommended: "Graphics Programming Black Book (Michael Abrash's Graphics Programming Black Book)," a comprehensive introduction to how to write graphics programs under DOS (2D and 3D) and assembly optimization (real-time rendering):
http://www.netyi.net/Resource/933a25cf-fa0e-4dab-b9d7-e58a0ea8f52e.aspx

[ Last edited by zyl910 on 2006-6-4 at 20:40 ]
人类存在的目的就是试图理解人类为何存在
Forum Jump: