File: fontdump.asm

package info (click to toggle)
1oom 1.11.7-1
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 4,032 kB
  • sloc: ansic: 71,715; makefile: 568; sh: 131; asm: 30
file content (37 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
; dumps VGA 8x8 font to "r.bin"
; written in nasm syntax
; nasm -o fontdump.com fontdump.asm
    org 100h    ; code starts at offset 100h
    use16       ; use 16-bit code
    ; get pointer to ROM font
    mov ax,1130h
    mov bh,03h          ; 8x8 font
    int 10h             ; es:bp -> ROM font
    ; save ROM font to file
    push es
    mov dx,filename     ; ds:dx -> filename
    xor cx,cx           ; normal attributes
    mov ah,3ch          ; create file
    int 21h
    jc fail             ; cf = 1 = error
    mov bx,ax           ; bx = output file handle
    mov cx,2048         ; cx = output size
    mov dx,bp
    pop ds              ; ds:dx -> data
    mov ah,40h          ; write to file
    int 21h
    jc fail             ; cf = 1 = error
    cmp ax,cx           ; ax = cx -> write ok
    jne fail
    mov ah,3eh          ; close file, bx = outputfile handle
    int 21h
    mov al,0
    jnc exit            ; cf = 1 = error
fail:
    mov al,1
exit:
    mov ah,4ch
    int 21h

; data
filename db 'r.bin',0