@cjs :
I attached the CROMEMCO customized version of alloccg.as
Assembling with Z80AS - passed. Tell me if you have any questions.
On the issue of customizing the BIOS:
I did it studying the BIOS code and changing little pieces of code that clearly were a heritage of the old 8080 code.
The BIOS used in RC2014 is the old Grant Searle BIOS, with some adjustments (e.g. CF related code, instead of floppy)
Example:
Old code:
match:
;copy data to or from buffer
ld a,(seksec) ;mask buffer number
and secmsk ;least signif bits
ld l,a ;ready to shift
ld h,0 ;double count
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
; hl has relative host buffer address
ld de,hstbuf
add hl,de ;hl = host address
ld de,(dmaAddr) ;get/put CP/M data
ld bc,128 ;length of move
ld a,(readop) ;which way?
or a
jr nz,rwmove ;skip if read
;
; write operation, mark and switch direction
ld a,1
ld (hstwrt),a ;hstwrt = 1
ex de,hl ;source/dest swap
;
rwmove:
;BC initially 128, DE is dest, HL is source
ldir
; data has been moved to/from host buffer
ld a,(wrtype) ;write type
cp wrdir ;to directory?
ld a,(erflag) ;in case of errors
ret nz ;no further processing
;
; clear host buffer for directory write
or a ;errors?
ret nz ;skip if so
xor a ;0 to accum
ld (hstwrt),a ;buffer written
call writehst
ld a,(erflag)
ret
Changed code:
match:
;copy data to or from buffer
ld a,(seksec) ;mask buffer number
and secmsk ;least signif bits
;
; ld l,a ;ready to shift
; ld h,0 ;double count
; add hl,hl
; add hl,hl
; add hl,hl
; add hl,hl
; add hl,hl
; add hl,hl
; add hl,hl
;
ld h,a
ld l,0
srl h
rr l ;HL = L << 7
;
; hl has relative host buffer address
ld de,hstbuf
add hl,de ;hl = host address
ld de,(dmaAddr) ;get/put CP/M data
ld bc,128 ;length of move
ld a,(readop) ;which way?
or a
jr nz,rwmove ;skip if read
;
; write operation, mark and switch direction
ld a,1
ld (hstwrt),a ;hstwrt = 1
ex de,hl ;source/dest swap
;
rwmove:
;BC initially 128, DE is dest, HL is source
ldir
; data has been moved to/from host buffer
ld a,(wrtype) ;write type
cp wrdir ;to directory?
ld a,(erflag) ;in case of errors
ret nz ;no further processing
;
; clear host buffer for directory write
or a ;errors?
ret nz ;skip if so
xor a ;0 to accum
ld (hstwrt),a ;buffer written
call writehst
ld a,(erflag)
ret
Another example:
Old code: (when reading from CF)
LD c,4
LD HL,hstbuf
rd4secs:
LD b,128
rdByte:
in A,(CF_DATA)
LD (HL),A
iNC HL
dec b
JR NZ, rdByte
dec c
JR NZ,rd4secs
Changed code:
; LD c,4
; LD HL,hstbuf
;rd4secs:
; LD b,128
;rdByte:
; in A,(CF_DATA)
; LD (HL),A
; iNC HL
; dec b
; JR NZ, rdByte
; dec c
; JR NZ,rd4secs
ld hl,hstbuf
ld bc,CF_DATA
inir
inir
This way, not only the code size decreases, but also the execution speed increases !
Any questions on this topic?
By the way, I suggest, in order to not interfere with this conversation related to assemblers, to create a new thread, about the topic you are interested in.
agreed, cjs ?
thanks,
Ladislau