  
PAGE  60,132
  
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
;圹                                                                      圹
;圹                             SPLAY                                    圹
;圹                                                                      圹
;圹      Created:   21-Jun-93                                            圹
;圹                                                                      圹
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
  
  
;-------------------------------------------------------------- seg_a -----
  
seg_a           segment para public
                assume cs:seg_a, ds:seg_a
  
                db      256 dup (0)
  
seg_a           ends
  
  
  
;-------------------------------------------------------------- seg_b -----
  
seg_b           segment para public
                assume cs:seg_b, ds:seg_b
  
                db      128 dup (0)
data_3          db      0
data_4          db      2
data_5          db      0
data_6          dw      0
data_7          dw      0
data_8          dw      0
data_9          dw      73CCh
  
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
;
;                       Program Entry Point
;
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
  
  
splay           proc    far
  
start:
                call    sub_1
                push    cs
                pop     ds
                cmp     data_5,0                                ; (5B79:0082=0)
                jne     loc_1                                   ; Jump if not equal
loc_1:
                mov     dx,0
                mov     ax,3D00h
                int     21h                                     ; DOS Services  ah=function 3Dh
                                                                ;  open file, al=mode,name@ds:dx
                jnc     loc_2                                   ; Jump if carry=0
                jmp     loc_11
loc_2:
                mov     data_7,ax                               ; (5B79:0085=0)
                cmp     data_5,0                                ; (5B79:0082=0)
                jne     loc_3                                   ; Jump if not equal
loc_3:
                push    ds
                mov     ax,7424h
                mov     ds,ax
                mov     bx,cs:data_7                            ; (5B79:0085=0)
                mov     cx,0FFFFh
                mov     dx,0
                sub     cx,dx
                mov     ah,3Fh                                  ; '?'
                int     21h                                     ; DOS Services  ah=function 3Fh
                                                                ;  read file, cx=bytes, to ds:dx
                jnc     loc_5                                   ; Jump if carry=0
                jmp     loc_11
loc_4:
                mov     dx,0
                mov     cx,0FFFFh
                mov     ah,3Fh                                  ; '?'
                int     21h                                     ; DOS Services  ah=function 3Fh
                                                                ;  read file, cx=bytes, to ds:dx
                jnc     loc_5                                   ; Jump if carry=0
                jmp     loc_11
loc_5:
                cmp     cx,ax
                jne     loc_6                                   ; Jump if not equal
                mov     ax,ds
                add     ax,1000h
                mov     ds,ax
                inc     cs:data_3                               ; (5B79:0080=0)
                jmp     short loc_4
loc_6:
                or      ax,ax                                   ; Zero ?
                jnz     loc_7                                   ; Jump if not zero
                dec     cs:data_3                               ; (5B79:0080=0)
loc_7:
                pop     ds
                mov     data_6,ax                               ; (5B79:0083=0)
                mov     bx,data_7                               ; (5B79:0085=0)
                mov     ah,3Eh                                  ; '>'
                int     21h                                     ; DOS Services  ah=function 3Eh
                                                                ;  close file, bx=file handle
                cmp     data_5,0                                ; (5B79:0082=0)
                jne     loc_8                                   ; Jump if not equal
loc_8:
                mov     ax,3508h
                int     21h                                     ; DOS Services  ah=function 35h
                                                                ;  get intrpt vector al in es:bx
                mov     data_8,bx                               ; (5B79:0087=0)
                mov     data_9,es                               ; (5B79:0089=73CCh)
                in      al,21h                                  ; port 21h, 8259-1 int IMR
                or      al,3
                out     21h,al                                  ; port 21h, 8259-1 int comands
                mov     dx,1A3h
                mov     ax,2508h
                int     21h                                     ; DOS Services  ah=function 25h
                                                                ;  set intrpt vector al to ds:dx
                mov     si,0
                mov     bx,data_6                               ; (5B79:0083=0)
                mov     cl,data_4                               ; (5B79:0081=2)
                mov     ch,data_3                               ; (5B79:0080=0)
                xor     di,di                                   ; Zero register
                mov     ax,7424h
                mov     es,ax
                mov     ah,0
                mov     al,34h                                  ; '4'
                out     43h,al                                  ; port 43h, 8253 wrt timr mode
                mov     al,36h                                  ; '6'
                out     40h,al                                  ; port 40h, 8253 timer 0 clock
                mov     al,ah
                out     40h,al                                  ; port 40h, 8253 timer 0 clock
                mov     al,90h
                out     43h,al                                  ; port 43h, 8253 wrt timr mode
                in      al,61h                                  ; port 61h, 8255 port B, read
                or      al,3
                out     61h,al                                  ; port 61h, 8255 B - spkr, etc
                in      al,21h                                  ; port 21h, 8259-1 int IMR
                and     al,0FEh
                out     21h,al                                  ; port 21h, 8259-1 int comands
