g0blinish Posted February 1, 2015 Share Posted February 1, 2015 When I typed source into Applewin 1.24.0, CALL 768 brings me no result, no sound. Source:http://compgroups.net/comp.sys.apple2.programmer/demo-iie-interrupt-code/2174106 *300L 0300- 4C 15 03 JMP $0315 0303- 48 PHA 0304- B1 06 LDA ($06),Y 0306- A2 C4 LDX #$C4 0308- A0 40 LDY #$40 030A- 8D 37 03 STA $0337 030D- 8E 38 03 STX $0338 0310- 68 PLA 0311- 20 36 03 JSR $0336 0314- 60 RTS 0315- A9 C4 LDA #$C4 0317- 85 07 STA $07 0319- A0 19 LDY #$19 031B- 20 03 03 JSR $0303 031E- A9 30 LDA #$30 0320- 8D FE 03 STA $03FE 0323- A9 03 LDA #$03 0325- 8D FF 03 STA $03FF 0328- A0 12 LDY #$12 032A- A9 08 LDA #$08 032C- 20 03 03 JSR $0303 032F- 60 RTS 0330- AD 30 C0 LDA $C030 0333- A5 45 LDA $45 0335- 40 RTI 0336- 4C 00 00 JMP $0000 Is possible to use interrupt? Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/ Share on other sites More sharing options...
JamesD Posted February 1, 2015 Share Posted February 1, 2015 When I typed source into Applewin 1.24.0, CALL 768 brings me no result, no sound. <snip> Is possible to use interrupt? I'm not even going to try to figure out what code with no labels or comments is doing. However, there is no vertical blank interrupt on the Apple II. I had to use one of the timers on the Mockingboard to generate a recurring interrupt for my music player. I believe you can also get an interrupt from the mouse card and a few others but I haven't used any of them. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167710 Share on other sites More sharing options...
david__schmidt Posted February 1, 2015 Share Posted February 1, 2015 Looks like this was from the following: https://groups.google.com/forum/#!topic/comp.sys.apple2.programmer/UnNYbNPzFPA Which goes on to say: "Working on unenhanced IIe with AppleMouse Card in Slot 4. Produces a rather high-pitched tone on the loud speaker." So... not going to work on an emulator without the AppleMouse card in slot 4. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167721 Share on other sites More sharing options...
g0blinish Posted February 1, 2015 Author Share Posted February 1, 2015 Mouse enable in the AppleWin options. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167738 Share on other sites More sharing options...
david__schmidt Posted February 1, 2015 Share Posted February 1, 2015 That's fine, but it doesn't mean AppleWin emulates the AppleMouse card (or, importantly, the interrupts it would provide). Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167786 Share on other sites More sharing options...
g0blinish Posted February 1, 2015 Author Share Posted February 1, 2015 but AppleWin emulates Multitasking Demo 1.1 Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167810 Share on other sites More sharing options...
david__schmidt Posted February 1, 2015 Share Posted February 1, 2015 Time to engage Mr. Finnegan, then. He's on comp.sys.apple2 frequently. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167814 Share on other sites More sharing options...
The Usotsuki Posted February 1, 2015 Share Posted February 1, 2015 (edited) Delorted. Edited February 1, 2015 by The Usotsuki Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3167879 Share on other sites More sharing options...
JamesD Posted February 1, 2015 Share Posted February 1, 2015 (edited) but AppleWin emulates Multitasking Demo 1.1 That doesn't mean the code you are trying to use is complete either. If the interrupt isn't set up properly you won't get any sound. The code is a little odd. Maybe I'm interpreting it wrong though since I haven't spent much time on it. They are using a JMP and I'm not sure where it is going; mostly because I don't know what is on page zero. It appears to be some addresses like $C4xx which is the ROM for a peripheral card. Perhaps it's calling routines in the mouse card ROM. $03FE is the IRQ handler address and it's obvious where it is being set but the interrupt handler doesn't save and restore registers so it's not what I would call a good example. 0300- 4C 15 03 JMP $0315 ;skip to the main code 0303- 48 PHA 0304- B1 06 LDA ($06),Y ; Y is changed by the caller 0306- A2 C4 LDX #$C4 0308- A0 40 LDY #$40 030A- 8D 37 03 STA $0337 ;self modifying code, change JMP address 030D- 8E 38 03 STX $0338 0310- 68 PLA 0311- 20 36 03 JSR $0336 ;call the JMP 0314- 60 RTS ;main 0315- A9 C4 LDA #$C4 0317- 85 07 STA $07 ; setup page zero 0319- A0 19 LDY #$19 ; page zero index? 031B- 20 03 03 JSR $0303 ; call the subroutine to perform a jump ;set the interrupt handler address to $0330 031E- A9 30 LDA #$30 ;self modifying code, change jump to $0330 0320- 8D FE 03 STA $03FE 0323- A9 03 LDA #$03 0325- 8D FF 03 STA $03FF ; pass an address to the ROM routine the JMP is calling? 0328- A0 12 LDY #$12 032A- A9 08 LDA #$08 032C- 20 03 03 JSR $0303 032F- 60 RTS ;the interrupt handler 0330- AD 30 C0 LDA $C030 ;click the speaker 0333- A5 45 LDA $45 ; *modifying a register within an interrupt without saving and restoring it is a bad idea* 0335- 40 RTI ;return from the interrupt ;perform a jump to different handlers? 0336- 4C 00 00 JMP $0000 ;address is changed by self modifying code Edited February 1, 2015 by JamesD Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168174 Share on other sites More sharing options...
JamesD Posted February 1, 2015 Share Posted February 1, 2015 Just a thought but maybe the emulator needs a ROM image for the mouse card ROM. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168196 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 One of my comments is wrong. Oops.Ignore the part that says ";self modifying code,..." ;set the interrupt handler address to $0330 031E- A9 30 LDA #$30 ;self modifying code, change jump to $0330 0320- 8D FE 03 STA $03FE 0323- A9 03 LDA #$03 0325- 8D FF 03 STA $03FF Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168296 Share on other sites More sharing options...
Iamgroot Posted February 2, 2015 Share Posted February 2, 2015 The LDY #$ before each JSR $303 is an offset into the $C400 page to get another offset for each of these mouse calls. They are as follows: Setmouse ($12) - sets the mode of the mouse - transparent or passiveServmouse ($13) - verifies mouse was cause of interruptReadmouse ($14) - updates screenholes and mouse posnClearmouse ($15) - clears mouse screenholes to 0; for delta modePosmouse ($16) - positions mouse cursorClampmouse ($17) - sets the screen clampsHomemouse ($18) - sets coords to top left of windowInitmouse ($19) - initialize mouse The instruction at $32A has a LDA #$08. This turns on interrupts for the mouse but the mouse is in passive mode and only some calls work in passive. Try changing that to a LDA #$09, which puts the mouse in transparent mode. or go into the monitor and change to this: 032B:09 Although the code is not quite complete as it stands, assuming the mouse is the only device creating interrupts on your computer, this routine does claim any and all interrupts as its own. But to do that there should be a CLC just before the RTI at $0335. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168319 Share on other sites More sharing options...
Iamgroot Posted February 2, 2015 Share Posted February 2, 2015 After going over my notes, there should not be an RTI in this code either unless an interrupt was allocated using Prodos. Change the RTI to an RTS. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168329 Share on other sites More sharing options...
Iamgroot Posted February 2, 2015 Share Posted February 2, 2015 Like I said before, this code is incomplete and was probably part of a larger program. As is, it still may not work until interrupts are turned on. Add a CLI just before the RTS at $033F to enable interrupts to be processed by the computer. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168343 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 And remember that the 6502 interrupt doesn't preserve A so if you want to update the mouse from within a program that actually does something then this interrupt handler will cause your code to malfunction. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168384 Share on other sites More sharing options...
g0blinish Posted February 2, 2015 Author Share Posted February 2, 2015 And remember that the 6502 interrupt doesn't preserve A so if you want to update the mouse from within a program that actually does something then this interrupt handler will cause your code to malfunction. All what i found is A stored into $45 Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168391 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 (edited) The code loads $45 into A in the interrupt, it does not save A into $45. It also does so after modifying A.I think I would have the JMP subroutine calls switched to JSRs inline and have an init routine that modifies the addresses once instead of doing it repeatedly.Without more docs on the mouse routines I wouldn't know exactly how to handle the interrupt but it would probably involve these steps: IRQ_Handler: ;push modified registers to stack pha ; txa ; pha ; tya ; pha ;check to see if interrupt was caused by mouse jsr $0000 ; modify with address of Servmouse ;if not, skip to interrupt exit ;I have no idea what Servmouse does so ??????? ; beq bne interrupt_exit: ;update mouse ; check what the mouse did and call the appropriate mouse routine? ; Readmouse Posmouse? interrupt_exit: ;pull registers ; pla ; tay ; pla ; tax pla rti Edited February 2, 2015 by JamesD Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168399 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 Are you just trying to see how an interrupt handler works or are you trying to see how to make the Apple II mouse work?I posted the code for my music player in another thread and it has an interrupt handler.You can find it in this thread. The code is much larger but it might be of some help. No promises I posted every fix to the code though.Link Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168420 Share on other sites More sharing options...
g0blinish Posted February 2, 2015 Author Share Posted February 2, 2015 No, I am lost into the docs threads and examples. Purpose is interrupt what switches two pages and outputs scroll text. Here is .dsk with source (INT6.S) and again it didn't work. Merlin_Assembler2.zip Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168470 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 (edited) I'll have to install Ciderpress or an emulator on my new machine before I could look at it.The easiest approach to doing what you want is to simply get it working without the interrupt. You can try polling the address that lets you read the vertical blank signal.If you create a WaitVBlank subroutine and call it from a main loop you could test for a signal from an interrupt or poll the address looking for VBlank.I think you just need to create a loop that checks if $C019 > 127 based on what I could find. I don't think it works on all Apples but then not all Apples have a mouse card either.*edit*Actually, I think you loop while that address is > 127. Not sure if emulators support this btw.This page talks about it:http://rich12345.tripod.com/aiivideo/vbl.html Edited February 2, 2015 by JamesD Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168623 Share on other sites More sharing options...
g0blinish Posted February 2, 2015 Author Share Posted February 2, 2015 so, better is to write code what feet with beeper into one frame? Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168670 Share on other sites More sharing options...
MarkO Posted February 2, 2015 Share Posted February 2, 2015 rich12345 also has a copy of Have an Apple Split by Bob Bishop, Softalk, October 1982.The Bottom Line is, "What is not generally known is that the blanking can be detected by the Apple II, even though it lacks the special hardware found in those other machines."MarkO Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168691 Share on other sites More sharing options...
g0blinish Posted February 2, 2015 Author Share Posted February 2, 2015 so, the point is "forget about interrupts"? Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168711 Share on other sites More sharing options...
MarkO Posted February 2, 2015 Share Posted February 2, 2015 so, the point is "forget about interrupts"? Probably.... Unless you have an Apple //c or ][gs, with standard Hardware to generate an Interrupt, you will need to make sure you Target Machine has Additional Hardware to make that happen.. e.g. The MOS6522 or equivalent on the Mouse Card/Interface is used for generating Interrupts. Mocking Board, Echo ][+, John Bell MOS6522 Card, etc... Interrupts are tricky on the Apple ][, because all the Disk ][ Access are Timing Critical, so Interrupts are Disabled while performing Disk Access. Apple DOS 3.3 is very poor with Interrupts, ProDOS has better support for Interrupts. vertical blank signal detection can be done by the above posted links.. MarkO Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168789 Share on other sites More sharing options...
JamesD Posted February 2, 2015 Share Posted February 2, 2015 It's not "better", just easier. The only reason you might have to use an interrupt is if you want to do something without stopping to poll but still have something take place at a closely timed interval.This makes interrupts ideal for things that need to keep running no matter what else you are doing.A person could reserve some memory, load a music player into it and then play music from a BASIC game, have a countdown timer, maintain a software clock, etc...If you get it working without the interrupt you can always add it later and you aren't debugging the interrupt at the same time as the rest of the code.Just remember, the IIe is the most abundant model out there and it requires a mouse card to support the interrupt you want to use and most IIe machines don't have a mouse card.The IIc, IIc+ and IIgs have the mouse card built in but they are less abundant.This is really a problem with the II series you just can't get around. To get a demo to run on the most machines you'll have to test what machine you are running on since different models behave differently. Quote Link to comment https://forums.atariage.com/topic/234547-issue-with-demo-iie-interrupt-code/#findComment-3168826 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.