Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : PASDEMO.ASM

 
Output of file : PASDEMO.ASM contained in archive : TASMSWAN.ZIP
%TITLE "Test Turbo Pascal external *.OBJ module"

IDEAL
;-------- Data segment combines with Turbo Pascal's global data segment
SEGMENT DATA word public

;-------- Import typed constants and variables from Turbo Pascal
EXTRN value : WORD, cr : BYTE, lf : BYTE

asmCount dw ?
ENDS DATA

;-------- Code segment combines with Turbo Pascal's main program
SEGMENT CODE byte public

ASSUME cs:CODE, ds:DATA

;--------- Export PUBLIC procedures to Turbo Pascal
PUBLIC AsmProc, CountPtr

;--------- Import procedures and functions from Turbo Pascal
EXTRN PasProc : NEAR, PasFunc : NEAR

%NEWPAGE
;------------------------------------------------------------------------
; PROCEDURE asmProc
;------------------------------------------------------------------------
;------------ PreInitialized variables must go in Code segment
testString db 'asmProc: Should be a "hatch mark" --> ', '$'

PROC asmProc NEAR
;------- call a Turbo Pascal procedure
call PasProc ; pasProc is in PASDEMO.pas

;------- use local data stored in the code segment
push ds
push cs
pop ds
ASSUME ds : CODE
mov dx,offset testString
mov ah,09h
int 21h
pop ds
ASSUME ds : DATA
;-------- get typed-constants from Turbo Pascal and use local static variables
mov ax,[value]
mov [asmCount],ax
;-------- call a Turbo Pascal function for a character value
call PasFunc
mov dl,al
mov ah,2
int 21h
;-------- get variables from Pascal
mov ah,2
mov dl,[cr]
int 21h
mov dl,[lf]
int 21h
ret
ENDP AsmProc

%NEWPAGE
;------------------------------------------------------------------------
; FUNCTION CountPtr : intPtr
;------------------------------------------------------------------------
PROC CountPtr NEAR
mov dx, SEG asmCount
mov ax, OFFSET asmCount
ret
ENDP CountPtr

ENDS CODE

END


  3 Responses to “Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : PASDEMO.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/