Category : Files from Magazines
Archive   : DBMS0690.ZIP
Filename : NEBEL1

 
Output of file : NEBEL1 contained in archive : DBMS0690.ZIP

Listing 1. SIMULATR.ASM


code_seg SEGMENT PARA PUBLIC 'CODE'

ASSUME CS:code_seg,DS:code_seg,ES:code_seg

on EQU 1 ; mnemonic for simulation mode on
off EQU 0 ; mnemonic for simulation mode off
simulator EQU on ; switch to enable simulation mode

ORG 00h

; ----- main calling routine for program -----

main proc far

jmp start ; jump to start of code

; ----- storage for passed far pointers -----

pointers DW 14 DUP ("FP") ; far pointer storage

; ### --- BEGIN SIMULATION ENVIRONMENT DATA --- ###

IF simulator

parameter1 DB "GOING TO EXTREMES",0
parameter2 DB "COMING INTO THE COUNTRY",0
parameter3 DB "For Whom the Bell Tolls",0
parameter4 DB "1-2-3 made easy",0
parameter5 DB 0
parameter6 DB 0
parameter7 DB 0

paradds DW parameter1 + 256 ; create the offset values
DW 0 ; for a surrogate block
DW parameter2 + 256 ; of far pointers to the
DW 0 ; dummy parameters
DW parameter3 + 256 ; immediately above,
DW 0 ; with the address
DW parameter4 + 256 ; displaced 256 bytes
DW 0 ; up in memory
DW parameter5 + 256 ;
DW 0 ; the segment values are
DW parameter6 + 256 ; added at runtime displaced
DW 0 ; 16 bytes down in memory
DW parameter7 + 256 ; relative to the CS
DW 0 ; register

stack_seg SEGMENT PARA STACK 'STACK'

ASSUME SS:stack_seg

stack_bytes DB 512 dup ("S")

stack_seg ends

ENDIF

; ### ---- END SIMULATION ENVIRONMENT DATA ---- ###

start:

cld ; just for safety's sake

; ### --- BEGIN SIMULATION ENVIRONMENT CODE --- ###

IF simulator

; ----- set up stack for return -----

push ds ; save DS for return
sub ax,ax ; put a zero on the stack
push ax ; for return

mov cs:paradds+2,cs ; move the current CS
sub cs:paradds+2,16 ; value minus 16 into
mov cs:paradds+6,cs ; the segment values of the
sub cs:paradds+6,16 ; surrogate address block
mov cs:paradds+10,cs ;
sub cs:paradds+10,16 ; the minus 16 displacement
mov cs:paradds+14,cs ; of the segment exactly
sub cs:paradds+14,16 ; compensates the plus 256 of
mov cs:paradds+18,cs ; offset to target the parameters
sub cs:paradds+18,16 ; beginning at parameter1
mov cs:paradds+22,cs ;
sub cs:paradds+22,16 ; this creates a block of
mov cs:paradds+26,cs ; far data consisting of far
sub cs:paradds+26,16 ; pointers

push cs ; align ES with CS to point at
pop es ; block of test addresses with
mov di,offset cs:paradds ; ES:DI

push cs ; align DS with CS to point
pop ds ; at first parameter
mov bx,offset cs:parameter1 ; with DS:BX

ENDIF

; ### ---- END SIMULATION ENVIRONMENT CODE ---- ###

call store_pointers ; store passed address block

push cs ; align cs
pop ds ; ds
push cs ; and es
pop es ; as standard start-up

call string_queue ; lowercase passed parameters

quit_nu:

ret

main endp

; ----- routine to store passed address block -----

store_pointers proc near

mov si,di ; swap the original passed
push es ; block pointers es:di
pop ds ; into ds:si for string move

push cs ; point es:di to storage space
pop es ; allocated in code segment
mov di,offset cs:pointers ; to locally store pointers

mov cx,14 ; we're moving 14 words
rep movsw ; go for it

ret

store_pointers endp

; ----- routine queue and process seven parameters -----

string_queue proc near

mov bx,offset cs:pointers ; point to far pointer storage
mov cx,7 ; max of seven passed parameters
queue_loop:
lds si,cs:[bx] ; load a far pointer into ds:si
cmp byte ptr[si],0 ; is it a null parameter?
jz queue_quit ; if so, just exit
add bx,4 ; else bump the block pointer
push cx ; save our parameter counter
push bx ; save our address block pointer
call lower_case ; lower case the current string
pop bx ; restore our block pointer
pop cx ; restore our parameter counter
loop queue_loop ; loop and check for repeat

queue_quit:

ret

string_queue endp

; ----- routine to lower case zero terminated string -----

lower_case proc near

lower_loop:
cmp byte ptr[si],0 ; end of string yet?
jz lower_quit ; if so, exit
cmp byte ptr[si],"A" ; do we an "A"
jb lower_skip ; if below just skip
cmp byte ptr[si],"Z" ; do we a "Z"
ja lower_skip ; if above just skip
or byte ptr[si],20h ; otherwise, do a lowercase
lower_skip:
inc si ; move right one character
jmp lower_loop ; loop back for another

lower_quit:

ret

lower_case endp

; ----- end of code segment -----

code_seg ENDS ; end of code segment

end main ; end assembly

; ----- end of module -----


  3 Responses to “Category : Files from Magazines
Archive   : DBMS0690.ZIP
Filename : NEBEL1

  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/