URL
https://opencores.org/ocsvn/System09/System09/trunk
Subversion Repositories System09
[/] [System09/] [tags/] [pre_mkfiles_rev1_merge/] [src/] [dump/] [dump_ide.lst] - Rev 103
Go to most recent revision | Compare with Previous | Blame | View Log
Assembler release DWC_2.0 version 2.11
May 6, 2004 (c) Motorola (free ware)
0001 *
0002 * Sector Dump Utility
0003 * for IDE Drives or Compact Flash
0004 * for the 6809
0005 * revised for 16 bit peripheral bus
0006 * on XESS XSA-3S1000 / XST-3.0
0007 *
0008 * John Kent
0009 * 1 Feb 2008
0010 *
0011 * SYS09BUG
0012 *
0013 F800 MON_BASE EQU $F800
0014 F800 MONV EQU MON_BASE+0
0015 F802 NEXTCV EQU MON_BASE+2
0016 F804 INCHV EQU MON_BASE+4
0017 F806 INCHEV EQU MON_BASE+6
0018 F808 INCHEKV EQU MON_BASE+8
0019 F80A OUTCHV EQU MON_BASE+10
0020 F80C PDATAV EQU MON_BASE+12
0021 F80E PCRLFV EQU MON_BASE+14
0022 F810 PSTRGV EQU MON_BASE+16
0023 *
0024 * Register Equates
0025 *
0026 E100 CF_BASE EQU $E100
0027 E100 CF_DATA EQU CF_BASE+0
0028 E102 CF_ERROR EQU CF_BASE+2 ; read error
0029 E102 CF_FEATURE EQU CF_BASE+2 ; write feature
0030 E104 CF_SECCNT EQU CF_BASE+4
0031 E106 CF_SECNUM EQU CF_BASE+6
0032 E108 CF_CYLLO EQU CF_BASE+8
0033 E10A CF_CYLHI EQU CF_BASE+10
0034 E10C CF_HEAD EQU CF_BASE+12
0035 E10E CF_STATUS EQU CF_BASE+14 ; read status
0036 E10E CF_COMAND EQU CF_BASE+14 ; write command
0037 E11E CF_AUX EQU CF_BASE+30
0038 *
0039 * Command Equates
0040 *
0041 0006 AUXRESET EQU $06 ; CF_AUX Reset command
0042 0002 AUXRELEA EQU $02
0043 0020 CMDREAD EQU $20 ; Read Single sector
0044 0030 CMDWRITE EQU $30 ; Write Single sector
0045 00E0 HEADLBA EQU $E0
0046 *
0047 * Status bit equates
0048 *
0049 0080 BUSY EQU $80
0050 0040 DRDY EQU $40
0051 0008 DRQ EQU $08
0052 0001 ERR EQU $01
0053 *
0054 * Start of Program
0055 *
0056 0100 ORG $0100
0057 0100 16 02 46 START LBRA START1
0058 *
0059 * DATA STORAGE
0060 *
0061 0103 00 00 00 SECNUM FCB $00,$00,$00
0062 0106 E0 00 CPORT FDB $E000
0063 0108 FF ECHO FCB $FF
0064 *
0065 * SECTOR BUFFER
0066 *
0067 0109 SECBUF RMB 512
0068 *
0069 * PROGRAM STACK
0070 *
0071 0309 RMB 64
0072 0349 STACK EQU *
0073 *
0074 * Initialization
0075 *
0076 0349 10 CE 03 49 START1 LDS #STACK
0077 *
0078 * Clear sector buffer
0079 *
0080 034D 8E 01 09 LDX #SECBUF
0081 0350 10 8E 00 00 LDY #0
0082 0354 C6 00 LDB #0
0083 0356 10 AF 81 ZEROLP STY ,X++
0084 0359 5A DECB
0085 035A 26 FA BNE ZEROLP
0086 *
0087 * INITIALIZE CF CARD FOR 8 BIT LBA MODE
0088 *
0089 035C CC 00 06 LDD #AUXRESET
0090 035F FD E1 1E STD CF_AUX
0091 0362 CC 00 02 LDD #AUXRELEA
0092 0365 FD E1 1E STD CF_AUX
0093 0368 BD 04 87 JSR WAITRDY
0094 036B CC 00 E0 LDD #HEADLBA
0095 036E FD E1 0C STD CF_HEAD
0096 0371 BD 04 87 JSR WAITRDY
0097 *
0098 * DISPLAY TITTLE BANNER
0099 *
0100 0374 8E 06 48 LDX #TTLMSG
0101 0377 BD 06 2B JSR PDATA
0102 *
0103 * COMMAND LOOP
0104 * R - READ
0105 * W - WRITE
0106 * N - NEXT
0107 * P - PREV
0108 * M - MODIFY
0109 * Q - QUIT
0110 *
0111 037A 8E 06 72 CMDLP LDX #CMDMSG
0112 037D BD 06 2B JSR PDATA
0113 0380 BD 06 2F JSR ECHON
0114 0383 81 52 CMPA #'R'
0115 0385 27 64 BEQ READ
0116 0387 81 4E CMPA #'N'
0117 0389 27 3D BEQ NEXT
0118 038B 81 50 CMPA #'P'
0119 038D 27 48 BEQ PREV
0120 038F 81 57 CMPA #'W'
0121 0391 10 27 00 A5 LBEQ WRITE
0122 0395 81 4D CMPA #'M'
0123 0397 27 2A BEQ MODIFY
0124 0399 81 51 CMPA #'Q'
0125 039B 27 22 BEQ QUIT
0126 039D 81 72 CMPA #'r'
0127 039F 27 4A BEQ READ
0128 03A1 81 6E CMPA #'n'
0129 03A3 27 23 BEQ NEXT
0130 03A5 81 70 CMPA #'p'
0131 03A7 27 2E BEQ PREV
0132 03A9 81 77 CMPA #'w'
0133 03AB 10 27 00 8B LBEQ WRITE
0134 03AF 81 6D CMPA #'m'
0135 03B1 27 10 BEQ MODIFY
0136 03B3 81 71 CMPA #'q'
0137 03B5 27 08 BEQ QUIT
0138 03B7 8E 07 3B LDX #WOTMSG
0139 03BA BD 06 23 JSR PSTRNG
0140 03BD 20 BB BRA CMDLP
0141 *
0142 * QUIT
0143 *
0144 03BF 6E 9F F8 00 QUIT JMP [MONV]
0145 *
0146 * MODIFY SECTOR
0147 *
0148 03C3 BD 05 2A MODIFY JSR MEMCHG
0149 03C6 20 B2 BRA CMDLP
0150 *
0151 * NEXT SECTOR (READ)
0152 * INCREMENT SECTOR NUMBER
0153 * WRAPS AROUND TO ZERO ON $FFFFFF
0154 *
0155 03C8 BE 01 04 NEXT LDX SECNUM+1
0156 03CB 30 01 LEAX 1,X
0157 03CD BF 01 04 STX SECNUM+1
0158 03D0 26 2A BNE READS
0159 03D2 7C 01 03 INC SECNUM
0160 03D5 20 25 BRA READS
0161 *
0162 * PREVIOUS SECTOR (READ)
0163 * DECREMENT SECTOR NUMBER
0164 * DON'T DECREMENT PAST $000000
0165 *
0166 03D7 BE 01 04 PREV LDX SECNUM+1
0167 03DA 26 08 BNE PREV1
0168 03DC 7D 01 03 TST SECNUM
0169 03DF 27 1B BEQ READS
0170 03E1 7A 01 03 DEC SECNUM
0171 03E4 30 1F PREV1 LEAX -1,X
0172 03E6 BF 01 04 STX SECNUM+1
0173 03E9 20 11 BRA READS
0174 *
0175 * READ SECTORS FROM CF
0176 *
0177 03EB 8E 06 E9 READ LDX #SECPMT
0178 03EE BD 06 23 JSR PSTRNG
0179 03F1 BD 05 90 JSR IN6HEX
0180 03F4 29 41 BVS RDEXIT
0181 03F6 F7 01 03 STB SECNUM
0182 03F9 BF 01 04 STX SECNUM+1
0183 *
0184 03FC 4F READS CLRA
0185 03FD C6 01 LDB #$01
0186 03FF FD E1 04 STD CF_SECCNT
0187 *
0188 0402 F6 01 05 LDB SECNUM+2
0189 0405 FD E1 06 STD CF_SECNUM
0190 *
0191 0408 F6 01 04 LDB SECNUM+1
0192 040B FD E1 08 STD CF_CYLLO
0193 *
0194 040E F6 01 03 LDB SECNUM+0
0195 0411 FD E1 0A STD CF_CYLHI
0196 *
0197 0414 C6 20 LDB #CMDREAD ; IDE READ MULTIPLE
0198 0416 FD E1 0E STD CF_COMAND
0199 0419 BD 04 87 JSR WAITRDY
0200 *
0201 041C 8E 01 09 LDX #SECBUF
0202 041F 10 8E 01 00 LDY #256
0203 *
0204 * READ LOOP
0205 *
0206 0423 BD 04 96 RDLOOP JSR WAITDRQ
0207 0426 FC E1 00 LDD CF_DATA ; reverse order of bytes
0208 0429 E7 80 STB ,X+
0209 042B A7 80 STA ,X+
0210 042D 31 3F LEAY -1,Y
0211 042F 26 F2 BNE RDLOOP
0212 *
0213 0431 BD 04 87 JSR WAITRDY
0214 0434 BD 04 9E JSR MEMDUMP
0215 0437 7E 03 7A RDEXIT JMP CMDLP
0216 *
0217 * WRITE SECTOR TO CF
0218 *
0219 043A 8E 06 E9 WRITE LDX #SECPMT
0220 043D BD 06 23 JSR PSTRNG
0221 0440 BD 05 90 JSR IN6HEX
0222 0443 29 3F BVS WREXIT
0223 0445 F7 01 03 STB SECNUM
0224 0448 BF 01 04 STX SECNUM+1
0225 *
0226 044B 4F CLRA
0227 044C C6 01 LDB #$01
0228 044E FD E1 04 STD CF_SECCNT
0229 *
0230 0451 F6 01 05 LDB SECNUM+2
0231 0454 FD E1 06 STD CF_SECNUM
0232 *
0233 0457 F6 01 04 LDB SECNUM+1
0234 045A FD E1 08 STD CF_CYLLO
0235 *
0236 045D F6 01 03 LDB SECNUM+0
0237 0460 FD E1 0A STD CF_CYLHI
0238 *
0239 0463 CC 00 30 LDD #CMDWRITE; IDE WRITE MULTIPLE
0240 0466 FD E1 0E STD CF_COMAND
0241 0469 BD 04 87 JSR WAITRDY
0242 *
0243 046C 8E 01 09 LDX #SECBUF
0244 046F 10 8E 01 00 LDY #256
0245 *
0246 * WRITE LOOP
0247 *
0248 0473 BD 04 96 WRLOOP JSR WAITDRQ
0249 0476 E6 80 LDB ,X+ ; reverse order of bytes
0250 0478 A6 80 LDA ,X+
0251 047A FD E1 00 STD CF_DATA
0252 047D 31 3F LEAY -1,Y
0253 047F 26 F2 BNE WRLOOP
0254 *
0255 0481 BD 04 87 JSR WAITRDY
0256 0484 7E 03 7A WREXIT JMP CMDLP
0257 *
0258 * WAIT UNTIL READY
0259 *
0260 0487 FC E1 0E WAITRDY LDD CF_STATUS
0261 048A C5 80 BITB #BUSY
0262 048C 26 F9 BNE WAITRDY
0263 048E FC E1 0E LDD CF_STATUS
0264 0491 C5 40 BITB #DRDY
0265 0493 27 F2 BEQ WAITRDY
0266 0495 39 RTS
0267 *
0268 * WAIT FOR DATA REQUEST
0269 *
0270 0496 FC E1 0E WAITDRQ LDD CF_STATUS
0271 0499 C5 08 BITB #DRQ
0272 049B 27 F9 BEQ WAITDRQ
0273 049D 39 RTS
0274 *
0275 * DUMP SECTOR IN MEMORY
0276 *
0277 049E 8E 07 02 MEMDUMP LDX #SECMSG
0278 04A1 BD 06 23 JSR PSTRNG
0279 04A4 B6 01 03 LDA SECNUM
0280 04A7 BD 05 F8 JSR OUT2H
0281 04AA BE 01 04 LDX SECNUM+1
0282 04AD BD 05 F0 JSR OUT4H
0283 04B0 BD 06 27 JSR PCRLF
0284 *
0285 * Dump first 256 bytes
0286 *
0287 04B3 10 8E 00 00 LDY #$0000
0288 04B7 30 A9 00 FF LEAX #$0FF,Y
0289 04BB BD 04 CF JSR AJDUMP
0290 *
0291 * Prompt to continue
0292 *
0293 04BE 8E 07 44 LDX #PAGMSG
0294 04C1 BD 06 23 JSR PSTRNG
0295 04C4 BD 06 38 JSR INCH
0296 *
0297 * Dump second 256 bytes
0298 *
0299 04C7 10 8E 01 00 LDY #$0100
0300 04CB 30 A9 00 FF LEAX #$0FF,Y
0301 *
0302 * ADJUST LOWER AND UPPER ADDRESS LIMITS
0303 * TO EVEN 16 BYTE BOUNDRIES.
0304 *
0305 * IF LOWER ADDR = $4532
0306 * LOWER BOUNDS WILL BE ADJUSTED TO = $4530.
0307 *
0308 * IF UPPER ADDR = $4567
0309 * UPPER BOUNDS WILL BE ADJUSTED TO = $4570.
0310 *
0311 * ENTER WITH LOWER ADDRESS IN X-REG.
0312 * -UPPER ADDRESS ON TOP OF STACK.
0313 *
0314 04CF 1F 10 AJDUMP TFR X,D GET UPPER ADDR IN D-REG
0315 04D1 C3 00 10 ADDD #$10 ADD 16 TO UPPER ADDRESS
0316 04D4 C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0317 04D6 34 06 PSHS A,B SAVE ON STACK AS UPPER DUMP LIMIT
0318 04D8 1F 20 TFR Y,D $F9A5 GET LOWER ADDRESS IN D-REG
0319 04DA C4 F0 ANDB #$F0 MASK TO EVEN 16 BYTE BOUNDRY
0320 04DC 1F 01 TFR D,X PUT IN X-REG AS LOWER DUMP LIMIT
0321 04DE AC E4 NXTLIN CMPX ,S COMPARE LOWER TO UPPER LIMIT
0322 04E0 27 05 BEQ SKPDMP IF EQUAL SKIP HEX-ASCII DUMP
0323 04E2 17 01 57 LBSR INCHEK CHECK FOR INPUT FROM KEYBOARD
0324 04E5 27 03 BEQ EDUMP
0325 04E7 32 62 SKPDMP LEAS 2,S READJUST STACK IF NOT DUMPING
0326 04E9 39 RTS ;
0327 *
0328 * PRINT 16 HEX BYTES FOLLOWED BY 16 ASCII CHARACTERS
0329 * FOR EACH LINE THROUGHOUT ADDRESS LIMITS.
0330 *
0331 04EA 34 10 EDUMP PSHS X PUSH LOWER ADDR LIMIT ON STACK
0332 04EC 8E 07 2F LDX #MSG5 POINT TO MSG " - "
0333 04EF 17 01 31 LBSR PSTRNG PRINT MSG
0334 04F2 AE E4 LDX ,S LOAD LOWER ADDR FROM TOP OF STACK
0335 04F4 17 00 F9 LBSR OUT4H PRINT THE ADDRESS
0336 04F7 17 01 46 LBSR OUT2S 2 SPACES
0337 04FA C6 10 LDB #$10 LOAD COUNT OF 16 BYTES TO DUMP
0338 04FC A6 89 01 09 ELOOP LDA SECBUF,X GET FROM MEMORY HEX BYTE TO PRINT
0339 0500 30 01 LEAX 1,X
0340 0502 17 00 F3 LBSR OUT2H OUTPUT HEX BYTE AS ASCII
0341 0505 17 01 3A LBSR OUT1S OUTPUT SPACE
0342 0508 5A DECB $F9D1 DECREMENT BYTE COUNT
0343 0509 26 F1 BNE ELOOP CONTINUE TIL 16 HEX BYTES PRINTED
0344 *
0345 * PRINT 16 ASCII CHARACTERS
0346 * IF NOT PRINTABLE OR NOT VALID
0347 * ASCII PRINT A PERIOD (.)
0348 050B 17 01 32 LBSR OUT2S 2 SPACES
0349 050E AE E1 LDX ,S++ GET LOW LIMIT FRM STACK - ADJ STACK
0350 0510 C6 10 LDB #$10 SET ASCII CHAR TO PRINT = 16
0351 0512 A6 89 01 09 EDPASC LDA SECBUF,X GET CHARACTER FROM MEMORY
0352 0516 30 01 LEAX 1,X
0353 0518 81 20 CMPA #$20 IF LESS THAN $20, NON-PRINTABLE?
0354 051A 25 04 BCS PERIOD IF SO, PRINT PERIOD INSTEAD
0355 051C 81 7E CMPA #$7E IS IT VALID ASCII?
0356 051E 23 02 BLS PRASC IF SO PRINT IT
0357 0520 86 2E PERIOD LDA #'. LOAD A PERIOD (.)
0358 0522 17 01 1F PRASC LBSR OUTCH PRINT ASCII CHARACTER
0359 0525 5A DECB DECREMENT COUNT
0360 0526 26 EA BNE EDPASC
0361 0528 20 B4 BRA NXTLIN
0362 *
0363 *
0364 ***** "M" MEMORY EXAMINE AND CHANGE *****
0365 *
0366 * RESTRICT ADDRESSING RANGE TO 512 BYTES ($000 - $1FF)
0367 *
0368 052A 8E 07 14 MEMCHG LDX #MEMMSG
0369 052D BD 06 23 JSR PSTRNG
0370 0530 17 00 74 LBSR IN3HEX INPUT ADDRESS
0371 0533 29 34 BVS CHRTN IF NOT HEX, RETURN
0372 0535 8C 02 00 CMPX #$0200
0373 0538 24 2F BHS CHRTN
0374 053A 1F 12 TFR X,Y SAVE ADDR IN "Y"
0375 053C 8E 07 2F MEMC2 LDX #MSG5 POINT TO MSG " - "
0376 053F 17 00 E1 LBSR PSTRNG PRINT MSG
0377 0542 1F 21 TFR Y,X FETCH ADDRESS
0378 0544 17 00 A9 LBSR OUT4H PRINT ADDR IN HEX
0379 0547 17 00 F8 LBSR OUT1S OUTPUT SPACE
0380 054A A6 A9 01 09 LDA SECBUF,Y GET CONTENTS OF CURRENT ADDR.
0381 054E 17 00 A7 LBSR OUT2H OUTPUT CONTENTS IN ASCII
0382 0551 17 00 EE LBSR OUT1S OUTPUT SPACE
0383 0554 17 00 60 LBSR BYTE LOOP WAITING FOR OPERATOR INPUT
0384 0557 28 11 BVC CHANGE IF VALID HEX GO CHANGE MEM. LOC.
0385 0559 81 08 CMPA #8 IS IT A BACKSPACE (CNTRL H)?
0386 055B 27 DF BEQ MEMC2 PROMPT OPERATOR AGAIN
0387 055D 81 18 CMPA #$18 IS IT A CANCEL (CNTRL X)?
0388 055F 27 DB BEQ MEMC2 PROMPT OPERATOR AGAIN
0389 0561 81 5E CMPA #'^ IS IT AN UP ARROW?
0390 0563 27 21 BEQ BACK DISPLAY PREVIOUS BYTE
0391 0565 81 0D CMPA #$D IS IT A CR?
0392 0567 26 13 BNE FORWRD DISPLAY NEXT BYTE
0393 0569 39 CHRTN RTS EXIT ROUTINE
0394 *
0395 *
0396 056A A7 A9 01 09 CHANGE STA SECBUF,Y CHANGE BYTE IN MEMORY
0397 056E A1 A9 01 09 CMPA SECBUF,Y DID MEMORY BYTE CHANGE?
0398 0572 27 08 BEQ FORWRD $F972
0399 0574 17 00 CB LBSR OUT1S OUTPUT SPACE
0400 0577 86 3F LDA #'? LOAD QUESTION MARK
0401 0579 17 00 C8 LBSR OUTCH PRINT IT
0402 057C 10 8C 01 FF FORWRD CMPY #$01FF
0403 0580 27 BA BEQ MEMC2
0404 0582 31 21 LEAY 1,Y POINT TO NEXT HIGHER MEM LOCATION
0405 0584 20 B6 BRA MEMC2 PRINT LOCATION & CONTENTS
0406 0586 10 8C 00 00 BACK CMPY #$0000
0407 058A 27 B0 BEQ MEMC2
0408 058C 31 3F LEAY -1,Y POINT TO LAST MEM LOCATION
0409 058E 20 AC BRA MEMC2 PRINT LOCATION & CONTENTS
0410 *
0411 * THE FOLLOWING ROUTINE LOOPS WAITING FOR THE
0412 * OPERATOR TO INPUT ONE VALID HEX ADDRESS. THE
0413 * ADDRESS IS RETURNED IN THE "X" REGISTER.
0414 *
0415 * IN6HEX - MS BYTE IN ACCB
0416 * LS WORD IN X REG
0417 *
0418 0590 32 7D IN6HEX LEAS -3,S
0419 0592 8D 23 BSR BYTE
0420 0594 29 57 BVS NOTHEX
0421 0596 A7 E4 STA 0,S
0422 0598 8D 1D BSR BYTE
0423 059A 29 51 BVS NOTHEX
0424 059C A7 61 STA 1,S
0425 059E 8D 17 BSR BYTE
0426 05A0 29 4B BVS NOTHEX
0427 05A2 A7 62 STA 2,S
0428 05A4 4F CLRA
0429 05A5 35 94 PULS B,X,PC
0430 *
0431 * INPUT 3 HEX DIGITS
0432 * RESULT RETURNED IN X
0433 *
0434 05A7 8D 21 IN3HEX BSR INHEX INPUT HEX (1 HEX CHAR)
0435 05A9 29 42 BVS NOTHEX EXIT IF NOT VALID HEX
0436 05AB 1F 01 TFR D,X
0437 05AD 8D 08 BSR BYTE INPUT BYTE (2 HEX CHAR)
0438 05AF 29 3C BVS NOTHEX
0439 05B1 34 10 PSHS X
0440 05B3 A7 61 STA 1,S
0441 05B5 35 90 PULS X,PC
0442 *
0443 ***** INPUT BYTE (2 HEX CHAR.) *****
0444 *
0445 05B7 8D 11 BYTE BSR INHEX GET HEX LEFT
0446 05B9 29 32 BVS NOTHEX EXIT IF NOT VALID HEX
0447 05BB 48 ASLA ;
0448 05BC 48 ASLA ;
0449 05BD 48 ASLA ; SHIFT INTO LEFT NIBBLE
0450 05BE 48 ASLA ;
0451 05BF 1F 89 TFR A,B PUT HEXL IN "B"
0452 05C1 8D 07 BSR INHEX GET HEX RIGHT
0453 05C3 29 28 BVS NOTHEX EXIT IF NOT VALID HEX
0454 05C5 34 04 PSHS B PUSH HEXL ON STACK
0455 05C7 AB E0 ADDA ,S+ ADD HEXL TO HEXR AND ADJ. STK
0456 05C9 39 RTS RETURN WITH HEX L&R IN "A"
0457 *
0458 *
0459 05CA 8D 63 INHEX BSR ECHON INPUT ASCII CHAR.
0460 05CC 81 30 CMPA #'0 IS IT > OR = "0" ?
0461 05CE 25 1D BCS NOTHEX IF LESS IT AIN'T HEX
0462 05D0 81 39 CMPA #'9 IS IT < OR = "9" ?
0463 05D2 22 03 BHI INHEXA IF > MAYBE IT'S ALPHA
0464 05D4 80 30 SUBA #$30 ASCII ADJ. NUMERIC
0465 05D6 39 RTS ;
0466 *
0467 *
0468 05D7 81 41 INHEXA CMPA #'A IS IT > OR = "A"
0469 05D9 25 12 BCS NOTHEX IF LESS IT AIN'T HEX
0470 05DB 81 46 CMPA #'F IS IT < OR = "F" ?
0471 05DD 22 03 BHI INHEXL IF > IT AIN'T HEX
0472 05DF 80 37 SUBA #$37 ASCII ADJ. ALPHA
0473 05E1 39 RTS ;
0474 *
0475 05E2 81 61 INHEXL CMPA #'a IS IT > OR = "a"
0476 05E4 25 07 BCS NOTHEX IF LESS IT AIN'T HEX
0477 05E6 81 66 CMPA #'f IS IT < "f"
0478 05E8 22 03 BHI NOTHEX IF > IT AIN'T HEX
0479 05EA 80 57 SUBA #$57 ADJUST TO LOWER CASE
0480 05EC 39 RTS ;
0481 *
0482 *
0483 05ED 1A 02 NOTHEX ORCC #2 SET (V) FLAG IN C-CODES REGISTER
0484 05EF 39 RTS ;
0485 *
0486 *
0487 05F0 34 10 OUT4H PSHS X PUSH X-REG. ON THE STACK
0488 05F2 35 02 PULS A POP MS BYTE OF X-REG INTO A-ACC.
0489 05F4 8D 02 BSR OUTHL OUTPUT HEX LEFT
0490 05F6 35 02 PULS A POP LS BYTE OF X-REG INTO A-ACC.
0491 05F8 OUTHL EQU *
0492 05F8 34 02 OUT2H PSHS A SAVE IT BACK ON STACK
0493 05FA 44 LSRA CONVERT UPPER HEX NIBBLE TO ASCII
0494 05FB 44 LSRA ;
0495 05FC 44 LSRA ;
0496 05FD 44 LSRA ;
0497 05FE 8D 04 BSR XASCII PRINT HEX NIBBLE AS ASCII
0498 0600 35 02 OUTHR PULS A CONVERT LOWER HEX NIBBLE TO ASCII
0499 0602 84 0F ANDA #$0F STRIP LEFT NIBBLE
0500 0604 8B 30 XASCII ADDA #$30 ASCII ADJ
0501 0606 81 39 CMPA #$39 IS IT < OR = "9" ?
0502 0608 2F 02 BLE OUTC IF LESS, OUTPUT IT
0503 060A 8B 07 ADDA #7 IF > MAKE ASCII LETTER
0504 060C 20 36 OUTC BRA OUTCH OUTPUT CHAR
0505 *
0506 * BINARY / ASCII --- THIS ROUTINE
0507 * OUTPUTS A BYTE IN ENHANCED
0508 * BINARY FORMAT. THE ENHANCEMENT
0509 * IS DONE BY SUBSTITUTING ASCII
0510 * LETTERS FOR THE ONES IN THE BYTE.
0511 * THE ASCII ENHANCEMENT LETTERS
0512 * ARE OBTAINED FROM THE STRING
0513 * POINTED TO BY THE INDEX REG. "X".
0514 *
0515 060E 34 02 BIASCI PSHS A SAVE "A" ON STACK
0516 0610 C6 08 LDB #8 PRESET LOOP# TO BITS PER BYTE
0517 0612 A6 80 OUTBA LDA ,X+ GET LETTER FROM STRING
0518 0614 68 E4 ASL ,S TEST BYTE FOR "1" IN B7
0519 0616 25 02 BCS PRTBA IF ONE PRINT LETTER
0520 0618 86 2D LDA #'- IF ZERO PRINT "-"
0521 061A 8D 28 PRTBA BSR OUTCH PRINT IT
0522 061C 8D 24 BSR OUT1S PRINT SPACE
0523 061E 5A DECB SUB 1 FROM #BITS YET TO PRINT
0524 061F 26 F1 BNE OUTBA
0525 0621 35 82 PULS A,PC
0526 *
0527 * PRINT STRING PRECEEDED BY A CR & LF.
0528 *
0529 0623 6E 9F F8 10 PSTRNG JMP [PSTRGV] PRINT CR/LF
0530 *
0531 * PCRLF
0532 *
0533 0627 6E 9F F8 0E PCRLF JMP [PCRLFV]
0534 *
0535 * PDATA
0536 *
0537 062B 6E 9F F8 0C PDATA JMP [PDATAV]
0538 *
0539 062F 7D 01 08 ECHON TST ECHO IS ECHO REQUIRED ?
0540 0632 27 04 BEQ INCH ECHO NOT REQ. IF CLEAR
0541 *
0542 * INCHE
0543 *
0544 * ---GETS CHARACTER FROM TERMINAL AND
0545 * ECHOS SAME. THE CHARACTER IS RETURNED
0546 * IN THE "A" ACCUMULATOR WITH THE PARITY
0547 * BIT MASKED OFF. ALL OTHER REGISTERS
0548 * ARE PRESERVED.
0549 *
0550 0634 6E 9F F8 06 INCHE JMP [INCHEV]
0551 *
0552 * INCH
0553 *
0554 * GET CHARACTER FROM TERMINAL. RETURN
0555 * CHARACTER IN "A" ACCUMULATOR AND PRESERVE
0556 * ALL OTHER REGISTERS. THE INPUT CHARACTER
0557 * IS 8 BITS AND IS NOT ECHOED.
0558 *
0559 *
0560 0638 6E 9F F8 04 INCH JMP [INCHV]
0561 *
0562 * INCHEK
0563 *
0564 * CHECK FOR A CHARACTER AVAILABLE FROM
0565 * THE TERMINAL. THE SERIAL PORT IS CHECKED
0566 * FOR READ READY. ALL REGISTERS ARE
0567 * PRESERVED, AND THE "Z" BIT WILL BE
0568 * CLEAR IF A CHARACTER CAN BE READ.
0569 *
0570 *
0571 063C 6E 9F F8 08 INCHEK JMP [INCHEKV]
0572 *
0573 0640 8D 00 OUT2S BSR OUT1S OUTPUT 2 SPACES
0574 0642 86 20 OUT1S LDA #$20 OUTPUT 1 SPACE
0575 *
0576 *
0577 * OUTCH
0578 *
0579 * OUTPUT CHARACTER TO TERMINAL.
0580 * THE CHAR. TO BE OUTPUT IS
0581 * PASSED IN THE A REGISTER.
0582 * ALL REGISTERS ARE PRESERVED.
0583 *
0584 0644 6E 9F F8 0A OUTCH JMP [OUTCHV]
0585 *
0586 * MESSAGE STRINGS
0587 *
0588 0648 0A 0D TTLMSG FCB $0A,$0D
0589 064A 43 4F 4D 50 41 43 FCC "COMPACT FLASH SECTOR READ/WRITE UTILITY"
54 20 46 4C 41 53
48 20 53 45 43 54
4F 52 20 52 45 41
44 2F 57 52 49 54
45 20 55 54 49 4C
49 54 59
0590 0671 04 FCB $04
0591 0672 0D 0A CMDMSG FCB $0D,$0A
0592 0674 28 52 29 20 52 45 FCC "(R) READ SECTOR "
41 44 20 53 45 43
54 4F 52 20 20 20
0593 0686 28 57 29 20 57 52 FCC "(W) WRITE SECTOR "
49 54 45 20 53 45
43 54 4F 52 20 20
0594 0698 0D 0A FCB $0D,$0A
0595 069A 28 4E 29 20 4E 45 FCC "(N) NEXT SECTOR "
58 54 20 53 45 43
54 4F 52 20 20 20
0596 06AC 28 50 29 20 50 52 FCC "(P) PREV SECTOR "
45 56 20 53 45 43
54 4F 52 20 20 20
0597 06BE 0D 0A FCB $0D,$0A
0598 06C0 28 4D 29 20 4D 4F FCC "(M) MODIFY SECTOR "
44 49 46 59 20 53
45 43 54 4F 52 20
0599 06D2 28 51 29 20 51 55 FCC "(Q) QUIT "
49 54 20 20 20 20
20 20 20 20 20 20
0600 06E4 0D 0A FCB $0D,$0A
0601 06E6 3A 20 FCC ": "
0602 06E8 04 FCB $04
0603 06E9 53 45 43 54 4F 52 SECPMT FCC "SECTOR NUMBER (6 HEX) : "
20 4E 55 4D 42 45
52 20 28 36 20 48
45 58 29 20 3A 20
0604 0701 04 FCB $04
0605 0702 53 45 43 54 4F 52 SECMSG FCC "SECTOR NUMBER - $"
20 4E 55 4D 42 45
52 20 2D 20 24
0606 0713 04 FCB $04
0607 0714 0D 0A MEMMSG FCB $0D,$0A
0608 0716 4D 45 4D 4F 52 59 FCC "MEMORY ADDRESS (3 HEX): "
20 41 44 44 52 45
53 53 20 28 33 20
48 45 58 29 3A 20
0609 072E 04 FCB $04
0610 072F 20 2D 20 MSG5 FCC " - "
0611 0732 04 FCB $04
0612 0733 00 00 0A 0D 00 00 MSG2 FCB $00,$00,$0A,$0D,$00,$00,$00,$04
00 04
0613 073B 57 68 61 74 20 3F WOTMSG FCC "What ?"
0614 0741 0D 0A 04 FCB $0D,$0A,$04
0615 0744 0D 0A PAGMSG FCB $0D,$0A
0616 0746 48 69 74 20 61 6E FCC "Hit any key to continue"
79 20 6B 65 79 20
74 6F 20 63 6F 6E
74 69 6E 75 65
0617 075D 04 FCB $04
0618 *
0619 END START
Program + Init Data = 1054 bytes
Error count = 0
Go to most recent revision | Compare with Previous | Blame | View Log