Add files via upload

This commit is contained in:
John Snape 2019-06-13 22:26:24 -07:00 committed by GitHub
parent 868979de0f
commit 1a84d1a8e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 543 additions and 0 deletions

155
dump.txt Normal file
View File

@ -0,0 +1,155 @@
0800- 4 .OR $800
0800- 5 ***********************************************************
0800- 6 * *
0800- 7 * DUMP:THIS PROGRAM WILL ALLOW ITS USER TO DUMP AN ENTIRE *
0800- 8 * TRACK IN ITS RAW FORM INTO MEMORY FOR EXAMINATION. *
0800- 9 * *
0800- 10 * INPUT: $02 = TRACK TO BE READ *
0800- 11 * *
0800- 12 * OUTPUT:$1000 = ADDRESS OF TRACK IMAGE *
0800- 13 * *
0800- 14 * ENTRY POINT: $800 *
0800- 15 * *
0800- 16 * PROGRAMMER: DON D WORTH 2/19/81 *
0800- 17 * *
0800- 18 ***********************************************************
0800- 19
0800- 20 * ZPAGE DEFINITIONS
0800- 21
0000- 22 PTR .EQ $0 WORK POINTER
0002- 23 TRACK .EQ $2 TRACK TO BE READ/WRITTEN
003C- 24 A1L .EQ $3C MONITOR POINTER
003E- 25 A2L .EQ $3E MONITOR POINTER
0048- 26 PREG .EQ $48 MONITOR STATUS REGISTER
0800- 27
0800- 28 * OTHER ADDRESSES
0800- 29
1000- 30 BUFFER .EQ $1000 TRACK IMAGE AREA
03E3- 31 LOCRPL .EQ $3E3 LOCATE RWTS PARMLIST SUBRTN
03D9- 32 RWTS .EQ $3D9 RWTS SUBROUTINE
FDED- 33 COUT .EQ $FDED PRINT ONE CHAR SUBROUTINE
FDB3- 34 XAM .EQ $FDB3 MONITOR HEX DUMP SUBRTN
0800- 35
0800- 36 * DISK I/O SELECTS
0800- 37
C080- 38 DRVSM0 .EQ $C080 STEP MOTOR POSITIONS
C081- 39 DRVSM1 .EQ $C081
C082- 40 DRVSM2 .EQ $C082
C083- 41 DRVSM3 .EQ $C083
C084- 42 DRVSM4 .EQ $C084
C085- 43 DRVSM5 .EQ $C085
C086- 44 DRVSM6 .EQ $C086
C087- 45 DRVSM7 .EQ $C087
C088- 46 DRVOFF .EQ $C088 TURN DRIVE OFF AFTER 6 REVS
C089- 47 DRVON .EQ $C089 TURN DRIVE ON
C08A- 48 DRVSL1 .EQ $C08A SELECT DRIVE 1
C08B- 49 DRVSL2 .EQ $C08B SELECT DRIVE 2
C08C- 50 DRVRD .EQ $C08C READ DATA LATCH
C08D- 51 DRVWR .EQ $C08D WRITE DATA LATCH
C08E- 52 DRVRDM .EQ $C08E SET READ MODE
C08F- 53 DRVWRM .EQ $C08F SET WRITE MODE
0800- 54
0800- 55 * RWTS PARMLIST DEFINITION
0800- 56
0800-00 57 RPLIOB .DA #0 IOB TYPE ($01)
0801-00 58 RPLSLT .DA #0 SLOT*16
0802-00 59 RPLDRV .DA #0 DRIVE
0803-00 60 RPLVOL .DA #0 VOLUME
0804-00 61 RPLTRK .DA #0 TRACK
0805-00 62 RPLSEC .DA #0 SECTOR
0806-00 63 RPLDCT .DA #0000 ADDRESS OF DCT
0807-00 64 RPLBUF .DA #0000 ADDRESS OF BUFFER
0808-00 65 RPLSIZ .DA #0000 SECTOR SIZE
0809-00 66 RPLCMD .DA #0 COMMAND CODE
0000- 67 RPLCNL .EQ $00 NULL COMMAND
0001- 68 RPLCRD .EQ $01 READ COMMAND
0002- 69 RPLCWR .EQ $02 WRITE COMMAND
0004- 70 RPLCFM .EQ $04 FORMAT COMMAND
080A-00 71 RPLRCD .DA #0 RETURN CODE
0010- 72 RPLRWP .EQ $10 WRITE PROTECTED
0020- 73 RPLRVM .EQ $20 VOLUME MISMATCH
0040- 74 RPLRDE .EQ $40 DRIVE ERROR
0080- 75 RPLRRE .EQ $80 READ ERROR
080B-00 76 RPLTVL .DA #0 TRUE VOLUME
080C-00 77 RPLPSL .DA #0 PREVIOUS SLOT
080D-00 78 RPLPDR .DA #0 PREVIOUS DRIVE
080E- 79
080E- 80 * USE RWTS TO POSITION THE ARM TO THE DESIRED TRACK
080E- 81
080E-20 E3 03 82 ( 6) DUMP JSR LOCRPL LOCATE RWTS PARMLIST
0811-84 00 83 ( 3) STY PTR AND SAVE POINTER
0813-85 01 84 ( 2) STA PTR+1
0815- 85
0815-A5 02 86 ( 3) LDA TRACK GET TRACK TO READ/WRITE
0817-A0 04 87 ( 2) LDY #RPLTRK STORE IN RWTS LIST
0819-91 00 88 ( 6) STA (PTR),Y
081B- 89
081B-A9 00 90 ( 2) LDA #RPLCNL NULL OPERATION
081D-A0 09 91 ( 2) LDY #RPLCMD AND STORE IN LIST
081F-91 00 92 ( 6) STA (PTR),Y
0821- 93
0821-A9 00 94 ( 2) LDA #0 ANY VOLUME WILL DO
0823-A0 03 95 ( 2) LDY #RPLVOL
0825-91 00 96 ( 6) STA (PTR),Y
0827-20 E3 03 97 ( 6) JSR LOCRPL RELOAD POINTER TO PARMS
082A-20 D9 03 98 ( 6) JSR RWTS CALL RWTS
082D-A9 00 99 ( 2) LDA #0
082F-85 48 100 ( 2) STA PREG FIX P REG SO DOS IS HAPPY
0831- 101
0831- 102 * PREPARE TO DUMP TRACK TO MEMORY
0831- 103
0831-A0 01 104 ( 2) LDY #RPLSLT GET SLOT*16
0833-B1 00 105 ( 5*) LDA (PTR),Y
0835-AA 106 ( 2) TAX
0836-BD 89 C0 107 ( 4*) LDA DRVON,X KEEP DRIVE ON
0839-BD 8E C0 108 ( 4*) LDA DRVRDM,X INSURE READ MODE
083C- 109
083C-A9 10 110 ( 2) LDA #BUFFER/$100 POINT AT DATA
083E-85 00 111 ( 2) STA PTR
0840-A9 00 112 ( 2) LDA #BUFFER
0842-85 01 113 ( 2) STA PTR+1
0844-A0 00 114 ( 2) LDY #0
0846- 115
0846- 116 * START DUMPING AT THE BEGINNING OF A SECTOR ADDRESS
0846- 117 * FIELD OR A SECTOR DATA FIELD
0846- 118
0846-BD 8C C0 119 ( 4*) LOOP1 LDA DRVRD,X WAIT FOR NEXT BYTE
0849-10 FB 120 (2**) BPL LOOP1
084B-C9 FF 121 ( 2) CMP #$FF AUTOSYNC?
084D-D0 F7 122 (2**) BNE LOOP1 NO, DON'T START IN MIDDLE
084F-BD 8C C0 123 ( 4*) LOOP2 LDA DRVRD,X WAIT FOR NEXT BYTE
0852-10 FB 124 (2**) BPL LOOP2
0854-C9 FF 125 ( 2) CMP #$FF TWO AUTOSYNCS?
0856-D0 EE 126 (2**) BNE LOOP1 NOT YET
0858-BD 8C C0 127 ( 4*) LOOP3 LDA DRVRD,X
085B-10 FB 128 (2**) BPL LOOP3
085D-C9 FF 129 ( 2) CMP #$FF STILL AUTOSYNCS?
085F-F0 F7 130 (2**) BEQ LOOP3 YES, WAIT FOR DATA BYTE
0861-D0 05 131 (2**) BNE LOOP4 ELSE, START STORING DATA
0863- 132
0863- 133 * ONCE ALIGNED, BEGIN COPYING THE TRACK TO MEMORY.
0863- 134 * COPY AT LEAST TWICE ITS LENGTH TO INSURE WE GET IT
0863- 135 * ALL.
0863- 136
0863-BD 8C C0 137 ( 4*) LOOPD LDA DRVRD,X WAIT FOR NEXT DATA BYTE
0866-10 FB 138 (2**) BPL LOOPD
0868-91 00 139 ( 6) LOOP4 STA (PTR),Y STORE IN MEMORY
086A-E6 00 140 ( 5) INC PTR BUMP POINTER
086C-D0 F5 141 (2**) BNE LOOPD
086E-E6 01 142 ( 5) INC PTR+1
0870-A5 01 143 ( 3) LDA PTR+1
0872-C9 40 144 ( 2) CMP #$40 DONE AT LEAST A TRACK?
0874-90 ED 145 (2**) BCC LOOPD NO, CONTINUE
0876-BD 88 C0 146 ( 4*) LDA DRVOFF,X TURN DRIVE OFF
0879- 147
0879- 148 * WHEN FINISHED, DUMP SOME OF TRACK IN HEX ON SCREEN
0879- 149
0879-A9 10 150 ( 2) EXIT LDA #BUFFER/$100 DUMP 800.8AF
087B-85 3C 151 ( 2) STA A1L
087D-A9 00 152 ( 2) LDA #BUFFER
087F-85 3D 153 ( 2) STA A1L+1
0881-A9 BF 154 ( 2) LDA #BUFFER/$100+$AF
0883-85 3E 155 ( 2) STA A2L
0885-A9 AF 156 ( 2) LDA #BUFFER+$AF
0887-85 3F 157 ( 2) STA A2L+1
0889-4C B3 FD 158 ( 3) JMP XAM EXIT VIA HEX DISPLAY

