Jump to content

Photo

display list interrupt with fastbasic ?


3 replies to this topic

#1 funkheld OFFLINE  

funkheld

    Moonsweeper

  • 265 posts

Posted Sat Sep 15, 2018 1:34 PM

Hi good afternoon.
 
how can you please implement the program below in fastbasic.
 
Thank you.
greeting

 

 

PROC DLI()
  BYTE WSYNC=$D40A
  BYTE COLPF2=$D018
 
  [PHA TXA PHA TYA PHA]    
  WSYNC=0
  COLPF2=$CC
  VSDLST=DLI2V
  [PLA TAY PLA TAX PLA RTI]  
RETURN


#2 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 402 posts
  • Location:Viņa del Mar, Chile

Posted Sun Sep 16, 2018 12:50 PM

Hi Funkheld!
 

how can you please implement the program below in fastbasic.
 

PROC DLI()
  BYTE WSYNC=$D40A
  BYTE COLPF2=$D018
 
  [PHA TXA PHA TYA PHA]    
  WSYNC=0
  COLPF2=$CC
  VSDLST=DLI2V
  [PLA TAY PLA TAX PLA RTI]  
RETURN


Because FastBasic is an interpreted language, you can't write an interrupt routine in it. You need to use machine language.

Something equivalent to your code is:
' Display List Interrupt example
'

' Assembly:       PHA/TXA/PHA/TYA/PHA/LDA#$00/STA $D40A
data dli() byte = $48,$8a,$48,$98,$48,$a9,$00,$8d,$0a,$d4,
'                 LDA#$CC/STA $D01A  /PLA/TAY/PLA/TAX/PLA/RTI
data       byte = $a9,$cc,$8d,$1A,$d0,$68,$a8,$68,$aa,$68,$40


' Set's graphics mode
gr. 7

' Draw some lines
plot 79,47
for i=0 to 100
  color rand(3)+1
  dr. rand(160),rand(96)
next i

dpoke 512, ADR(dli)     ' Sets display-list interrupt
poke dpeek(560)+40, $8D ' Writes an interrupt line in the display-list
poke 54286, 192         ' Enable DLI

? "Press any key to exit";
repeat : until key()


#3 funkheld OFFLINE  

funkheld

    Moonsweeper

  • Topic Starter
  • 265 posts

Posted Sun Sep 16, 2018 3:09 PM

hello, that's wonderful with fastbasic ... !!!!!
 
I have my own displaylist in memory from $ 2100.
the interrupt works wonderfully.
 
Without manipulation of fastbasic.cfg is a graphic representation with Players difficult.
Especially affects Graphics 24.
 
Thank you.
 

dlist =560
savmsc=$58
ramadr=$2100
max=3840
 
ramtop = $6a   : sdmctl = $22f  : pcolr0 = $2c0 
hposp0 = $d000 : gractl = $d01d : pmbase = $d407
p0pf = $d004 : hitclr = $d01e : pm0br = $d008 : vdelay = $d01c
 
' Assembly:       PHA/TXA/PHA/TYA/PHA/LDA#$00/STA $D40A
data dli() byte = $48,$8a,$48,$98,$48,$a9,$00,$8d,$0a,$d4,
'                 LDA#$CC/STA $D01A  /PLA/TAY/PLA/TAX/PLA/RTI
data       byte = $a9,$cc,$8d,$1A,$d0,$68,$a8,$68,$aa,$68,$40
 
data dldat() byte = $70, $70, $70, $4d, 
data          byte = $00,$21,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $41, 
data          byte = $00, $20 
 
dladr=adr(dldat)
move dladr,$2000,255
 
memtop = peek(ramtop) - 8
p0mem  = $100 * memtop + $400
for a=(memtop*256) to (memtop*256+2047)
    poke a,0
next 
 
oldpos = p0mem
poke ramtop, memtop
 
gr. 23
color 1
 
dpoke dlist,$2000
dpoke savmsc,ramadr
 
plot 0,0
drawto 159,95
plot 159,0
drawto 0,95
 
dpoke 512, ADR(dli)     ' Sets display-list interrupt
poke dpeek(560)+60, $8D ' Writes an interrupt line in the display-list
poke 54286, 192         ' Enable DLI
 
