This commit is contained in:
Michaelangel007 2017-10-26 16:33:56 -07:00
parent 889e22f5c3
commit d8f3e88ddf
4 changed files with 228 additions and 70 deletions

View File

@ -9,6 +9,15 @@
1. Start AppleWin 1. Start AppleWin
2. F3 to select Slot 6, Drive 1 2. F3 to select Slot 6, Drive 1
3. Open: `hgrbyte.dsk` 3. Open: `hgrbyte.dsk`
4. Select BASIC.SYSTEM
5. `BLOAD TUT.DHGR`
6. `BRUN DHGR.BYTE`
Ver 27.
- Ripped out ROM output routines and replaced with native code for speed
- Updated the status bar so that the saved bits and revers are displayed
- Added x/2 byte column output
- Shortened memory bank indicator "AUX/MAIN" to "A/M"
# Keys: # Keys:

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,12 @@
; Merlin32 ; Merlin32
CONFIG_DHGR = 1 CONFIG_DHGR = 1
CONFIG_BIOS = 0 ; 1=Use slow ROM for text, 0=Use native code for COUT, HOME
; DHGR Byte Inspector ; DHGR Byte Inspector
; https://github.com/Michaelangel007/apple2_hgrbyte/
;
; Michael Pohoreski ; Michael Pohoreski
; Version 22 ; https://github.com/Michaelangel007/apple2_hgrbyte/
; Version 27
; ;
; TL:DR; ; TL:DR;
; IJKL to move ; IJKL to move
@ -62,6 +62,8 @@ CONFIG_DHGR = 1
; = Set cursor byte from temporary ; = Set cursor byte from temporary
; ;
; TODO: ; TODO:
; ? Help screen
; col/2
; Z = clear aux mem ; Z = clear aux mem
; X = swap aux/main mem ; X = swap aux/main mem
; M = mark begin/end -- show width,height,x,y ; M = mark begin/end -- show width,height,x,y
@ -73,6 +75,7 @@ CONFIG_DHGR = 1
CH = $24 ; 40-col text cursor column CH = $24 ; 40-col text cursor column
CV = $25 ; 40-col text cursor row CV = $25 ; 40-col text cursor row
CH80 = $57B ; 80-col text cursor column CH80 = $57B ; 80-col text cursor column
BASL = $28 ; 16-bit pointer to start of TEXT row
GBASL = $26 ; 16-bit pointer to start of D/HGR scanline GBASL = $26 ; 16-bit pointer to start of D/HGR scanline
GBASH = $27 GBASH = $27
@ -96,13 +99,17 @@ SETTXT = $FB39
;CR = $FC62 ;CR = $FC62
;CROUT = $FD8E ; Output CR ;CROUT = $FD8E ; Output CR
COUT = $FDED ; Char Output aka putch() DO CONFIG_BIOS
PR_HEX = $FDD3 PR_HEX = $FDD3
PRBYTE = $FDDA PRBYTE = $FDDA
COUT = $FDED ; Char Output aka putch()
ELSE
FIN
; When Store80 OFF aux mem determined by AUXRDON/AUXWRON
; When Store80 ON, Page 2=ON, read/writes touch aux mem ; When Store80 ON, Page 2=ON, read/writes touch aux mem
SW_STORE80 = $C000 ; STA $+0 OFF, $+1 ON SW_STORE80 = $C000 ; use $C002 .. $C005 for aux mem
SW_STORE81 = $C001 ; $C055 = page 2 SW_STORE81 = $C001 ; use page 2 = $C055 for aux mem
SW_SET40COL = $C00C ; 40-col mode SW_SET40COL = $C00C ; 40-col mode
SW_SET80COL = $C00D ; 80-col mode SW_SET80COL = $C00D ; 80-col mode
@ -123,6 +130,8 @@ SW_DHGR = $C05E ; Mode DHGR
SW_SHGR = $C05F ; Mode SHGR SW_SHGR = $C05F ; Mode SHGR
cursor_row = $E2 ; used by Applesoft HGR.row cursor_row = $E2 ; used by Applesoft HGR.row
tempByte = $F6 ; forward bits for pixel print
aux_ptr = $F7 ; copy of GBAS but points to HGR2 $40xx..$5Fxx aux_ptr = $F7 ; copy of GBAS but points to HGR2 $40xx..$5Fxx
lastkey = $F9 lastkey = $F9
cursor_org = $FA ; When cursor is saved cursor_org = $FA ; When cursor is saved
@ -133,7 +142,7 @@ FLAG_FULL = $01 ; == $1 -> $C052 MIXCLR
; ; == $0 -> $C053 MIXSET ; ; == $0 -> $C053 MIXSET
flags = $FD ; flags = $FD ;
temp = $FE temp = $FE ; reverse bits for pixel print
cursor_col = $FF ; x2 for DHGR cursor_col = $FF ; x2 for DHGR
HGRPAGE = $E6 ; used by Applesoft HGR.page HGRPAGE = $E6 ; used by Applesoft HGR.page
; $20=MAIN, $40=AUX ; $20=MAIN, $40=AUX
@ -149,7 +158,7 @@ __MAIN = $900
ORG __MAIN ORG __MAIN
DhgrByte DhgrByte
LDA #22 ; Version - copy HGR1 to aux, HGR2 to HGR1 LDA #27 ; Version - copy HGR1 to aux, HGR2 to HGR1
JSR Init_Exit ; FEATURE: Set to 00 if you don't want to copy AUX $2000 to MAIN $4000 JSR Init_Exit ; FEATURE: Set to 00 if you don't want to copy AUX $2000 to MAIN $4000
BIT PAGE1 ; Page 1 BIT PAGE1 ; Page 1
@ -160,7 +169,6 @@ DhgrByte
DO CONFIG_DHGR DO CONFIG_DHGR
STA SW_DHGR ; $C05E DHGR, not HGR STA SW_DHGR ; $C05E DHGR, not HGR
STA SW_SET80COL ; $C00D 80-col on STA SW_SET80COL ; $C00D 80-col on
STA SW_STORE80 ; Turn off for app
FIN FIN
BRA _Center BRA _Center
@ -206,8 +214,6 @@ _EdgeU LDA #00
STA cursor_row STA cursor_row
ADC #1 ADC #1
BNE GetByte ; always BNE GetByte ; always
_Center _Center
LDA #WIDTH/2 LDA #WIDTH/2
STA cursor_col STA cursor_col
@ -234,7 +240,9 @@ GetByte ; Cursor position changed
PutByte PutByte
STA cursor_val ; current value STA cursor_val ; current value
STA cursor_tmp ; flashing cursor STA cursor_tmp ; flashing cursor
JSR DrawStatus JSR DrawStatus
; STA SW_STORE80
FlashByte FlashByte
JSR FlashCursorByte JSR FlashCursorByte
GetKey GetKey
@ -367,32 +375,12 @@ Digit
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
DrawStatus DrawStatus
; STA SW_STORE81 ; COUT uses
LDA #20 ; Cursor.Y = Top of 4 line split TEXT/HGR window LDA #20 ; Cursor.Y = Top of 4 line split TEXT/HGR window
JSR VTAB_COL0 ; Cursor.X = 0 JSR VTAB_COL0 ; Cursor.X = 0
LDA #'X'+$80 ; X=## Y=## $=####:## LDA #'X'+$80 ; X=## Y=## $=####:##
JSR COUT JSR COUT
DO CONFIG_DHGR
LDY #8 ; src = &char[1][8]
LDA cursor_col
CLC
ROR
BCS HaveMainMem
HaveAuxMem
LDY #0 ; src = &char[0][8]
HaveMainMem
LDX #0 ; dst = 0
CopyMemType
LDA sMemType,Y
STA sTextFooter,X
INY ; src++
INX ; dst++
CPX #8
BNE CopyMemType
FIN
LDA cursor_col LDA cursor_col
JSR PR_HEX JSR PR_HEX
LDA #' '+$80 LDA #' '+$80
@ -416,15 +404,65 @@ CopyMemType
JSR PRBYTE JSR PRBYTE
LDA #':'+$80 LDA #':'+$80
JSR COUT JSR COUT
LDA cursor_val LDA cursor_val
JSR PRBYTE JSR PRBYTE
LDA #' '+$80 LDA #' '+$80
JSR COUT JSR COUT
LDA cursor_val
JSR ReverseByte
JSR PrintStatusLine2
JSR PrintStatusLine3
JMP PrintStatusLine4
; --- Status Line 2 ---
PrintStatusLine2
LDA #21 ; Cursor.Y = 21
JSR VTAB_COL0
DO CONFIG_DHGR
LDA #'/' + $80
JSR COUT
LDA cursor_col
LSR
JSR PR_HEX
LDA #' '+$80
JSR COUT
LDA cursor_col
LSR
BCS HaveMainMem
HaveAuxMem
LDX #<sMemTypeBeg ; src = &char[0][0]
BCC HaveMemType ; always
HaveMainMem
LDX #<sMemTypeEnd ; src = &char[1][0]
HaveMemType
LDY #>sMemTypeBeg
JSR PrintStringZ
FIN
LDA #12
JSR HTAB
LDX #<sTextFooter2
LDY #>sTextFooter2
JSR PrintStringZ
LDA cursor_org
JSR PrintInverseByte
; JSR PRBYTE
LDA #' '+$80
JSR COUT
LDA cursor_org
; intentional fall into ReverseByte
; ----------
ReverseByte ReverseByte
LDX #8 LDX #8
LDA cursor_val
STA temp STA temp
STA tempByte
ReverseBit ReverseBit
ASL temp ASL temp
ROR ROR
@ -445,22 +483,24 @@ PrintBitsNormal
LDA #'~'+$80 LDA #'~'+$80
JSR COUT JSR COUT
LDX #8
LDA cursor_val
PrintBitsReverse PrintBitsReverse
LDX #8
LDA tempByte
PrintBitsReverse1
TAY TAY
JSR Bit2Asc JSR Bit2Asc
TYA TYA
LSR LSR
DEX DEX
BNE PrintBitsReverse BNE PrintBitsReverse1
LDA #'$'+$80 LDA #'$'+$80
JSR COUT JSR COUT
PLA ; restore reverse byte PLA ; restore reverse byte
JSR PRBYTE JSR PRBYTE
RTS
LDA cursor_org ; X=0 PrintInverseByte
PHA PHA
LSR LSR
LSR LSR
@ -469,22 +509,25 @@ PrintBitsReverse
JSR NibToInvTxt JSR NibToInvTxt
PLA PLA
JSR NibToInvTxt JSR NibToInvTxt
RTS
LDA #21 ; Cursor.Y = 21
JSR VTAB_COL0
LDX #0 ; --- Status Line 3 ---
PrintFooter1 PrintStatusLine3
LDA sTextFooter, X
BEQ _DoneStatus
JSR COUT ; 4 line text window, 2nd row
INX
BNE PrintFooter1 ; (almost) always
_DoneStatus
; Draw pixel grouping
LDA #22 LDA #22
JSR VTAB_COL0 JSR VTAB_COL0
LDA #20
JSR HTAB
LDX #<sTextFooter3
LDY #>sTextFooter3
JMP PrintStringZ
; --- Status Line 4 ---
; Draw pixel grouping
PrintStatusLine4
LDA #23
JSR VTAB_COL0
LDA #29 LDA #29
JSR HTAB JSR HTAB
@ -504,6 +547,22 @@ PrintFooter2
BNE PrintFooter2 BNE PrintFooter2
RTS RTS
; IN:
; X=Lo
; Y=Hi
PrintStringZ
STX PrintString2+1
STY PrintString2+2
LDX #0
PrintString2
LDA $DA1A, X
BEQ PrintString3
JSR COUT ; 4 line text window, 2nd row
INX
BNE PrintString2 ; (almost) always
PrintString3
RTS
; Display nibble as inverse text ; Display nibble as inverse text
; 0 -> '0' $30 ; 0 -> '0' $30
; 9 -> '9' $39 ; 9 -> '9' $39
@ -516,8 +575,9 @@ NibToInvTxt
BCC PrintSave BCC PrintSave
SBC #$39 ; C=1, $3A ':' -> $01 'A', $3F '?' -> $06 SBC #$39 ; C=1, $3A ':' -> $01 'A', $3F '?' -> $06
PrintSave PrintSave
STA sTextFooter+17,X ; VTAB 21:HTAB 17 and 18, Update Saved Byte JSR COUT
INX ; STA sTextFooter+17,X ; VTAB 21:HTAB 17 and 18, Update Saved Byte
; INX
RTS RTS
Bit2Asc Bit2Asc
@ -545,7 +605,7 @@ GetCursorByte ; Main Aux
TAY ; y = byte column TAY ; y = byte column
BCS _get_main BCS _get_main
_get_aux _get_aux
STA SW_STORE80 ; STA SW_STORE80
LDA (aux_ptr),Y LDA (aux_ptr),Y
DB $2C ; OPTIMIZAITON: BRA _get_val -> BIT $abs - BIT $26B1 DB $2C ; OPTIMIZAITON: BRA _get_val -> BIT $abs - BIT $26B1
_get_main _get_main
@ -579,7 +639,7 @@ SetCursorByte
TXA ; pop byte TXA ; pop byte
BCS _set_main BCS _set_main
STA SW_STORE80 ; STA SW_STORE80
STA (aux_ptr),Y ; Shadow copy to HGR2 STA (aux_ptr),Y ; Shadow copy to HGR2
STA SW_AUXWROFF+1 ; Write AUX STA SW_AUXWROFF+1 ; Write AUX
_set_main _set_main
@ -590,20 +650,86 @@ _set_main
STA SW_AUXWROFF ; Write MAIN STA SW_AUXWROFF ; Write MAIN
RTS RTS
; ========================================================================
DO CONFIG_BIOS
ELSE
ClearText80
STA SW_AUXWROFF+1
JSR ClearText40
STA SW_AUXWROFF
ClearText40
LDA #' '+$80 ; NORMAL SPC
TAY
ClearTextPage
STA $400,Y
STA $480,Y
STA $500,Y
STA $580,Y
STA $600,Y
STA $680,Y
STA $700,Y
STA $780,Y
INY
CPY #$78
BNE ClearTextPage
RTS
PR_HEX
PHA
LDA #'=' + $80 ; normal
JSR COUT
PLA
PRBYTE
PHA
LSR
LSR
LSR
LSR
JSR PR_NIB
PLA
AND #$0F
PR_NIB
ORA #'0' + $80
CMP #':' + $80
BCC COUT
ADC #$06
COUT
PHY
DO CONFIG_DHGR
PHX
TAX ; push char
LDA CH80
LSR
TAY ; Y = col/2
TXA ; pop char
BCS Main
Aux
STA SW_AUXWROFF+1 ; Write AUX
Main
ELSE
LDY CH
FIN
STA (BASL),Y
DO CONFIG_DHGR
STA SW_AUXWROFF ; Write MAIN
INC CH80
PLX
ELSE
INC CH
FIN
PLY
RTS
FIN
; ======================================================================== ; ========================================================================
; Common code -- called by Init, Exit ; Common code -- called by Init, Exit
Init_Exit Init_Exit
STA SW_SET80COL
DO CONFIG_DHGR DO CONFIG_DHGR
STA SW_STORE80 ; Turn off for AUXMOVE
STA SW_ALTCHAR0 ; Turn off mouse-text
STA SW_AUXRDOFF STA SW_AUXRDOFF
STA SW_AUXWROFF STA SW_AUXWROFF
STA SW_STORE80
STA SW_ALTCHAR0 ; Turn off mouse-text
LDX #$20 LDX #$20
LDY #$40 LDY #$40
@ -648,6 +774,9 @@ OnInit
CLC ; C=0 Aux to Main CLC ; C=0 Aux to Main
JSR SetDst00 ; C=0 don't do MOVE JSR SetDst00 ; C=0 don't do MOVE
JSR AUXMOVE JSR AUXMOVE
STA SW_SET80COL
BRA DoneCopy BRA DoneCopy
; "Unlinearize" interleaved AUX/MAIN memory ; "Unlinearize" interleaved AUX/MAIN memory
@ -672,12 +801,17 @@ OnExit
STA SW_SET40COL ; $C00C STA SW_SET40COL ; $C00C
STA SW_DHGR+1 ; $C05F DHGR off STA SW_DHGR+1 ; $C05F DHGR off
STA SW_STORE81 ; Enable Page 2 switching ; STA SW_STORE81 ; Enable Page 2 switching
DoneCopy DoneCopy
FIN FIN
DO CONFIG_BIOS
JSR SETTXT JSR SETTXT
JSR HOME JSR HOME
ELSE
JSR ClearText80
STA TXTCLR+1
FIN
LDX #$20 LDX #$20
STX HGRPAGE STX HGRPAGE
@ -718,11 +852,20 @@ DoneDst00
; ======================================================================== ; ========================================================================
sTextFooter sTextFooter2
; 1 2 3 ; 1 2 3
; 0123456789012345678901234567890123456789 ; 0123456789012345678901234567890123456789
; 1 2
; 0123456789ABCDEF0123456789ABCDEF01234567
; "X=## Y=## $=####:## %%%%%%%%~%%%%%%%%$00" ; "X=## Y=## $=####:## %%%%%%%%~%%%%%%%%$00"
ASC "---/---- SAVE:?? 76543210 " ; "/=## A/M SAVE:?? %%%%%%%%~%%%%%%%%$00
; " 76543210 12345678
; " [11]222-
ASC "SAVE:"
DB $00
sTextFooter3
ASC "76543210 "
INV "12345678" ;1-8 INVERSE INV "12345678" ;1-8 INVERSE
; DB '1' & $3F ; DB '1' & $3F
; DB '2' & $3F ; DB '2' & $3F
@ -734,10 +877,16 @@ sTextFooter
; DB '8' & $3F ; DB '8' & $3F
DB $00 DB $00
; char [2][8] ; char [2][3]
sMemType sMemTypeBeg
ASC "AUX/----" INV "A"
ASC "---/MAIN" ASC "/M"
DB $00
sMemTypeEnd
ASC "A/"
INV "M"
DB $00
; These alternative text groupings ; These alternative text groupings
; don't look as good in DHGR 80-col text mode ; don't look as good in DHGR 80-col text mode
@ -751,10 +900,10 @@ sMemType
; 12345678123456781234567812345678 ; 12345678123456781234567812345678
; Show which pixel group the bits belong to ; Show which pixel group the bits belong to
sPixelFooter sPixelFooter
ASC "[11]222 " ASC "[11]222-"
ASC "2[33]44 " ASC "2[33]44-"
ASC "44[55]6 " ASC "44[55]6-"
ASC "666[77] " ASC "666[77]-"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------