diff --git a/Platform/Apple/virtual/src/font/build.xml b/Platform/Apple/virtual/src/font/build.xml index 9ff3aa0f..398f7219 100644 --- a/Platform/Apple/virtual/src/font/build.xml +++ b/Platform/Apple/virtual/src/font/build.xml @@ -1,8 +1,8 @@ - + - + @@ -31,9 +31,10 @@ - - + + + diff --git a/Platform/Apple/virtual/src/font/pfontEngine.s b/Platform/Apple/virtual/src/font/pfontEngine.s index bd1dbbd2..89f5a222 100644 --- a/Platform/Apple/virtual/src/font/pfontEngine.s +++ b/Platform/Apple/virtual/src/font/pfontEngine.s @@ -28,61 +28,64 @@ ;10/14 v.24 input a single char ;10/27 v.25 comments updated -* = $6000 +* = $E000 ; Use hi-bit ASCII for Apple II !convtab "../include/hiBitAscii.ct" ; Global definitions !source "../include/global.i" -!source "../include/debug.i" +!source "../include/mem.i" -DEBUG = 0 ; 1=some logging, 2=lots of logging +DEBUG = 0 ; 1=some logging, 2=lots of logging -zTmp1 EQU $FC ;zero page Temporary variables -zTmp2 EQU $FD -zTmp3 EQU $FE -L.Adr EQU $1E ;Zero page address variable -H.Adr EQU $1F ;for general indrct adrs indexing -InBufr EQU $200 ;Input Buffer -InBufrX EQU $2FF ;Input Buffer index (length) +zTmp1 = $2 ;zero page Temporary variables +zTmp2 = $3 +zTmp3 = $4 +HgrHrz = $5 ;horizontal index added to base adr +L_Adr = $6 ;Zero page address variable +H_Adr = $7 ;for general indrct adrs indexing +MskBytL = $8 ;Mask byte 1st +MskBytH = $9 ;Mask byte 2nd +MskByte = $A ;Mask byte +GBasL = $26 ;LoByte HGR mem pg base adr EABABxxx +GBasH = $27 ;HiByte PPPFGHCD for Y=ABCDEFGH P=page -TxOut EQU $DB5C ;ApleSft Txt char Out (for testing) +InBufr = $200 ;Input Buffer +InBufrX = $2FF ;Input Buffer index (length) -Font0 EQU $5A00 ;Font0 bitmap defs -HgrTbHi EQU $5E74 ;HGR base address lookup table -HgrTbLo EQU $5F34 ;" Lo order value -Demo.Do EQU $6000 ;Demo app -Kbd.Rd EQU $C000 ;read keyboard -Kbd.Clr EQU $C010 ;clear keyboard strobe +Kbd_Rd = $C000 ;read keyboard +Kbd_Clr = $C010 ;clear keyboard strobe - JMP Demo.Do ;Do a demo of the routines +Font0 !word 0 ;address of font +CharRate !byte $80 ;plot rate {0..FF} 0=fastest +WaitStat !byte 0 ;Wait State {0,1,2,3,4,5,6,7} +NoPlt_Flg !byte 0 ;flag: NO PLOT - only get width +InvTx_Flg !byte 0 ;flag: Inverse (black on white) text +MskTx_Flg !byte 0 ;flag: mask HGR before plotting text +UndTx_Flg !byte 0 ;flag: Underline text +CtrJs_Flg !byte 0 ;flag: center justify +BkgColor !byte $80 ;color byte {0,80=blk,FF=wht,etc} +FrgColor !byte $FF ;color byte +CursColL !byte 0 ;Lo-byte of 16-bit horz X-pos value +CursColH !byte 0 ;Hi-byte X-position {0..279} +CursRow !byte 0 ;vertical Y-position {0..191} +ChrWdth !byte 0 ;character width (number of pixels) +PltChar !byte 0 ;character to be plotted {0..110} +AscChar !byte 0 ;Ascii Char value {$80..$FF} -CharRate DFB $80 ;plot rate {0..FF} 0=fastest -WaitStat DFB 0 ;Wait State {0,1,2,3,4,5,6,7} -NoPlt.Flg DFB 0 ;flag: NO PLOT - only get width -InvTx.Flg DFB 0 ;flag: Inverse (black on white) text -MskTx.Flg DFB 0 ;flag: mask HGR before plotting text -UndTx.Flg DFB 0 ;flag: Underline text -CtrJs.Flg DFB 0 ;flag: center justify -BkgColor DFB $80 ;color byte {0,80=blk,FF=wht,etc} -FrgColor DFB $FF ;color byte -CursColL DFB 0 ;Lo-byte of 16-bit horz X-pos value -CursColH DFB 0 ;Hi-byte X-position {0..279} -CursRow DFB 0 ;vertical Y-position {0..191} -ChrWdth DFB 0 ;character width (number of pixels) -PltChar DFB 0 ;character to be plotted {0..110} -AscChar DFB 0 ;Ascii Char value {$80..$FF} +;Initialize the font engine. Address of font in X=lo/Y=hi. +Init JMP DoInit ;API call address ;When using ASCii character values, the values must be ;tested for control codes before they can be plotted ;using the plot character routine. -PlotAsc JMP TestChr ;API call address +PlotAsc JMP TestChr ;API call address ;If you know which of the {0..110} bitmapped characters ;you want plotted, you can bypass testing for control ;codes, making this a faster way to plot. -PlotBmp JMP PlotFnt ;API call address +PlotBmp JMP PlotFnt ;API call address ;To get a single character using a flashing cursor on ;the HGR screen use GetAsc. The GetYN flag forces the @@ -90,14 +93,19 @@ PlotBmp JMP PlotFnt ;API call address ;to the screen, which allows us to do a password input. ;ChrWdth, PltChar & AscChar will have values after the ;routine executes. Similar to Aplsft GET A$ construct. -GetYN.Flg DFB $00 ;flag: force Y/N input -CursIcn DFB 103 ;cursor icon 103=cactus -GetAsc JMP Get.Chr ;API call address +GetYN_Flg !byte $00 ;flag: force Y/N input +CursIcn !byte 103 ;cursor icon 103=cactus +GetAsc JMP Get_Chr ;API call address ;To get a string of text up to 40 chars long using a ;flashing cursor use GetStr. It allows use of either ;left arrow or delete key to backspace. -GetStr JMP In.Str +GetStr JMP In_Str + +;Simple init routine. Just records the font address. +DoInit STX Font0 + STY Font0+1 + RTS ;This routine converts (x,y) {0..279,0..191} to HGR address ;{$2000..$3FFF} and an offset bit (for the pixel within the @@ -113,39 +121,35 @@ GetStr JMP In.Str ;which is stored in zero page $26, $27; $E5 stores offset. ;This routine uses the same zero page addresses. -GBasL EQU $26 ;LoByte HGR mem pg base adr EABABxxx -GBasH EQU $27 ;HiByte PPPFGHCD for Y=ABCDEFGH P=page -HgrHrz EQU $E5 ;horizontal index added to base adr - GetAdr LDA CursRow ;Get vert cursor position & save it PHA ;Then, clear storage used for indexing LDX #$00 ;into array of stored addrs, 1 per line STX zTmp3 ;Lp1 {0..9} vertical size of the bitmap JSR GetOfst ;Get bit offset by dividing {0..279} by 7 -GA.Lp1 JSR GetBase ;Get initial addrs location frm lookup tbl -GA.Lp2 LDY zTmp3 ;Get index into stored addresses +GA_Lp1 JSR GetBase ;Get initial addrs location frm lookup tbl +GA_Lp2 LDY zTmp3 ;Get index into stored addresses CLC LDA GBasL ;get lo-byte of HGR address ADC HgrHrz ;add the horizontal position offset byte - STA GA.Ary,Y ;store the composite address in the array + STA GA_Ary,Y ;store the composite address in the array INY LDA GBasH ;load the hi-byte of HGR address; store - STA GA.Ary,Y ;that also (each array element is 2-bytes) + STA GA_Ary,Y ;that also (each array element is 2-bytes) INY STY zTmp3 ;save the index value of the array TYA CMP #18 ;when we've stored 9 pairs, we're done - BPL GA.Done + BPL GA_Done INC CursRow ;increment the {0..191} down one line LDA CursRow AND #$07 ;check if it crosses the 'n'* 7th line - BEQ GA.Lp1 ;if so, use ROM to recalc new addrs, else, + BEQ GA_Lp1 ;if so, use ROM to recalc new addrs, else, LDA GBasH ;get HiByt of adrs wrd |pppFGHcd|eABABxxx| CLC ;(line position is ABCDEFGH bit pattern) ADC #$04 ;increment the FGH bit pattern STA GBasH ;and save the result. This is faster - JMP GA.Lp2 ;than using the GetBase routine every time. -GA.Done PLA ;restore vertical position + JMP GA_Lp2 ;than using the GetBase routine every time. +GA_Done PLA ;restore vertical position STA CursRow RTS GetBase LDX CursRow ;Look-up the base HGR memory location @@ -169,33 +173,30 @@ D16x8L2 SBC #7 D16x8L3 ROL HgrHrz ;8-bit quotient (offset byte) DEX BNE D16x8L1 - STA H.Bit ;8-bit remainder (offset bit) + STA H_Bit ;8-bit remainder (offset bit) RTS -H.Bit DFB 0 ;offset bit - pixels {0..7} -GA.Ary DS 18,$0 ;Define Storage: 16 bytes preset to 0 +H_Bit !byte 0 ;offset bit - pixels {0..7} +GA_Ary !fill 18,$0 ;Define Storage: 16 bytes preset to 0 ; ;This routine plots the bitmap patters on the HGR screen ;using indirect addressing based on the array of 2-byte ;address words generated by the prior code. -MskBytL EQU $FA ;Mask byte 1st -MskBytH EQU $FB ;Mask byte 2nd -MskByte EQU $E3 ;Mask byte -ChrX10L DFB $00 ;char val x9 offset into bitmap table -ChrX10H DFB $00 ;LO & HI bytes -ChrX10i DFB $00 ;char font bmp index -Byt2nd DFB $00 ;2nd byte of bitmap when stratling 2-bytes -Flg2nd DFB $00 ;flag indicating 2nd byte is needed -MlpIdx DFB $00 ;Main loop index into address table -Flg8xcp DFB $00 ;flag: 8-pixel char exception -FlgBchr DFB $00 ;flag: black character -RtMrgnL DFB $00 ; -RtMrgnH DFB $00 ; -SvY DFB $00 ; +ChrX10L !byte $00 ;char val x9 offset into bitmap table +ChrX10H !byte $00 ;LO & HI bytes +ChrX10i !byte $00 ;char font bmp index +Byt2nd !byte $00 ;2nd byte of bitmap when stratling 2-bytes +Flg2nd !byte $00 ;flag indicating 2nd byte is needed +MlpIdx !byte $00 ;Main loop index into address table +Flg8xcp !byte $00 ;flag: 8-pixel char exception +FlgBchr !byte $00 ;flag: black character +RtMrgnL !byte $00 ; +RtMrgnH !byte $00 ; +SvY !byte $00 ; -PlotFnt LDX NoPlt.Flg +PlotFnt LDX NoPlt_Flg BNE GetWdth - JSR GetAdr ;first, load DS.Ary w/2-byte HGR addrs + JSR GetAdr ;first, load DS_Ary w/2-byte HGR addrs LDA FrgColor AND #$7F EOR #$7F @@ -220,17 +221,17 @@ GetWdth LDA #0 STA ChrX10H ;save index value {0..990} CLC - LDA #>Font0 ;get base address of Font bitmap table + LDA Font0 ;get base address of Font bitmap table ADC ChrX10L ;and add the PlotChar x10 offset to it - STA L.Adr - LDA #9 - BMI Wp.TvOk ;no - ok + BMI Wp_TvOk ;no - ok LDX #9 ;yes - clamp to 9 -Wp.TvOk LDA Flg.Prm2 ;is 2nd of 2 digits? - BNE Wp.Cmb ;yes - combine +Wp_TvOk LDA Flg_Prm2 ;is 2nd of 2 digits? + BNE Wp_Cmb ;yes - combine TXA - STA Wp.Dig1 ;else save it, and, - INC Flg.Prm2 ;set 2nd digit flag + STA Wp_Dig1 ;else save it, and, + INC Flg_Prm2 ;set 2nd digit flag RTS -Wp.Cmb STX Wp.Dig2 ;save digit - LDA Wp.Dig1 ;get 1st digit +Wp_Cmb STX Wp_Dig2 ;save digit + LDA Wp_Dig1 ;get 1st digit ASL ;multiply by 10 - STA T1.Val ;10=8+2 + STA T1_Val ;10=8+2 ASL ASL - ADC T1.Val - ADC Wp.Dig2 ;add digits together + ADC T1_Val + ADC Wp_Dig2 ;add digits together TAX LDA WaitStat CMP #5 ;is param for Htab? - BNE Wp.VtVal ;no - then do Vtab + BNE Wp_VtVal ;no - then do Vtab TXA ;yes - then restore param ; STX GrAdCol ;and change column value - BPL Wp.Tdn -Wp.VtVal TXA ;if Vtab then restore param + BPL Wp_Tdn +Wp_VtVal TXA ;if Vtab then restore param LSR ;make it an even value ASL ; STA GrAdRow ;store it as a row parameter -Wp.Tdn JMP Wpr.Clr +Wp_Tdn JMP Wpr_Clr ;Chage char/ticker rate ;these digits are treated as base-16 -Wp.cRate TXA ;restore alpha char +Wp_cRate TXA ;restore alpha char SEC SBC #$30 ;change Chr"#" to Val# AND #$1F ;mask off digit TAX CMP #10 ;digit >9 - BMI Wp.RvOk ;no - ok + BMI Wp_RvOk ;no - ok SEC SBC #7 ;make A..F be 11..15 TAX -Wp.RvOk LDA Flg.Prm2 ;is 2nd of 2 digits? - BNE Wp.rCmb ;yes - combine +Wp_RvOk LDA Flg_Prm2 ;is 2nd of 2 digits? + BNE Wp_rCmb ;yes - combine TXA ;no - clamp to {0..F} AND #$0F - STA Wp.Dig1 ;and save it - INC Flg.Prm2 ;set 2nd digit flag + STA Wp_Dig1 ;and save it + INC Flg_Prm2 ;set 2nd digit flag RTS -Wp.rCmb STX Wp.Dig2 ;save digit - LDA Wp.Dig1 ;get 1st digit +Wp_rCmb STX Wp_Dig2 ;save digit + LDA Wp_Dig1 ;get 1st digit ASL ;shift it ASL ASL ASL - ORA Wp.Dig2 ;combine the digits + ORA Wp_Dig2 ;combine the digits STA CharRate ;store the rate parameter - JMP Wpr.Clr + JMP Wpr_Clr + +HgrTbHi !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $20,$24,$28,$2C,$30,$34,$38,$3C + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $21,$25,$29,$2D,$31,$35,$39,$3D + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $22,$26,$2A,$2E,$32,$36,$3A,$3E + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + !byte $23,$27,$2B,$2F,$33,$37,$3B,$3F + +HgrTbLo !byte $00,$00,$00,$00,$00,$00,$00,$00 + !byte $80,$80,$80,$80,$80,$80,$80,$80 + !byte $00,$00,$00,$00,$00,$00,$00,$00 + !byte $80,$80,$80,$80,$80,$80,$80,$80 + !byte $00,$00,$00,$00,$00,$00,$00,$00 + !byte $80,$80,$80,$80,$80,$80,$80,$80 + !byte $00,$00,$00,$00,$00,$00,$00,$00 + !byte $80,$80,$80,$80,$80,$80,$80,$80 + !byte $28,$28,$28,$28,$28,$28,$28,$28 + !byte $A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8 + !byte $28,$28,$28,$28,$28,$28,$28,$28 + !byte $A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8 + !byte $28,$28,$28,$28,$28,$28,$28,$28 + !byte $A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8 + !byte $28,$28,$28,$28,$28,$28,$28,$28 + !byte $A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8 + !byte $50,$50,$50,$50,$50,$50,$50,$50 + !byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0 + !byte $50,$50,$50,$50,$50,$50,$50,$50 + !byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0 + !byte $50,$50,$50,$50,$50,$50,$50,$50 + !byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0 + !byte $50,$50,$50,$50,$50,$50,$50,$50 + !byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0