Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

zzarko
on 2021-01-11
00:39:46
 Re: Help with raster interrupt

Sorry I wasn't clear, games aren't mine, I just used them to test the cartridge code (that one is mostly mine). My friend and I are making a new 264 banking cartridge, probably with up to 2MB EPROM, and I was reading (and asking) a lot to make the software side work. Once it is finished, I'll add all the code to
https://bitbucket.org/zzarko/magic-desk-cartridge-generator/
PC/Python side is 99% identical to C64 side, and Plus4 ASM is about 70-80% identical to C64 side, and it will be easier for me to maintain it when all the code is in one place.

Posted By

MMS
on 2021-01-10
18:19:30
 Re: Help with raster interrupt

Nice one! based on the video they look great and will be challanging! happy

Posted By

zzarko
on 2021-01-10
16:21:20
 Re: Help with raster interrupt

Thank you all for help and comments! In the end I wrote my own scanning routine based on this that gives me key codes that I can easily use without changing the logic I already had for C64 version of the code.

I also added a music playback, and this is how cartridge menu looks and sounds now (music is demo tune from KnaeckeTraecker):
https://www.youtube.com/watch?v=fv3p-i4dRew

This is close to finished, but needs more testing.

Posted By

MMS
on 2021-01-09
04:41:05
 Re: Help with raster interrupt

Reading this the Digital Box II demo came into my mind, handling most of the keys you mention.
In the YAPE Monitor function you may check that code (though almost the complete memory used most of it just digitized sound)

Posted By

zzarko
on 2021-01-09
02:25:41
 Re: Help with raster interrupt

Thank you very much for advice how to do interrupt acknowledge! Now my code works as I wanted happy

I was asking about SCNKEY because I need to be able to distinguish between all these keys:
0-9, A-Z, A-Z with Shift pressed, cursor keys (up/down/left/right), Enter, Space, Esc, F1-F7, Help.

I'll look at the code you suggested, thanks for that also!

Posted By

Csabo
on 2021-01-08
19:14:41
 Re: Help with raster interrupt

You're missing the "acknowledge interrupt" step. You just need to read and write $FF09, in practice this is usually ASL $FF09 or something similar.

You don't _have_ to call SCNKEY/GETIN from IRQ. Those write to $C6 IIRC.

If you need to look at some working code, all my demos/games should have source code released. (Let me know if you see something that's missing the source.) E.g. check Stack 123 for a fully working keyboard handler, etc.

Posted By

zzarko
on 2021-01-08
16:34:23
 Re: Help with raster interrupt

Also, I would like to use SCNKEY/GETIN for keyboard reading, if possible. From what I have understood, I should call SCNKEY from IRQ, but I do not know what other calls, if any, should be made in IRQ for SCNKEY to work. If SCNKEY isn't feasable solution, I'll go with reading the registers directly (I have found a page here explaining how it works).

Posted By

zzarko
on 2021-01-08
16:26:33
 Help with raster interrupt

Using the explanations from Forum64.de I was able to make this test code (written in KickAssembler):

.label SCREEN = $0C00
.label COLORR = $0800

.const FirstLine = 10
.label IRQ_Vector = $0314
.label IRQ_Kernel = $CE0E
.label Kernel_IRQ_Exit = $FCC3

*= $1001
BasicUpstart(DoIt)
*= $1020

DoIt:
sei
lda #<TEDIRQ
sta IRQ_Vector
lda #>TEDIRQ
sta IRQ_Vector+1

lda #00
tay
!: sta SCREEN,y
sta SCREEN+$100,y
sta SCREEN+$200,y
sta SCREEN+$2E8,y
tya
dey
bne !-

lda #$ff
sta $ff0c
sta $ff0d // hide cursor

lda #$32
sta $FF15
cli

MainCode:
inc $FF15
jmp MainCode

TEDIRQ:
lda #33
sta $FF19

lda #$FE
!: cmp $FF1C
beq !- // wait until $FF1C ≠ 0
!: cmp $FF1C
bne !- // wait until $FF1C ≠ 1

inc $FF19
lda #FirstLine

WaveLine:
!: cmp $FF1D
bne !-

inc $FF19
clc
adc #$08
cmp #FirstLine + 24*8
bne WaveLine

TEDIRQend:
inc $FF19
inc SCREEN
jmp Kernel_IRQ_Exit

This is just a skeleton for what I really want to do, but I have come to an obstacle: main code isn't running. The code at label MainCode should constantly change the background color, but that is not happening, it runs once maybe twice and that's it. My best guess is that either interrupt code eats all the CPU time (I may have misunderstood something about how raster on TED works) or that maybe interrupt isn't acknowledged (I do not know how to do that on Plus/4).

I have been reading about Plus/4 programming during the past week, but I haven't been able to find much about raster interrupts. Any help would be appreciated.


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon