home *** CD-ROM | disk | FTP | other *** search
- open =$ffc0
- readst =$ffb7
- setlfs =$ffba
- setnam =$ffbd
- load =$ffd5
- getin =$ffe4
- clrchn =$ffcc
- close =$ffc3 ;a
- chrin =$ffcf
- chkout =$ffc9 ;x
- chkin =$ffc6 ;x
- plot =$fff0
- chrout =$ffd2
- color'pointer =243
- screen'line'pointer =209
- print'number =$bdcd ;x,a
- clear'line =59903
- background =53281
- border =53280
- unlisten =$ffae
- clall =$ffe7
- source =251
- end =253
- destination =$14
- ;dis
- .org $c000
- .mem
- ;obj "@0:swapymem"
- ;by Jeff Jones
- ;sys source,end+1,dest
- ;copy =addr
- ;swap =addr+7
- ;ROM in copy =addr+14
-
-
- lda #0 ;regular copy
- sta 212 ;just using this as a flag
- sec
- bcs get'numbers
- side'door lda #64 ;swap mode
- sta 212
- sec
- bcs get'numbers
-
- trap'door lda #128 ;original rom on
- sta 212
-
- get'numbers jsr $aefd
- jsr $ad8a
- jsr $b7f7
- sty source
- sta source+1
-
- jsr $aefd
- jsr $ad8a
- jsr $b7f7
-
- sty end
- sta end+1
-
- jsr $aefd
- jsr $ad8a
- jsr $b7f7
-
- lda end+1
- cmp source+1 ;is end lower than source?
- beq next'test
- bcs okay
- bcc quit ;if so, bail out
-
- next'test lda end
- cmp source
- bcc quit
- beq quit
-
- okay bit 212 ;leave ROM alone?
- bmi +
-
- sei ;don't interrupt this groove
- lda 1
- pha ;stash I/O status
- lda #$74 ;knock 'em all out
- sta 1
-
- + ldy #0
- - lda (source),y
- bit 212 ;Swap?
- bvc + ;if clear then nope
- pha
- lda (destination),y
- sta (source),y
- pla
- + sta (destination),y
-
- inc source ;increment source and dest
- bne +
- inc source+1
- + inc destination
- bne +
- inc destination+1
-
- + lda source+1 ;finis?
- cmp end+1
- bcc - ;not finished by page
-
- lda source
- cmp end
- bcc - ;just plain not finished
-
- bit 212 ;was I/O reg stashed?
- bmi quit ;if not then don't restore
-
- pla ;get back original I/O reg
- sta 1 ;back to normal
- cli ;interrupts back on
- quit lda #0
- sta 212 ;make sure quote mode is off
- rts
-
-