Sample procedure using Pascal language specifier

ideal
model large, Pascal ; Code is FAR, language is Pascal
; Data and stack in DGROUP

CODESEG
global demo_PAS:proc ; Make public as "DEMO_PAS"

; Procedure demo_PAS (a:word; b,b2:pointer; d:byte); external;
proc demo_PAS
arg a:word, b:dword:2, d:byte = arglen ; arglen = 12 (2)
local x:dword, y:word:2 = localspc ; localspc = 8 (3)
uses ds
; Source text: ; Code generated:
; ; push bp #p (1)
; ; mov bp,sp #p (1)
; ; sub sp,localspc #p (3)
; ; push ds #p (4)
mov [word low x],sp ; mov [dgroup:bp-08],sp (3)
mov [y],arglen ; mov [dgroup:bp-04],12 (3)
mov ax,[a] ; mov ax,[dgroup:bp+16] (2)
les di,[b] ; les di,[dgroup:bp+08] (2)
mov dl,[d] ; mov dl,[dgroup:bp+06] (2)
mul dl ; mul dl
stosw ; stosw
; [ Useful code omitted ]
RET ; pop ds #e (4)
; ; mov sp,bp #e (3)
; ; pop bp #e (1)
; ; retf arglen #e (5) (1)
endp
; (1) Generated by Pascal language specifier (in MODEL statement)
; If 80186+ instructions are enabled, PUSH BP; MOV BP,SP;
; SUB SP,localspc and MOV SP,BP; POP BP, will be replaced
; by ENTER/LEAVE.
; (2) Equate generated by ARG directive
; (3) Generated by LOCAL directive
; (4) Generated by USES directive
; (5) Generated by MODEL (code is FAR)
; #p procedure prolog code (PROC statement)
; #e procedure epilog code (RET statement, several RETs possible)


; Calling from assembler:
DATASEG
blen db 20
CODESEG
assume ds:@data
call demo_PAS, ax, ds si, es di, [word PTR blen]
; CALL generates:
; push ax
; push ds si
; push es di
; push [word PTR blen]
; call demo_PAS

END