## News:

Message to All Guests
NB: Posting URL's See here: Posted URL Change

## Recent posts

#1
##### 16 bit DOS Programming / Re: VGA Planes -Plot Pixel and...
Last post by tda0626 - Today at 07:42:22 AM
Quote from: NoCforMe on Today at 05:28:48 AMHave you read Michael Abrash's chapter on programming the VGA?
I haven't read it, but the guy has a knack for explaining things clearly, in plain English.

I read the section explains it but it still puzzles me on certain aspects.

Also found these sites:

https://uchicago-cs.github.io/pintos/specs/freevga/vga/vga.htm

http://qzx.com/pc-gpe/

Quote from: FORTRANS on Today at 06:43:12 AMHi Tim,

Quote from: tda0626 on Today at 03:28:48 AMSo there is 256KB in VGA memory divided up into 4 planes but each plane is 16000 bytes. The math of that doesn't make sense to me or is it writing 4 pixels when I plot one pixel? Confused...

In the VGA 320x200 256 color mode you have 320*200 = 64,000 bytes.
Divide into four planes and each plane holds 16,000 bytes (unchained).
When you write a pixel you select which plane(s) to write to.

Regards,

Steve N.

How does that relate to 256KB of video memory if all 4 planes are just 16000 bytes? Guess that is where I getting hung up on, Steve.

I made some notes that I think are right for writing to a video plane. Does it look right?

Write to Video Plane:
1. Plane 0 = width * height / 4 * 0 or just 0
2. Plane 1 = width * height / 4 * 1
3. Plane 2 = width * height / 4 * 2
4. Plane 3= width * height / 4 * 3
5. Set Sequencer Controller 0x3c4 to register 2 - Map Mask Register
6. Map Mask Register - set 0x3c5 to (   SHL 1 ( X & 3) )
7. Write color to plane ( Plane + width * Y / 4 + X )

#2
##### 16 bit DOS Programming / Re: VGA Planes -Plot Pixel and...
Last post by FORTRANS - Today at 06:43:12 AM
Hi Tim,

Quote from: tda0626 on Today at 03:28:48 AMSo there is 256KB in VGA memory divided up into 4 planes but each plane is 16000 bytes. The math of that doesn't make sense to me or is it writing 4 pixels when I plot one pixel? Confused...

In the VGA 320x200 256 color mode you have 320*200 = 64,000 bytes.
Divide into four planes and each plane holds 16,000 bytes (unchained).
When you write a pixel you select which plane(s) to write to.

Regards,

Steve N.
#3
##### 16 bit DOS Programming / Re: VGA Planes -Plot Pixel and...
Last post by NoCforMe - Today at 05:28:48 AM
Have you read Michael Abrash's chapter on programming the VGA?
I haven't read it, but the guy has a knack for explaining things clearly, in plain English.
#4
##### 16 bit DOS Programming / VGA Planes -Plot Pixel and Pag...
Last post by tda0626 - Today at 03:28:48 AM
What compelled the engineers to design this monstrosity? Jk

I have been trying to wrap my head around the plot pixel and Page flip in unchain mode for the last week or so by reading everything I can find on the subject to understand the fundamentals but I am scratching my head.

So there is 256KB in VGA memory divided up into 4 planes but each plane is 16000 bytes. The math of that doesn't make sense to me or is it writing 4 pixels when I plot one pixel? Confused...

The page flip as far as I can tell is done through the CRT Controller high and low address registers but how do I calculate the address of the plane I am on?

Also, if I want to write to a certain plane, do I need to switch the plane with the Map Mask register?

Tim

