Qbasicnews.com

Full Version: NEED HELP WRITING A 32-BIT TRUE COLOR PIXEL SUB PROGRAM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Code:
'SWITCH TO 800X600X32BPP VIDEO MODE
DETECTVIDEO 800, 600, 32
SETVIDEO
'SETUP COLOR
COLOUR = VAL("&H" + HEX$(BLUE%) + "&H" + HEX$(ALPHA%) + "&H" + HEX$(RED%) + "&H" + HEX$(GREEN%))
' DRAW 32-BIT PIXEL TO SCREEN
MEM16 &HA000, 0, COLOUR, 0

'MOV AX, SEG&
'MOV ES, AX
'MOV WORD PTR [OFF&], DAT&
'RETF RET&

SUB MEM16 (SEG&, OFF&, DAT&, RET&)
DIM ASM AS STRING
ASM = ""
ASM = ASM + CHR$(&HB8) + MKI$(SEG&)
ASM = ASM + CHR$(&H8E) + CHR$(&HC0)
IF LEN(MKI$(OFF&)) < 3 THEN
  ASM = ASM + CHR$(&HC7) + CHR$(&H06) + MKI$(OFF&) + MKI$(DAT&)
ELSE
  ASM = ASM + CHR$(&HC7) + CHR$(&H06) + MKI$(OFF&) + MKI$(DAT&)
  ASM = ASM + CHR$(&HC7) + CHR$(&H06) + MKI$(OFF&+3) + MKI$(DAT&)
END IF
ASM = ASM + CHR$(&HCA) + MKI$(RET&)
DEF SEG = VARSEG(ASM)
  CAL ABSOLUTE(SADD(ASM))
DEF SEG
END SUB
Erm... what? What language is that in? What's the program supposed to do? And, most of all, what do you want out of us?
1) The program is written in QBASIC 1.1 for dos.
2) I am using a VESA Lib I programmed about 2 months ago.
3) The program is supposed to plot a 32bpp pixel in the upper left hand counter.
1.-The program may be in QB but you are issuing machine-code instructions, are you asking us to read machine-code? Could you put the assembler instructions as comments in each line for everyone to read?

2.- VESA modes are banked, you can't use a simple memcopy to access the whole screen. There is some bank switching code missing...

3.- You call some DETECTVIDEO and SETVIDEO of your own, you don't post them. Perhaps the problem is there?

4.- What's the problem?


PS: If you need absolutely to use high resolution switch to FB, it will spare you a lot of headaches....
Code:
COLOUR = VAL("&H" + HEX$(BLUE%) + "&H" + HEX$(ALPHA%) + "&H" + HEX$(RED%) + "&H" + HEX$(GREEN%))
BARG?
Never heard of that color format..

Anyways, afaik 32bit, or even anything above 8bit, is NOT supported by the VESA standard.. some cards have it, some dont.
Also, VESA is outdated, and wont work on 99.99% of modern computers

Like Antoni said, use FB if you want highres.
You're right, Z!re, VAL will stop reading after the blue value. Perhaps you found the problem, without knowing what it is Big Grin
Quote:You're right, Z!re, VAL will stop reading after the blue value. Perhaps you found the problem, without knowing what it is Big Grin
I noticed the multiple &H's too, but BARG?.. Just has me stumped Tongue
@Z!re
the code works.....
Quote:@Z!re
the code works.....
okay! it works. and we still don't know what the original problem is/was...
If you really need to program using 32 bit colour I would recommend learning FreeBasic, it has native 32bit colour.
Pages: 1 2