I was reading about Don Lancaster's "Vaporlock" technique for finding the exact timing of the vertical blank during screen refreshes. Does anyone happen to have the sourcecode available or know where I can find the companion disk that came with Enhancing Your Apple II and IIe? I am hoping to avoid typing everything in manually
Anonymous
User login
Please support the defense of Ukraine.
Direct or via Unclutter App
Active forum topics
Recent content
Navigation
No Ads.
No Trackers.
No Social Media.
All Content Locally Hosted.
Built on Free Software.
We have complied with zero government requests for information.
In the mid-80's through word of mouth, I played around with (
LDA $C050) what is referred to as the "floating bus", although at the time I didn't know that term. Much much later, I found Bob Bishop's article "Have an Apple Split" from Softalk, October 1982, and others have similar programs that use the floating bus.Here is my quick one-liner to see a horizontal video effect:
300:AD 50 C0 EA AD 51 C0 4C 0 3 N 300GThis needs to be run from the MONitor on a real Apple II, or with a cycle accurate emulator like AppleWin, Epple ][, KEGS, ...
I've heard others use the term "vaporlock", so regarding Don Lancaster's book, I was able to find a few things ...
The book on Don Lancaster's web site:
https://www.tinaja.com/ebooks/enhance_vII.pdf
page 204 Enhancement 13 PROGRAM 13-1 Listing of VAPORLOCK.SOURCE.
A disk with the VAPORLOCK binary program without the source code:
https://archive.org/download/d181s1-mon-rom-vaporlock/d181s1-mon-rom-vaporlock.dsk
Bob Bishop, ( of Apple Vision fame ), has also done some work on this "quirk" of the Apple ][..
See: Have an Apple Split
and : Apple II Vapor Lock and the Floating Bus
Don Lancaster's other books are a great read. I would read each of his Articles in the Computer Shopper, back in the 1980's...
Also checkout Vince Weaver's Demo that uses this techneque: Apple II 64k Cycle Counting Megademo
MarkO
I've been experimenting with that kind of stuff all month, but I didn't know it was called "vapor lock".
WINDOWTOGGLEisn't very pretty, but it's surprisingly satisfying to play with. It divides the screen into ten 4-character-wide windows that can be independently switched betwen graphics mode and text mode.I posted a variant of
WINDOWTOGGLEin the Apple II Enthusiasts group on Facebook. Apparently it's a useful test case, as developers of Accurapple and AppleWin asked me to share the source code on Slack.Either assemble the program and start it with
BRUN WINDOWTOGGLE.OBJ0, or enter the machine code in the monitor and start it with300GPress the keys 0-9 to switch each region between text or graphics.
IMG_0886.JPG
IMG_0870.JPG
Here's a machine-code listing:
0300:20 69 03 AD 57 C0 AD 540308:C0 AD 52 C0 AD 50 C0 AD0310:50 C0 10 FB 24 06 EA 4C0318:26 03 CD 50 C0 CD 50 C00320:CD 50 C0 CD 50 C0 CD 500328:C0 CD 50 C0 CD 50 C0 CD0330:50 C0 CD 50 C0 CD 50 C00338:CD 50 C0 CD 50 C0 CD 560340:C0 CD 53 C0 EA AD 00 C00348:10 D0 C9 9B D0 01 60 290350:0F EA 2C 10 C0 85 3D 0A0358:38 65 3D AA BD 1A 03 690360:01 29 F1 9D 1A 03 D0 D00368:60 A9 20 85 E6 85 3D A90370:40 85 3F A0 00 84 3C 840378:3E B1 3C 29 7F 91 3C 200380:B4 FC 90 F5 A9 40 85 3C0388:85 3D A5 3C 20 11 F4 A00390:00 B1 26 09 80 91 26 E60398:3C C6 3D D0 ED B9 A9 0303A0:F0 06 20 F0 FD C8 D0 F503A8:60 8D D0 D2 C5 D3 D3 A003B0:CB C5 D9 D3 A0 B0 AD B903B8:00And the ASM source:
SOURCE FILE: WINDOWTOGGLE----- NEXT OBJECT FILE NAME IS WINDOWTOGGLE.OBJ00300: 0300 1 ORG $3000300: 2 * 65-cycle color killer 0300: 3 *0300: 4 * This polls for screen byte #$80 or hires alternate-black..0300: 5 * Then it uses a 65-cycle loop to split the screen into vertical strips.0300: 6 *0300: 7 ; ** BIOS locations **0300: 003C 8 A1L EQU $3C0300: 003D 9 A1H EQU $3D0300: 003E 10 A2L EQU $3E0300: 003F 11 A2H EQU $3F0300: FCB4 12 NXTA1 EQU $FCB4 ; routine to increment (A1) and compare (A2)0300: 13 ;0300: 0026 14 HBASL EQU $26 ; hires base address (low byte)0300: F411 15 HPOSN EQU $F411 ; set HBASL to base address of HGR line in A0300: 00E6 16 HGRPAGE EQU $E6 ;base address ($20 or $40)0300: 0024 17 MONCH EQU $24 ;cursor horizontal position0300: FDF0 18 COUT1 EQU $FDF0 ; character output to screen0300: 19 *0300: 20 ; ** Screen soft switches **0300: C050 21 TEXTOFF EQU $C0500300: C051 22 TEXTON EQU $C0510300: C052 23 MIXEDOFF EQU $C0520300: C053 24 MIXEDON EQU $C0530300: C054 25 PAGE1 EQU $C0540300: C055 26 PAGE2 EQU $C0550300: C056 27 LORES EQU $C0560300: C057 28 HIRES EQU $C0570300: 29 *0300:20 69 03 30 INIT JSR HISCRUB ; start by scrubbing the HGR screen0303: 31 ;0303:AD 57 C0 32 FINDSYNC LDA HIRES ;Choose hi resolution mode0306:AD 54 C0 33 LDA PAGE1 ;Default to page 10309:AD 52 C0 34 LDA MIXEDOFF ;text window off until sync acquired030C:AD 50 C0 35 LDA TEXTOFF ; scan must occur in graphics mode030F: 36 ;030F: 37 * Various find loops - all but 1 commented out at a time030F: 38 * 1. FIND HIGH BIT for graphics without half-dot-shift030F: 39 ;030F:AD 50 C0 40 FINDLOOP LDA TEXTOFF0312:10 FB 030F 41 BPL FINDLOOP ; keep searching if high bit isn't set0314: 42 ;0314: 43 * 2. FIND ALTERNATE BLACK for #$80 in first column0314: 44 ; LDA #$800314: 45 ;FINDLOOP CMP TEXTOFF0314: 46 ; BNE FINDLOOP ;keep searching if it doesn't match yet0314: 47 ;0314:24 06 48 BIT 6 ; 3 cycles0316:EA 49 NOP ; 2 cycles0317:4C 26 03 50 JMP P16 ;JMP 16 cycles inside loop031A: 51 ;031A:CD 50 C0 52 SYNCLOOP CMP TEXTOFF ;Cols 00 01 02 03031D:CD 50 C0 53 P04 CMP TEXTOFF ; 04 05 06 070320:CD 50 C0 54 P08 CMP TEXTOFF ; 08 09 10 110323:CD 50 C0 55 P12 CMP TEXTOFF ; 12 13 14 150326:CD 50 C0 56 P16 CMP TEXTOFF ; 16 17 18 190329:CD 50 C0 57 P20 CMP TEXTOFF ; 20 21 22 23032C:CD 50 C0 58 P24 CMP TEXTOFF ; 24 25 26 27032F:CD 50 C0 59 P28 CMP TEXTOFF ; 28 29 30 310332:CD 50 C0 60 P32 CMP TEXTOFF ; 32 33 34 350335:CD 50 C0 61 P36 CMP TEXTOFF ; 36 37 38 390338:CD 50 C0 62 P40 CMP TEXTOFF ; .. .. .. ..033B:CD 50 C0 63 P44 CMP TEXTOFF ; HBL033E:CD 56 C0 64 P48 CMP LORES ; HBL0341:CD 53 C0 65 P52 CMP MIXEDON ; last switch until next line0344:EA 66 NOP ;[2] + 38 = 3A0345:AD 00 C0 67 LDA $C000 ;[4] + 3A = 3E0348:10 D0 031A 68 BPL SYNCLOOP ;[3] + 3E = 41034A:C9 9B 69 CMP #$9B ;[3] was 'esc' pressed?034C:D0 01 034F 70 BNE TOGGLE ;[3] no, branch to toggle routine034E:60 71 RTS034F: 72 ;034F:29 0F 73 TOGGLE AND #$0F ;[2] restrict to range 0-F0351: 74 ; do a couple of timing adjustments0351:EA 75 NOP ;burn 2 cycles to help sync again0352: 76 ;BIT 6 ;burn 3 cycles to help sync again0352:2C 10 C0 77 BIT $C010 ; clear keyboard0355:85 3D 78 STA A1H ; store in memory for arithmetic0357:0A 79 ASL A ; A = keycode * 20358:38 80 SEC ; set carry for next instruction0359:65 3D 81 ADC A1H ; A = (keycode * 3) + 1035B:AA 82 TAX ; move index to X reg035C:BD 1A 03 83 LDA SYNCLOOP,X ;get low-order byte of a SYNCLOOP instruction035F:69 01 84 ADC #1 ;increment low nybble0361: 85 ** Choose only 1 of the next 2 lines, comment-out the other **0361:29 F1 86 AND #$F1 ; cycle through 2 switches only0363: 87 * AND #$F7 ; cycle through all 8 switches0363:9D 1A 03 88 STA SYNCLOOP,X ;update low-order byte0366:D0 D0 0338 89 BNE P40 ;branch to 40-cycles-into-loop0368:60 90 RTS0369: 91 ;0369: 92 * Scrub high bits out of hires memory0369: 93 ;0369:A9 20 94 HISCRUB LDA #$20036B:85 E6 95 STA HGRPAGE ;Set HGR page address036D:85 3D 96 STA A1H ;Set (A1) to start address036F:A9 40 97 LDA #$400371:85 3F 98 STA A2H ;Set (a2) to end address0373:A0 00 99 LDY #00375:84 3C 100 STY A1L0377:84 3E 101 STY A2L0379:B1 3C 102 MASKLOOP LDA (A1L),Y ; read next byte037B:29 7F 103 AND #$7F ; remove high bit037D:91 3C 104 STA (A1L),Y ; store it back037F:20 B4 FC 105 JSR NXTA10382:90 F5 0379 106 BCC MASKLOOP0384: 107 ;0384: 108 * Now add a high bit to 64 bytes in a column starting at line 640384: 109 ;0384:A9 40 110 LDA #64 ; start at line 640386:85 3C 111 STA A1L ; current line0388:85 3D 112 STA A1H ; current count038A:A5 3C 113 DEMASKLOOP LDA A1L038C:20 11 F4 114 JSR HPOSN038F:A0 00 115 LDY #00391:B1 26 116 LDA (HBASL),Y0393:09 80 117 ORA #$80 ; add high bit0395:91 26 118 STA (HBASL),Y0397:E6 3C 119 INC A1L0399:C6 3D 120 DEC A1H039B:D0 ED 038A 121 BNE DEMASKLOOP039D: 122 ;039D: 123 ; Print message at MSGTEXT039D:B9 A9 03 124 MSGLOOP LDA MSGCR,Y03A0:F0 06 03A8 125 BEQ MSGDONE03A2:20 F0 FD 126 JSR COUT103A5:C8 127 INY03A6:D0 F5 039D 128 BNE MSGLOOP03A8: 129 ;03A8:60 130 MSGDONE RTS03A9: 131 ;03A9:8D 132 MSGCR DB $8D ;carriage return03AA:D0 D2 C5 D3 133 MSGTEXT ASC "PRESS KEYS 0-9"03B8:00 134 DB 03D A1H 3C A1L 3F A2H 3E A2LFDF0 COUT1 038A DEMASKLOOP 030F FINDLOOP ?0303 FINDSYNC26 HBASL E6 HGRPAGE C057 HIRES 0369 HISCRUBF411 HPOSN ?0300 INIT C056 LORES 0379 MASKLOOPC052 MIXEDOFF C053 MIXEDON ? 24 MONCH 03A9 MSGCR03A8 MSGDONE 039D MSGLOOP ?03AA MSGTEXT FCB4 NXTA1?031D P04 ?0320 P08 ?0323 P12 0326 P16?0329 P20 ?032C P24 ?032F P28 ?0332 P32?0335 P36 0338 P40 ?033B P44 ?033E P48?0341 P52 C054 PAGE1 ?C055 PAGE2 031A SYNCLOOPC050 TEXTOFF ?C051 TEXTON 034F TOGGLE** SUCCESSFUL ASSEMBLY := NO ERRORS** ASSEMBLER CREATED ON 21-MAY-83 REL-07** TOTAL LINES ASSEMBLED 134** FREE SPACE PAGE COUNT 77Is there a better way to post source code here? The [code] and <code> tags apparently don't work.