loc_9:
                or      di,di                                   ; Zero ?
                jz      loc_9                                   ; Jump if zero
                cli                                             ; Disable interrupts
                in      al,21h                                  ; port 21h, 8259-1 int IMR
                or      al,1
                out     21h,al                                  ; port 21h, 8259-1 int comands
                sti                                             ; Enable interrupts
                in      al,61h                                  ; port 61h, 8255 port B, read
                and     al,0FCh
                out     61h,al                                  ; port 61h, 8255 B - spkr, etc
                mov     al,34h                                  ; '4'
                out     43h,al                                  ; port 43h, 8253 wrt timr mode
                mov     al,0
                out     40h,al                                  ; port 40h, 8253 timer 0 clock
                out     40h,al                                  ; port 40h, 8253 timer 0 clock
                mov     al,0B6h
                out     43h,al                                  ; port 43h, 8253 wrt timr mode
                mov     ax,533h
                out     42h,al                                  ; port 42h, 8253 timer 2 spkr
                mov     al,ah
                out     42h,al                                  ; port 42h, 8253 timer 2 spkr
                push    ds
                lds     dx,dword ptr cs:data_8                  ; (5B79:0087=0) Load 32 bit ptr
                mov     ax,2508h
                int     21h                                     ; DOS Services  ah=function 25h
                                                                ;  set intrpt vector al to ds:dx
                pop     ds
                in      al,21h                                  ; port 21h, 8259-1 int IMR
                and     al,0FCh
                out     21h,al                                  ; port 21h, 8259-1 int comands
                                                                ;  al = 8, inhibit IRQ3 rs232
                cmp     data_5,0                                ; (5B79:0082=0)
                jne     loc_10                                  ; Jump if not equal
loc_10:
                mov     ax,4C00h
                int     21h                                     ; DOS Services  ah=function 4Ch
                                                                ;  terminate with al=return code
loc_11:
                mov     ax,4C01h
                int     21h                                     ; DOS Services  ah=function 4Ch
                                                                ;  terminate with al=return code
                db      90h
  
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
;
;                       External Entry Point
;
;圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹
  
int_08h_entry   proc    far
                cli                                             ; Disable interrupts
                xor     al,al                                   ; Zero register
                out     42h,al                                  ; port 42h, 8253 timer 2 spkr
                mov     al,ah
                out     42h,al                                  ; port 42h, 8253 timer 2 spkr
                dec     cl
                jnz     loc_13                                  ; Jump if not zero
                mov     cl,cs:data_4                            ; (5B79:0081=2)
                mov     ah,es:[si]
                shr     ah,1                                    ; Shift w/zeros fill
                shr     ah,1                                    ; Shift w/zeros fill
                inc     ah
                inc     si
                or      ch,ch                                   ; Zero ?
                jz      loc_12                                  ; Jump if zero
                or      si,si                                   ; Zero ?
                jnz     loc_13                                  ; Jump if not zero
                push    ax
                mov     ax,es
                add     ax,1000h
                mov     es,ax
                pop     ax
                dec     ch
                jmp     short loc_13
                db      90h
loc_12:
                cmp     si,bx
                jne     loc_13                                  ; Jump if not equal
                not     di
loc_13:
                mov     al,20h                                  ; ' '
                out     20h,al                                  ; port 20h, 8259-1 int command
                                                                ;  al = 20h, end of interrupt
                sti                                             ; Enable interrupts
                iret                                            ; Interrupt return
int_08h_entry   endp
  
  
splay           endp
  
;哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌
;                              SUBROUTINE
;苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘
  
sub_1           proc    near
                cld                                             ; Clear direction
                mov     si,80h
                mov     cl,[si]
                inc     si
                or      cl,cl                                   ; Zero ?
                jz      loc_20                                  ; Jump if zero
loc_14:
                mov     al,[si]
                inc     si
                cmp     al,20h                                  ; ' '
                je      loc_14                                  ; Jump if equal
                cmp     al,0Dh
                je      loc_20                                  ; Jump if equal
                cmp     al,2Dh                                  ; '-'
                je      loc_17                                  ; Jump if equal
                cmp     al,2Fh                                  ; '/'
                je      loc_17                                  ; Jump if equal
                dec     si
                push    cs
                pop     es
                mov     di,0
loc_15:
                mov     al,[si]
                cmp     al,0Dh
                je      loc_ret_16                              ; Jump if equal
                movsb                                           ; Mov [si] to es:[di]
                jmp     short loc_15
  
loc_ret_16:
                ret
loc_17:
                mov     al,[si]
                cmp     al,53h                                  ; 'S'
                je      loc_19                                  ; Jump if equal
                cmp     al,73h                                  ; 's'
                je      loc_19                                  ; Jump if equal
                cmp     al,40h                                  ; '@'
                je      loc_18                                  ; Jump if equal
                jmp     short loc_20
                db      90h
loc_18:
                not     cs:data_5                               ; (5B79:0082=0)
                inc     si
                jmp     short loc_14
loc_19:
                inc     si
                mov     al,[si]
                cmp     al,30h                                  ; '0'
                jbe     loc_21                                  ; Jump if below or =
                cmp     al,35h                                  ; '5'
                jge     loc_21                                  ; Jump if > or =
                mov     ah,35h                                  ; '5'
                sub     ah,al
                mov     cs:data_4,ah                            ; (5B79:0081=2)
                inc     si
                jmp     short loc_14
loc_20:
                mov     dx,2E9h
                jmp     short loc_21
                db      90h
loc_21:
                mov     ax,4C01h
                int     21h                                     ; DOS Services  ah=function 4Ch
                                                                ;  terminate with al=return code
  
seg_b           ends
  
  
  
                end     start
