瀏覽代碼

Fix trampling of last digit in dumpax_os

special_first_anniversary_edition
Patrick Jakobsen 5 年之前
父節點
當前提交
70545a53a3
共有 1 個檔案被更改,包括 5 行新增5 行删除
  1. +5
    -5
      lib/os_lib.nasm

+ 5
- 5
lib/os_lib.nasm 查看文件

@ -35,20 +35,20 @@ printALChar:
dumpax_os:
pusha ; save registers
mov bx, ax
mov dx, ax
mov ah, 0xE ; Teletype output
mov cx, 4 ; 4 nipples in a 16 bit word
.loop:
rol bx, 4 ; rotate to next nipple
mov al, bl ; we copy to al because we need to mask only the low 4 bits
rol dx, 4 ; rotate to next nipple
mov al, dl ; we copy to al because we need to mask only the low 4 bits
and al, 1111b ; Do the masking
add al, '0' ; convert to ASCII
cmp al, '9' ; If we are greater than 9 ascii, we add 7 to make digit 10 be represented as 'A'
jbe .skip ; -|-
add al, 7 ; -|-
.skip: ; -|-
mov bl, 0x02 ;color
mov bl, 0xe2 ;color
int 0x10 ; BIOS call 'output'
loop .loop
@ -63,4 +63,4 @@ os_change_screen:
; and base pointer has to be set.
mov ah, 0x05
int 0x10
ret
ret

Loading…
取消
儲存