home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / MISSING / CIVMAP21.ZIP / civint2.asm < prev    next >
Assembly Source File  |  1993-06-16  |  3KB  |  69 lines

  1. ; This procedure will be called every time civ.exe checkes the improvement
  2. ; of a map field. It tests if the field positions are contained in the
  3. ; improvement list. If they are found then it simulates an improvement,
  4. ; if there normally would be none and vice versa.
  5. ; Besides it fetches the 'masterword' by which civ.exe normally calculates
  6. ; whether a field is improved or not and writes it to the variable masterw
  7. ; of the main Turbo Pascal program civ_map2.pas. It uses that above the
  8. ; position where you have build in the int F2h call civ.exe calculates the
  9. ; normal improvement state of a field. 21h bytes above the new int F2h
  10. ; call you can find the pointer to that 'masterw'.
  11.  
  12. data       segment word public
  13.            extrn counter : word, x : word, y : word, masterw : word
  14. data ends          
  15.  
  16. code       segment word public
  17.            assume cs:code, ds : data
  18.            public civint2;
  19.  
  20. civint2     proc far
  21.             cmp ax, cx           ; these commands has been overwritten
  22.             je l0                ; in civ.exe while inserting the int F2 call
  23.             sub ax, ax
  24.             jmp l1
  25. l0:         mov ax, 0001h
  26. l1:         push di              ; start of the real procedure
  27.             mov di, sp
  28.             push bx
  29.             push cx
  30.             push si
  31.             push ds
  32.             push es
  33.             mov si, ss:[di+4]    ; fetch segment address of int F2h call
  34.             mov es, si           ;    from stack
  35.             mov si, ss:[di+2]    ; fetch offset address of int F2h call
  36.             sub si, 21h          ; jump 21h bytes back in civ.exe code
  37.             mov bx, es:[si]      ; get pointer on 'masterword'
  38.             mov si, ds           ; ds register of civ.exe -> es
  39.             mov es, si
  40.             mov si, data         ; get data segment of variable masterw
  41.             mov ds, si
  42.             mov cx, es:[bx]      ; get 'masterword'
  43.             mov masterw, cx      ; write it to variable masterw
  44.             mov si, 0fffeh       ; si : pointer in coordinate lists
  45.             mov cx, counter      ; loop counter cx starts at list length
  46.                                  ;     'counter'
  47. l2:         add si, 02h
  48.             dec cx
  49.             jl l3                ; loop finished ?
  50.             mov bx, x[si]        ; get element of list of x positions
  51.             cmp bx, ss:[bp+8]    ; compare with x position of map field
  52.             jne l2
  53.             mov bx, y[si]        ; the same with y position
  54.             cmp bx, ss:[bp+0ah]
  55.             jne l2               ; found ?
  56.             xor ax, 0001h        ; if yes: change ax (ax=0: not improve,
  57. l3:         pop es               ;                    ax=1: improve)
  58.             pop ds
  59.             pop si
  60.             pop cx
  61.             pop bx
  62.             mov sp, di
  63.             pop di
  64.             iret                 ; that's all
  65. civint2     endp
  66.  
  67. code        ends
  68.             end
  69.