Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Related calls

None.

Notes

GN_Crc was implemented in OZ V4.5. It is used by the integrated EazyLink popdown to validate uploaded file content. FlashStore also uses it to display the checksum of a File Entry to be fetched to RAM. GN_Crc will be used more in future OZ developments.

If this system call is used in stand-alone applications, it is necessary to validate which OZ version the application is running on:

Code Block
include "fileio.def"

      ld   a,FA_PTR
      ld   ix,ffffh
      ld   de,0          ; result in DEBC
      oz   OS_Frm
      ld   a,44h         ; OZ versions are embedded as hexnibbles in C register.
      cp   c
      jr   nc, not_ozv45 ; Check for OZ V4.5 failed (44h-45h gives Fc = 1)

 

 

Code Block
titleExample for CRC - 32 on memory contents
include "crc32.def"
      ld   a,CRC_MEMA
      ld   hl,crctext
      ld   bc,crctext_end - crctext
      ld   de,0
      oz   GN_Crc
      ; CRC–32 returned is 0x414FA339 (DE = 0x414F, BC = 0xA339)
.crctext       
      defm "The quick brown fox jumps over the lazy dog"
.crctext_end               
Code Block
titleExample for CRC - 32 on open RAM file
include "crc32.def"
include "fileio.def"

DEFC FileBufferSize = 1280
DEFVARS $2000                          ; "popdown" workspace from 2000H onwards
        FileBuffer ds.b FileBufferSize ; buffer for file I/O
ENDDEF

        LD   A, OP_IN
        LD   BC,128
        LD   HL,filename               ; pointer to local filename
        LD   D,H
        LD   E,L
        OZ   GN_Opf 
        JR   C,not_available

; example with no buffer:
        ld   a, CRC_FILE
        ld   hl,0
        ld   de,0                      ; Use FFFFFFFFh as initial Crc-32
        oz   GN_Crc                    ; get CRC-32 of Open file (no buffer)
        oz   GN_Cl                     ; close file

; example with buffer
        ld   a, CRC_FILE
        ld   hl,FileBuffer             ; use buffer
        ld   bc,FileBufferSize             
        ld   de,0                      ; Use FFFFFFFFh as initial Crc-32
        oz   GN_Crc                    ; get CRC-32 of Open file (with buffer)
        oz   GN_Cl                     ; close file


Code Block
titleExample for CRC - 32 on File Entry in File Card
include "crc32.def"
include "eprom.def"

        ld   c,2               
        ld   de,epfilename             ; search for filename in filea area of slot 2
        ld   a, EP_Find
        oz   OS_Epr                     
        ret  c                         ; file area not there
        ret  nz                        ; file entry not found

        ld   a, CRC_EPFL
        ld   de,0                      ; Use FFFFFFFFh as initial Crc-32
        oz   GN_Crc                    ; get CRC-32 of File Entry