diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/MAPPER/WCHSTRA.ASM | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/MAPPER/WCHSTRA.ASM')
| -rw-r--r-- | v4.0/src/MAPPER/WCHSTRA.ASM | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/WCHSTRA.ASM b/v4.0/src/MAPPER/WCHSTRA.ASM new file mode 100644 index 0000000..2f42822 --- /dev/null +++ b/v4.0/src/MAPPER/WCHSTRA.ASM | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | ; | ||
| 2 | page 60,132 | ||
| 3 | ; | ||
| 4 | title CP/DOS VioWrtCharStrAtt mapper | ||
| 5 | ; | ||
| 6 | vioxxx segment byte public 'vio' | ||
| 7 | assume cs:vioxxx,ds:nothing,es:nothing,ss:nothing | ||
| 8 | ; | ||
| 9 | ; ************************************************************************* * | ||
| 10 | ; * | ||
| 11 | ; * MODULE: viowrtcharstratt Write character string with attribute | ||
| 12 | ; * | ||
| 13 | ; * FILE NAME: wchstra.asm | ||
| 14 | ; * | ||
| 15 | ; * CALLING SEQUENCE: | ||
| 16 | ; * | ||
| 17 | ; * push@ dword char_str | ||
| 18 | ; * push word length | ||
| 19 | ; * push word row | ||
| 20 | ; * push word column | ||
| 21 | ; * push@ dword attribute | ||
| 22 | ; * push word vio handle | ||
| 23 | ; * call viowrtcharstr | ||
| 24 | ; * | ||
| 25 | ; * | ||
| 26 | ; * MODULES CALLED: BIOS int 10h | ||
| 27 | ; * | ||
| 28 | ; ************************************************************************* | ||
| 29 | |||
| 30 | public viowrtcharstratt | ||
| 31 | .sall | ||
| 32 | .xlist | ||
| 33 | include macros.inc | ||
| 34 | .list | ||
| 35 | |||
| 36 | full_scr_err equ 0001h | ||
| 37 | error_bvs_parameter equ 0002h | ||
| 38 | |||
| 39 | str struc | ||
| 40 | old_bp dw ? | ||
| 41 | return dd ? | ||
| 42 | handle dw ? ; vio handle | ||
| 43 | attr dd ? ; attribute pointer | ||
| 44 | column dw ? ; column number | ||
| 45 | row dw ? ; starting position for output | ||
| 46 | lngth dw ? ; length of the string | ||
| 47 | addr dd ? ; string to be written (pointer) | ||
| 48 | str ends | ||
| 49 | |||
| 50 | viowrtcharstratt proc far | ||
| 51 | Enter viowrtcharstratt ; push registers | ||
| 52 | |||
| 53 | sub bh,bh | ||
| 54 | sub ax,ax ; Start with clean error condition | ||
| 55 | mov dx,[bp].column ; get column number | ||
| 56 | cmp dl,80 ; check for upper boundry | ||
| 57 | jg error ; branch if illegal number | ||
| 58 | |||
| 59 | mov ax,[bp].row ; get row number | ||
| 60 | cmp al,25 ; check for upper boundry | ||
| 61 | jg error ; branch if illegal number | ||
| 62 | mov dh,al | ||
| 63 | mov ah,02h | ||
| 64 | pushal ; Save registers in case int 10h | ||
| 65 | ; messes them up | ||
| 66 | int 10h ; Set start cursor position | ||
| 67 | |||
| 68 | popal | ||
| 69 | lds si,[bp].attr ; Set up attribute in BL | ||
| 70 | mov bl,byte ptr ds:[si] | ||
| 71 | lds si,[bp].addr ; DS:SI is pointer to string | ||
| 72 | mov di,[bp].lngth | ||
| 73 | ; **************************** | ||
| 74 | ; cmp bl,15 ; ** assume good attribute! ** | ||
| 75 | ; jg error ; **************************** | ||
| 76 | |||
| 77 | top: mov al,byte ptr [si] | ||
| 78 | mov ah,09h ; set write char/attrib function code | ||
| 79 | mov cx,1 ; write only one character | ||
| 80 | pushal ; Save registers in case int 10h | ||
| 81 | ; messes them up | ||
| 82 | int 10h ; Output one character | ||
| 83 | |||
| 84 | popal ; restore registers | ||
| 85 | inc si | ||
| 86 | dec di | ||
| 87 | inc dl | ||
| 88 | cmp dl,80 ; Handle end of line condition | ||
| 89 | jne around ; | | ||
| 90 | inc dh ; | | ||
| 91 | mov dl,00 ; V | ||
| 92 | cmp dh,25 ; Handle end of screen condition | ||
| 93 | jne around ; | | ||
| 94 | mov ax,full_scr_err ; Error in AX | ||
| 95 | jmp exit | ||
| 96 | |||
| 97 | around: mov ah,02h | ||
| 98 | pushal ; Save registers in case int 10h | ||
| 99 | ; messes them up | ||
| 100 | int 10h ; Increment cursor position | ||
| 101 | |||
| 102 | popal | ||
| 103 | cmp di,0 ; check if complete string is written | ||
| 104 | jne top ; else, go and write next character | ||
| 105 | |||
| 106 | sub ax,ax ; set no error code | ||
| 107 | |||
| 108 | error: mov ax,error_bvs_parameter | ||
| 109 | |||
| 110 | exit: Mexit ; return | ||
| 111 | ret size str - 6 | ||
| 112 | ; | ||
| 113 | viowrtcharstratt endp | ||
| 114 | vioxxx ends | ||
| 115 | end | ||