Classic Computer Magazine Archive PROGRAM LISTING: 87-06/INFORMER.M65


0100 ; THE INFORMER - SOURCE CODE
0110 ; BY MATT LOVELESS & MIKE EGGERS
0120 ; (c)1987, ANTIC PUBLISHING, INC.
0130     .TITLE "INFORMER II -- Internal status line"
0140     *=  $0600
0150 ;
0160 SETVBV = $E45C  ;Sets VBL vector
0170 XITVBV = $E462  ;VBLANK exit rtn
0180 SDLST = $0230   ;Vector to D/L
0190 CONSOL = $D01F  ;Console buttons
0200 ROWCUR = $54    ;Cursor row
0210 COLCUR = $55    ;Cursor column
0220 SHFLOK = $02BE  ;CAPS/LWR status
0230 INVFLG = $02B6  ;Inv. video flag
0240 MEMLO = $90     ;BASIC low mem.
0250 HIMEM = $02E5   ;System high mem
0260 CASINI = $02    ;Cassette boot
0270 ;                init. vector
0280 BOOTF = $09     ;Boot flag
0290     .PAGE "Setup system vectors"
0300 ;==========================
0310 ;  Put INFORMER online.
0320 ;==========================
0321 STARTCODE
0330 SETUP
0340     LDA #SETUP&255 ;high byte of 0311 ;                   init. addr.
0350     STA CASINI
0360     LDA #SETUP/256 ;low byte of
0370 ;                   init. addr.
0380     STA CASINI+1
0390     LDA BOOTF   ;Cassette boot?
0400     ORA #$02
0410     STA BOOTF
0420     LDA #$04    ;Check [OPTION]
0430     BIT CONSOL
0440     BNE ON
0450 ;
0460     RTS         ;If [OPTION]then
0470 ;                don't set VBI's
0480 ;
0490 ON
0500     LDX #DOLINE/256 ;Hi VBL vctr
0510     LDY #DOLINE&255 ;Low byte
0520     LDA #7      ;Use def. vector
0530     JMP SETVBV  ;Set VBLANK vctr
0540 ;
0550 ;         (The RTS instruction
0560 ;          of SETVBV will return
0570 ;          control.)
0580 ;
0590     .PAGE "Build a new INFORMER line"
0600 ;
0610 DOLINE
0620     LDA SDLST+1 ;If Hi byte of
0630 ;                DLIST vector
0640     CMP #DSPLST/256
0650 ;                is the same as
0660 ;                hi byte of mine
0670     BEQ MAKELN  ;then DLIST is
0680 ;                still setup.
0690 ;
0700 ;Setup new DISPLAY-LIST header
0710     LDA SDLST   ;Set DLIST JuMP
0720     CLC         ;to jump to
0730 ;               ;current-DLIST+3
0740     ADC #3      ;to avoid
0750 ;                BLANK-8-LINES
0760     STA JMPADR  ;instructions.
0770     LDA SDLST+1
0780     ADC #0
0790     STA JMPADR+1
0800     LDA #DSPLST&255 ;Reset DLIST
0810     STA SDLST   ;    vector to
0820     LDA #DSPLST/256 ;point to
0830     STA SDLST+1 ;    my header.
0840 ;
0850 ; Create the informer line
0860 ;
0870 MAKELN
0880     LDA ROWCUR  ;Print cur. row
0890     LDY #RSPOT-MESSAGE
0900 ;     (position in status line.)
0910     JSR CONVRT
0920 ;
0930     LDA COLCUR  ;Print column
0940     LDY #CSPOT-MESSAGE
0950     JSR CONVRT
0960 ;
0970 ;Find the CAPS/LOWER
0980 ;and INVERSE modes.
0990     LDA SHFLOK  ;Get CAPS/LOWR
1000 ;                status, convert
1010     CLC         ;into an index
1020     ROL A       ;between 0 and 2
1030     ROL A
1040     ROL A
1050     TAX 
1060     LDA SHFTBL,X ;Get visual
1070 ;                 representation
1080     ORA INVFLG  ;Check INVERSE
1090     EOR #$80    ;Toggle inverse
1100 ;                if necessary.
1110     STA LSPOT
1120 ;   Put free RAM on screen
1130     SEC 
1140     LDA HIMEM   ;subtract MEMLO
1150 ;                from HIMEM
1160     SBC MEMLO
1170     TAY         ;save it in Y
1180     LDA HIMEM+1
1190     SBC MEMLO+1
1200     LDX #$00
1210 LOOP
1220     PHA         ;save for later
1230     LSR A       ;SHIFT HIGH
1240 ;                NIBBLE DOWN
1250     LSR A
1260     LSR A
1270     LSR A
1280     JSR CB2AH   ;Convert binary
1290 ;                to ATASCII hex
1300     STA FRESPOT,X ;& display it
1310     INX 
1320     PLA 
1330     AND #$0F    ;mask hi nibble
1340     JSR CB2AH
1350 ;
1360     STA FRESPOT,X
1370     INX 
1380     CPX #$04
1390     BEQ RETURN
1400 ;
1410     TYA 
1420 ;
1430     JMP LOOP
1440 RETURN
1450     JMP XITVBV  ;go home
1460 ;
1470     .PAGE "Convert binary to printable hex"
1480 ;===============================
1490 ;  CONVERT BINARY TO HEX
1500 ;    (Mike made me do it)
1510 ;===============================
1520 CB2AH
1530     CMP #$0A    ;Digit 0 thru 9?
1540     BCC NUMBER  ;YES!!!
1550 ;
1560     CLC 
1570     ADC #$97    ;Make it A-F
1580     RTS 
1590 ;
1600 NUMBER
1610     ORA #$90    ;Make it 0-9
1620     RTS 
1630     JMP RETURN  ;UNCONDITIONAL!
1640 ;
1650     .PAGE "Convert binary to printable"
1660 CONVRT
1670     LDX #4      ;Max 4x10 values
1680 LOOP2
1690     CMP MAXTBL,X ; <= to value?
1700     BCS FOUND   ;Yes
1710 ;
1720     DEX         ;No, next check
1730     BNE LOOP2
1740 ;
1750 FOUND
1760     SEC 
1770     SBC MAXTBL,X ;Pull off tens
1780     ORA #$90    ;Make digit
1790 ;                printable
1800     STA MESSAGE+1,Y
1810     LDA CHRTBL,X ;Print tens
1820 ;                 digit
1830     STA MESSAGE,Y
1840     RTS 
1850     .PAGE "Tables and message line"
1860 ;==========================
1870 ;  DATA AREAS AND TABLES
1880 ;==========================
1890 DSPLST
1900 ;    Prints INFORMER line
1910     .BYTE $70,$60,$10,$42
1920     .WORD MESSAGE
1930     .BYTE $01   ;Goto to old DL
1940 JMPADR
1950     .WORD 0
1960 ;
1970 SHFTBL
1980     .BYTE $61,$21,$40 ;"A","a",""
1990 MAXTBL
2000     .BYTE 0,10,20,30,40 ;Tens
2010 ;                        table
2020 CHRTBL
2030 ;    Printable tens:
2040     .BYTE $90,$91,$92,$93,$94
2050 ;
2060 MESSAGE
2070     .BYTE $80,$A9,$EE,$E6,$EF
2080     .BYTE $F2,$ED,$E5,$F2,$80,$D6
2090     .BYTE $AD,$EF,$E4,$E5,$9A,$80
2100 LSPOT
2110     .BYTE 0     ;Mode
2120     .BYTE $80,$D6,$B2,$80
2130 RSPOT
2140     .BYTE 0,0   ;Row
2150     .BYTE $80,$80,$A3,$80
2160 CSPOT
2170     .BYTE 0,0   ;Column
2180     .BYTE $C2,$80,$A6,$80,$84
2190 FRESPOT
2200     .BYTE 0,0,0,0
2210     .BYTE $80
2220     *=  $02E0
2230     .WORD STARTCODE

Back to previous page