26
hcalc.txt Normal file
View File

@ -0,0 +1,26 @@
0300- 5
0300- 6 *SAVE S.NEW.WOZ.HIRES.CALC
0300- 7 *--------------------------------
0026- 8 GBASL .EQ $26
0027- 9 GBASH .EQ $27
00E6- 10 HPAG2 .EQ $E6 Applesoft puts it here anyway.
0300- 11 *--------------------------------
0300-0A 12 ( 2) CALC ASL A--BCDEFGH0
0301-AA 13 ( 2) TAX TAX...TXA could be TAY...TYA
0302-29 F0 14 ( 2) AND #$F0 A--BCDE0000
0304-10 02 15 (2**) BPL .1 B=0
0306-09 05 16 ( 2) ORA #$05 A--BCDE0B0B
0308-90 02 17 (2**) .1 BCC .2 A-0
030A-09 0A 18 ( 2) ORA #$0A A--BCDEABAB
030C-0A 19 ( 2) .2 ASL B--CDEABAB0
030D-0A 20 ( 2) ASL C--DEABAB00
030E-85 26 21 ( 2) STA GBASL
0310-8A 22 ( 2) TXA C--BCDEFGH0
0311-29 0E 23 ( 2) AND #$0E C--0000FGH0
0313-65 E6 24 ( 3) ADC HPAG2 O--OOxxFGH0
0315- 25 * HPAG2 = $10 for base $2000, $20 for base $4000
0315-06 26 26 ( 5) ASL GBASL D--00xxFGHC GBASL=EABAB000
0317-2A 27 ( 2) ROL 0--0xxFGHCD
0318-85 27 28 ( 2) STA GBASH
031A-60 29 ( 6) RTS
031B- 30 *--------------------------------

