ECE291 Computer Engineering II Lockwood, Spring 1999

Horizon Web Browser


Goals:

We will implement an x86 assembly program that can display simple HTML documents from a local NetBIOS server. The documents will be displayed on an 1024x768x256 SVGA screen using protected mode to write linear data to the screen. The browser will use buttons to navigate back and forth, have a text field to enter hyperlinks, and scrolling through the document. Our web browser will be complied under NASM and uses WDOSX for protected mode support.

A web browser has never been attempted in ECE 291 before, but the most challenging part of our program is using protected mode to display HTML documents. As far as we know, no one has ever done 1024x768x256, so we think that doing both protected mode and high color graphics will challenge our assembly language knowledge and make the program more useful in the real world.

Required to run: 80386DX or better for 32-bit protected mode, 4MB video card, 32MB RAM.

NOTE: You must run the client and server programs at the same time for Horizon to work properly.


Implementation:


Procedures:

Networking: Isaac Sanchez

The web browser will connect to a "web server" over a session level Netbios connection. The browser will send a request to the server requesting a file. The server will then send the file to the client. The client will then pass the file into a buffer, so that the data can be used by HTMLConvert.

GetFile within Horizon:

Constants:

RESET equ 032h
CANCEL equ 035h
STATUS equ 0B3h
STATUS_WAIT equ 034h
TRACE equ 0F9h
UNLINK equ 070h
ADD_NAME equ 0B0h
ADD_NAME_WAIT equ 030h
ADD_GROUP_NAME equ 0B6h
ADD_GROUP_NAME_WAIT equ 036h
DELETE_NAME equ 0B1h
DELETE_NAME_WAIT equ 031h
CALL_ equ 090h
LISTEN equ 091h
LISTEN_WAIT equ 011h
HANG_UP equ 092h
SEND equ 094h
SEND_WAIT equ 014h
CHAIN_SEND equ 097h
RECEIVE equ 095h
RECIEVE_WAIT equ 015h
RECEIVE_ANY equ 096h
SESSION_STATUS equ 0B4h
SEND_DATAGRAM equ 0A0h
SEND_BCST equ 0A2h
RECEIVE_DATA equ 0A1h
RECEIVE_BCST_DATA equ 0A3h

Structures:

NCB struc
ncb_command db ? ; command code
ncb_retcode db ? ; error return code
ncb_lsn db ? ; session number
ncb_num db ? ; name number
ncb_buf_off dw ? ; ptr to send/receive data offset
ncb_buf_seg dw ? ; ptr to send/receive data segment
ncb_buflen dw ? ; length of data
ncb_callname db 16 dup (?) ; remote name
ncb_name db 16 dup (?) ; local name
ncb_rto db 0 ; receive timeout
ncb_sto db 0 ; send timeout
ncb_post_off dw ? ; async command complete post offset
ncb_post_seg dw ? ; async command complete post segment
ncb_lana_num db ? ; adapter number
ncb_cmd_done db ? ; 0FFh until command completed
ncb_res db 14 dup (?) ; reserved
NCB ends

Inputs:

Outputs:

Modified Variables:

Purpose:

This procedure will be called by the client when it requires a file from the server. It will establish a connection, send the filename to the server and then receive the file. The file will then be written into File_Dump, which is a 1 megabyte allocation in memory.

Server Program:

Constants:

RESET equ 032h
CANCEL equ 035h
STATUS equ 0B3h
STATUS_WAIT equ 034h
TRACE equ 0F9h
UNLINK equ 070h
ADD_NAME equ 0B0h
ADD_NAME_WAIT equ 030h
ADD_GROUP_NAME equ 0B6h
ADD_GROUP_NAME_WAIT equ 036h
DELETE_NAME equ 0B1h
DELETE_NAME_WAIT equ 031h
CALL_ equ 090h
LISTEN equ 091h
LISTEN_WAIT equ 011h
HANG_UP equ 092h
SEND equ 094h
SEND_WAIT equ 014h
CHAIN_SEND equ 097h
RECEIVE equ 095h
RECIEVE_WAIT equ 015h
RECEIVE_ANY equ 096h
SESSION_STATUS equ 0B4h
SEND_DATAGRAM equ 0A0h
SEND_BCST equ 0A2h
RECEIVE_DATA equ 0A1h
RECEIVE_BCST_DATA equ 0A3h

Structures:

NCB struc
ncb_command db ? ; command code
ncb_retcode db ? ; error return code
ncb_lsn db ? ; session number
ncb_num db ? ; name number
ncb_buf_off dw ? ; ptr to send/receive data offset
ncb_buf_seg dw ? ; ptr to send/receive data segment
ncb_buflen dw ? ; length of data
ncb_callname db 16 dup (?) ; remote name
ncb_name db 16 dup (?) ; local name
ncb_rto db 0 ; receive timeout
ncb_sto db 0 ; send timeout
ncb_post_off dw ? ; async command complete post offset
ncb_post_seg dw ? ; async command complete post segment
ncb_lana_num db ? ; adapter number
ncb_cmd_done db ? ; 0FFh until command completed
ncb_res db 14 dup (?) ; reserved
NCB ends

PPROCEDURES:

MAIN:

Inputs:

Outputs:

Modified Variables:

The ReadIn buffer is used to temporarily hold data that is readin from the files and then sent to the client.

Purpose:

The web server will initialize itself, listen for a connection, and then service client's requests. The server will open the file, read in the data into the ReadIn buffer, then send the data over the network. The procedure will then close the file and connection, and wait for another request.

MouseIntsall:

Inputs:

Outputs:

Modified Variables:

Purpose:

Installs the Mouse handler

MouseUninstall:

Inputs:

Outputs:

Modified Variables:

