Changeset 92


Ignore:
Timestamp:
Apr 8, 2017, 12:26:28 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Added function to print decimal value to com-port [v1.1.1-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/regular/auxio.asm

    r57 r92  
    154154; Print char to com-port (teletype style)
    155155AuxIO_Teletype  Proc     Near  Uses  ax dx
    156 
    157 
    158     ;~ pusha
    159     ;~ xor     dx,dx
    160     ;~ mov     ah,03h
    161     ;~ mov     al,00h
    162     ;~ int     14h
    163     ;~ mov     ah,al
    164     ;~ shr     al,4
    165     ;~ and     al,0fh
    166     ;~ add     al,'0'
    167     ;~ cmp     al,'9'
    168     ;~ jbe     @F
    169     ;~ add     al,7
    170 ;~ @@: push    ax
    171     ;~ xor     dx,dx
    172     ;~ mov     ah,01h
    173     ;~ int     14h
    174     ;~ pop     ax
    175     ;~ mov     al,ah
    176     ;~ and     al,0fh
    177     ;~ add     al,'0'
    178     ;~ cmp     al,'9'
    179     ;~ jbe     @F
    180     ;~ add     al,7
    181 ;~ @@: xor     dx,dx
    182     ;~ mov     ah,01h
    183     ;~ int     14h
    184     ;~ popa
    185 
    186         ;~ pusha
    187 ;~ @@:
    188         ;~ xor     dx,dx
    189         ;~ mov     ah,03h
    190         ;~ mov     al,00h
    191         ;~ int     14h
    192         ;~ and     al,20h
    193         ;~ cmp     al,20h
    194         ;~ jnz     @B
    195         ;~ popa
    196 
    197 
    198156        mov     dx,[BIOS_AuxParms]            ; get port and parameters
    199157        xor     dh,dh                         ; we don't need the parameters
     
    217175
    218176
     177; Print byte as decimal to com-port (teletype style)
     178AuxIO_TeletypeDecByte   Proc     Near  Uses  ax dx
     179        call    CONV_BinToPBCD  ; Convert to PBCD
     180        mov     dx, ax          ; Save PBCD value
     181        shr     ah, 4           ; Move digit count to low nibble
     182        cmp     ah, 3           ; Less than 3 digits ?
     183        jb      @F              ; Yep, skip digit with index 2
     184        mov     al, dh          ; Get byte with digit
     185        and     al, 0fh         ; Mask it out
     186        add     al, '0'         ; To ASCII
     187        call    AuxIO_Teletype
     188    @@:
     189        shr     dh, 4           ; Move digit count to low nibble
     190        cmp     dh, 2           ; Less that 2 digits ?
     191        jb      @F              ; Yep, skip digit with index 1
     192        mov     al, dl          ; Get byte with digit
     193        shr     al, 4           ; Move to lower nibble
     194        add     al, '0'         ; To ASCII
     195        call    AuxIO_Teletype
     196    @@:
     197        mov     al, dl          ; Get byte with digit
     198        and     al, 0fh         ; Mask it out
     199        add     al, '0'         ; To ASCII
     200        call    AuxIO_Teletype
     201        ret
     202AuxIO_TeletypeDecByte   EndP
     203
     204
    219205; Print Bin-byte to com-port (teletype style)
    220206; This outputs 8 characters ('0' or '1' for each bit)
Note: See TracChangeset for help on using the changeset viewer.