0

i am confused that what will be the value of variable DPBBUF_SIZ given below the value given as (4472 + 15) / 16 and assigned to varible DPBBUF_SIZ is in terms of hexadecimal or decimal. please let me know what value will be assigned to varibale DPBBUF_SIZ. thanks in advance.

    DOSSIZE     EQU  5000H
    DPBBUF_SIZ  DW   (4472 + 15) / 16 ; my PROBLEM is that what value will 
                                  ;be assigned to varible "DPBBUF_SIZ" here.
    GOINIT:
    CLD
    XOR     SI,SI
    MOV     DI,SI

    IF      MSVER
    MOV     CX,[MEMORY_SIZE]
    CMP     CX,1
    JNZ     NOSCAN
    MOV     CX,2048                 ; START SCANNING AT 32K BOUNDARY
    XOR     BX,BX

    MEMSCAN:INC     CX
    JZ      SETEND
    MOV     DS,CX
    MOV     AL,[BX]
    NOT     AL
    MOV     [BX],AL
    CMP     AL,[BX]
    NOT     AL
    MOV     [BX],AL
    JZ      MEMSCAN
    SETEND:
    MOV     [MEMORY_SIZE],CX
    ENDIF

    IF      IBMVER OR IBMJAPVER
    MOV     CX,[MEMORY_SIZE]
    ENDIF

    NOSCAN:
    MOV     AX,CS
    MOV     DS,AX
    ASSUME  DS:SYSINITSEG

    IF      HIGHMEM
    SUB     CX,(DOSSIZE / 16)       ; Leave room for DOS
    SUB     CX,CS:[DPBBUF_SIZ]      ; Allow OEM to tune  (my problem: what 
             ;will be the final value of CX after this line or instruction)
    ENDIF


    SHR     AX,1                    ; Divide by 16 for paras
    SHR     AX,1
    SHR     AX,1
    SHR     AX,1
    SUB     CX,AX
    MOV     ES,CX

    SHR     CX,1                    ; Divide by 2 to get words
    REP     MOVSW                   ; RELOCATE SYSINIT

    ASSUME  ES:SYSINITSEG

    PUSH    ES
    MOV     AX,OFFSET SYSIN
    PUSH    AX

    ....................
    ....more code here..

i think that given code will be enough to understand the problem. am i doing any mistake somewhere, please guide. thanks.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 2
    Obviously `DPBBUF_SIZ` is going to be `(4472 + 15) / 16 = 280`. Why do you have a problem with that? If in doubt ask for assembly listing or disassemble. – Jester Nov 29 '18 at 13:30
  • Thanks jester, it is obvious. Please let me know that in value (4472 + 15) / 16, why it took the numbers 4472, 15, 16. Are they random or there is any purpose behind them. –  Nov 29 '18 at 13:42
  • We can't know what `DPBBUF` is we need more context. Apparently its size in bytes is 4472. The `+15` and the `/16` are to calculate size in 16 byte units ("paragraphs"). – Jester Nov 29 '18 at 13:45
  • Jes I went through documents, and they say that DPBBUF means Drive Parameter Block BUFFER. Further, I am confused 4472 is decimal or binary or hexadecimal? –  Nov 29 '18 at 14:02
  • 1
    It can't be binary since that only has 0 and 1. It could be hex but it isn't. It's plain simple decimal. As you can see this file uses a `H` suffix for hex as in `5000H`. – Jester Nov 29 '18 at 14:12
  • 3
    To find the minimum number of chunks (rounded up) required to contain a value you can use the formula `(x+(n-1))/n` where `x` is the value you need to contain and `n` is the chunk size. On the x86 a paragraph is a 16 byte chunk. You ignore the fractional part of the result. (4472+15)/16 is the same as x=4472, n=16 which is (4472+(16-1))/16 = 280 (we dropped the fractional part of the result). It takes 280 chunks (paragraphs) to fully contain the value 4472. 280*16=4480 which 4472 rounded up to the nearest number evenly divisible by 16 – Michael Petch Nov 29 '18 at 16:34
  • 1
    280 would be the 16-bit value stored at DPBBUF_SIZ – Michael Petch Nov 29 '18 at 16:42

0 Answers0