home *** CD-ROM | disk | FTP | other *** search
- ; graph.a
- ;──────────────────────────────────────────────────────────────────────────────
- ; Bar Graph display subroutine for LHSFX
- ;──────────────────────────────────────────────────────────────────────────────
-
- INSTXT "sfx.i"
-
- PUBLIC InitGraph
- PUBLIC UpdateGraph
-
- EXT Prt
- EXT Abort
- EXT stop
-
- Space EQU 32
- Rev EQU 18 ; Reverse video on
- RevOff EQU 146 ; Reverse video off
- Left EQU 157 ; Cursor left
-
-
- BarChar fcb RevOff,32 ; 0 bars
- fcb RevOff,180 ; 2 bars
- fcb RevOff,161 ; 4 bars
- fcb 18,170 ; 6 bars
-
- BSS Remainder,1
- BSS BarSize,3
-
- ;──────────────────────────────────────────────
- ; Initialize. Call with OriginalSize in .a.x.y
- ;──────────────────────────────────────────────
-
- InitGraph sta BarSize
- stx BarSize+1
- sty BarSize+2
- and #3
- sta Remainder
- Graph0 ldx #2
- Graph1 lsr BarSize+2
- ror BarSize+1
- ror BarSize
- dex
- bne Graph1
-
- Graph2 lda BarSize
- ora BarSize+1
- beq DoRem
- lda #18
- jsr Prt
- lda #' '
- jsr Prt
- lda BarSize
- bne Graph3
- dec BarSize+1
- Graph3 dec BarSize
- jmp Graph2
-
- DoRem lda Remainder
- asl a
- tay
- lda BarChar,y
- jsr Prt
- iny
- lda BarChar,y
- jsr Prt
- dec Remainder
- lda #RevOff
- jmp Prt
-
- ;───────────────────────────────────────
- ; Update and possibly abort on RUN/STOP
- ;───────────────────────────────────────
-
- UpdateGraph pha
- txa
- pha
- tya
- pha
-
- jsr stop ; Check for user abort
- beq gabort
- lda Remainder
- bpl Graph4
- lda #Left
- jsr Prt
- lda #3
- sta Remainder
- Graph4 lda #Left
- jsr Prt
- jsr DoRem
-
- Graph5 pla
- tay
- pla
- tax
- pla
- rts
-
- gabort ldy #>ErrMssg
- ldx #<ErrMssg
- jmp Abort
-
- ErrMssg fcb 13
- fcc "RUN STOP PRESSED"
- fcb 13,0
-
- END
-