misc2.s
1 ; CCGMS Terminal 2 ; 3 ; Copyright (c) 2016,2020, Craig Smith, alwyz. All rights reserved. 4 ; This project is licensed under the BSD 3-Clause License. 5 ; 6 ; Miscellaneous 2 7 ; 8 9 ;---------------------------------------------------------------------- 10 SET_PETSCII 11 txt_newpunter: 12 .byte CR,CR,WHITE,"NEW Punter",0 13 txt_up: 14 .byte "Up",0 15 txt_down: 16 .byte "Down",0 17 txt_load: 18 .byte "load.",CR,0 19 txt_enter_filename: 20 .byte "Enter Filename: ",0 21 txt_yellow: 22 .byte CR,YELLOW," ",0 23 txt_loading: 24 .byte "loading: ",CYAN,0 25 txt_press_c_to_abort: 26 .byte CR,WHITE," (Press C= to abort.)",CR,CR,0 27 txt_aborted: 28 .byte "Aborted.",CR,0 29 txt_good_bad_blocks: 30 .byte LTGREEN," ","Good Blocks: ",WHITE,"000",WHITE," - " 31 .byte LTGREEN,"Bad Blocks: ",WHITE,"000",CR,0 32 txt_graphics: 33 .byte LTGREEN,"Graphics",0 34 txt_graphics2: 35 .byte RVSON,BLUE,"C",LTBLUE,"/",CYAN,"G",RVSOFF,YELLOW,0 36 txt_ascii: 37 .byte CYAN,"Anscii",0 38 txt_terminal_ready: 39 .byte " Terminal Ready.",LTGRAY,CR,CR,0 40 txt_term_activated: 41 .byte " Term Activated.",LTGRAY,CR,CR,0 42 txt_disconnecting: 43 .byte CR,CR,WHITE,"Disconnecting...",LTGRAY,CR,CR,0 44 SET_ASCII 45 46 ;---------------------------------------------------------------------- 47 drtype: .byte "DSPUR" 48 drtyp2: .byte "EERSE" 49 drtyp3: .byte "LQGSL" 50 51 ;---------------------------------------------------------------------- 52 directory_format: 53 .byte YELLOW 54 .byte $02 ; ctrl-b: blocks 55 .byte 157 56 .byte 157 57 .byte WHITE 58 .byte $06 ; ctrl-f: file type 59 .byte " " 60 .byte CYAN 61 .byte $0e ; ctrl-n: file name 62 .byte LTGREEN 63 .byte " " 64 .byte 63 65 .byte " " 66 .byte 0 67 directory_format_end: 68 69 ;---------------------------------------------------------------------- 70 aciaemu_filename: 71 .byte $08 ; 2400 baud 72 .byte $00 73 74 .byte $51,$0d ; [XXX unused] 75 76 aciaemu_filename_len: 77 .byte 2 ; [XXX only read; should be constant] 78 79 filename_i0: 80 .byte "I0" 81 82 ; device number of the (first) disk drive 83 device_disk: 84 .byte 8 85 86 ; is a drive present in the system 87 drive_present: 88 .byte 1 89 90 config_file_loaded: 91 .byte 0 92 93 prev_char: 94 .byte 0 95 96 newbuf .byte <endprg,>endprg 97 98 ; System Timing 99 ; 0: NTSC 100 ; 1: PAL 101 is_pal_system: 102 .byte 0 103 104 ; SuperCPU detected 105 ; 0: no SuperCPU 106 ; 1: SuperCPU detected 107 ; 2: SuperCPU detected, message already printed (don't print again) 108 supercpu: 109 .byte 0 110 111 SET_PETSCII 112 txt_supercpu_enabled: 113 .byte "SuperCPU Enabled!",CR,CR,0 114 SET_ASCII 115 116 nicktemp: 117 .byte 0 ; [XXX unused] 118 119 drivetemp: 120 .byte 0 121 122 ;---------------------------------------------------------------------- 123 ; pre-calculate CRC16 tables for XMODEM-CRC 124 crctable: 125 ldx #0 126 txa 127 : sta crclo,x 128 sta crchi,x 129 inx 130 bne :- 131 ldx #0 132 @1: txa 133 eor crchi,x 134 sta crchi,x 135 ldy #8 136 @2: asl crclo,x 137 rol crchi,x 138 bcc @3 139 lda crchi,x 140 eor #$10 141 sta crchi,x 142 lda crclo,x 143 eor #$21 144 sta crclo,x 145 @3: dey 146 bne @2 147 inx 148 bne @1 149 rts 150 151 ;---------------------------------------------------------------------- 152 ; SuperCPU 153 supercpu_on: 154 lda supercpu 155 beq scpuout 156 lda #1 157 sta $d07b 158 scpuout rts 159 160 supercpu_off: 161 lda supercpu 162 beq scpuout 163 lda #1 164 sta $d07a 165 rts 166 167 ;---------------------------------------------------------------------- 168 ; Clear RS232 buffer 169 clear232: 170 pha 171 lda #0 172 sta rtail 173 sta rhead 174 sta rfree 175 pla 176 rts 177 178 ;---------------------------------------------------------------------- 179 ; [XXX this should be closer to the PUNTER code] 180 puntdelay: 181 ; you got a better way to do this? have at it! 182 pha 183 txa 184 pha 185 tya 186 pha 187 ldx #0 188 ldy #0 189 : inx 190 bne :- 191 iny 192 bne :- 193 pla 194 tay 195 pla 196 tax 197 pla 198 rts