Posted by Jaz on 1998-03-02
I have an array, 54 bytes in size (1-dimensional) eaach byte is either 0 or 1. These "0"s and "1"s, put in a 6*9 pixels large rectangle result in a small icon: 000000 011100 111 100010 1 1 100010 1 1 100010 1 1 111110 11111 100010 1 1 100010 1 1 000000 This would be the letter "A". What is the fastest way to turn the array data into the icon (the "1"s should get drawn pixels, nothing should be drawn at the "0" positions) with Pascal? This is going to be a text output routine so I need a really fast Pascal or Assembler routine (please no for x := 0 to 5 do for y := 0 to 8 do if array[y*6+x] = 1 then putpixel(x,y) ... ). Jaz --- luna.kil@xxxxxxx.xxx === member of the Coder's Guild: --- http://www.paracatz.com/codersguild/ If anyone hasn't answered this question yet, Array db 0, , 0 .186 MOV SI, Offset Array ; DS = Array Segment Already ; Assuming 320x200x256 Screen Resolution MOV AX, Y SHL AX, 6 MOV DI, AX SHL AX, 2 ADD DI, AX ADD DI, X PUSH 0A000h POP ES ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ; Above Just Sets DI to (X, Y) Position in 320x200x256 Color Mode ; And Sets ES To Video Segment ; Also Make sure DS:SI = Array Seg:Offset MOV AL, Colour ; Set Color Of Character OUTSIDE: MOV CX, 9 ; Loop 9 Rows MOV DL, 80h ; Print 8 Pixels Per Row INSIDE: TEST DL, [SI] ; Test For Pixel to Plot JZ SHORT SKIP ; No Pixel, Skip STOSB ; Plot Pixel JMP SHORT NEXT SKIP: INC DI ; Next Pixel NEXT: SHR DL, 1 ; Shift Bit Mask Right JZ SHORT INSIDE ; If Bit Did Not Shift Off, Not Done Yet INC SI ; Next Byte in Array ADD DI, 320 - 8 ; Next Row on Screen LOOP SHORT OUTSIDE ; Loop Back Up ; Done Scrat/_Secret http://www.nauticom.net/www/secret
Previous post | Next post | Timeline | Home