#5
##### MasmBasic & the RichMasm IDE / Create a shortcut
Last post by jj2007 - June 21, 2024, 07:49:08 AM
`include \masm32\MasmBasic\MasmBasic.inc ; ## COM demo: create shortcut ##include IShellLink.inc; credits to Gerardo Friedrich (BiteRider), Jaymeson Trudgen (NaN) and Ernest Murphy (source).codeCreateSC proc pPathObj, pPathLinkLOCAL WebInterface, pIPersistFile  lea edi, WebInterface  pIShellLink equ dword ptr [edi]  .if rv(CoCreateInstance, offset CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, offset IID_IShellLink, edi)==S_OK CoInvoke pIShellLink, IShellLinkWVtbl.QueryInterface, addr IID_IPersistFile, addr pIPersistFile .if eax==S_OK CoInvoke pIShellLink, IShellLinkWVtbl.SetPath, pPathObj CoInvoke pIShellLink, IShellLinkWVtbl.SetIconLocation, pPathObj, 0 .if eax==S_OK CoInvoke pIPersistFile, IPersistFileVtbl.Save, pPathLink, TRUE PrintLine Str\$("Done, result=%i", eax) .endif .endif  .endif  retCreateSC endp  SetGlobals src\$, lnk\$  Init  .if rv(OleInitialize, NULL)==S_OK wLet src\$=wRec\$(MbExeFolder\$)+"ShortCut.asc" wLet lnk\$=wRec\$(MbExeFolder\$)+"ScSource.lnk" invoke CreateSC, src\$, lnk\$ invoke OleUninitialize  .endifEndOfCode`
#6
##### The Laboratory / Re: Trimming spaces and tabs i...
Last post by NoCforMe - June 19, 2024, 07:01:08 AM
Thanks! Great explanation.
#7
##### The Laboratory / Re: Trimming spaces and tabs i...
Last post by Vortex - June 19, 2024, 06:36:19 AM
Hi NoCforMe,

`    xor    al,32 ; XORing al with 32 has two results : zero or another value    mov    ah,al ; copy al to ah    xor    al,41 ; To get back the original value of al, we can do again xor al,32. This would be followed by                    xor al,9. Combined XOR operations removes the extra second xor al,32  : 32 xor 9 = 41                   xor ( xor al,32 ) , 9 = xor al,41                   XORing al with 41 has two results : zero or another value    and    ah,al ; This and operation will reduce the number of results ( ah and al ) to one :                   The possible combinations :                   ah=0 , al=non-zero , and ah,al -> 0                   ah=non-zero , al=0 , and ah,al -> 0                   ah=non-zero , al=non-zero , and ah,al -> non-zero    add    ah,0FFh ; if (and ah,al) = 0 => 0+255 = 255 = > the carry flag is zero.                      if (and ah,al) = non-zero => <non-zero value> + 255 will cause an overflow setting the                      carry flag to 1    adc    edx,0   ; Carry flag = 0 => the original value of al was 32 or 9 and they should be bypassed with                      the condition carry flag=0 : edx + 0 + carry flag 0 = edx                   ; Carry flag = 1 => the original value of al was not 32 or 9 and this character should be                      preserved in the buffer pointed by edx : edx + 0 + carry flag 1 = edx+1    cmp    al,9    ; After the previous operations xor al,32 and xor al,41, the NULL terminator is converted to                     ASCII 9    jne    @b      ; If al!=9 the go to return back to the beginning of the loop.`
#8
##### The Laboratory / Re: Trimming spaces and tabs i...
Last post by NoCforMe - June 19, 2024, 06:02:51 AM
So can you explain to us how this works?
`    xor    al,32    mov    ah,al    xor    al,41    and    ah,al    add    ah,0FFh    adc    edx,0    cmp    al,9    jne    @b`It may be obvious to you, but it sure isn't to me.
#9
##### The Laboratory / Re: Trimming spaces and tabs i...
Last post by Vortex - June 19, 2024, 04:51:36 AM
Another version :

- Removed conditional setnz instructions.
- No need of ebx.

`include     RemoveSpaces.inc.datamystr       db '    This    Is   A       Test String.',0msg         db '%s',13,10,'Lenght of string = %u',0.data?buffer      db 256 dup(?)buffer2     db 32 dup(?).codeRemoveSpaces PROC str1:DWORD,buff:DWORD    mov     ecx,str1    mov     edx,buff@@:    movzx   eax,BYTE PTR [ecx]    mov     BYTE PTR [edx],al    add     ecx,1    xor     al,32    mov     ah,al    xor     al,41    and     ah,al    add     ah,0FFh    adc     edx,0    cmp     al,9    jne     @bfinish:    mov     eax,edx    sub     eax,buff    retRemoveSpaces ENDPstart:    invoke  RemoveSpaces,ADDR mystr,ADDR buffer    invoke  wsprintf,ADDR buffer2,\            ADDR msg,ADDR buffer,eax    invoke  StdOut,ADDR buffer2    invoke  ExitProcess,0END start`
#10
##### The Laboratory / Re: Trimming spaces and tabs i...
Last post by sudoku - June 18, 2024, 09:51:55 PM
Quote from: TimoVJL on June 18, 2024, 09:06:29 PMAlso is an as a linux as or windows as.exe ?
You do have a sense of humor.
No, not using "as" as assembler here.    therefore I am not assembling said clam.