In 2011-2012, when I dealt with the BBX81 project (an unfinished host for BBC Basic 80), I planned to realize a "HDready" (320x200

In that 33 (+1) chunks were 528 bytes (33*16) unusable space, what I found too much, and the 800 bytes stack did not fit on code space (the host's maximal size can be about 3K), so the idea was dropped.
Some days (weeks) ago, I found these sketches and I was wondering why I did not apply such solution as in case of the SPONZY. There were little helper routines which radically decreased the stack size. The possibility is given here too.
Step1: we have to change the whole hi-res address just once in a 256 bytes chunk. In the next 5 cases it is enough to change the lower byte only.
Code: Select all
NextLine
add a,40 ; the next line in the 256B chunk
jp dfe_cont ; continue d-file execution (delay)
dfe_cont
jp dfe_ldR ; continue d-file execution
;
;
; ======================================================== the dummy D-FILE
;
df_exec .equ $+$8000
pop hl ; get line address
ld a,h ;
ld i,a ; set MSB
ld a,l ;
;
dfe_ldR .equ $+$8000
ld r,a ; set LSB
ddf_data
.ds 40 ; the line buffer
ret nc ;
;
; ========================================================== HI-RES section
;
HR_stack
.dw df_exec,Line001
.dw NextLine,NextLine,NextLine,NextLine, NextLine
.dw df_exec,Line006
.dw NextLine,NextLine,NextLine,NextLine,NextLine
;
;
.dw df_exec,Line235
.dw NextLine,NextLine,NextLine,NextLine,NextLine
.dw dfe_exit ; the last return address in the HR_stack
;
; ====================================================
; 320x240 pixel hires data (40x256 bytes)
; ====================================================
Line001
; etc
Step2: there are 16 bytes between the 240 bytes parts of hi-res data. Is it possible to insert here that 14 bytes parts of the stack


Code: Select all
NextLine
add a,40 ; the next line in the 256B chunk
jp dfe_cont ; continue d-file execution (delay)
ChgStack
ld l,c ; set stack pointer to the end of
ld sp,hl ; the 6th hires line in the chunk
ld a,208 ; addr. of the 6th hires line
dfe_cont
jp dfe_ldR ; continue d-file execution
;
; ======================================================== the dummy D-FILE
;
df_exec .equ $+$8000
pop hl ; get line address
ld a,h ;
ld i,a ; set MSB
ld a,l ;
;
dfe_ldR .equ $+$8000
ld r,a ; set LSB
ddf_data
.ds 40 ; the line buffer
ret nc ;
;
; ====================================================== the HI-RES section
;
HR_stack
.dw df_exec,Line001
.dw NextLine,NextLine,NextLine,NextLine
.dw ChgStack
Line001
.ds 240 ; the 6 hi-res lines
.dw df_exec,Line006
.dw NextLine,NextLine,NextLine,NextLine
.dw ChgStack,0
Line006
.ds 240 ; the 6 hi-res lines
;
;
.dw df_exec,Line235
.dw NextLine,NextLine,NextLine,NextLine
.dw ChgStack,0
Line235
.ds 240 ; the 6 hi-res lines
.dw dfe_exit ; the last return address in the HR_stack
The attachment contains a little demo (and a tool to create it), which is optimised for tape loading:
- the code is as small (and smart

- it stores the picture (h-file) in unexpanded format (9600 bytes);
- the size of the ".p"-file is less than 10K;
- if the picture contains more black pixels (ones) than whites (zeros), then the ".p"- (and the ".wav")-file will store the inverse of the picture
(this won't affect the tool's other outputs).
You can calibrate the picture position on the screen using the arrow keys (SHIFT+ 5,6,7,8) - by default it is calibrated for the EightyOne's displaying - and If you press SHIFT+9 together, that inverts the picture

Enjoy,
Zsolt
ps.: my test machine is under construction, so feedbacks are welcome