| MASM - Program development - BIN - Qbasic - INT21 |
Assembler-kode til Qbasic-rutinen Int21()
SUB Int21h CALL absolute(r, int21) END SUB |
Assembler-koden
;-----------------------------MASM header
ASSUME CS:CODE
CODE SEGMENT
ORG 0 ;this is a binary file
;-----------------------------BSAVE/BLOAD header
head: db 0FDh ;BSAVE/BLOAD ID
dw 9000h ;segment - not used - any value is ok
dw 0000h ;offset - not used - any value is ok
dw Last-First ;computed size of code
;-----------------------------Code
First: push bp ;standard entry
mov bp,sp ;[bp+0] : old bp
;[bp+2] : QBASIC return segment
;[bp+4] : QBASIC return offset
;[bp+6] : offset r
mov bx,[bp+6] ;offset r
mov bp,bx
mov ax,[bp] ;ax
mov bx,[bp+2] ;bx
mov cx,[bp+4] ;cx
mov dx,[bp+6] ;dx
mov si,[bp+8] ;si
mov di,[bp+10] ;di
int 21h
jnc ok ;jump if no error
mov [bp+12],ax ;ec = error code
jmp fin
ok: mov [bp],ax
mov [bp+2],bx
mov [bp+4],cx
mov [bp+6],dx
mov [bp+8],si
mov [bp+10],di
mov word ptr [bp+12],0 ;no error
fin: pop bp ;standard exit
retf 2 ;far return - clean up one parameter
;-----------------------------
Last:
CODE ENDS
END head
|