276
mouse.txt Normal file
View File

@ -0,0 +1,276 @@
0000- 5 ;
0000- 6 ; Mouse Handler (Apple //c)
0000- 7 ;
0000- 8 ; by Christopher A. Mosher
0000- 9 ;
0000- 10 ; May, 1987 (updated for ProDOS)
0000- 11 ; June, 1986
0000- 12 ;
0000- 13 ; This program handles the mouse for use
0000- 14 ; by other programs. It displays a cursor on
0000- 15 ; the eighty-column text screen, which the user
0000- 16 ; controls with the mouse.
0000- 17 ; The program has three main parts: mouseon,
0000- 18 ; mouseoff, and Irqhndl. mouseon installs the
0000- 19 ; interrupt handlers entry address in the
0000- 20 ; interrupt vector table in the ProDOS System
0000- 21 ; Global Page; and then enables the mouses
0000- 22 ; movement interrupts. mouseoff will deallocate
0000- 23 ; the interrupt and disable the mouse. Irqhndl
0000- 24 ; is the interrupt request handler. Its
0000- 25 ; address is the one installed in the Global
0000- 26 ; Page, and it gets control at each interrupt.
0000- 27 ;
0000- 28
0000- 29 ; page $00 locations
00FA- 30 bas .eq $FA ; text screen base address ($FA-$FB)
0008- 31 oldbas .eq $08 ; old text screen base address ($08-$09)
00FE- 32 row .eq $FE ; storage for row
00FF- 33 col .eq $FF ; storage for column
0000- 34
0000- 35 ; screen hole locations
0478- 36 minl .eq $0478 ; Clamping minimum to set (low)
0578- 37 minh .eq $0578 ; Clamping minimum to set (high)
04F8- 38 maxl .eq $04F8 ; Clamping maximum to set (low)
05F8- 39 maxh .eq $05F8 ; Clamping maximum to set (high)
047C- 40 mouxl .eq $047C ; X coordinate (low)
057C- 41 mouxh .eq $057C ; X coordinate (high)
04FC- 42 mouyl .eq $04FC ; Y coordinate (low)
05FC- 43 mouyh .eq $05FC ; Y coordinate (high)
077C- 44 moustat .eq $077C ; Mouse status byte:
0000- 45 ; bit meaning
0000- 46 ; x....... button down
0000- 47 ; .x...... button down still
0000- 48 ; ..x..... movement since last read
0000- 49 ; ...x.... (reserved)
0000- 50 ; ....x... VBL interrupt has occurred
0000- 51 ; .....x.. button interrupt has occurred
0000- 52 ; ......x. movement interrupt has occurred
0000- 53 ; .......x (reserved)
0000- 54
0000- 55 ; ProDOS global page
BF00- 56 mli .eq $BF00 ; Machine Language Interface entry
0040- 57 alloc_int .eq $40
0041- 58 dealloc_int .eq $41
0000- 59
0000- 60 ; I/O ROM locations
C01C- 61 page2sw .eq $C01C ; page two switch
C054- 62 page1 .eq $C054 ; off: page1 (or main memory)
C055- 63 page2 .eq $C055 ; on : page2 (or auxiliary memory)
0000- 64
0000- 65 ; slot ROM locations
C412- 66 mtable .eq $C412 ; Start of mouse ROM table
0000- 67 setm .eq $00 ; Set up mouse mode
0001- 68 servem .eq $01 ; Set up carry flag and MOUSTAT
0004- 69 posm .eq $04 ; Set mouse to X and Y coodinates
0005- 70 clampm .eq $05 ; Set clamping boundaries:
0007- 71 initm .eq $07 ; Set default values
0000- 72
9700- 73 .or $9700
9700-4C 14 97 74 jmp mouseon ; turn on the mouse
9703-4C 84 97 75 jmp mouseoff ; turn off the mouse
9706- 76
9706-42 77 cursor .db $42 ; mouse cursor
9707- 78
9707- 79 parms ; parameter list for MLI calls
9707-02 80 .db 2
9708-00 81 .db $00
9709-04 98 82 .dw irqhndl
970B- 83
970B-00 C4 84 mouse .dw $C400 ; address of mouse routine
970D-00 85 mouxls .db $00 ; storage for X coordinate (low)
970E-00 86 mouxhs .db $00 ; storage for X coordinate (high)
970F-00 87 mouyls .db $00 ; storage for Y coordinate (low)
9710-00 88 moustats .db $00 ; storage for mouse status
9711-00 89 oldchr .db $00 ; old character value
9712-00 90 oldp2s .db $00 ; old page two switch setting
9713-00 91 oldy .db $00 ; old Y register value
9714- 92
9714- 93 mouseon ; turn on the mouse
9714-A9 02 94 lda #2 ; allocate interrupt
9716-8D 07 97 95 sta parms
9719-20 00 BF 96 jsr mli
971C-40 97 .db alloc_int
971D-07 97 98 .dw parms
971F-A2 07 99 ldx #initm ; set default values
9721-20 D0 97 100 jsr mouser
9724-A9 3C 101 lda #$3C ; set clamping boundaries for X
9726-8D F8 04 102 sta maxl
9729-A9 01 103 lda #$01
972B-8D F8 05 104 sta maxh
972E-A9 00 105 lda #$00
9730-8D 78 04 106 sta minl
9733-8D 78 05 107 sta minh
9736-A2 05 108 ldx #clampm
9738-20 D0 97 109 jsr mouser
973B-A9 B8 110 lda #$B8 ; set clamping boundaries for Y
973D-8D F8 04 111 sta maxl
9740-A9 00 112 lda #$00
9742-8D F8 05 113 sta maxh
9745-A9 01 114 lda #$01
9747-A2 05 115 ldx #clampm
9749-20 D0 97 116 jsr mouser
974C-A9 03 117 lda #$03 ; set mouse to movement mode
974E-A2 00 118 ldx #setm
9750-20 D0 97 119 jsr mouser
9753-A5 FE 120 lda row ; set X and Y coordinates
9755-0A 121 asl
9756-0A 122 asl
9757-0A 123 asl
9758-8D FC 04 124 sta mouyl
975B-A9 00 125 lda #$00
975D-8D FC 05 126 sta mouyh
9760-A5 FF 127 lda col
9762-0A 128 asl
9763-0A 129 asl
9764-8D 7C 04 130 sta mouxl
9767-A9 00 131 lda #$00
9769-2A 132 rol
976A-8D 7C 05 133 sta mouxh
976D-A2 04 134 ldx #posm
976F-20 D0 97 135 jsr mouser
9772-2C 1C C0 136 bit page2sw ; store page2
9775-08 137 php
9776-20 55 98 138 jsr newcur ; output new cursor and restore and save values
9779-8D 54 C0 139 sta page1 ; restore page2
977C-28 140 plp
977D-10 03 141 bpl exint
977F-8D 55 C0 142 sta page2
9782-58 143 exint cli ; enable interrupts
9783-60 144 rts
9784- 145
9784- 146 mouseoff ; turn off the mouse
9784-A9 00 147 lda #$00 ; set mouse to off mode
9786-A2 00 148 ldx #setm
9788-20 D0 97 149 jsr mouser
978B-2C 1C C0 150 bit page2sw ; store page2
978E-08 151 php
978F-8D 54 C0 152 sta page1 ; remove cursor
9792-2C 12 97 153 bit oldp2s
9795-10 03 154 bpl l7
9797-8D 55 C0 155 sta page2
979A-AC 13 97 156 l7 ldy oldy
979D-AD 11 97 157 lda oldchr
97A0-91 08 158 sta (oldbas),y
97A2-8D 54 C0 159 sta page1 ; restore page2
97A5-28 160 plp
97A6-10 03 161 bpl l9
97A8-8D 55 C0 162 sta page2
97AB-AD 0F 97 163 l9 lda mouyls ; calculate ROW
97AE-4A 164 lsr
97AF-4A 165 lsr
97B0-4A 166 lsr
97B1-85 FE 167 sta row
97B3-4E 0E 97 168 lsr mouxhs ; calculate COL
97B6-6E 0D 97 169 ror mouxls
97B9-4E 0E 97 170 lsr mouxhs
97BC-6E 0D 97 171 ror mouxls
97BF-AD 0D 97 172 lda mouxls
97C2-85 FF 173 sta col
97C4-A9 01 174 lda #1
97C6-8D 07 97 175 sta parms
97C9-20 00 BF 176 jsr mli ; deallocate interrupt
97CC-41 177 .db dealloc_int
97CD-07 97 178 .dw parms
97CF-60 179 rts
97D0- 180
97D0-48 181 mouser pha
97D1-BD 12 C4 182 lda mtable,x
97D4-8D 0B 97 183 sta mouse
97D7-68 184 pla
97D8-08 185 php
97D9-78 186 sei
97DA-20 FD 97 187 jsr domsub
97DD-6E 0B 97 188 ror mouse
97E0-AD 7C 04 189 lda mouxl
97E3-8D 0D 97 190 sta mouxls
97E6-AD 7C 05 191 lda mouxh
97E9-8D 0E 97 192 sta mouxhs
97EC-AD FC 04 193 lda mouyl
97EF-8D 0F 97 194 sta mouyls
97F2-AD 7C 07 195 lda moustat
97F5-8D 10 97 196 sta moustats
97F8-28 197 plp
97F9-0E 0B 97 198 asl mouse
97FC-60 199 rts
97FD-A2 C4 200 domsub ldx #$C4
97FF-A0 40 201 ldy #$40
9801-6C 0B 97 202 jmp (mouse)
9804- 203
9804- 204 irqhndl ; interrupt handler
9804-D8 205 cld ;
9805-A2 01 206 ldx #servem ;
9807-20 D0 97 207 jsr mouser ; service mouse interrupt
980A-B0 19 208 bcs erirq ; if not mouse interrupt then exit
980C-AD 10 97 209 lda moustats ; get mouse status
980F-4A 210 lsr ; put movement bit
9810-4A 211 lsr ; in carry
9811-90 12 212 bcc erirq ; if no movement then exit
9813-2C 1C C0 213 bit page2sw ; store page2
9816-08 214 php
9817-20 27 98 215 jsr mvehndl ; handle movement
981A-8D 54 C0 216 sta page1 ; restore page2
981D-28 217 plp
981E-10 03 218 bpl exirq
9820-8D 55 C0 219 sta page2
9823-18 220 exirq clc
9824-89 221 .db $89 ; bit absorbs sec
9825-38 222 erirq sec
9826-60 223 rts
9827- 224
9827- 225 mvehndl ; movement handler
9827-8D 54 C0 226 sta page1 ; remove old cursor
982A-A9 80 227 lda #$80
982C-2C 12 97 228 bit oldp2s
982F-10 03 229 bpl l1
9831-8D 55 C0 230 sta page2
9834-AC 13 97 231 l1 ldy oldy
9837-AD 11 97 232 lda oldchr
983A-91 08 233 sta (oldbas),y
983C-AD 0F 97 234 lda mouyls ; calculate ROW
983F-4A 235 lsr
9840-4A 236 lsr
9841-4A 237 lsr
9842-85 FE 238 sta row
9844-4E 0E 97 239 lsr mouxhs ; calculate COL
9847-6E 0D 97 240 ror mouxls
984A-4E 0E 97 241 lsr mouxhs
984D-6E 0D 97 242 ror mouxls
9850-AD 0D 97 243 lda mouxls
9853-85 FF 244 sta col
9855-A5 FE 245 newcur lda row ; calculate base address
9857-20 82 98 246 jsr bascalc
985A-8D 54 C0 247 sta page1 ; choose main/aux memory
985D-A5 FF 248 lda col
985F-4A 249 lsr
9860-B0 03 250 bcs l3
9862-8D 55 C0 251 sta page2
9865-A8 252 l3 tay ; output cursor and save old values
9866-8C 13 97 253 sty oldy
9869-B1 FA 254 lda (bas),y
986B-8D 11 97 255 sta oldchr
986E-AD 06 97 256 lda cursor
9871-91 FA 257 sta (bas),y
9873-AD 1C C0 258 lda page2sw
9876-8D 12 97 259 sta oldp2s
9879-A5 FA 260 lda bas
987B-85 08 261 sta oldbas
987D-A5 FB 262 lda bas+1
987F-85 09 263 sta oldbas+1
9881-60 264 rts
9882- 265
9882-48 266 bascalc pha ; text screen base address calculator (ROM)
9883-4A 267 lsr
9884-29 03 268 and #3
9886-09 04 269 ora #4
9888-85 FB 270 sta bas+1
988A-68 271 pla
988B-29 18 272 and #$18
988D-90 02 273 bcc bcs1
988F-69 7F 274 adc #$7F
9891-85 FA 275 bcs1 sta bas
9893-0A 276 asl
9894-0A 277 asl
9895-05 FA 278 ora bas
9897-85 FA 279 sta bas
9899-60 280 rts

28
move_block.txt Normal file
View File

@ -0,0 +1,28 @@
;THIS SUBROUTINE MOVES A BLOCK OF DATA IN MEMORY. THE STARTING
;ADDRESS OF THE DATA IS CONTAINED IN LOCATIONS $40 (LOW ADDRESS
;BYTE) AND $41 (HIGH ADDRESS BYTE). THE STARTING ADDRESS OF
;THE DESTINATION OF THE DATA IS CONTAINED IN LOCATIONS $42 (LOW
;ADDRESS BYTE) AND $43 (HIGH ADDRESS BYTE). THE NUMBER OF BYTES
;TO BE MOVED IS CONTAINED IN LOCATION $44.
MOVE8 LDX $44 /LOAD BYTE COUNT INTO X REGISTER
SEC /CALCULATE MOVE DISPLACEMENT
LDA $42
SBC $40
LDA $43
SBC $41
BMI DISPN /DISPLACEMENT NEGATIVE?
LDY $44 /NO. START MOVE WITH LAST BYTE
CONTI DEY
LDA ($40),Y /LOAD BYTE FROM SOURCE LOCATION
STA ($42),Y / AND STORE IT AT DESTINATION LOCATION
DEX /DECREMENT BYTE COUNT
BNE CONTI /LOOP UNTIL ALL BYTES MOVED
RTS
DISPN LDY #00 /START MOVE WITH FIRST BYTE
CONT2 LDA ($40),Y /LOAD BYTE FROM SOURCE LOCATION
STA ($42),Y / AND STORE IT AT DESTINATION LOCATION
INY /INDEX TO NEXT BYTE
DEX /DECREMENT BYTE COUNT
BNE CONT2 /LOOP UNTIL ALL BYTES MOVED
RTS

26
mul16x16.txt Normal file
View File

@ -0,0 +1,26 @@
2000- 5
0000- 6 MUL1L .EQ $00 ;Multiplicand
0001- 7 MUL1H .EQ $01
0002- 8 MUL2L .EQ $02 ;Multiplier
0003- 9 MUL2H .EQ $03
0004- 10 RSLTL .EQ $04 ;Result
0005- 11 RSLTH .EQ $05
2000- 12
2000-A0 10 13 ( 2) RMUL LDY #16 16-BIT MULTIPLIER
2002-A5 00 14 ( 3) .1 LDA MUL1L (MUL1 * MUL2) + RSLT
2004-4A 15 ( 2) LSR CHECK NEXT BIT OF MULTIPLIER
2005-90 0D 16 (2**) BCC .2 IF ZERO, DON'T ADD MULTIPLICAND
2007-18 17 ( 2) CLC ADD MULTIPLICAND TO PARTIAL PRODUCT
2008-A5 02 18 ( 3) LDA MUL2L
200A-65 04 19 ( 3) ADC RSLTL
200C-85 02 20 ( 2) STA MUL2L
200E-A5 03 21 ( 3) LDA MUL2H
2010-65 05 22 ( 3) ADC RSLTH
2012-85 03 23 ( 2) STA MUL2H
2014-66 03 24 ( 5) .2 ROR MUL2H SHIFT PARTIAL PRODUCT
2016-66 02 25 ( 5) ROR MUL2L
2018-66 01 26 ( 5) ROR MUL1H
201A-66 00 27 ( 5) ROR MUL1L
201C-88 28 ( 2) DEY NEXT BIT
201D-D0 E3 29 (2**) BNE .1 UNTIL ALL 16
201F-60 30 ( 6) RTS

32
prdec.txt Normal file
View File

@ -0,0 +1,32 @@
FDED- 5 COUT .EQ $FDED
0300- 6 *------------------------------------
0300- 7 * Print Decimal with Leading Zero
0300- 8 *
0300-A2 AF 9 ( 2) PDW0 LDX #"0"-1 Start with ASCII zero-1
0302-38 10 ( 2) SEC Set up subtraction
0303-E8 11 ( 2) .1 INX Increment ten's digit
0304-E9 0A 12 ( 2) SBC #10 Take out ten
0306-B0 FB 13 (2**) BCS .1 Still more tens
0308-69 BA 14 ( 2) ADC #"0"+10 Add back one ten, and make ASCII
030A-48 15 ( 3) PHA Save unit's digit
030B-8A 16 ( 2) TXA Get ten's digit
030C-20 ED FD 17 ( 6) JSR COUT Print ten's digit
030F-68 18 ( 4) PLA Get unit's digit
0310-4C ED FD 19 ( 3) JMP COUT and print it
0313- 20 *------------------------------------
0313- 21 * Print Decimal with Leading Space
0313- 22 *
0313-A2 AF 23 ( 2) PDSPC LDX #"0"-1 Start with ASCII zero-1
0315-38 24 ( 2) SEC Set up subtraction
0316-E8 25 ( 2) .1 INX Increment ten's digit
0317-E9 0A 26 ( 2) SBC #10 Take out ten
0319-B0 FB 27 (2**) BCS .1 Still more tens
031B-69 BA 28 ( 2) ADC #"0"+10 Add back one ten, and make ASCII
031D-48 29 ( 3) PHA Save unit's digit
031E-8A 30 ( 2) TXA Get ten's digit
031F-C9 B0 31 ( 2) CMP #"0" Print
0321-D0 02 32 (2**) BNE .2 00-09 as " 0" through " 9"
0323-A9 A0 33 ( 2) LDA #" "
0325-20 ED FD 34 ( 6) .2 JSR COUT Print ten's digit
0328-68 35 ( 4) PLA Get unit's digit
0329-4C ED FD 36 ( 3) JMP COUT and print it