User:Johnburger/Demo/Ints/Debug/Init

From OSDev Wiki
Jump to navigation Jump to search

To initialise the debugger just requires some initial parameters to be set up, and the current TSS to be marked as a System.TSS to prevent the Task Switcher switching away and bouncing balls all through the display.

Once the Debugger is finished, the .Done routine is called to clear the screen, and repair the current TSS.

Demo/Ints/Debug/Init.inc

;
; Ints/Debug/Init.inc
;

; This module handles the Debug interrupt Init and Done routines.

;...............................................................................
Ints.Debug.Init:
                MOV             AX,Selector(GDT.VGA, GDT, RPL0)
                MOV             ES,AX           ; Point to Screen, for STOSW
                MOV             AX,Selector(GDT.Data, GDT, RPL0)
                MOV             FS,AX           ; Point to global (Key) Data

                ; Default Show.Row format
                CALL            Ints.Debug.Key.Format.Bytes
                CALL            Ints.System.Init
                RET

;...............................................................................
Ints.Debug.Done:
                CLD                             ; Work forwards
                MOV             AH,Debug.Colour.Blank
                MOV             AL,' '
                MOV             DH,Debug.VGA.Height
                MOV             EDI,(Debug.VGA.Top*VGA.Cols+Debug.VGA.Left)*2
.Loop:
                MOV             ECX,Debug.VGA.Width
                REP             STOSW
                ADD             EDI,(VGA.Cols-Debug.VGA.Width)*2
                DEC             DH
                JNZ             .Loop

                CALL            Ints.System.Done
                RET