fix irq routine removal

This commit is contained in:
Irmen de Jong 2019-07-10 03:57:03 +02:00
parent 1f89571aa5
commit 0c7f107d01
2 changed files with 14 additions and 10 deletions

View File

@ -104,7 +104,12 @@ class CallGraph(private val program: Program): IAstVisitor {
}
override fun visit(subroutine: Subroutine) {
if((subroutine.name=="start" && subroutine.definingScope().name=="main")
val alwaysKeepSubroutines = setOf(
Pair("main", "start"),
Pair("irq", "irq")
)
if(Pair(subroutine.definingScope().name, subroutine.name) in alwaysKeepSubroutines
|| subroutine.name== initvarsSubName || subroutine.definingModule().isLibraryModule) {
// make sure the entrypoint is mentioned in the used symbols
addNodeAndParentScopes(subroutine)

View File

@ -5,10 +5,11 @@
~ main {
sub start() {
c64.SCROLY &= %11101111 ; blank the screen
c64utils.set_rasterirq_excl(40)
c64.SCROLY &= %11101111 ; blank the screen
c64utils.set_rasterirq_excl(40) ; register exclusive raster irq handler
while(true) {
; enjoy the moving bars :)
}
}
@ -20,22 +21,20 @@
const ubyte barheight = 4
ubyte[] colors = [6,2,4,5,15,7,1,13,3,12,8,11,9]
ubyte color = 0
ubyte ypos = 0
ubyte yanim = 0
sub irq() {
Y++ ; slight timing delay to avoid rasterline transition issues
ubyte rasterpos = c64.RASTER
if color!=len(colors) {
c64.EXTCOL = colors[color]
c64.RASTER += barheight ; next raster Irq for next color
color++
c64.RASTER = rasterpos+barheight
}
else {
ypos += 2
c64.EXTCOL = 0
color = 0
c64.RASTER = sin8u(ypos)/2+40
yanim += 2
c64.RASTER = sin8u(yanim)/2+30 ; new start of raster Irq
}
c64.SCROLY &= $7f ; set high bit of the raster pos to zero
}
}