Purpose:

Uninstalls the mouse handler

MouseHandler:

Inputs:

Outputs:

Modified Variables:

Purpose:

Sets the exiting variable to indicate exiting


 

HTML Conversion: George Neurauter

This part of the program takes the incoming HTML file from HTMLBuffer and converts the ASCII into a series of predefined opcodes and ASCII text that will allow HTMLParse to allow the network to get images and sends palette entries and ASCII text to the graphic routines for display.

HTMLConvert:


BGColor equ 14
ImgSource equ 1
LinkRef equ 2
Head1 equ 3
EndHead1 equ 4
Head2 equ 5
EndHead2 equ 6
Head3 equ 7
EndHead3 equ 8
Paragraph equ 9
EndParagraph equ 10
Break equ 11
FontColor equ 12
EndFontColor equ 13
DefaultFont equ 15
EndHTML equ 16
Center equ 20
EndCenter equ 21
 

HTMLParse:

;DataHeader db 20 dup(0) ; Header for all data passed to
; RawBuffer
;The data header to be sent to the screen display
;is defined to be:
;===============

DataType db 1 ;defines data passed
; 0 = BMP
; 1 = Text (default)

LineNumber dd ? ;Current line in RawBuffer

HyperLink db ? ;(text only) - denotes if
; text is hyperlink

; 0 = Not HyperLink
; 1 = Hyperlink (different color)

DefaultFontRGB db 4 dup (0) ;(text only) - gives default font
; color - black by default
; Format - 00(Red)(Green)(Blue) - 00000000 = black by default
; 00000000 = black
; FF000000 = red ,etc.,etc.

FontType db 1 ;(text only) - denotes font size
; passed - 1 default
; 1 = normal(default)
; 2 = Heading 3 (bold?? normal)
; 3 = Heading 2 (2x bold?? normal)
; 4 = Heading 1 (3x bold?? normal)

NumChars db ? ;(text only) - number of chars
; in text packet

BackgroundColor db 0
db 3 dup (0FFh) ; color of background - white by
; default
; 4 bytes reserved

VerifyWord:

CenterText:

SCANHTML:

SCANCONV:

IGNOREHTML:

SendRawData:

  • This function is called by HTMLParse when a line of text or an image is to be written to the screen. [base_selector_file] is given a 20 byte header defined in the comments. Following this is ASCII text data or BMP image data. If the text is to be centered, CenterText is called and the ASCII text is tabbed in to write it to the center of the screen. If an image is to be shown, GetFile is called and the image filename is given to the server program and the image is read into [File_Dump] which is then written to [base_selector_file]. Once the data in [base_selector_file] is written, ConvertData is called and the information is written to the screen. After writing to the screen, FontType is reset to 1 and NumChars = 0 and LineNum is incremented to send to the next line.
  • Inputs: All data header variables, TextBuffer (text), [File_Dump] (image)
  • Outputs: [base_selector_file] which ConvertData uses to write to screen
  • External Procedures Used: GetFile, ConvertData
  • Data used to write data buffer:

    ;DataHeader db 20 dup(0) ; Header for all data passed to
    ; RawBuffer
    ;The data header to be sent to the screen display
    ;is defined to be:
    ;===============

    DataType db 1 ;defines data passed
    ; 0 = BMP
    ; 1 = Text (default)

    LineNumber dd ? ;Current line in RawBuffer

    HyperLink db ? ;(text only) - denotes if
    ; text is hyperlink

    ; 0 = Not HyperLink
    ; 1 = Hyperlink (different color)

    DefaultFontRGB db 4 dup (0) ;(text only) - gives default font
    ; color - black by default
    ; Format - 00(Red)(Green)(Blue) - 00000000 = black by default
    ; 00000000 = black
    ; FF000000 = red ,etc.,etc.

    FontType db 1 ;(text only) - denotes font size
    ; passed - 1 default
    ; 1 = normal(default)
    ; 2 = Heading 3 (bold?? normal)
    ; 3 = Heading 2 (2x bold?? normal)
    ; 4 = Heading 1 (3x bold?? normal)

    NumChars db ? ;(text only) - number of chars
    ; in text packet

    BackgroundColor db 0
    db 3 dup (0FFh) ; color of background - white by
    ; default


    ; 4 bytes reserved

    WriteColor:


    Graphics, Design, and Program Implementation: Chris Wissing and Adil Hussain

    One task of a web browser is to display text and graphics on the screen, but to do this in mode 13h the text would have to be almost one half inch high in order to read, which would not allow many things to be displayed on the screen. In order to overcome this limitation we decided to use protected mode to address more memory and effectively allow us to display text and graphics at 1024X768x16.7M resolution. 

    InitVideo:

    MakeMem:

    ConvertData:

    KillRawBuffer:

    ConvertBMP:

    FillScreen:

    SplashScreen:

    DeInitVideo:

    PrintURL:

    TextDisplay1:

    TextDisplay2:

    TextDisplay3:

    TextDisplay4:

    Initialize:

    Load_Font0:

    Load_Font1:

    Load_Font2:

    Load_Font3:


    Handlers, Installing/Uninstalling/Loop Functions: Chris Wissing and Adil Hussain

    WaitForInput:

    MouseInstall:

    MouseUnInstall:

    MouseHandler:

    Description - This routine will be called by MouseInstall. It should process clicks on the screen.

    Inputs -

    Outputs -

    KeyboardInstall:

    KeyboardUninstall:

    KeyboardHandler:


    Contact Information:

    Chris Wissing - wissing@uiuc.edu

    Adil Hussain - ahussai1@uiuc.edu

    George Neurauter - neurautr@uiuc.edu

    Isaac Sanchez - iisanche@uiuc.edu