poke p0mem, 0 : move p0mem, p0mem+1, 127 
poke pcolr0, $1f
poke sdmctl, peek(sdmctl) ! 24
poke pmbase, memtop
poke gractl, 2
 
data pmdata()  byte = 255,129,129,129,129,129,129,255
data pmclear() byte = 0,0,0,0,0,0,0,0
 
xpos = 50 : ypos = 50
exec movepm
 
repeat 
joy0=stick(0)
 
if joy0=14 
    test=1
ypos=ypos-1
exec movepm
    elif joy0=13
    test=2
ypos=ypos+1
exec movepm
    elif joy0=7 
    test=3
     xpos=xpos+1
exec movepm
    elif joy0=11 
    test=4
     xpos=xpos-1
exec movepm
   endif
 
if peek(p0pf) > 0    
   poke hitclr,1
   
   if test=1
        test=0
        ypos=ypos+2
exec movepm
elif test=2
test=0
    ypos=ypos-2
exec movepm
elif test=3
test=0
xpos=xpos-2 
exec movepm
elif test=4
test=0
xpos=xpos+2 
            exec movepm 
endif     
endif   
 
until key()
 
poke gractl, 0
poke sdmctl, peek(sdmctl) & 247
poke ramtop, memtop + 8
 
end
 
proc movepm
x = xpos  : y = p0mem + ypos 
 
pause 0
poke hposp0, x
move adr(pmclear), oldpos, 8
move adr(pmdata),  y,      8
oldpos = y
endproc

Attached Thumbnails

  • Bild2.jpg

Edited by funkheld, Tue Sep 18, 2018 2:57 AM.


#4 funkheld OFFLINE  

funkheld

    Moonsweeper

  • Topic Starter
  • 265 posts

Posted Mon Sep 17, 2018 9:23 AM


Hello.
now it worked with the dli with several lines.
asm-compiler is atasm.exe
 
 created with my purebasicprogram from the bin data  :
--------------------------------------------------------------------------------------------
data dli() byte =$48, $8A, $48, $A9, $01, $8D, $0A, $D4, $A9, $C5, 
data      byte =  $8D, $1A, $D0, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
........
----------------------------------------------------------------------------------------------
 
Thank you.
greeting
 

asm-daten:

    * = start
pha
txa
pha
lda #1
sta $d40a
lda #$c5
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$89
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$41
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$69
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$0
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$89
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$0
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$a9
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
lda #$0
sta $d01a 
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
sta $d40a
pla
tax
pla
rti
 
[code=auto:0]
dlist =560
savmsc=$58
ramadr=$2000
 
data dli() byte =$48, $8A, $48, $A9, $01, $8D, $0A, $D4, $A9, $C5, 
data      byte =  $8D, $1A, $D0, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $A9, $89, $8D, 
data      byte =  $1A, $D0, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $A9, $41, $8D, $1A, 
data      byte =  $D0, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $A9, $69, $8D, $1A, $D0, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $A9, $00, $8D, $1A, $D0, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $A9, $89, $8D, $1A, $D0, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $A9, $00, $8D, $1A, $D0, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $A9, $A9, $8D, $1A, $D0, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $A9, $00, $8D, $1A, $D0, $8D, $0A, $D4, $8D, $0A, 
data      byte =  $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, 
data      byte =  $8D, $0A, $D4, $8D, $0A, $D4, $8D, $0A, $D4, $8D, 
data      byte =  $0A, $D4, $68, $AA, $68, $40
 
data dldat() byte = $70, $70, $70, $4d, 
data          byte = $00,$20,
data          byte = $8D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D, $0D,
data          byte = $0D, $0D, $0D, $0D, $0D, $41, 
data          byte = $00, $00 
 
dladr=adr(dldat)
poke dladr+103,dladr
 
dpoke dlist,dladr
dpoke savmsc,ramadr
 
dpoke 512, ADR(dli)     
poke 54286, 192         
 
repeat
until key()
 
end
[code=auto:0]
 

Attached Thumbnails

  • Bild2.jpg

Edited by funkheld, Tue Sep 18, 2018 12:52 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users