Changeset 43 for trunk/BOOTCODE/REGULAR/AUXIO.ASM
- Timestamp:
- Apr 11, 2014, 11:48:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/REGULAR/AUXIO.ASM
r31 r43 34 34 35 35 ; Initialize the com-port, but only when logging is enabled. 36 ; It get's it's parameters from offset 1B0hin the MBR.36 ; It get's it's parameters from the value in the MBR. 37 37 ; Out: AX - line status 38 AuxIO_Init 39 ; bits 7-5 = datarate (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps)40 ; bits 4-3 = parity (00 or 10 = none, 01 = odd, 11 = even)41 ; bit 2 = stop-bits (set = 2 stop-bits, clear = 1 stop-bit)42 ; bits 1-0 = data-bits (00 = 5, 01 = 6, 10 = 7, 11 = 8)43 ; mov [BIOS_AuxParms],ax ; save initialization and port44 movdx,[BIOS_AuxParms] ; DL=port, 0=disabled, 1=com1; DH=config-parms45 testdl,dl ; see if logging is enabled, if not, skip initialization46 jzAuxIO_Init_NoLogging47 48 decdl ; adjust port-number49 anddl,03h ; 3 is max value50 51 ; Initialization message52 movsi,offset AuxInitMsg53 callMBR_Teletype54 55 ; Port number56 callVideoIO_SyncPos57 moval,dl58 incal59 callVideoIO_PrintByteDynamicNumber60 xorsi,si61 callMBR_TeletypeNL62 63 ; Do the initialization64 moval,dh ; initialization parameters to al65 movdh,0 ; DX now contains port-number66 movah,067 int14h ; intialize com-port68 AuxIO_Init_NoLogging:69 ret70 AuxIO_Init 38 AuxIO_Init Proc Near Uses dx si 39 ; bits 7-5 = datarate (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps) 40 ; bits 4-3 = parity (00 or 10 = none, 01 = odd, 11 = even) 41 ; bit 2 = stop-bits (set = 2 stop-bits, clear = 1 stop-bit) 42 ; bits 1-0 = data-bits (00 = 5, 01 = 6, 10 = 7, 11 = 8) 43 ; mov [BIOS_AuxParms],ax ; save initialization and port 44 mov dx,[BIOS_AuxParms] ; DL=port, 0=disabled, 1=com1; DH=config-parms 45 test dl,dl ; see if logging is enabled, if not, skip initialization 46 jz AuxIO_Init_NoLogging 47 48 dec dl ; adjust port-number 49 and dl,03h ; 3 is max value 50 51 ; Initialization message 52 mov si,offset AuxInitMsg 53 call MBR_Teletype 54 55 ; Port number 56 call VideoIO_SyncPos 57 mov al,dl 58 inc al 59 call VideoIO_PrintByteDynamicNumber 60 xor si,si 61 call MBR_TeletypeNL 62 63 ; Do the initialization 64 mov al,dh ; initialization parameters to al 65 mov dh,0 ; DX now contains port-number 66 mov ah,0 67 int 14h ; intialize com-port 68 AuxIO_Init_NoLogging: 69 ret 70 AuxIO_Init EndP 71 71 72 72 … … 75 75 ; Destroyed: None 76 76 AuxIO_PrintSingleChar Proc Near Uses ax es di 77 nop77 nop 78 78 AuxIO_PrintSingleChar EndP 79 79 80 80 81 81 ; Print char to com-port (teletype style) 82 AuxIO_Teletype 83 movdx,[BIOS_AuxParms] ; get port and parameters84 xordh,dh ; we don't need the parameters85 testdl,dl ; test if logging is enabled86 jzAuxIO_Teletype_NoLogging ; nope, return immediately87 decdl ; adjust port-number88 anddl,03h ; 3 is max value89 movah,01h90 int14h ; send char to com-port91 AuxIO_Teletype_NoLogging:92 ret93 AuxIO_TeleType 82 AuxIO_Teletype Proc Near Uses ax dx 83 mov dx,[BIOS_AuxParms] ; get port and parameters 84 xor dh,dh ; we don't need the parameters 85 test dl,dl ; test if logging is enabled 86 jz AuxIO_Teletype_NoLogging ; nope, return immediately 87 dec dl ; adjust port-number 88 and dl,03h ; 3 is max value 89 mov ah,01h 90 int 14h ; send char to com-port 91 AuxIO_Teletype_NoLogging: 92 ret 93 AuxIO_TeleType EndP 94 94 95 95 96 96 ; Print newline char (unix) to com-port (teletype style) 97 AuxIO_TeletypeNL 98 moval,1099 callAuxIO_Teletype100 ret101 AuxIO_TeleTypeNL 97 AuxIO_TeletypeNL Proc Near Uses ax 98 mov al,10 99 call AuxIO_Teletype 100 ret 101 AuxIO_TeleTypeNL EndP 102 102 103 103 … … 108 108 ; Destroyed: None 109 109 AuxIO_TeletypeHexByte Proc Near Uses ax 110 callCONV_BinToAsc ; Returns high hex-nibble in AH, low hex-nibble in AL111 xchgal,ah ; High hex-nibble first112 callAuxIO_Teletype ; Output to com-port113 xchgal,ah ; Low hex-nibble next114 callAuxIO_Teletype ; Output to com-port115 ret110 call CONV_BinToAsc ; Returns high hex-nibble in AH, low hex-nibble in AL 111 xchg al,ah ; High hex-nibble first 112 call AuxIO_Teletype ; Output to com-port 113 xchg al,ah ; Low hex-nibble next 114 call AuxIO_Teletype ; Output to com-port 115 ret 116 116 AuxIO_TeleTypeHexByte EndP 117 117 … … 122 122 ; Destroyed: None 123 123 AuxIO_TeletypeHexWord Proc Near 124 xchgal,ah ; High byte first125 callAuxIO_TeletypeHexByte ; Output to com-port126 xchgal,ah ; low byte next127 callAuxIO_TeletypeHexByte ; Output to com-port128 ret124 xchg al,ah ; High byte first 125 call AuxIO_TeletypeHexByte ; Output to com-port 126 xchg al,ah ; low byte next 127 call AuxIO_TeletypeHexByte ; Output to com-port 128 ret 129 129 AuxIO_TeleTypeHexWord EndP 130 130 … … 136 136 ; Destroyed: None 137 137 AuxIO_TeletypeHexDWord Proc Near 138 xchgax,dx139 callAuxIO_TeletypeHexWord ; High word first140 xchgax,dx141 callAuxIO_TeletypeHexWord ; Low word next142 ret138 xchg ax,dx 139 call AuxIO_TeletypeHexWord ; High word first 140 xchg ax,dx 141 call AuxIO_TeletypeHexWord ; Low word next 142 ret 143 143 AuxIO_TeleTypeHexDWord EndP 144 144 … … 150 150 ; Destroyed: None 151 151 AuxIO_TeletypeHexQWord Proc Near 152 xchgdx,bx153 xchgax,cx154 callAuxIO_TeletypeHexDWord ; High dword first155 xchgdx,bx156 xchgax,cx157 callAuxIO_TeletypeHexDWord ; Low dword next158 ret152 xchg dx,bx 153 xchg ax,cx 154 call AuxIO_TeletypeHexDWord ; High dword first 155 xchg dx,bx 156 xchg ax,cx 157 call AuxIO_TeletypeHexDWord ; Low dword next 158 ret 159 159 AuxIO_TeleTypeHexQWord EndP 160 160 161 161 162 162 163 164 165 166 163 ; Print 0-terminated string to com-port 167 AuxIO_Print Proc Near Uses ax bx cx dx168 AuxIO_PrintNext:169 lodsb170 testal,al171 jzAuxIO_PrintEOS172 callAuxIO_Teletype173 jmpAuxIO_PrintNext174 AuxIO_PrintEOS:175 ret176 AuxIO_Print EndP164 AuxIO_Print Proc Near Uses ax bx cx dx 165 AuxIO_PrintNext: 166 lodsb 167 test al,al 168 jz AuxIO_PrintEOS 169 call AuxIO_Teletype 170 jmp AuxIO_PrintNext 171 AuxIO_PrintEOS: 172 ret 173 AuxIO_Print EndP 177 174 178 175 … … 182 179 AuxIO_DumpParagraph Proc Near Uses ax cx dx si 183 180 184 ; Dump the index dword185 xordx,dx186 movax,si187 callAuxIO_TeletypeHexDWord188 189 ; Separate it from the dump190 moval,' '191 callAuxIO_Teletype192 moval,' '193 callAuxIO_Teletype194 moval,'|'195 callAuxIO_Teletype196 moval,' '197 callAuxIO_Teletype198 199 ; Save si for later200 pushsi201 202 ; Four groups of 4 bytes203 movcx,4204 205 206 AuxIO_DumpParagraph_Next_1:207 208 ; byte at offset 0209 lodsb210 callAuxIO_TeletypeHexByte211 212 ; space separator213 moval,' '214 callAuxIO_Teletype215 216 ; byte at offset 1217 lodsb218 callAuxIO_TeletypeHexByte219 220 ; space separator221 moval,' '222 callAuxIO_Teletype223 224 ; byte at offset 2225 lodsb226 callAuxIO_TeletypeHexByte227 228 ; space separator229 mov al,' '230 callAuxIO_Teletype231 232 ; byte at offset 3233 lodsb234 callAuxIO_TeletypeHexByte235 236 ; space separator237 mov al,' '238 callAuxIO_Teletype239 240 ; separator241 mov al,'|'242 callAuxIO_Teletype243 244 ; space separator245 mov al,' '246 callAuxIO_Teletype247 248 loopAuxIO_DumpParagraph_Next_1249 250 ; space separator251 mov al,' '252 callAuxIO_Teletype253 254 ; recall pointer255 popsi256 257 ; 16 ascii bytes to print258 movcx,16259 260 AuxIO_DumpParagraph_Next_2:261 movah,'.' ; char to use ufnot printable262 lodsb ; load byte263 callCONV_ConvertToPrintable ; use dot's if not printable264 callAuxIO_Teletype ; print it265 loopAuxIO_DumpParagraph_Next_2266 ret267 AuxIO_DumpParagraph EndP268 269 270 271 AuxIO_DumpSector Proc Near Uses cx si272 movcx,32 ; Number of paragraphs in a sector273 AuxIO_DumpSector_Next:274 callAuxIO_DumpParagraph ; Dump te paragraph275 addsi,16 ; Advance pointer276 callAuxIO_TeletypeNL277 loopAuxIO_DumpSector_Next278 ret279 AuxIO_DumpSector EndP280 281 282 AuxIOHello :db 'AiR-BOOT com-port debugging',10,0283 284 285 181 ; Dump the index dword 182 xor dx,dx 183 mov ax,si 184 call AuxIO_TeletypeHexDWord 185 186 ; Separate it from the dump 187 mov al,' ' 188 call AuxIO_Teletype 189 mov al,' ' 190 call AuxIO_Teletype 191 mov al,'|' 192 call AuxIO_Teletype 193 mov al,' ' 194 call AuxIO_Teletype 195 196 ; Save si for later 197 push si 198 199 ; Four groups of 4 bytes 200 mov cx,4 201 202 203 AuxIO_DumpParagraph_Next_1: 204 205 ; byte at offset 0 206 lodsb 207 call AuxIO_TeletypeHexByte 208 209 ; space separator 210 mov al,' ' 211 call AuxIO_Teletype 212 213 ; byte at offset 1 214 lodsb 215 call AuxIO_TeletypeHexByte 216 217 ; space separator 218 mov al,' ' 219 call AuxIO_Teletype 220 221 ; byte at offset 2 222 lodsb 223 call AuxIO_TeletypeHexByte 224 225 ; space separator 226 mov al,' ' 227 call AuxIO_Teletype 228 229 ; byte at offset 3 230 lodsb 231 call AuxIO_TeletypeHexByte 232 233 ; space separator 234 mov al,' ' 235 call AuxIO_Teletype 236 237 ; separator 238 mov al,'|' 239 call AuxIO_Teletype 240 241 ; space separator 242 mov al,' ' 243 call AuxIO_Teletype 244 245 loop AuxIO_DumpParagraph_Next_1 246 247 ; space separator 248 mov al,' ' 249 call AuxIO_Teletype 250 251 ; recall pointer 252 pop si 253 254 ; 16 ascii bytes to print 255 mov cx,16 256 257 AuxIO_DumpParagraph_Next_2: 258 mov ah,'.' ; char to use ufnot printable 259 lodsb ; load byte 260 call CONV_ConvertToPrintable ; use dot's if not printable 261 call AuxIO_Teletype ; print it 262 loop AuxIO_DumpParagraph_Next_2 263 ret 264 AuxIO_DumpParagraph EndP 265 266 267 268 AuxIO_DumpSector Proc Near Uses cx si 269 mov cx,32 ; Number of paragraphs in a sector 270 AuxIO_DumpSector_Next: 271 call AuxIO_DumpParagraph ; Dump te paragraph 272 add si,16 ; Advance pointer 273 call AuxIO_TeletypeNL 274 loop AuxIO_DumpSector_Next 275 ret 276 AuxIO_DumpSector EndP 277 278 279 AuxIOHello db 'AiR-BOOT com-port debugging',10,0 280 281 282
Note:
See TracChangeset
for help on using the changeset viewer.