Classic Computer Magazine Archive PROGRAM LISTING: 89-04a/MINIMON.M65


0100 ; MINIMON
0110 ; BY JOE KIMBROUGH
0120 ; (c)1988, ANTIC PUBLISHING INC.
0130 AFP =   $D800
0140 BUFF1 = $0500
0150 CH  =   $02FC
0160 COLCRS = $55
0170 CONSOL = $D01F
0180 EOL =   $9B
0190 FASC =  $D8E6
0200 FPI =   $D9D2
0210 IFP =   $D9AA
0220 INVFLG = $02B6
0230 KGB =   $F2FD
0240 OUTCHAR = $F2B0
0250 PR2 =   $34F3
0260 ROWCRS = $54
0270 ;
0280     *=  $3400
0290 STARTCODE
0300     LDA $FCD8   ;800 or XL/XE?
0310     CMP #$A2
0320     BNE MAIN.MENU ;If not 800                            then proceed
0330     LDA #$E2
0340     STA OS.MOD.1+1
0350     LDA #$A4
0360     STA OS.MOD.2+1
0370     LDA #$F6
0380     STA OS.MOD.1+2
0390     STA OS.MOD.2+2
0400 MAIN.MENU
0410     LDY #$00
0420 LOOP.1
0430     LDA MENU.TEXT,Y ;Print main                            menu
0440     JSR PRINT.CHAR
0450     INY 
0460     CPY #$56
0470     BNE LOOP.1
0480 ;
0490 PUTCUR
0500     LDA #$15    ;Place cursor
0510     STA COLCRS
0520     LDA #$0C
0530     STA ROWCRS
0540     LDA #$20
0550     JSR PRINT.CHAR
0560     JSR GET.CHAR ;Get menu choice
0570     CMP #'1
0580     BNE DPE1
0590 ;
0600     JMP DOSPOKE ;Go to DOSPOKE
0610 ;
0620 DPE1
0630     CMP #$32
0640     BNE DPE2
0650 ;
0660     JMP DOSPEEK ;Go to DOSPEEK
0670 ;
0680 DPE2
0690     CMP #'3
0700     BNE PUTCUR
0710 ;
0720     LDA #$0C    ;Store keycode                       for EOL in CH for
0730     STA CH      ;auto-[RETURN]                       after going back                      to DOS
0740     RTS 
0750 ;
0760 DOSPOKE
0770     LDY #$05    ;Clear ASCII                           input buffer
0780     LDA #$00
0790 LOOP.2
0800     STA BUFF1,Y
0810     DEY 
0820     BNE LOOP.2
0830 ;
0840     LDY #$00
0850 LOOP.3
0860     LDA DOSPOKE.TEXT,Y ;Print                           DOSPOKE screen
0870     JSR PRINT.CHAR
0880     INY 
0890     CPY #$3B
0900     BNE LOOP.3
0910 ;
0920     LDA #$14    ;Place cursor
0930     STA COLCRS
0940     LDA #$01
0950     STA ROWCRS
0960     LDA #$20
0970     JSR PRINT.CHAR
0980     LDA #$03    ;Limit input                           to 3 digits
0990     STA $CF
1000     JSR KEYBD.INP ;Get POKE value                        [ASC->INT]
1010     LDA $CC     ;Hi-byte > $FF ?
1020     BNE DOSPOKE ;If not 0, then                        start over.
1030     LDA $CB     ;Store low byte
1040     STA $CE
1050     LDA #$14    ;Place cursor
1060     STA COLCRS
1070     LDA #$03
1080     STA ROWCRS
1090     LDA #$20
1100     JSR PRINT.CHAR
1110     LDA #$05    ;Limit input to                        5 digits
1120     STA $CF
1130     JSR KEYBD.INP ;Get address                           [ASC->INT]
1140     LDY #$00
1150     LDA $CE     ;Get stored INT
1160     STA ($CB),Y ;Put in addr.
1170     JMP DOSPOKE ;Go back
1180 ;
1190 DOSPEEK
1200     LDY #$05    ;Clear ASCII                           input buffer
1210     LDA #$00
1220 LOOP.4
1230     STA BUFF1,Y
1240     DEY 
1250     BNE LOOP.4
1260 ;
1270     LDY #$00
1280 LOOP.5
1290     LDA DOSPEEK.TEXT,Y ;Print                           DOSPEEK screen
1300     JSR PRINT.CHAR
1310     INY 
1320     CPY #$64
1330     BNE LOOP.5
1340 ;
1350     LDA #$10    ;Place cursor
1360     STA COLCRS
1370     LDA #$02
1380     STA ROWCRS
1390     LDA #$20
1400     JSR PRINT.CHAR
1410     LDA #$05    ;Limit input to                        5 digits
1420     STA $CF
1430     JSR KEYBD.INP ;Get address                           [ASC->INT]
1440     LDA #$10    ;Place cursor
1450     STA COLCRS
1460     LDA #$04
1470     STA ROWCRS
1480     LDA #$20
1490     JSR PRINT.CHAR
1500     LDY #$00
1510     LDA ($CB),Y ;Get contents                          of address
1520     STA $D4     ;Store lo-byte                         in FR0
1530     LDA #$00
1540     STA $D5     ;Put $00 in                            high byte FR0
1550     JSR IFP     ;Convert INT->FP
1560     JSR FASC    ;Convert FP->ASC
1570     LDA $0580   ;Print ASCII
1580     CMP #$30
1590     BNE PR1
1600 ;
1610     INC PR2
1620 PR1
1630     LDY #$00
1640 CPJ3
1650     LDA $0580,Y
1660     CMP #$80
1670     BCC CPJ1
1680 ;
1690     EOR #$80
1700 CPJ1
1710     CMP #$2E
1720     BEQ CPJ2
1730 ;
1740     JSR PRINT.CHAR
1750     INY 
1760     CPY #$07
1770     BNE CPJ3
1780 ;
1790 CPJ2
1800     LDA #$80
1810     STA PR2
1820     LDY #$06    ;Clear ASCII                           output buffer
1830     LDA #$20
1840 LOOP.6
1850     STA $0580,Y
1860     DEY 
1870     BNE LOOP.6
1880 ;
1890     LDA #$9B
1900     JSR PRINT.CHAR
1910 CHECK.CONSOLE
1920     LDA CONSOL  ;Check console                         keys
1930     CMP #$03    ;Is it OPTION?
1940     BNE CHECK.START
1950 ;
1960     JMP MAIN.MENU
1970 ;
1980 CHECK.START
1990     CMP #$06    ;Is it START?
2000     BNE CHECK.CONSOLE
2010 ;
2020     JMP DOSPEEK ;Re-run DOSPEEK
2030 ;
2040 ; -----------------------------
2050 ; Keyboard Input/ASCII->Integer
2060 ; -----------------------------
2070 KEYBD.INP
2080     LDY #$00
2090 GET.KEY
2100     JSR GET.CHAR ;Get a key
2110     CMP #$1B    ;Is it ESC?
2120     BNE CPJ4    ;If not, go on
2130 ;
2140     PLA         ;Clear stack of
2150     PLA         ;return addr.
2160     JMP MAIN.MENU
2170 CPJ4
2180     CMP #$9B
2190     BEQ END.OF.LINE
2200 ;
2210     CMP #$7E    ;Backspace
2220     BNE CHK9
2230 ;
2240     TAX 
2250     DEY 
2260     LDA #$00
2270     STA BUFF1,Y
2280     TXA 
2290     CPY #$FF    ; Limit cursor                          travel
2300     BEQ KEYBD.INP
2310 ;
2320     JSR PRINT.CHAR
2330     JMP GET.KEY
2340 ;
2350 CHK9
2360     CMP #$3A    ; Is it >9?
2370     BCS GET.KEY ; If so, go back
2380 ;
2390     CMP #$30    ; Is it <0?
2400     BCC GET.KEY ; If so, go back
2410 ;
2420     CPY $CF     ;Check inp limit
2430     BNE DO.BUFFR
2440 ;
2450     LDA #$9B
2460     JMP END.OF.LINE
2470 ;
2480 DO.BUFFR
2490     JSR PRINT.CHAR
2500     STA BUFF1,Y ; Store digit in                        ASCII buffer
2510     INY 
2520     JMP GET.KEY
2530 ;
2540 END.OF.LINE
2550     JSR PRINT.CHAR
2560     LDA #$00    ;Set up FR0
2570     STA $F2
2580     STA $F3
2590     LDA #$05
2600     STA $F4
2610     JSR AFP     ; ASC -> FP
2620     JSR FPI     ; FP -> INT
2630     LDA $D4     ; Get lo-byte
2640     STA $CB
2650     LDA $D5     ; Get hi-byte
2660     STA $CC
2670     RTS 
2680 ;
2690 ;---------------
2700 ; I/O ROUTINES
2710 ;---------------
2720 GET.CHAR
2730     STY $CD     ;Save Y
2740 OS.MOD.1
2750     JSR KGB     ;Get char
2760     CMP #$A0    ;Inverse video?
2770     BCC NO.INV.VIDEO
2780 ;
2790     EOR #$80    ;Fix inv. video
2800 NO.INV.VIDEO
2810     LDX #$00    ;Disable inverse                       video key
2820     STX INVFLG
2830     LDY $CD     ;Restore Y
2840     RTS 
2850 ;
2860 PRINT.CHAR
2870     STY $CD     ;Save Y
2880 OS.MOD.2
2890     JSR OUTCHAR ;Print char
2900     LDY $CD     ;Restore Y
2910     RTS 
2920 ;
2930 ; ------ TEXT --------
2940 ;
2950 MENU.TEXT
2960     .BYTE "}",EOL
2970     .BYTE "          ��Ӡ"
2980     .BYTE "���˯����",EOL,EOL
2990     .BYTE EOL,EOL,EOL
3000     .BYTE "� DOSPOKE",EOL,EOL
3010     .BYTE "� DOSPEEK",EOL,EOL
3020     .BYTE "� EXIT TO DOS",EOL,EOL
3030     .BYTE "Your choice:  ",EOL
3040 DOSPOKE.TEXT
3050     .BYTE "}",EOL
3060     .BYTE "Poke the integer:",EOL,EOL
3070     .BYTE "Into the address:",EOL,EOL,EOL
3080     .BYTE "Press ��� to exit",EOL
3090 DOSPEEK.TEXT
3100     .BYTE "}[Press ��� to abort input]",EOL,EOL
3110     .BYTE "Peek address:",EOL,EOL
3120     .BYTE "Holds number:",EOL,EOL,EOL
3130     .BYTE "������ Main menu",EOL,EOL
3140     .BYTE "����  Re-run DOSPEEK",EOL
3150     *=  $02E0
3160     .WORD STARTCODE
3170     .END 


Back to previous page