RE: Line interrupts
Is this in z80 ? From: owner-sam-us...@nvg.ntnu.no [mailto:owner-sam-us...@nvg.ntnu.no] On Behalf Of Andrew Park Sent: 01 January 2014 15:37 To: sam-users@nvg.ntnu.no Subject: Line interrupts Hi all Happy new year lets hope we can see some more sam stuff this year. Any idea how i can set up a line interrupt routine between 32768 and 65535? I want to change the palette twice once at line 0 and then again on line 128. Many thanks Andy
RE: Line interrupts
Yes im using jam assembler to write the code Thanks Andy From: owner-sam-us...@nvg.ntnu.no [mailto:owner-sam-us...@nvg.ntnu.no] On Behalf Of Adrian Brown Sent: 01 January 2014 15:59 To: sam-users@nvg.ntnu.no Subject: RE: Line interrupts Is this in z80 ? From: owner-sam-us...@nvg.ntnu.no [mailto:owner-sam-us...@nvg.ntnu.no] On Behalf Of Andrew Park Sent: 01 January 2014 15:37 To: sam-users@nvg.ntnu.no Subject: Line interrupts Hi all Happy new year lets hope we can see some more sam stuff this year. Any idea how i can set up a line interrupt routine between 32768 and 65535? I want to change the palette twice once at line 0 and then again on line 128. Many thanks Andy
Re: Line interrupts
Set up an IM2 vector table, use the frame interrupt to set up the first line interrupt (send the line number you want to fire to port $f9), then have your line interrupt routine set up the second time it should trigger by sending the new line number again to port $f9. I do that more or less for my special edition version of lost disks of sam I've been tinkering with for a while now, only inside an IM1 interrupt routine. Seems to work absolutely fine so far, although I don't know if it would be considered the right way. Probably not, but if it works, I'm happy as larry. Happy new year:) Andrew - Original Message - From: Andrew Park To: sam-users@nvg.ntnu.no Sent: Wednesday, January 01, 2014 3:37 PM Subject: Line interrupts Hi all Happy new year lets hope we can see some more sam stuff this year. Any idea how i can set up a line interrupt routine between 32768 and 65535? I want to change the palette twice once at line 0 and then again on line 128. Many thanks Andy
Re: Line interrupts
On 01/01/2014 15:37, Andrew Park wrote: Hi all Happy new year lets hope we can see some more sam stuff this year. Any idea how i can set up a line interrupt routine between 32768 and 65535? I want to change the palette twice once at line 0 and then again on line 128. Many thanks Andy Hi Andy Happy new year. Here are some examples that work for me. Easy way is the polling version: StatusReg: equ 249 LineIntBit: equ 0 WaitLine: out (StatusReg),a Loop: in a,(StatusReg) bit LineIntBit,a ret z jp nz,Loop Test: ld a,0 call WaitLine ;... ld a,128 call WaitLine ;... ret This works fine if you have full control over the computer. But it's not a fully automatic interrupt mode, so has a bunch of waiting around. Interrupt Mode 1 will jump to 00056 - no good for you. IM0 is designed for an external device interrupt request, usually an RST, which is in the 0-32767 range).So IM2 is your other option. If you haven't worked with it before it's worth reading Steve Taylor's assembly language tutorial (16 on this page: http://sam.speccy.cz/coding.html). Here's an example where the interrupt is called every line. org 32768 dump 1,0 SetupIM2: di ; Disable interrupts im 2; Set mode ld a,129; Set I register between 128-254 (not 255 as this will wrap onto 0-32767 page) ld i,a ; Write jump table (257 bytes of byte x at I*256) ld h,a ld l,0 ld (hl),130 ld d,h ld e,1 ld bc,256 ldir ei ; Enable interrupts xor a ; Set initial line interrupt value out (StatusReg),a Loop: ;... rest of your program halt jp Loop ; Put your interrupt routine at x*256+x org 33410 dump 1,33410-32768 IntRout: di ld a,(Line+1) and 127 ld bc,248 out (c),a Line: ld a,0 out (StatusReg),a inc a cp 192 jp nz,SkipReset xor a SkipReset: ld (Line+1),a ei reti In your routine you will want to be more careful with saving registers so returning to normal program flow won't corrupt registers. Also, I didn't check the interrupt type (by doing in a,(249); bit 0,a), so this will mess up if the mouse is installed, or MIDI data is being transferred. I notice the MIDI support in SimCoupé is missing have I missed an update maybe? Or is there any schedule for this? I only ask because I've been tinkering with SAM music lately and I'm convinced the quality of the standard chip music on the SAM would vastly improve with better UI... Hope this helps Howard --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
RE: Line interrupts
I always run with a standard Rom replacement system so use IM mode 1. Stick a JP at $38 and handle the interrupt that way. It depends if you need to use the system ROM, but if you don't always consider running your code as a rom replacement, it also gives you the RST vectors for faster calls for standard functions. If you want I can send you a basic setup for this, including an interrupt handler Adrian From: owner-sam-us...@nvg.ntnu.no [mailto:owner-sam-us...@nvg.ntnu.no] On Behalf Of Andrew Gillen Sent: 01 January 2014 19:34 To: sam-users@nvg.ntnu.no Subject: Re: Line interrupts Set up an IM2 vector table, use the frame interrupt to set up the first line interrupt (send the line number you want to fire to port $f9), then have your line interrupt routine set up the second time it should trigger by sending the new line number again to port $f9. I do that more or less for my special edition version of lost disks of sam I've been tinkering with for a while now, only inside an IM1 interrupt routine. Seems to work absolutely fine so far, although I don't know if it would be considered the right way. Probably not, but if it works, I'm happy as larry. Happy new year:) Andrew - Original Message - From: Andrew Park mailto:alp...@ntlworld.com To: sam-users@nvg.ntnu.no Sent: Wednesday, January 01, 2014 3:37 PM Subject: Line interrupts Hi all Happy new year lets hope we can see some more sam stuff this year. Any idea how i can set up a line interrupt routine between 32768 and 65535? I want to change the palette twice once at line 0 and then again on line 128. Many thanks Andy