...
Code Block |
---|
|
--------- Iterate CRC-32 over local memory buffer -----------
IN:
A = CRC_MEMA (0)
HL = pointer to buffer (local memory),
BC = buffer size
DE = 0, Initialize CRC-32 with FFFFFFFFh
DE > 0, (local) pointer to initial 4-byte CRC-32
OUT, if call successful:
Fc = 0
DEBC = CRC-32 result (DE = high-word, BC = low-word)
OUT, if call failed:
Fc = 1
A = RC_BAD ($04) - bad argument
Registers changed after return:
......HL/IXIY same
AFBCDE../.... different
-------------------------------------------------------------
-------- Iterate CRC-32 on open RAM file until EOF ----------
IN:
A = CRC_FILE (1)
HL = 0, no buffer
HL > 0, pointer to file buffer (local memory),
BC = buffer size (if HL > 0)
DE = 0, Initialize CRC-32 with FFFFFFFFh
DE > 0, (local) pointer to initial 4-byte CRC-32
IX = file handle of open file (using GN_Opf)
OUT, if call successful:
Fc = 0,
DEBC = CRC-32
File pointer has reached EOF
OUT, if call failed:
Fc = 1,
A = RC_BAD ($04) - bad argument
A = RC_xxx (file & handle related errors)
Registers changed after return:
......HL/IXIY same
AFBCDE../.... different
-------------------------------------------------------------
------- Iterate CRC-32 on File Entry in a File Card ---------
IN:
A = CRC_EPFL (2)
BHL = pointer to file entry
DE = 0, Initialize CRC-32 with FFFFFFFFh
DE > 0, (local) pointer to initial 4-byte CRC-32
OUT, if call successful:
Fc = 0,
DEBC = CRC-32
OUT, if call failed:
Fc = 1,
A = RC_BAD ($04) - bad argument
A = RC_xxx (file card related errors)
Registers changed after return:
......HL/IXIY same
AFBCDE../.... different
------------------------------------------------------------- |
None.
Notes
GN_Crc was implemented in OZ V4.5. It is used by the integrated EazyLink popdown to validate uploaded file content. GN_Crc will be used 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 |
---|
title | Example 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 |
---|
title | Example 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 |
---|
title | Example for CRC - 32 on open RAM file |
---|
|
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
|