opinion (Developers)
> Possibly disagree. Have to see source code.
Here you have it as written this morning, raw cut&paste - the whole installation section, I can't seem to be able to copy the whole source into this box nor is it necessary - refer to the v 1.5 for context. It's unpolished, untested and just to give you crumbles to attack until I give you more food :=)
;-------------------------------------------- installation
align 16
; everything before this point /might/ be trashed by further processing,
; offset (from initial PSP) MUST be >= max resident's size (currently 1F0h)
.ERRNZ $-Firstb LT 0F0h ; resident size minus 100h bytes
NMCB DB "M" ; or "Z"
NOwner DW 0 ; owner
NParas DW 0 ; size
DB 11 dup (?)
NPSP DW 40h/2 dup (?) ; new mini-PSP while installing
Shft EQU 10h+(NPSP-firstb) shr 4 ; #paras from old to new PSP
Shftb = Shft shl 4 ; #bytes dø
doinstall:
if ?ATCHECK
; (skipped)
endif ; ?ATCHECK
; KBINST3 : enhanced conventional memory use.
; : copy MCB and PSP (to NMCB)
; : adjust seg reference in copied PSP
; : adjust new MCB, mark self-owned.
; : activate new PSP
; : split our own container at newMCB
; : *CLI*
; : *manually* mark our low part, and environment (if any) MCBs owner-free
; : DOS-allocate resident block (from low) see note 2 below
; : *STI*
; : copy resident part down into new block.
; : set ptrs to previous ints 15 & optional 2F (in new code)
; : activate new ints
; : done! back to caller (DOS) by int 21/4C
;Notes:
;1- we never execute from freed memory,
;2- we use int 21/48 rather than duplicate its function. We are not worried that
; DOS will STI internally, TSRs interrupting int21 should know how to behave.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 1 - copy MCB+PSP out of the way (10h+40h bytes !) -> NMCB,NPSP
mov cx,(10h+40h)/2 ; size of MCB+size of mini-PSP
CLD
MOV AX, CS:[psp]
DEC AX ; AX: seg oldMCB
MOV DS, AX ; Assume DS: oldMCB
mov BX, AX
add BX, Shft ; BX: seg newMCB
MOV ES, BX ; Assume ES: newMCB
sub si, si
sub di, di
rep movsw ; copy 5 paras, from MCB (really)
inc BX ; BX: seg newPSP
mov es:[10h+36h], BX; adjust seg(handles pointer)
; 2 - prepare new MCB, keeping copied M or Z signature
mov es:[1], BX ; owner (self)
sub word ptr es:[3], Shft ; size
; 3 - make copied PSP active :
mov ah, 50h
int 21h ; ASSUME BX:newPSP
; 4 - *CLI*. Adjust Original MCB to cover only up to NewMCB, and mark it FREE.
CLI ; protection
mov byte ptr ds:[0], 'M' ; signature
mov word ptr ds:[3], Shft-1 ; paragraphs
mov word ptr ds:[1], 0 ; mark free !
; 5 - Mark our environment block, if any, FREE :
mov CX,DS:[10h+2Ch]
jcxz @F
DEC CX
mov ES, CX
MOV word ptr ES:[1], 0 ; owner=None
@@:
; 6 - ask DOS for a suitable block; make it owned by system
; calculate resident size.
if ?SUPPINT2F
mov BX, offset EndofInt2F
test byte ptr inst2f,01
jnz @F
endif
mov BX, offset EndofInt15
@@:
mov al, BL
shr BX, 4
and al,0fh
jz @F
inc BX
@@:
mov prglen, BX ; local store (BP rel)
mov AH, 48h ; DOS allocate for resident code
int 21h ; will STI internally, not a problem
; JC XXXX ; ... error? shouldn't happen :=) TODO
...rec mov CS:[psp], AX ; to be kept by resident copy
push AX
dec ax ; MCB of new block
mov ES, AX
mov bx, 0008
mov es:[0001], bx ; owner = System
xor si,si
xor di,di
mov word ptr es:[BX],"BK" ; indicator = "KBF"
mov word ptr es:[BX+2]," F"
pop ES
; 7 - Copy resident part to its final place :
INT 3
; ES: newly allocated for Resident Segment
mov BX, KBRES ; segment
mov DS, BX ; source
mov cx,prglen ; paragraphs
shl cx,3 ; -> words
rep movsw
; 4.5 - set pointers to previous ints in resident code :
push ES
pop DS ; resident segment
ASSUME DS: KBRES ; in fact, DS: *new* Resident Segment
mov ax, 3515h
int 21h
mov word ptr orgint15+0, bx
mov word ptr orgint15+2, es
if ?SUPPINT2F
test byte ptr inst2f,01
jz @F
mov ax, 352Fh
int 21h
mov word ptr orgint2f+0, bx
mov word ptr orgint2f+2, es
ASSUME DS: NOTHING
@@:
endif
; 5 - Activate interrupt hook(s) :
if NOT ?KBZERO
if ?KBFR ; make sure dead key related flags are reset :
PUSH DS
push 40h ; BIOS data seg
pop ds
ASSUME ds:BIOSSEG
and Cflags, not 3
POP DS
ASSUME DS:nothing
endif
endif
INT 3
; ASSUME DS: new (resident) segment
mov dx,offset introu15
mov ax,2515h
; push ds
int 21h
; pop ds
if ?SUPPINT2F
test byte ptr inst2f,01 ; local storage
jz @F
mov dx,offset introu2f
mov ax, 252fh
int 21h
@@:
endif
INT 3
; 6 - Installation done, return to DOS.
mov ax,4c00h
int 21h
main endp
; ---------------------------------------------------------------------
---
Ninho
Complete thread:
- keyb: new! memory scheme, easy TEST - Ninho, 22.05.2011, 19:10 (Developers)
- boring - ecm, 22.05.2011, 23:58
- boring - Ninho, 23.05.2011, 01:20
- not that boring after all (nt) - ecm, 23.05.2011, 13:27
- boring - Ninho, 23.05.2011, 01:20
- review - ecm, 23.05.2011, 13:18
- review - Ninho, 23.05.2011, 23:10
- review - ecm, 24.05.2011, 00:45
- review - Ninho, 24.05.2011, 12:50
- review - ecm, 24.05.2011, 15:20
- of TSR powers & limits - Ninho, 25.05.2011, 11:24
- Swap! - ecm, 25.05.2011, 14:13
- of TSR powers & limits - Ninho, 25.05.2011, 15:14
- Swap! - ecm, 25.05.2011, 14:13
- of TSR powers & limits - Ninho, 25.05.2011, 11:24
- review - ecm, 24.05.2011, 15:20
- review - Ninho, 24.05.2011, 12:50
- review - ecm, 24.05.2011, 00:45
- fix - Ninho, 29.05.2011, 14:36
- opinion - ecm, 29.05.2011, 14:49
- opinion - Ninho, 29.05.2011, 16:36
- evaluation - ecm, 29.05.2011, 17:26
- evaluation - Ninho, 29.05.2011, 21:00
- hardly a 100% solution - ecm, 29.05.2011, 22:17
- hardly a 100% solution - Ninho, 30.05.2011, 19:26
- hardly a 100% solution - ecm, 30.05.2011, 19:33
- hardly a 100% solution - Ninho, 30.05.2011, 21:14
- hardly a 100% solution - ecm, 30.05.2011, 21:20
- hardly a 100% solution - Ninho, 30.05.2011, 23:50
- allocation no higher than the PSP - ecm, 30.05.2011, 23:56
- allocation no higher than the PSP - Ninho, 01.06.2011, 18:56
- allocation no higher than the PSP - ecm, 01.06.2011, 19:10
- allocation no higher than the PSP - Ninho, 01.06.2011, 18:56
- allocation no higher than the PSP - ecm, 30.05.2011, 23:56
- hardly a 100% solution - Ninho, 30.05.2011, 23:50
- hardly a 100% solution - ecm, 30.05.2011, 21:20
- hardly a 100% solution - Ninho, 30.05.2011, 21:14
- hardly a 100% solution - ecm, 30.05.2011, 19:33
- hardly a 100% solution - Ninho, 30.05.2011, 19:26
- hardly a 100% solution - ecm, 29.05.2011, 22:17
- evaluation - Ninho, 29.05.2011, 21:00
- opinion - Ninho, 30.05.2011, 19:04
- sti - ecm, 30.05.2011, 19:26
- evaluation - ecm, 29.05.2011, 17:26
- opinion - Ninho, 29.05.2011, 16:36
- opinion - ecm, 29.05.2011, 14:49
- review - Ninho, 23.05.2011, 23:10
- boring - ecm, 22.05.2011, 23:58