home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_08 / v7n8127a.txt < prev    next >
Text File  |  1989-10-02  |  2KB  |  72 lines

  1.  
  2.  
  3.          IDEAL
  4.         %pagesize 56,120
  5.         MODEL    LARGE
  6.         P386
  7. STRUC        descSTRUCTURE     ;global descriptor table entry 
  8. seglim        dw    ?    ;max size of the segment
  9. loaddr        dw    ?       ;24-bits of address little-endian
  10. hiaddr        db    ?
  11. axright        db    ?    ;access rights must be 93h
  12. res0            dw    ?    ;reserved - must be zero
  13.         ENDS
  14.  
  15.         stack
  16.         DB    512 DUP (?)
  17.  
  18.         dataseg
  19. label        GDT  descstructure    ;User supplied partially filled-in GDT
  20.  descstructure    <0,0,0,0,0>        ;dummy - must be zeros
  21.  descstructure    <0,0,0,0,0>        ;descriptor of this GDT - must be zero
  22. label        movesource    descstructure
  23.  descstructure    <0ffffh,0,0,0,0>    ;descriptor of source block
  24. label        movedest     descstructure
  25.  descstructure    <0ffffh,0,0,0,0>    ;descriptor of destination block
  26.  descstructure    <0,0,0,0,0>        ;BIOS will modify to Protected code seg
  27.  DESCSTRUCTURE    <0,0,0,0,0>        ;BIOS will modify to Protected stk seg
  28.  
  29. POSTER        DB    0
  30. COUNTER        DW    0
  31.  
  32. FILL        DB    2400 DUP (0AAH)    ;move this to FELL
  33. FELL        DB    2400 DUP (055H)    
  34.  
  35. MACRO        MAKE_24_BIT_ADDR SEGVAL, OFSET, MEG
  36.         MOV     AX,MEG
  37.         MOV    CX,SEGVAL
  38.           REPT    4
  39.           SHL    CX,1
  40.           RCL    AX,1
  41.         ENDM
  42.         ADD    CX,offset OFSET
  43.         ADC    AL,0        ;fixup if carry out of 16 bits
  44.         ENDM
  45.  
  46.         codeseg
  47. proc        start    near
  48.         cld                ;string direction
  49.         mov    ax,dgroup        ;init data seg
  50.         MOV    DS,AX
  51.         make_24_bit_addr   ds, fill, 0    ;test pattern
  52.         MOV    [MOVESOURCE.LOADDR],CX    ;addr goes into GDT entry for
  53.         MOV    [MOVESOURCE.HIADDR],AL    ;     source
  54.  
  55.         make_24_bit_addr   ds, fell, 0    ;address target area
  56.         MOV    [MOVEdest.LOADDR],CX
  57.         MOV    [MOVEdest.HIADDR],AL
  58.         MOV    [MOVEsource.axright],93h;tell 80x86 protection it's ok
  59.         MOV    AX,DS                   ;point ES:SI to our GDT
  60.         MOV    ES,AX
  61.         MOV    SI,OFFSET GDT
  62.         MOV    AH,87H            ;request function 87h
  63.         MOV    CX,1200            ;how many WORDS to move
  64.         INT    15H
  65.  
  66.         MOV    AH,4CH            ;terminate program
  67.         INT    21H
  68.         ENDP
  69.  
  70.         end    start
  71.  
  72.