A new 503 byte Sector Viewer created by John Brook has been released. The viewer includes all source code as well as the executable. According to John’s post on CSA2, ”
This is a single-block (503-byte) ProDOS utility which will read DOS 3.3 sectors and dump+display them as both hex and ascii.It runs on all Apple II computers including Integer ROM and ][+ machines.
It is a SYS file and can be run from Basic.System or launched directly. It will quit to Basic if present or Quit to ProDOS.
The following disk image contains View.Sector and it’s source code, as well as the program which inspired it: the DOS.SECTOR.VIEW utility and it’s source code.
https://drive.google.com/file/
d/ 0B9I8jo6bktRAVjNvcXotZmNZems/ view?usp=sharing Enjoy.
-JB
@JBrooksBSICALL-151
2000:D8 58 8D 0C C0 8D 00 C0 20 93 FE 20 89 FE 8D FB 04 20 2F FB 20 58 FC A9 11 85 67 A9 0F 85 68 A2
2020:0D A0 27 B9 A7 21 99 50 07 B9 7F 21 99 D0 07 88 10 F1 24 CA 8A 29 0F 85 60 4A F0 F7 08 09 B0 8D
2040:71 07 0A 0A 0A 0A 28 A0 B1 B0 03 09 80 C8 85 62 8C 77 07 A5 67 0A 0A 0A 85 65 A9 00 2A 85 66 A4
2060:68 B9 6F 21 4A 05 65 85 65 A9 00 85 63 69 10 85 64 49 A1 8D 5A 07 A9 16 85 23 20 5B FB A2 04 BD
2080:6A 21 85 24 B5 64 20 DA FD CA D0 F3 8A 20 5B FB A2 03 86 61 20 00 BF 80 61 00 D0 42 A8 AA 85 24
20A0:F0 03 20 8E FD 98 20 DA FD A9 BA 20 ED FD A5 32 49 C0 85 32 B9 00 11 20 DA FD C8 F0 06 A5 24 C9
20C0:1B 90 EB A0 1C BD 00 11 09 80 C9 A0 B0 02 A9 AE 91 28 E8 F0 0C C8 C0 28 90 EB 8A A8 B0 C4 20 58
20E0:FC 06 29 20 18 FD C9 9B D0 16 20 39 FB AD 00 BE C9 4C F0 09 A9 65 8D 97 20 A2 04 D0 95 4C 00 BE
2100:A6 68 A4 67 C9 88 F0 04 C9 8B D0 11 CA 10 05 A2 0F 88 30 CF 86 68 84 67 A6 60 4C 34 20 C9 95 F0
2120:04 C9 8A D0 0E E8 E0 10 90 EA A2 00 C8 C0 24 90 E3 B0 B0 A6 60 C9 AD F0 D8 C9 BD F0 EF C9 89 D0
2140:03 4C 33 20 C9 A0 F0 D0 69 47 C9 F9 90 0A 2A 29 0F AA C5 60 D0 C4 F0 E9 A0 27 B9 CF 21 99 D0 07
2160:88 10 F7 2C 00 C0 10 FB 4C 21 20 07 05 11 19 01 0F 0C 0D 0A 0B 08 09 06 07 04 05 02 03 00 0E 16
2180:09 05 17 2E 13 05 03 14 0F 12 20 20 02 19 20 0A 0F 08 0E 20 02 12 0F 0F 0B 13 20 20 32 31 2D 0D
21A0:01 12 2D 32 30 31 37 C2 CC CB BD A4 B0 B0 B0 B0 AF B0 A0 D4 D2 CB BD A4 B0 B0 A0 D3 C5 C3 BD A4
21C0:B0 B0 A0 D3 CC CF D4 BD B6 A0 C4 D2 D6 BD B1 2D 2F 3D 3A 14 12 0B 20 20 0C 2F 12 3A 13 05 03 20
21E0:20 05 13 03 3A 02 19 05 20 20 14 01 02 2F 23 3A 0E 05 17 20 04 13 0B
BSAVE VIEW.SECTOR,A$2000,L$1F7*—————————–
—
* View.Sector – ProDOS util to
* display DOS 3.3 sectors as
* hex and ascii
*
* By John Brooks, 21-Mar-2017
*—————————–—
lst offtyp $FF ;Make ProDOS SYS file
org $2000*—————————–
—
MaxTrack = 35 ;Allow 36 tracks (0-35)BlkBuf = $1000 ;Stats print expects blocks at $1000 or $1100
SecBuf = BlkBuf+$100 ;Selected half-block (sector) is loaded here*—————————–
—
dum $60
ZpSltDrv ds 1 ;0000SSSD. S:slot 0-7. D:0=Drive2, 1=Drive1
ZpParams ds 1 ;P8 parameters: Read Block or Quit
ZpUnit ds 1 ;P8 unit: DSSS0000
ZpBlkPtr ds 2 ;P8 Ptr to BlkBuf or BlkBuf+$100 based on sector
ZpBlkNum ds 2 ;P8 Block containing requested sector
ZpTrk ds 1 ;Track to read
ZpSec ds 1 ;Sector to read
dend*—————————–
—
P8cQuit = $65 ;P8 Cmd: Quit
P8cRdBlk = $80 ;P8 Cmd: Read BlockP8Basic = $BE00
P8Mli = $BF00*—————————–
—
ZpWindBtm = $23
ZpCH = $24
ZpBasL = $28
ZpInvFlg = $32IoText22 = $750
IoText23 = $7D0
IoKbd = $C000
IoClr80Col = $C000
IoClr80Vid = $C00C
RmInit = $FB2F
RmSetTxt = $FB39
RmTabV = $FB5B
RmHome = $FC58
RmRdKey1 = $FD18
RmCrOut = $FD8E
RmPrByte = $FDDA
RmCOut = $FDED
RmSetKbd = $FE89
RmSetVid = $FE93*—————————–
—
SecView
cld ;No BCD
cli ;Enable IIGS control panel access
sta IoClr80Vid ;Disable 80 column display
sta IoClr80Col ;Bank in 40 column video memory
jsr RmSetVid ;Use ROM text output
jsr RmSetKbd ;Use ROM keyboard input
sta $4fb
jsr RmInit ;Clear text windows
jsr RmHome ;Clear screenlda #$11 ;Start at DOS catalog: Track=$11
sta ZpTrk
lda #$0F ;Sector=$0F
sta ZpSecldx #6*2+1 ;Start with slot 6, drive 1
ShowMsg ldy #40-1
:Print lda MsgStat,y
sta IoText22,y ;Stats on line 22
lda MsgInfo,y
sta IoText23,y ;Info on line 23
dey
bpl :Printdb $24 ;BIT. Skip dex & use X slot/drive as-is
NextDisk dex ;Go to next drive or slot
SetDisk txa
and #$f ;Make 0000SSSD
sta ZpSltDrv
lsr ;A=00000SSS, C=drive #
beq NextDisk ;Slot 0 is illegal, spin to slot 7,d1
php ;Save C=drive #
ora #”0″ ;Convert slot to ascii
sta IoText22+33 ;Display new slot
asl ;*16 to make prodos unit: 0SSS0000
asl
asl
asl
plp ;Pull C=drive #
ldy #”1″
bcs :Drive1
ora #$80 ;Set ProDOS unit to drive 2: 1SSS0000
iny ;Display drive is “2”
:Drive1 sta ZpUnit
sty IoText22+39 ;Display drive #lda ZpTrk
asl
asl
asl
sta ZpBlkNum ;Block = 8 * Trk
lda #0
rol
sta ZpBlkNum+1 ;Set block high byteldy ZpSec ;Use sector to calc the block half
lda Sec2Blk,Y ; and low 3 bits of block num
lsr ;c=1 if sec in 1st half of blk, c=0 if 2nd half
ora ZpBlkNum
sta ZpBlkNum ;Set low 3 bits of block numlda #0
sta ZpBlkPtr
adc #>BlkBuf ;Load block to $1000 or $1100 based on block half
sta ZpBlkPtr+1
eor #$A1 ;Convert $10/$11 to ascii $B1(“1”) or $B0(“0″)
sta IoText22+10 ;Display block half asciilda #22
sta ZpWindBtm ;Window the top 22 text lines (protect last 2 lines)
jsr RmTabV ;Show stats on 23rd line
ldx #4 ;Print 4x hex stats bytes
:ShowHex lda StatHPos-1,x
sta ZpCH ;Set hor pos
lda ZpBlkNum-1,x ;Get stat value
jsr RmPrByte ;Show as hex
dex
bne :ShowHextxa ;X=0
jsr RmTabV ;VTab to top line to show sector contentsldx #3 ;3 params for ProDOS read block
GoQuit stx ZpParams
jsr P8Mli
ModP8Cmd db P8cRdBlk
da ZpParams
bne ReadErr ;Skip sector display if there’s an error:ShowSec tay ;Start hex display at sec byte 0
tax ;Start asc display at sec byte 0
sta ZpCH ;Start at col 0
beq :Start ;Always. Stay on top row:NewLine jsr RmCrOut ;Go to next row
:Start tya
jsr RmPrByte ;Show sec offset
lda #”:”
jsr RmCOut:PrByte lda ZpInvFlg
eor #$c0 ;Alternate normal (even byte) & inverse (odd byte)
sta ZpInvFlg
lda SecBuf,y ;Print byte of sector
jsr RmPrByte
iny
beq :DoAscii ;If end of sec, print ascii
lda ZpCH
cmp #12*2+3 ;12 bytes per row + 3 hdr
bcc :PrByte:DoAscii ldy #12*2+4 ;H pos for ascii print
:PrAscii lda SecBuf,x
ora #$80
cmp #” ” ;Check for control chars
bcs :AsciiOk
lda #”.” ;Replace non-printing bytes with “.”
:AsciiOk sta (ZpBasL),y ;Show ascii of sector byte
inx
beq ToMenu ;If end of sector bytes then done
iny
cpy #40 ;Are we at the end of the text row?
bcc :PrAsciitxa ;Y=sec offset of next line
tay
bcs :NewLine ;AlwaysReadErr jsr RmHome ;If block read error, clear sector display
ToMenu asl ZpBasL+1 ;Hide RdKey cursorMenu jsr RmRdKey1
cmp #$9b ;ESC key
bne :NotEsc
jsr RmSetTxt ;Clear text window
lda P8Basic
cmp #$4c ;Is basic.system loaded?
beq :GoBasic
lda #P8cQuit ;No basic. Do P8 quit cmd
sta ModP8Cmd
ldx #4 ;P8 quit param count
bne GoQuit ;Always.
:GoBasic jmp P8Basic ;Exit to basic.system:NotEsc ldx ZpSec ;Prepare to change Track & Sector
ldy ZpTrk
cmp #$88 ;LEFT key
beq :DecSec
cmp #$8B ;UP key
bne :NotDec
:DecSec dex ;Previous sector
bpl :PutSec
:DecWrap ldx #15 ;Sector wrapped
:PrevTrk dey ;Previous track
bmi Menu ;Clamp track at 0
:PutSec stx ZpSec ;Save changed track and/or sector
sty ZpTrk
:Refresh ldx ZpSltDrv ;X=drive to read
:SetDisk jmp SetDisk ;Read sector & display:NotDec cmp #$95 ;RIGHT key
beq :IncSec
cmp #$8A ;DOWN key
bne :NotInc
:IncSec inx ;Next sector
cpx #16
bcc :PutSec
ldx #0
:NextTrk iny ;Next track
cpy #MaxTrack+1
bcc :PutSec ;Ignore if track is out of range
bcs Menu ;Always:NotInc ldx ZpSltDrv
cmp #”-” ;- key: Track -= 1
beq :PrevTrk
:NotDash cmp #”=” ;= key: Track += 1
beq :NextTrk
:NotEql cmp #$89 ;TAB key: next drive or slot
bne :NotTab
:NextDsk jmp NextDisk:NotTab cmp #” ” ;SPACE key: reload current track,sector & display
beq :Refresh
:NotSpc adc #$FF-“7”-1 ;-1:c=1. Move ascii “1-7” to $F9-$FF
cmp #$F9
bcc :NotSlot
rol ;Set 1111SSS1: drive 1 of selected slot
and #$0F ;0000SSSD
tax ;New slot+drive
cmp ZpSltDrv ;Compare to current slot & drive
bne :SetDisk ;If new slot, then use slot with drive 1
beq :NextDsk ;Always. Same slot, use drive 2:NotSlot ldy #40-1 ;Print 40 char help text
:ShowHlp lda MsgHelp,y
sta IoText23,y ;Display on last row
dey
bpl :ShowHlp
:WaitKey bit IoKbd
bpl :WaitKey
jmp ShowMsg ;Redraw stats & info, then show sectorStatHPos db 7,5,17,25 ;H offsets to print block lo, block hi, trk, sec
Sec2Blk db 0*2+1,7*2+1,6*2+0,6*2+1 ;Block offset & half for each sector
db 5*2+0,5*2+1,4*2+0,4*2+1
db 3*2+0,3*2+1,2*2+0,2*2+1
db 1*2+0,1*2+1,0*2+0,7*2+0MsgInfo inv “VIEW.SECTOR BY JOHN BROOKS 21-MAR-2017”
MsgStat asc “BLK=$0000/0 TRK=$00 SEC=$00 SLOT=6 DRV=1”
MsgHelp inv “-/=:TRK L/R:SEC ESC:BYE TAB/#:NEW DSK”lst off
https://drive.google.com/file/d/0B9I8jo6bktRAVjNvcXotZmNZems/view