Changeset 101 for trunk/bootcode/regular/other.asm
- Timestamp:
- Apr 8, 2017, 12:26:55 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/regular/other.asm
r95 r101 562 562 ret 563 563 MBR_TeletypeSyncPos EndP 564 565 ; Check if a memory block is all zeros 566 ; IN : BX pointer to memblock 567 ; CX length to check, zero length is interpreted as block is zero 568 ; OUT : ZF=1 block if all zeros 569 ; NOTE: Segment used is DS, which should be the same as ES 570 IsMemBlockZero Proc Near Uses ax di 571 push es ; Save ES just to be sure 572 push ds ; Segment to use 573 pop es ; Pop in ES because ES is required for scasb 574 mov di, bx ; Pointer to memblock 575 xor al, al ; Compare to zero 576 repe scasb ; Scan the block, will leave ZF=1 if all zeros 577 mov bx, di ; Update pointer (points past last byte compared) 578 pop es ; Restore ES 579 ret 580 IsMemBlockZero EndP 581 582 ; Check if a loaded sector is all zeros 583 ; IN : BX pointer to memblock 584 ; OUT : ZF=1 block if all zeros 585 ; NOTE: Segment used is DS, which should be the same as ES 586 IsSectorZero Proc Near Uses cx 587 mov cx, sector_size ; Normal size of a sector (512 bytes) 588 call IsMemBlockZero ; Check the memory block 589 ret 590 IsSectorZero EndP
Note:
See TracChangeset
for help on using the changeset viewer.