<commit_before>bits 16			; 16-bit real mode

org 0		    ; this code is as PIC as possible

; entry point

; video segment
%ifdef TARGET_PC98
 %define VIDSEG 0xA000
%else
 %define VIDSEG 0xB800
%endif

; stack storage
%define S_BASE  (-28)

; use CALL to store IP (instruction pointer)
start:                              ; -> S_BASE =   0
    call        start2              ; -> S_BASE =  -2    NTS: Stored value is orig IP + 3
start2:
    push        ax                  ; -> S_BASE =  -4
    push        bx                  ; -> S_BASE =  -6
    push        cx                  ; -> S_BASE =  -8
    push        dx                  ; -> S_BASE = -10
    push        si                  ; -> S_BASE = -12
    push        di                  ; -> S_BASE = -14
    push        bp                  ; -> S_BASE = -16
    pushf                           ; -> S_BASE = -18
    push        cs                  ; -> S_BASE = -20
    push        ds                  ; -> S_BASE = -22
    push        es                  ; -> S_BASE = -24
    push        ss                  ; -> S_BASE = -26
    push        ax                  ; -> S_BASE = -28   will become SP

    cli                             ; turn off interrupts

    mov         bp,sp               ; -> make stack ptr accessible
    lea         ax,[bp-S_BASE]
    mov         [bp],ax             ; -> S_BASE = -28

    sub         word [bp-2-S_BASE],3; -> S_BASE =  -2   Adjust IP

    cld                             ; prepare video RAM writing
    mov         ax,VIDSEG
    mov         es,ax
    xor         di,di               ; ES:DI where to write (upper left corner)

    push        cs
    pop         ds

    mov         bx,[bp-2-S_BASE]    ; get IP (the base of our data)
    lea         si,[bx+hexes]       ; SI = hex strings
    add         bx,string2x

    mov         cx,(-S_BASE) / 2

; -----------------------------------
; So:
;   SS:BP = SP + S_BASE = start of struct
;   ES:DI = video RAM
;   DS:BX = 2-char strings
;   DS:SI = &hexes[0]
;   CX    = count
; -----------------------------------
ploop:
    mov         ax,[bx]
    add         bx,2
    call        putc
    mov         al,ah
    call        putc
    mov         al,' '
    call        putc
    loop        ploop

; STOP
    jmp         short $

; putc
; in:
; AL = char
; ES:DI = VRAM
; out:
; AL = destroyed
; DI += 2
putc:
%ifdef TARGET_PC98
    push        ax
    xor         ah,ah           ; keep upper byte zero, single wide
    stosw
    pop         ax
    mov         al,0xE1         ; white, not invisible
    es
    mov         [di+0x2000],al  ; ES:DI = attribute
%else
    push        ax
    mov         ah,0x07         ; VGA light gray attribute
    stosw
    pop         ax
%endif
    ret
<commit_msg>two rows<commit_after>bits 16			; 16-bit real mode

org 0		    ; this code is as PIC as possible

; entry point

; video segment
%ifdef TARGET_PC98
 %define VIDSEG 0xA000
%else
 %define VIDSEG 0xB800
%endif

; stack storage
%define S_BASE  (-28)

; use CALL to store IP (instruction pointer)
start:                              ; -> S_BASE =   0
    call        start2              ; -> S_BASE =  -2    NTS: Stored value is orig IP + 3
start2:
    push        ax                  ; -> S_BASE =  -4
    push        bx                  ; -> S_BASE =  -6
    push        cx                  ; -> S_BASE =  -8
    push        dx                  ; -> S_BASE = -10
    push        si                  ; -> S_BASE = -12
    push        di                  ; -> S_BASE = -14
    push        bp                  ; -> S_BASE = -16
    pushf                           ; -> S_BASE = -18
    push        cs                  ; -> S_BASE = -20
    push        ds                  ; -> S_BASE = -22
    push        es                  ; -> S_BASE = -24
    push        ss                  ; -> S_BASE = -26
    push        ax                  ; -> S_BASE = -28   will become SP

    cli                             ; turn off interrupts

    mov         bp,sp               ; -> make stack ptr accessible
    lea         ax,[bp-S_BASE]
    mov         [bp],ax             ; -> S_BASE = -28

    sub         word [bp-2-S_BASE],3; -> S_BASE =  -2   Adjust IP

    cld                             ; prepare video RAM writing
    mov         ax,VIDSEG
    mov         es,ax
    xor         di,di               ; ES:DI where to write (upper left corner)

    push        cs
    pop         ds

    mov         bx,[bp-2-S_BASE]    ; get IP (the base of our data)
    lea         si,[bx+hexes]       ; SI = hex strings
    add         bx,string2x

    mov         cx,2

ploopo:
    push        cx
    push        di
    mov         cx,(-S_BASE) / 2 / 2

; -----------------------------------
; So:
;   SS:BP = SP + S_BASE = start of struct
;   ES:DI = video RAM
;   DS:BX = 2-char strings
;   DS:SI = &hexes[0]
;   CX    = count
; -----------------------------------
ploop:
    mov         ax,[bx]
    add         bx,2
    call        putc
    mov         al,ah
    call        putc
    mov         al,' '
    call        putc
    loop        ploop

    pop         di
    pop         cx
    add         di,80*2
    loop        ploopo

; STOP
    jmp         short $

; putc
; in:
; AL = char
; ES:DI = VRAM
; out:
; AL = destroyed
; DI += 2
putc:
%ifdef TARGET_PC98
    push        ax
    xor         ah,ah           ; keep upper byte zero, single wide
    stosw
    pop         ax
    mov         al,0xE1         ; white, not invisible
    es
    mov         [di+0x2000],al  ; ES:DI = attribute
%else
    push        ax
    mov         ah,0x07         ; VGA light gray attribute
    stosw
    pop         ax
%endif
    ret

{'fraction_non_alphanumeric': 0.1045462586237396, 'fraction_numerical': 0.025296302848045286, 'mean_word_length': 0.8740470666224727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6478499', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1724, 'n_words': 539}