📄 api1.asm
字号:
rol ax,1
xor ax,1
pop bx
ret
endfunc obq_stat,us
; pan_apply
function pan_appl,y
frame
arg panhan,dword
arg winhan,dword
arg namptr,ptr
arg lname,word
arg winptr,ptr
arg keyptr,ptr
push bp
mov bp,sp
push bx
push es
push_dptr namptr[bp]
xor ax,ax
push ax
push lname[bp]
push winhan+2[bp]
push winhan[bp]
@send apply,panhan[bp]
load_dptr es,bx,winptr[bp]
pop es:[bx]
pop es:[bx+2]
load_dptr es,bx,keyptr[bp]
pop es:[bx]
pop es:[bx+2]
@send status,panhan[bp]
pop ax
pop bx
pop es
pop bx
pop bp
ret
endfunc pan_appl,y
; ptr_getscale
function ptr_gets,cale
frame
arg ptrhan,dword
arg rowptr,ptr
arg colptr,ptr
push bp
mov bp,sp
push bx
push es
@send getscale,ptrhan[bp]
load_dptr es,bx,colptr[bp]
pop es:[bx]
pop ax
load_dptr es,bx,rowptr[bp]
pop es:[bx]
pop ax
xor ax,ax
pop es
pop bx
pop bp
ret
endfunc ptr_gets,cale
; ptr_setscale
function ptr_sets,cale
frame 1
arg ptrhan,dword
arg row,word
arg col,word
push bx
mov bx,dvm_setscale*256+dva_tos
ep_dword_int_int:
push bp
mov bp,sp
xor ax,ax
push ax
push row[bp]
push ax
push col[bp]
push ptrhan+2[bp]
push ptrhan[bp]
mov ah,12h
int 15h
xor ax,ax
pop bp
pop bx
ret
endfunc ptr_sets,cale
; ptr_write
function ptr_writ,e
push bx
mov bx,dvm_write*256+dva_tos
jmp short ep_dword_int_int
endfunc ptr_writ,e
; win_cursor
function win_curs,or
arg winhan,dword
arg row,word
arg col,word
push bx
mov bx,dvm_at*256+dva_tos
jmp short ep_dword_int_int
endfunc win_curs,or
; tim_addto
function tim_addt,o
frame 1
arg timhan,dword
arg val,dword
push bx
mov bx,dvm_addto*256+dva_tos
ep_dword_dword:
push bp
mov bp,sp
push val+2[bp]
push val[bp]
push timhan+2[bp]
push timhan[bp]
mov ah,12h
int 15h
xor ax,ax
pop bp
pop bx
ret
endfunc tim_addt,o
; tim_write
function tim_writ,e
arg winhan, dword
arg time, dword
push bx
mov bx,dvm_write*256+dva_tos
jmp short ep_dword_dword
endfunc tim_writ,e
; tim_status
function tim_stat,us
frame
arg timhan,dword
push bp
mov bp,sp
push bx
@send status,timhan[bp]
pop bx
pop ax
rol ax,1
rol ax,1
pop bx
pop bp
ret
endfunc tim_stat,us
; win_addto
function win_addt,o
frame
arg winhan,dword
arg charptr,ptr
arg nchars,word
arg attrptr,ptr
arg nattrs,word
push bp
mov bp,sp
push bx
push_dptr charptr[bp]
xor ax,ax
push ax
push nchars[bp]
push_dptr attrptr[bp]
push ax
push nattrs[bp]
@send addto,winhan[bp]
pop bx
pop bp
ret
endfunc win_addt,o
; win_eof
function win_eof,
frame
arg winhan,dword
push bp
mov bp,sp
push bx
@send eof,winhan[bp]
pop ax
pop bx
pop bx
pop bp
ret
endfunc win_eof,
register_stream db 1bh,0,2,0,0d5h,0e4h,1bh,10h,0,0
register proc
push ax
push bx
push cx
push cs
mov cx,offset cs:register_stream
push cx
xor cx,cx
push cx
mov cx,10
push cx
push ax
push bx
@send write,tos
pop cx
pop bx
pop ax
ret
register endp
; app_new
function app_new,
mov bl,1
jmp short tsn1
endfunc app_new,
; tsk_new
function tsk_new,
frame 1
arg entryp,cptr
arg stk,ptr
arg lstack,word
arg titlptr,ptr
arg ltitle,word
arg rows,word
arg cols,word
mov bl,0
tsn1: push bx
push bp
mov bp,sp
push cx
push di
push es
push_dptr titlptr[bp] ; push pointer to title string
xor ax,ax ; push title length
push ax
push ltitle[bp]
push ax ; push # rows in window
push rows[bp]
push ax ; push # columns in window
push cols[bp]
push ax ; no input buffer needed
push ax
;
; This is the path that spawns a subtask. There is no way to spawn a task
; with an initial set of registers or on a given stack. We therefore spawn
; the task to a intermediate routine called task_starter and send the
; requested stack buffer to the new task as a mailbox message. In the stack
; buffer we place the initial DS and ES values and the requested entry
; point. Task_starter simply reads its mailbox to find the stack, sets
; up things accordingly, and calls the users entry point.
wn1: xor ax,ax ; 128 byte system data stack
push ax
mov bx,128
push bx
mov bx,-1 ; default return stack = -1
push bx
push bx
push cs ; address of task_starter routine
mov bx,offset cs:task_starter
push bx
@send new,window ; spawn subtask to execute task_starter
cmp byte ptr [bp+2],0 ; owner task ?
jnz wn2 ; jump if so
pop bx
pop ax
push ax
push bx
call register ; register subtask
wn2: mov ax,es ; save system ES
load_dptr es,di,stk[bp] ; get user stack buffer
add di,lstack[bp]
mov es:[di-2],cs ; push task_ender onto user stack
mov es:[di-4],offset cs:task_ender
load_cptr dx,cx,entryp[bp] ; push task entry point
mov es:[di-6],dx
mov es:[di-8],cx
mov es:[di-10],ds ; push initial ds
mov es:[di-12],ax ; push initial es
@send handle,me ; get parents handle
pop es:[di-16] ; push parents handle
pop es:[di-14]
mov ax,[bp+2] ; push owner task flag flag
mov es:[di-18],ax
mov bx,lstack[bp] ; get stack length
sub di,bx
pop cx ; pop new task handle into dx:cx
pop dx
push es ; push pointer to stack
push di
xor ax,ax ; push length of stack
push ax
push bx
push ax ; status = 0
push ax
push dx ; push new task handle
push cx
@send subfrom,mailtos ; send mail by reference
mov ax,cx ; return new tasks handle
pop es
pop di
pop cx
pop bp
add sp,2
fix_long
ret
endfunc tsk_new,
task_starter proc far
@send read,mailme ; read mailme
pop cx ; pop stack length
pop ax
pop bx ; pop stack base
pop ax
add bx,cx
sub bx,18
cli
mov ss,ax
mov sp,bx
sti
@call ostack ; trick DESQview into going off stack
@call ustack
pop bx ; pop owner task flag
test bl,bl
jz tst1 ; jump if not owner task
@send handle,me ; get task handle
pop bx
pop ax
call register ; register self
tst1: pop cx ; pop parents handle
pop dx
pop es ; pop ES
pop ds ; pop DS
ret ; return to subtask
task_starter endp
task_ender proc
@send free,me
task_ender endp
; win_new
function win_new,
frame
arg titlptr,ptr
arg ltitle,word
arg rows,word
arg cols,word
push bp
mov bp,sp
push cx
push di
push es
push_dptr titlptr[bp] ; push pointer to title string
xor ax,ax ; push title length
push ax
push ltitle[bp]
push ax ; push # rows in window
push rows[bp]
push ax ; push # columns in window
push cols[bp]
push ax ; no input buffer needed
push ax
push ax ; no data stack
push ax
push ax ; no rturn stack
push ax
push ax ; no entry point
push ax
wn4: @send new,window ; create it
pop bx ;get segment ptr
pop ax ;get ip ptr
call register ; register it
mov dx,ax
mov ax,bx
pop es
pop di
pop cx
pop bp
fix_long
ret
endfunc win_new,
; win_nread
function win_nrea,d
frame
arg winhan,dword
arg nchars,word
arg bufptr,ptr
arg lbuf,ptr
push bp
mov bp,sp
push bx
push es
xor ax,ax
push ax
push nchars[bp]
@send readn,winhan[bp]
load_dptr es,bx,lbuf[bp]
pop es:[bx]
pop ax
load_dptr es,bx,bufptr[bp]
pop es:[bx]
pop es:[bx+2]
xor ax,ax
pop es
pop bx
pop bp
ret
endfunc win_nrea,d
; win_stream
function win_stre,am
frame
arg winhan,dword
arg strptr,ptr
push bp
mov bp,sp
push es
mov dx,sp
load_dptr es,bx,strptr[bp]
push es
push bx
mov bx,es:[bx+2]
add bx,4
xor ax,ax
push ax
push bx
push winhan+2[bp]
push winhan[bp]
jmp short do_win_write
endfunc win_stre,am
; win_write
function win_writ,e
frame
arg winhan,dword
arg bufptr,ptr
arg lbuf,word
push bp
mov bp,sp
push es
mov dx,sp
push_dptr bufptr[bp]
xor ax,ax
push ax
push lbuf[bp]
push winhan+2[bp]
push winhan[bp]
do_win_write:
@send write,tos
mov ax,sp
cmp dx,ax
je wst1
pop ax
pop dx
jmp short wst2
wst1: xor ax,ax
xor dx,dx
wst2: pop es
pop bp
fix_long
ret
endfunc win_writ,e
; api_shadow
function api_shad,ow
push es
xor ax,ax
mov es,ax
@call shadow
mov dx,es
xor ax,ax
pop es
fix_long
ret
endfunc api_shad,ow
; api_update
function api_upda,te
frame
arg vptr,dword
arg count,word
push bp
mov bp,sp
push cx
push di
push es
les di,vptr[bp]
mov cx,count[bp]
@call update
xor ax,ax
pop es
pop di
pop cx
pop bp
ret
endfunc api_upda,te
; api_getmem
function api_getm,em
frame
arg count,word
push bp
mov bp,sp
push di
push es
mov bx,count[bp]
@call getmem
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -