  
  ; Start up code
  .MODEL MEDIUM
  .386
  .STACK
  .CODE
  .STARTUP
  mov ah,4Ch
  int 21h

;dim a as integer, b as integer, c as integer
  .DATA
  _A dw 0
  _B dw 0
  _C dw 0

;dim x as integer, y as integer, l as long
  _X dw 0
  _Y dw 0
  _L dd 0

;const pi = 3, e = pi

;const cent = 100

;a=b/8
  .CODE
  mov cx,_B
  shr cx, 3
  mov _A,cx

;a=b/7
  mov ax,_B
  mov cx, 7
  cwd
  idiv cx
  mov _A,ax

;a=(b*c)/32
  mov ax,_B
  imul _C
  shr ax, 5
  mov _A,ax

;if a = 1 then
  cmp _A, 1
  je @3
  jmp @1
  @3:

;a = b
  mov ax,_B
  mov _A,ax

;elseif a = 2 then
  jmp @2
  @1:
  cmp _A, 2
  je @5
  jmp @4
  @5:

;a = c
  mov ax,_C
  mov _A,ax

;elseif a = 3 then
  jmp @2
  @4:
  cmp _A, 3
  je @7
  jmp @6
  @7:

;a = x
  mov ax,_X
  mov _A,ax

;end if
  @6:
  @2:

;a=-(b mod x) * (x - 100 * a) /b
  mov ax,_B
  cwd
  idiv _X
  neg dx
  mov ax,_A
  mov cx, 100
  mov bx,dx
  imul cx
  mov cx,_X
  sub cx,ax
  mov ax,bx
  imul cx
  cwd
  idiv _B
  mov _A,ax

;select case a
  mov ax,_A
  mov word ptr[$_temp_data],ax

;case is > 1
  cmp word ptr[$_temp_data], 1
  jg @10
  jmp @8
  @10:

;a=1
  mov _A, 1

;case 2
  jmp @9
  @8:
  cmp word ptr[$_temp_data], 2
  je @12
  jmp @11
  @12:

;a=2
  mov _A, 2

;case 4
  jmp @9
  @11:
  cmp word ptr[$_temp_data], 4
  je @14
  jmp @13
  @14:

;a=16
  mov _A, 16

;case else
  jmp @9
  @13:

;a=32
  mov _A, 32

;end select
  @15:
  @9:

;function firstsub (int1 as integer) as integer
  _FIRSTSUB:
  push bp
  mov bp,sp
  sub sp,@STACK1

;dim a as integer

;dim b as byte

;for a = 1 to 100
  ; <for>
  ; calculate & save end- and increasevalue
  mov word ptr[$_temp_data], 100
  ; assign begin value to variable
  mov word ptr[bp- 2], 1
  jmp @19
  @18:
  ;  <body>

;if a = 10 then
  cmp word ptr[bp- 2], 10
  je @23
  jmp @21
  @23:

;return a*int1 + 1000
  mov ax,word ptr[bp- 2]
  imul word ptr[bp+ 6]
  add ax, 1000
  jmp @17

;end if
  @21:
  @22:

;next
  mov ax,word ptr[bp- 2]
  inc ax
  mov word ptr[bp- 2],ax
  @19:
  mov ax,word ptr[bp- 2]
  cmp ax,word ptr[$_temp_data]
  jg @24
  jmp @18
  @24:
  @20:

;end function
  @17:
  pop bp
  retf 2
  @STACK1 EQU 3

;sub testsub (x as integer, y as long, z as byte)
  _TESTSUB:
  push bp
  mov bp,sp
  sub sp,@STACK2

;dim i as integer, l as long, b as byte

;i = x
  mov ax,word ptr[bp+ 12]
  mov word ptr[bp- 2],ax

;l = y
  mov eax,dword ptr[bp+ 8]
  mov dword ptr[bp- 6],eax

;b = z
  mov al,byte ptr[bp+ 6]
  mov byte ptr[bp- 7],al

;end sub
  @25:
  pop bp
  retf 7
  @STACK2 EQU 7

;dim l1 as long, b1 as byte
  .DATA
  _L1 dd 0
  _B1 db 0

;testsub (firstsub(b),l1,b1)
  .CODE
  push _B
  call _FIRSTSUB
  push ax
  push _L1
  mov al,_B1
  xor ah,ah
  push ax
  call _TESTSUB

;a = firstsub(b)*firstsub(a)
  push _B
  call _FIRSTSUB
  mov word ptr[$_temp_data],ax
  push _A
  call _FIRSTSUB
  imul word ptr[$_temp_data]
  mov _A,ax
  
  $TEMPVARSIZE equ 4
  .DATA
  $_temp_data db $TEMPVARSIZE dup (0)
  END
