cj7hawk
Veteran Member
I'm guessing this is a really dumb question I'm about to ask, but isn't a program that types something out like you want normally just something small like this; ( I didn't include the check for file open before just assuming it will read, but I wanted to keep the example simple - though I remember you had a fairly long program that did other things, so I'm confused ) - Also please forgive the messy mnemonics. I don't have the hang of posting code snippets to the forum yet.
EQU BDOS,$0005
EQU FCB1,$005C
.ORG $0100
LD DE,$0080
LD C,$1A ; Function 1A - Set the DMA address to the buffer at 0080.
CALL BDOS ; Set DMA to 0080 -
LD DE,FCB1 ; FCB
LD C,$0F ; Open File.
CALL BDOS ; Get the first matching file.
TYPE_READ:
LD DE,FCB1 ; FCB
LD C,$14 ; read record
CALL BDOS ; Get the first matching file.
PUSH AF
CALL PRINT_RECORD
POP AF
OR A ; Check for file status
JR Z,TYPE_READ
LD E,$0D
LD C,2
CALL BDOS
LD E,$0A
LD C,2
CALL BDOS
ret
PRINT_RECORD:
LD B,128
LD HL,$0080 ; DMA address.
PRINT_RECORD_LOOP:
PUSH HL
PUSH BC
LD E,(HL)
LD C,2
CALL BDOS
POP BC
POP HL
INC HL
DJNZ PRINT_RECORD_LOOP
ret
EQU BDOS,$0005
EQU FCB1,$005C
.ORG $0100
LD DE,$0080
LD C,$1A ; Function 1A - Set the DMA address to the buffer at 0080.
CALL BDOS ; Set DMA to 0080 -
LD DE,FCB1 ; FCB
LD C,$0F ; Open File.
CALL BDOS ; Get the first matching file.
TYPE_READ:
LD DE,FCB1 ; FCB
LD C,$14 ; read record
CALL BDOS ; Get the first matching file.
PUSH AF
CALL PRINT_RECORD
POP AF
OR A ; Check for file status
JR Z,TYPE_READ
LD E,$0D
LD C,2
CALL BDOS
LD E,$0A
LD C,2
CALL BDOS
ret
PRINT_RECORD:
LD B,128
LD HL,$0080 ; DMA address.
PRINT_RECORD_LOOP:
PUSH HL
PUSH BC
LD E,(HL)
LD C,2
CALL BDOS
POP BC
POP HL
INC HL
DJNZ PRINT_RECORD_LOOP
ret