home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
F
/
LOTTO50.LBR
/
LOTOCONV.ZY0
/
LOTOCONV.ZY0
Wrap
Text File
|
2000-06-30
|
2KB
|
125 lines
MACLIB DOSCALLS
MACLIB MACROS
;
INCLUDE TERMINAL.Z80
;
SETSP
LD DE,WFCB
LD C,OPENF
CALL BDOS
;
LD HL,TABLE
LD DE,TABLE+1
LD (HL),255
LD BC,1024*10
LDIR
;
LD DE,DMA
LD C,SETDMA
CALL BDOS
LD HL,TABLE
LD BC,0A80H ;B=Numbers to read C=pending if any
READDAT:
PUSH BC
PUSH HL
LD DE,WFCB
LD C,RDSEQ
CALL BDOS
INC A
POP HL
POP BC
JP Z,ENDOFFILE
LD DE,DMA
READDMA:
LD A,(DE)
CP ' '
JR Z,SKIPSP
CP CR
JR Z,SKIPSP
CP LF
JR Z,SKIPSP
CP 26
JP Z,ENDOFFILE
SUB '0'
PUSH AF
LD A,C
ADD A,A
ADD A,A
ADD A,C
ADD A,A
LD C,A
POP AF
ADD A,C
LD C,A
JR NEXTC
SKIPSP:
LD A,C
OR A
JP M,NEXTC ;was cleared out before
PUSHALL
LD H,0
LD L,C
CALL HEXDEC
POPALL
LD (HL),C
INC HL
LD C,128 ;now it is clear
DJNZ NEXTC ;until a whole row read
LD B,10 ;reset to another full line
LD (ENDTABLE),HL
CALL CRLF
NEXTC:
INC DE
XOR A
CP D
JR Z,READDMA
JR READDAT ;next record until EOF
ENDOFFILE:
LD B,80H
FILLEOF
LD (HL),255
INC HL
DJNZ FILLEOF
LD DE,OUTFCB
CALL MAKEFILE
JP Z,EXIT
LD DE,TABLE
FLUSHIT:
PUSH DE
LD C,SETDMA
CALL BDOS
LD DE,OUTFCB
LD C,WRTSEQ
CALL BDOS
POP DE
LD HL,80H
ADD HL,DE
EX DE,HL
LD HL,0
ENDTABLE EQU $-2
OR A
SBC HL,DE
JR NC,FLUSHIT
CLOSEIT:
LD DE,OUTFCB
LD C,CLOSEF
CALL BDOS
JP EXIT
MAKEFILE:
DOMAKEFILE
CRLF:
DOCRLF
HEXDEC:
DOHEXDEC
;
DS 100
STACK:
WFCB: DB 0,'LOTTO DAT',0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0
OUTFCB: DB 0,'LOTTO BIN',0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0
TABLE:
END