Oh, thank you. Mine gave me errors so I set a2 to point to end of code snippet where there's about 1K buffer of bytes before you hit the image data. Yours is much cleaner so I'll fix it all up at one point:
Code: Select all
swap move.b (a0),(a2)
move.b (a1),(a0)+
move.b (a2),(a1)+
dbra d0,swap
rts
But it all works. Attached is the modified code that only uses 34K of reserved space and along with the second screen starting at $28000, which uses 32K, it all totals to 68K when running, plenty of space for a 128K BBQL.
So the BOOT file now only stores one file and directly loads in the other file and then calls the code:
Code: Select all
10 REMark Hi Resolution Demo
15 MODE 8: INPUT #0, "Device? "; dev$
20 :
25 code_size=2048
30 a=RESPR(code_size+32768)
35 scr=a+code_size
40 PRINT "Address ",a
45 :
50 DIR dev$&"_dvd":INPUT #0, "Enter pic name, exclude #_dvd? ";a$
55 INPUT #0, "Enter: lores, hires, mixed? ";type$
60 LBYTES dev$&a$&"1_dvd",scr
65 LBYTES dev$&a$&"2_dvd",131072
70 LBYTES dev$&type$&"_bin",a: CALL a
75 MODE 8: GO TO 50
Here's the new assembly -- this one generates mixed_bin, but all you need to do is change where it calls from mixed to hires or lores and re-assemble (that's what the DITHVIDE.MDV is for):
Code: Select all
* dithVide for Sinclair QL
* /interrupt handler in supervisor mode/
* (C) Omega 2006 (omega.webnode.com)
nm_frms EQU 900
nm_lins EQU $0fa
ln_wait EQU $0006
bg_wait EQU $02d7 2e6
sv.plist EQU $3c offset, frame linked list 2803c
sv.pcint EQU $35 copy of system interrupt
pc_intr EQU $18021 interrupt hw status register
mc_stat EQU $18063 master chip settings
screen1 EQU $20000
screen2 EQU $28000
* bit 1 - screen off (1)
* bit 3 - lores (1), hires (0)
* bit 6 - (0) PAL, (1) NTSC
* bit 7 - (0) VRAM starts $20000, (1) $28000
; save registers
; goto supervisor mode
start trap #0
movem.l d0-d7/a0-a6,-(a7)
; disable interrupt
ori #$0700,sr
lea ssvsp,a0
move.l sp,(a0) save stack
move.b #$80,mc_stat switch to 2nd vram, hires
lea stack,sp new stack address
move.l #$28000,a6 sys_vars
lea frames,a0
move.w #nm_frms,(a0)
; compute memory start for images
lea start,a0
add.l #2048,a0 add code_size in basic
; swap image with vram2
move.l #screen2,a1 addr of vram2
lea screen,a2
move.w #$8000,d0
jsr swap
; jsr clscr
lea flipper,a0 address of vector
lea mixed,a2 address of routine
move.l a2,4(a0) save routine address to vector
move.l a0,$2803c save vector address to sv.plist
andi.w #$f8ff,sr ei (enable interrupt)
loop jmp loop
exit ori.w #$0700,sr di
movem.l (a7)+,a0 restore stack
; restore system variables
move.l a6,a1
lea start,a0
add.l #2048,a0
move.l #$8000,d0
jsr ldir
move.b #0,mc_stat switch to screen1, hires
; exit
lea ssvsp,a0
move.l (a0),sp restore stack
movem.l (a7)+,d0-d7/a0-a6
moveq #0,d0 return no error
move.w #$0800,sr user mode, EI
rts
; clear both screens
clscr move.l #$8000,d0
move.b #$ff,d1
jsr clmemb
move.l #$8000,d0
move.b #0,d1
jsr clmemb
; ldir (memory move routine) slow
; a0 - from / a1 - to / d0 - size
ldir move.b (a0)+,(a1)+
dbra d0,ldir
rts
; swap (memory swap routine) slow
; a0 - from / a1 - to / a2 - screen / d0 - size
swap move.b (a0),(a2)
move.b (a1),(a0)+
move.b (a2),(a1)+
dbra d0,swap
rts
; clmemb (clear mem) slow
; a0 - where / d0 - size / d1 - with what
clmemb move.b d1,(a0)+
dbra d0,clmemb
rts
flipper:
dc.l 0,0
lores:
movem.l d0-d7/a0,-(a7)
lea vram_l,a0
eor.b #$80,(a0)
move.b (a0),mc_stat
lea frames,a0
subi.w #01,(a0)
movem.l (a7)+,d0-d7/a0
beq exit
rts
hires:
movem.l d0-d7/a0,-(a7)
lea vram_h,a0
eor.b #$80,(a0)
move.b (a0),mc_stat
lea frames,a0
subi.w #01,(a0)
movem.l (a7)+,d0-d7/a0
beq exit
rts
mixed:
movem.l d0-d4/a0,-(a7)
move.b #%00000010,mc_stat screen off
lea vram_m,a0
move.b (a0),d0
move.b #%10001000,d1
move.w #bg_wait,d4
bg_wlp dbra d4,bg_wlp
move.w #nm_lins,d2
nm_llp move.w #ln_wait,d3
move.b d0,mc_stat
eor.b d1,d0
ln_wlp dbra d3,ln_wlp
nop
nop
nop
nop
dbra d2,nm_llp
eor.b d1,(a0)
lea frames,a0
subi.w #01,(a0)
movem.l (a7)+,d0-d4/a0
beq exit
rts
modes dc.l 0 lores
dc.l 0 hires
dc.l 0 mixed
frames dc.w 0
vram_l dc.b %00001000 ram 0 lores
vram_m dc.b %00000000 ram 0 hires
vram_h dc.b %10000000 ram 0 hires
ssvsp dc.l 0
ds.b $0200
stack
screen