Does anybody know how to copy 24-bit numbers to the video memory
in a reasonably fast manner in real mode.
This code kinda works but if you call it too much it'll crash big
time. Windows kicks my program out, and dos does a "SYSTEM HALTED!"
' Set a Pixel in vesa 24 bit mode.(Kinda Like PSet)
SUB VesaPSet (x, y, BYVAL clr AS DWORD)
DIM offset AS LOCAL DWORD
DIM bank AS LOCAL WORD
offset = (Bpsl * y) + (x * Bpp) + yOffset
bank = (offset \ &H10000) ' * wingran
offset = offset - &H10000 * bank
bank = bank * wingran
IF bank <> curBank THEN
curBank = bank
! mov ax, &H4F05
! mov bx, &H0000
! mov dx, curBank
! call dword VidFunc
END IF
'everything before this is tested and works in the other modes.
'so I'm sure the problem is in here somewhere.
IF offset < 65535 THEN
! add offset, 2
! mov ax, &HA000
! mov di, offset
! mov es, ax
! mov ax, clr
! stosb
! mov cl, 8
! db &H66
! sar ax, cl
! sub offset, 2
! stosw
END IF
END SUB
Can anyone see off hand where the error is, and could anyone help
me to eliminate the backward memory write in a fast and clean way.
Any help would be grately appreciated, this has been bugging me
for days.
All this trouble came from trying to convert this basic code to
assembly.
DEF SEG = &HA000
IF offset& < 65535 THEN
POKE offset&+2, BITS?(clr)
SHIFT RIGHT clr, 8
POKEI offset&, BITS??(clr)
END IF
as you can see this also writes the numbers to memory backwards
and is way too slow. but it does work.
if you need to see more of the code just let me know.
------------------
[This message has been edited by Buck Huffman (edited May 02, 2002).]
in a reasonably fast manner in real mode.
This code kinda works but if you call it too much it'll crash big
time. Windows kicks my program out, and dos does a "SYSTEM HALTED!"
' Set a Pixel in vesa 24 bit mode.(Kinda Like PSet)
SUB VesaPSet (x, y, BYVAL clr AS DWORD)
DIM offset AS LOCAL DWORD
DIM bank AS LOCAL WORD
offset = (Bpsl * y) + (x * Bpp) + yOffset
bank = (offset \ &H10000) ' * wingran
offset = offset - &H10000 * bank
bank = bank * wingran
IF bank <> curBank THEN
curBank = bank
! mov ax, &H4F05
! mov bx, &H0000
! mov dx, curBank
! call dword VidFunc
END IF
'everything before this is tested and works in the other modes.
'so I'm sure the problem is in here somewhere.
IF offset < 65535 THEN
! add offset, 2
! mov ax, &HA000
! mov di, offset
! mov es, ax
! mov ax, clr
! stosb
! mov cl, 8
! db &H66
! sar ax, cl
! sub offset, 2
! stosw
END IF
END SUB
Can anyone see off hand where the error is, and could anyone help
me to eliminate the backward memory write in a fast and clean way.
Any help would be grately appreciated, this has been bugging me
for days.
All this trouble came from trying to convert this basic code to
assembly.
DEF SEG = &HA000
IF offset& < 65535 THEN
POKE offset&+2, BITS?(clr)
SHIFT RIGHT clr, 8
POKEI offset&, BITS??(clr)
END IF
as you can see this also writes the numbers to memory backwards
and is way too slow. but it does work.
if you need to see more of the code just let me know.
------------------
[This message has been edited by Buck Huffman (edited May 02, 2002).]
Comment