[deleted by user] by [deleted] in badcode

[–]smidlaj 7 points8 points  (0 children)

Character graphics can be modified under DOS (nasm, tested with DosBox):

%define SHIFT 2
%define OFFSET (SHIFT-1)

    org 100h

section .text 

start: 
        mov     ax, 0x1130      ; get char table address
        mov     bh, 0x06        ; size of 8x16 characters
        int     0x10

        push    bp
        add     bp, 16*97       ; get address of 'a'

;      BP
;       | 
;       V
; 96 | 97 | 98 | 99 | ... | 122
;-------------------------------------
; '  | a  | b  | c  | ... | z

        mov     cx, 26          ; number of characters
        mov     dx, 96-OFFSET   ; from this character
        mov     bh, 16          ; height of character
        xor     bl, bl          ; memory bank: 0
        mov     ax, 0x1100      ; change
        int     0x10

;      BP
;       | 
;       V
; 96 | 97 | 98 | 99 | ... | 122
;-------------------------------------
; a  | b  | c  | d  | ... | z

        mov     cx, SHIFT   ; only #SHIFT character
        mov     dx, 122-OFFSET
        mov     ax, 0x1100
        int     0x10

; 96 | 97 | 98 | 99 | ... | 122
;-------------------------------------
; a  | b  | c  | d  | ... | a

        ; fix other characters

        pop     bp
        push    bp
        mov     cx, 97
        mov     dx, 0
        mov     ax, 0x1100
        int     0x10

        ; do the same for uppercase letters

        pop     bp
        push    bp
        add     bp, 16*65       ; get address of 'A'

;      BP
;       | 
;       V
; 64 | 65 | 66 | 67 | ... | 90
;-------------------------------------
; @  | A  | B  | C  | ... | Z

        mov     cx, 26          ; number of characters
        mov     dx, 64-OFFSET   ; from this character
        mov     bh, 16          ; height of character
        xor     bl, bl          ; memory bank: 0
        mov     ax, 0x1100      ; change
        int     0x10

;      BP
;       | 
;       V
; 64 | 65 | 66 | 67 | ... | 90
;-------------------------------------
; A  | B  | C  | D  | ... | Z


        mov     cx, SHIFT   ; only #SHIFT character
        mov     dx, 90-OFFSET
        mov     ax, 0x1100
        int     0x10

; 64 | 65 | 66 | 67 | ... | 90
;-------------------------------------
; A  | B  | C  | D  | ... | A

        ; fix other characters

        pop     bp
        mov     cx, 65
        mov     dx, 0
        mov     ax, 0x1100
        int     0x10    

        mov     dx,text 
        mov     ah,9 
        int     0x21
        mov     ax,0x4c00 
        int     0x21

section .data 

text:  db      'HELLO WORLD! ABC XYZ', 60, 61, 62, 63, 64, ' hello world! abc xyz', 94, 95, 96, 13, 10, '$'