******************************************************************************** * Starship Commander for the Apple II, by Gilman Louie * * Copyright 1981 Voyager Software * * * * Disassembly of "SUBROUTINES". * ******************************************************************************** * Three short assembly-language routines: * * * * Make sound: POKE 2048,pitch : POKE 2049,duration : CALL 2050 * * Clear screen: POKE 2072,color1 : POKE 2073,color2 : CALL 2074 * * Invert screen colors: CALL 2115 * ******************************************************************************** * Disassembly by Andy McFadden, using 6502bench SourceGen v1.5. * * Last updated 2020/01/22 * ******************************************************************************** pitch .eq $0800 duration .eq $0801 SPKR .eq $c030 ;RW toggle speaker .org $0802 ; ; Makes a tone of the specified pitch and duration. ; ; (I've seen nearly identical code elsewhere, e.g. in Galactic Trilogy's TONE, ; so there's probably a common source.) ; 0802: ad 30 c0 SOUND lda SPKR ;click 0805: 88 L0805 dey ;on entry from a CALL, Y will be $02 (addr low) 0806: d0 05 bne L080D 0808: ce 01 08 dec duration ;are we done yet? 080b: f0 09 beq :done ;yes 080d: ca L080D dex ;pausing between clicks? 080e: d0 f5 bne L0805 ;yes 0810: ae 00 08 ldx pitch 0813: 4c 02 08 jmp SOUND 0816: 60 :done rts 0817: 00 .junk 1 0818: d5 color0 .dd1 $d5 ;even color for fill 0819: aa color1 .dd1 $aa ;odd color for fill ; ; Clears the hi-res screen to the colors in color0/color1. ; 081a: a2 00 CLEAR ldx #$00 ;start at $2000 081c: a0 20 ldy #$20 081e: 8e 2b 08 :loop stx :_store_even+1 0821: 8c 2c 08 sty :_store_even+2 0824: 8c 36 08 sty :_store_odd+2 0827: ad 18 08 lda color0 082a: 8d fe 3f :_store_even sta $3ffe 082d: e8 inx 082e: 8e 35 08 stx :_store_odd+1 0831: ad 19 08 lda color1 0834: 8d ff 3f :_store_odd sta $3fff 0837: e8 inx 0838: e0 00 cpx #$00 ;(unnecessary) 083a: d0 e2 bne :loop 083c: c8 iny 083d: c0 40 cpy #$40 ;reached end of hi-res page 1? 083f: d0 dd bne :loop ;not yet 0841: 60 rts 0842: 20 .junk 1 ; ; Inverts bytes from $1F9D to $3FFF. ; 0843: a0 1f INVERT ldy #$1f 0845: 8e 52 08 :loop stx :_load+1 ;on entry from a CALL, X will be $9D 0848: 8e 57 08 stx :_store+1 084b: 8c 53 08 sty :_load+2 084e: 8c 58 08 sty :_store+2 0851: ad ff 3f :_load lda $3fff ;get the hi-res byte 0854: 49 ff eor #$ff ;invert the colors 0856: 8d ff 3f :_store sta $3fff ;write it back 0859: e8 inx 085a: d0 e9 bne :loop 085c: c8 iny 085d: c0 40 cpy #$40 ;reached end of hi-res page 1? 085f: d0 e4 bne :loop ;not yet 0861: 60 rts 0862: e4 60 60 .junk 3