home *** CD-ROM | disk | FTP | other *** search
- ;
- ; vramj3.asm: hterm screen control for J-3100 series (mainly using BIOS)
- ;
- ; Author: Kaz.Tominaga@Titech/Giken
- ;
- ; 1.1 89/11/01 Tominaga@Titech converted from vrampc.asm
- ; 1.2 90/06/22 Halca.Hirano add soft font support functions
- ;
- ; $Header: vramj3.asv 1.3 90/06/22 04:52:00 hirano Exp $
- ;
- ; Entry:
- ; utilities
- ; u_short getDSeg()
- ; splx(): enable interrupt
- ; spl7(): disable interrupt
- ; void moveMemory(to, toSeg, from, fromSeg, num)
- ;
- ; J3100 VRAM access thru BIOS routines
- ; void fillVRAMJ3(at, num, data, attrib)
- ; void moveForwardJ3(to, from, num)
- ; void moveBackwardJ3(to, from, num)
- ; void saveVRAM(off, seg)
- ; void loadVRAM(off, seg)
- ; void swapVRAM(fromoff, fromseg, tooff, toseg)
- ; u_short b_getCursor()
- ; void b_setCursor(xy)
- ; u_short b_readChar()
- ; void b_writeChar(c)
- ; void b_reverseChar()
- ; u_short b_readCharAt(xy)
- ; void b_writeCharAt(c, xy)
- ; void b_reverseCharAt(xy)
- ; void v_reverseScreen()
- ;
- ; soft font backing store access and GVRAM access routines
- ; void fillVRAM(at, num, data, attrib)
- ; void moveForward(to, from, num, attribFlag)
- ; void moveBackward(to, from, num, attribFlag)
- ; void moveForByte(to, from, num)
- ; void moveBackByte(to, from, num)
- ;
-
- ; Constants
- COLUMN_COUNT equ 80 ; width of display
- ROW_COUNT equ 25 ; height of display
-
- ; compensate for the BIOS' unsuitable reading from the code buffer
- SPACE_CHAR_READ equ 0020h ; space character code with normal
- ; attribute read from the code buffer
- SPACE_CHAR_CODE equ 7720h ; if above is found, this code must be
- ; written because the attribute 00h
- ; means 'transparent' and if it is
- ; written no difference is appear on
- ; the screen instead of clearing
- ; the position by space character.
- ; constants used for kstate
- SJIS1_EXPECT equ 0 ; sjis1 or ascii code is expected next
- SJIS2_EXPECT equ 1 ; sjis2 is expected
- ;
- _DATA segment word public 'DATA'
- _DATA ends
-
- extrn _vramSegment:word ; extern u_short vramSegment
- extrn _gvramSegment:word ; extern u_short gvramSegment
-
- _TEXT segment word public 'CODE'
- assume ds:_DATA,cs:_TEXT
- ;
- ; work area
- ;
- kstate dw SJIS1_EXPECT ; kanji state
-
-
- ;
- ; u_short getDSeg()
- ; return: data segment
- ;
- public _getDSeg
- _getDSeg proc far
- mov ax,ds
- ret
- _getDSeg endp
-
- ;
- ; splx(): enable interrupt
- ;
- public _splx
- _splx proc far
- sti
- ret
- _splx endp
-
- ;
- ; spl7(): disable interrupt
- ;
- public _spl7
- _spl7 proc far
- cli
- ret
- _spl7 endp
-
-
- ;
- ; void fillVRAMJ3(at, num, data, attrib)
- ; u_short at; location to start filling at (y << 8) | x
- ; u_short num; number to fill
- ; u_short data; fill data
- ; u_short attrib; fill attribute
- ;
- ; put 'num' 'data's at 'at' and put num 'attrib's at attribute area
- ;
- public _fillVRAMJ3
- _fillVRAMJ3 proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push dx
- mov bx,[6+bp] ; bx := location (bios expression)
- mov cx,[8+bp] ; cx := filling count
- mov ax,[10+bp] ; ax := filling data
- mov dx,[12+bp] ; dx := attribute
- mov ah,dl ; make ax to be (attr << 8) | data
- ; dx is now not need
- cmp cx,0 ; if count = 0
- jz fvret ; return
- fvloop:
- ; write char
- push bx ; location
- push ax ; char
- call far ptr _b_writeCharAt ; write ax at location bx
- add sp,4 ; restore stack
- ; next cursor position
- inc bl ; increment x
- cmp bl,COLUMN_COUNT ; x < 80?
- jl fvnext ; yes. jump.
- ; x = 80
- mov bl,0 ; to top of next line
- inc bh
- cmp bh,ROW_COUNT ; y < 25?
- jl fvnext ; yes. jump.
- ; y = 25
- jmp fvret ; no more filling
- fvnext:
- loop fvloop ; to fill next position
- ; done
- fvret:
- pop dx
- pop cx
- pop bx
- pop bp
- ret
- _fillVRAMJ3 endp
-
- ;
- ; void moveForwardJ3(to, from, num)
- ; u_short to; destination location (y << 8) | x
- ; u_short from; source location (y << 8) | x
- ; u_short num; the number of characters to move
- ;
- ; This routine moves char and attribute 'from' 'to' 'num' chars.
- ; The direction is incremental (from lower address to higher address).
- ; Therefore this procedure should be used to move sequenced char block
- ; from higher address to lower address. This is used by deleteChar().
- ;
- ; To make up for the lack of ability of J-3100 screen BIOS, this routine
- ; traces what kind of code(such as sjis1, sjis2...) is written on the
- ; screen the most recently while copying, and if the last character
- ; to be written is a sjis1 code, eliminates it.
- ;
- public _moveForwardJ3
- _moveForwardJ3 proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push dx
- ; reset kanji state
- mov cs:kstate,SJIS1_EXPECT ; clear kanji state flag
- ; get parameters
- mov dx,[6+bp] ; destination location
- mov bx,[8+bp] ; source location
- mov cx,[10+bp] ; count
- mfloop:
- ; counter
- cmp cx,0 ; if 0
- jz mfret ; done
- ; check source location
- cmp bl,COLUMN_COUNT ; x < 80?
- jl mfsrcok ; source location ok
- ; x >= 80
- mov bl,0 ; to top of next line
- inc bh ; increment y
- cmp bh,ROW_COUNT ; y < 25?
- jl mfsrcok ; source location ok
- ; y >= 25
- jmp mfret ; no more process
- mfsrcok:
- ; check destination location
- cmp dl,COLUMN_COUNT ; x < 80?
- jl mfdestok ; destination location ok
- ; x >= 80
- mov dl,0 ; to top of next line
- inc dh ; increment y
- cmp dh,ROW_COUNT ; y < 25?
- jl mfdestok ; destination location ok
- ; y >= 25
- jmp mfret ; no more process
- mfdestok:
- ; get one char at source location
- push bx ; location
- call far ptr _b_readCharAt ; read char and attr into ax
- add sp,2 ; restore stack
- ; now ax has char and its attr. BE CAREFUL TO PRESERVE IT UNTIL WRITING IT!
- ; ; set kanji state by the character
- ; cmp cs:kstate,SJIS2_EXPECT
- ; je mfsjis2
- ; ; either sjis1 or ascii code is expected
- ; call near ptr isSJIS1 ; check if al is sjis1 code
- ; jnc mfwriteok ; if ascii, write it as it is
- ; ; sjis1
- ; mov cs:kstate,SJIS2_EXPECT ; change kanji state
- ; ; check if the sjis1 code is all right to write
- ; cmp cx,1 ; is the last char?
- ; jne mfwriteok ; if not, it can be written.
- ; jmp mfloopend ; otherwise skip the process to write
- ;mfsjis2:; sjis2 is expected (and assume that it is)
- ; mov cs:kstate,SJIS1_EXPECT ; change kanji state
- ;mfwriteok:
- ; put it at destination
- push dx ; location
- push ax ; char and attr
- call far ptr _b_writeCharAt ; write char and attr at dx
- add sp,4 ; restore stack
- mfloopend:
- ; increment source location
- inc bl ; increment x
- ; increment destination location
- inc dl ; increment x
- ; decrement counter
- dec cx ; to treat next char
- jmp mfloop ; next looping
- mfret:
- pop di
- pop cx
- pop bx
- pop bp
- ret
- _moveForwardJ3 endp
-
- ;
- ; void moveBackwardJ3(to, from, num)
- ; u_short to; destination location (y << 8) | x
- ; u_short from; source location (y << 8) | x
- ; u_short num; the number of characters to move
- ;
- ; This routine moves char and attribute 'from' 'to' 'num' chars.
- ; The direction is decremental (from higher address to lower address).
- ; Therefore this procedure should be used to move sequenced char block
- ; from lower address to higher address. This is used by insertChar().
- ;
- ; To make up for the lack of ability of J-3100 screen BIOS, this routine
- ; traces what kind of code(such as sjis1, sjis2...) is written on the
- ; screen the most recently while copying, and if the last character
- ; to be written is a sjis1 code, eliminates it.
- ;
- ; BE CAREFUL that this routine uses stack as working area. It counts
- ; the data when putting into the stack, and pop them (and may write on the
- ; screen) as much as pushed. You should set the stack size by carefully
- ; estimating how much it is needed (4096byte stack is large enough in fact,
- ; because J-3100 has 80x25 screen size and a character has its code and
- ; attribute each of 1byte.)
- ;
- public _moveBackwardJ3
- _moveBackwardJ3 proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push dx
- push di
- ; reset kanji state
- mov cs:kstate,SJIS1_EXPECT ; clear kanji state flag
- ; get source and destination location
- mov bx,[8+bp] ; source location
- mov dx,[6+bp] ; destination location
- ; get count
- mov ax,[10+bp] ; count
- mov cl,COLUMN_COUNT ; = 80
- div cl ; count / 80
- ; set source location to tail of the string block to transfer
- add bh,al ; add quotient (for y)
- add bl,ah ; add modulo (for x)
- ;
- ; loop for getting characters into stack
- ;
- mov cx,[10+bp] ; get count once more
- mov di,0 ; count of data actually pushed into the stack
- mbgetloop:
- ; counter
- cmp cx,0 ; if 0
- jz mbgetend ; done
- ; decrement source location
- dec bl ; decrement x
- ; check source location
- cmp bl,0 ; x >= 0?
- jge mbsrcok ; source location ok
- ; x < 0
- mov bl,COLUMN_COUNT-1 ; to end of next line
- dec bh ; decrement y
- cmp bh,0 ; y >= 0?
- jge mbsrcok ; source location ok
- ; y < 0
- jmp mbgetend ; no more process
- mbsrcok:
- mov ax,7720h ; clear ax with a space with normal attr
- cmp bh,ROW_COUNT ; y >= 25?
- jge mbgot ; then push the space as it is
- ; get one char at source location
- push bx ; location
- call far ptr _b_readCharAt ; read char and attr into ax
- add sp,2 ; restore stack
- mbgot:
- push ax ; push the data into stack
- inc di ; count it
- ; decrement counter
- dec cx ; to treat next char
- jmp mbgetloop ; next looping
- mbgetend:
- ;
- ; then pop them and write on the screen
- ;
- mov cx,di ; use the count of data in the stack
- mbputloop:
- ; counter
- cmp cx,0 ; if 0
- jz mbputend ; done
- ; check destination location
- cmp dl,COLUMN_COUNT ; x < 80?
- jl mbdestok ; destination location ok
- ; x >= 80
- mov dl,0 ; to the top of next line
- inc dh ; increment y
- cmp dh,ROW_COUNT ; y < 25?
- jl mbdestok ; destination location ok
- ; y >= 25
- pop ax ; discard a character on the stack
- jmp mbputtail ; go on looping
- mbdestok:
- ; put the data at destination
- pop ax ; get data from the stack
- dec di ; not need in fact
- ; now ax has char and its attr. BE CAREFUL TO PRESERVE IT UNTIL WRITING IT!
- ; ; set kanji state by the character
- ; cmp cs:kstate,SJIS2_EXPECT
- ; je mbsjis2
- ; ; either sjis1 or ascii code is expected
- ; call near ptr isSJIS1 ; check if al is sjis1 code
- ; jnc mbwriteok ; if ascii, write it as it is
- ; ; sjis1
- ; mov cs:kstate,SJIS2_EXPECT ; change kanji state
- ; ; check if the sjis1 code is all right to write
- ; cmp cx,1 ; is the last char?
- ; jne mbwriteok ; if not, it can be written.
- ; jmp mbputtail ; otherwise skip the process to write
- ;mbsjis2:; sjis2 is expected (and assume that it is)
- ; mov cs:kstate,SJIS1_EXPECT ; change kanji state
- ;mbwriteok:
- push dx ; location
- push ax ; char and attr as a parameter
- call far ptr _b_writeCharAt ; write char and attr at dx
- add sp,4 ; restore stack
- mbputtail:
- ; increment destination location
- inc dl ; increment x
- ; decrement counter
- dec cx ; to treat next char
- jmp mbputloop ; next looping
- mbputend:
- pop di
- pop dx
- pop cx
- pop bx
- pop bp
- ret
- _moveBackwardJ3 endp
-
- ;
- ; void moveMemory(to, toSeg, from, fromSeg, num)
- ; u_short to; destination address
- ; u_short toSeg; destination address
- ; u_short from; source address
- ; u_short fromSeg; source address
- ; u_short num; words to move
- ;
- public _moveMemory
- _moveMemory proc far
- push bp
- mov bp,sp
- push cx
- push si
- push di
- push ds
- push es
- mov cx,[14+bp] ; cx := count
- mov ax,[12+bp]
- mov ds,ax ; ds := from segment
- mov ax,[10+bp]
- mov si,ax ; si := from offset
- mov ax,[8+bp]
- mov es,ax ; es := to segment
- mov ax,[6+bp]
- mov di,ax ; di := to offset
- cld ; direction is forward
- rep movsw ; move char
- pop es
- pop ds
- pop di
- pop si
- pop cx
- pop bp
- ret
- _moveMemory endp
-
- ;
- ; void saveVRAM(off, seg)
- ; u_short off; offset of buffer
- ; u_short seg; segment of buffer
- ; save the contents of VRAM into the buffer
- ;
- public _saveVRAM
- _saveVRAM proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push es
- ; get parameters
- mov bx,[6+bp] ; get offset of the buffer
- mov ax,[8+bp] ; get segment of the buffer
- mov es,ax ; set it into es
- mov cx,0 ; reset cursor position
- svvloop:
- ; check if the position is valid
- cmp cl,COLUMN_COUNT ; x < 80?
- jl svvok ; yes. jump.
- ; x >= 80
- mov cl,0 ; to top of next line
- inc ch ; increment y
- cmp ch,ROW_COUNT ; y < 25?
- jl svvok ; yes. jump.
- ; y >= 25
- jmp svvret ; no more process
- svvok:
- ; read char from VRAM
- push cx ; x-y
- call far ptr _b_readCharAt ; read char and attr at the position
- add sp,2 ; restore stack
- svvsavechar:
- ; ax has char and its attr
- mov es:[bx],ax ; save it into the buffer
- inc bx ; increment
- inc bx
- svvloopend:
- inc cl ; increment x
- jmp svvloop ; next looping
- ; done
- svvret:
- pop es
- pop cx
- pop bx
- pop bp
- ret
- _saveVRAM endp
-
- ;
- ; void loadVRAM(off, seg)
- ; u_short off; offset of buffer
- ; u_short seg; segment of buffer
- ; load the contents of the buffer into VRAM
- ;
- public _loadVRAM
- _loadVRAM proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push es
- ; get parameters
- mov bx,[6+bp] ; get offset of the buffer
- mov ax,[8+bp] ; get segment of the buffer
- mov es,ax ; set it into es
- mov cx,0 ; reset cursor position
- ldvloop:
- ; check if the position is valid
- cmp cl,COLUMN_COUNT ; x < 80?
- jl ldvok ; yes. jump.
- ; x >= 80
- mov cl,0 ; to top of next line
- inc ch ; increment y
- cmp ch,ROW_COUNT ; y < 25?
- jl ldvok ; yes. jump.
- ; y >= 25
- jmp ldvret ; no more process
- ldvok:
- mov ax,es:[bx] ; load one char from the buffer
- inc bx ; increment
- inc bx
- ; put char into VRAM
- push cx ; x-y
- push ax ; char and its attr
- call far ptr _b_writeCharAt ; write char and attr at the position
- add sp,4 ; restore stack
- ldvloopend:
- inc cl ; increment x
- jmp ldvloop ; next looping
- ; done
- ldvret:
- pop es
- pop cx
- pop bx
- pop bp
- ret
- _loadVRAM endp
-
- ;
- ; void swapVRAM(fromoff, fromseg, tooff, toseg)
- ; u_short fromoff; offset of buffer where swap in VRAM from
- ; u_short fromseg; segment of buffer
- ; u_short tooff; offset of buffer where swap out VRAM to
- ; u_short toseg; segment of buffer
- ; save the contents of VRAM into `to' buffer and
- ; load the contents of `from' buffer into VRAM
- ; (`from' and `to' buffer can be the same)
- ;
- public _swapVRAM
- _swapVRAM proc far
- push bp
- mov bp,sp
- push bx
- push cx
- push dx
- push si
- push di
- push es
- ;
- mov si,[6+bp] ; get the offset of the source
- mov ax,[8+bp] ; segment
- mov es,ax ; ... into ES
- mov di,[10+bp] ; get the offset of the destination
- mov cx,[12+bp] ; segment (held in CX)
- mov bx,0 ; set cursor position to the leftmost-uppermost
- ;
- spvloop:
- cmp bl,COLUMN_COUNT ; check x of cursor
- jl spvok ; ok. jump.
- ; x >= 80
- mov bl,0 ; set x to top of next line
- inc bh ; increment y
- cmp bh,ROW_COUNT ; check y
- jl spvok ; ok. jump.
- ; y >= 25
- jmp spvend ; end of screen
- ;
- spvok: ; now ES must have source segment and CX must have dest segment
- push bx ; as a paramter
- call far ptr _b_readCharAt ; read char at (BX) into AX
- add sp,2 ; restore stack
- mov dx,ax ; put char read into DX
- mov ax,es:[si] ; get char in source area
- add si,2 ; increment source address by 2
- push bx ; as a parameter(location)
- push ax ; char to be written
- call far ptr _b_writeCharAt ; write char DX at (BX)
- add sp,4 ; restore stack
- ; swap ES(source seg.) and CX(dest seg.)
- mov ax,es
- mov es,cx
- mov cx,ax
- ; now ES has dest segment, CX has source segment and DX has char read
- mov es:[di],dx ; put the char read from screen into dest area
- add di,2 ; increment dest address by 2
- ; swap ES(dest seg.) and CX(source seg.)
- mov ax,es
- mov es,cx
- mov cx,ax
- ; now ES has source segment and CX has dest segment
- inc bl ; increment x
- jmp spvloop ; loop to process next character
- ;
- spvend:
- pop es
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop bp
- ret
- _swapVRAM endp
-
- ;
- ; *** basic BIOS routines for screen operations ***
- ;
- ; u_short b_getCursor()
- ; get current cursor position using BIOS
- ; return AH=0~24, AL=0~79
- ;
- public _b_getCursor
- _b_getCursor proc far
- push bx
- push cx
- push dx
- mov bh,0 ; screen page
- mov ah,3 ; read cursor position
- int 10h ; display bios
- mov ax,dx ; dx has cursor position
- pop bx
- pop cx
- pop dx
- ret
- _b_getCursor endp
-
- ;
- ; void b_setCursor(xy)
- ; u_short xy;
- ; set cursor position using BIOS
- ; xy is (y << 8) | x
- ;
- public _b_setCursor
- _b_setCursor proc far
- push bp
- mov bp,sp
- push bx
- push dx
- mov dx,[6+bp] ; cursor position to dx
- mov bh,0 ; screen page
- mov ah,2 ; set cursor position
- int 10h ; screen bios
- pop dx
- pop bx
- pop bp
- ret
- _b_setCursor endp
-
- ;
- ; u_short b_readChar()
- ; read a character at the cursor position.
- ; returns AX as AH=attr, AL=char
- ;
- public _b_readChar
- _b_readChar proc far
- push bx
- mov bh,0 ; screen page
- mov ah,8 ; read char
- int 10h ; screen bios
- ; now AX is set as shown above.
- cmp ax,SPACE_CHAR_READ ; if the char is to be adjusted,
- jne rcret
- mov ax,SPACE_CHAR_CODE ; adjust it suitable to later writing
- rcret:
- pop bx
- ret
- _b_readChar endp
-
- ;
- ; void b_writeChar(c)
- ; u_short c;
- ; write a character (c & 0xff) at the cursor position
- ; with attribute code (c >> 8). cursor is not moved.
- ;
- public _b_writeChar
- _b_writeChar proc far
- push bp
- mov bp,sp
- push bx
- push cx
- mov ax,[6+bp] ; get char and attr
- mov bl,ah ; attr into bl
- mov cx,1 ; write 1 char
- mov ah,9 ; write char with attribute(al has char code)
- int 10h ; screen bios
- ; done
- pop cx
- pop bx
- pop bp
- ret
- _b_writeChar endp
-
- ;
- ; void b_reverseChar()
- ; reverse the character displayed at the cursor position
- ;
- public _b_reverseChar
- _b_reverseChar proc far
- ; read character and its attribute
- push bx
- push cx
- mov bh,0 ; screen page
- mov ah,8 ; read character
- int 10h ; screen bios
- ; now ax has (attr << 8) | char
- mov bh,0
- mov bl,ah ; get attr
- and bl,07h ; is normal or reversed?
- jz brc_reversed ; reversed. jump.
- ; normal. change into reversed
- mov bl,70h
- jmp brc_end
- brc_reversed: ; reversed. change into normal
- mov bl,77h ; attr 77h is assumed to be normal attr.
- brc_end: ; now AL has char code, BL has new attr
- mov bh,0 ; screen page
- mov cx,1 ; write 1 char
- mov ah,9 ; write char and attr
- int 10h ; screen bios
- ; done
- pop cx
- pop bx
- ret
- _b_reverseChar endp
-
- ;
- ; u_short b_readCharAt(xy)
- ; u_short xy; (y << 8) | x
- ; read a character at x-y
- ;
- public _b_readCharAt
- _b_readCharAt proc far
- push bp
- mov bp,sp
- ; set cursor to x-y
- push [6+bp] ; set param
- call far ptr _b_setCursor
- add sp,2
- ; read the char there
- call far ptr _b_readChar
- ; done
- pop bp
- ret
- _b_readCharAt endp
-
- ;
- ; void b_writeCharAt(c, xy)
- ; u_short c; (c & 0xff) is char, (c >> 8) is attribute
- ; u_short xy; (y << 8) | x
- ; write a character (c & 0xff) at x-y
- ; with attribute code (c >> 8). cursor is set to x-y.
- ;
- public _b_writeCharAt
- _b_writeCharAt proc far
- push bp
- mov bp,sp
- ; set cursor to x-y
- push [8+bp] ; set param
- call far ptr _b_setCursor
- add sp,2
- ; write c there
- push [6+bp] ; set param
- call far ptr _b_writeChar
- add sp,2
- ; done
- pop bp
- ret
- _b_writeCharAt endp
-
- ;
- ; void b_reverseCharAt(xy)
- ; u_short xy; (y << 8) | x
- ; reverse the character at x-y. cursor is set to x-y.
- ;
- public _b_reverseCharAt
- _b_reverseCharAt proc far
- push bp
- mov bp,sp
- ; set cursor to x-y
- push [6+bp] ; set param
- call far ptr _b_setCursor
- add sp,2
- ; reverse char there
- call far ptr _b_reverseChar
- ; done
- pop bp
- ret
- _b_reverseCharAt endp
-
- ;
- ; void v_reverseScreen()
- ;
- ; reverse the screen
- ;
- public _v_reverseScreen
- _v_reverseScreen proc far
- push bx
- push cx
- push si
- push es
- mov ax,word ptr _vramSegment
- mov es,ax ; get VRAM segment into es
- mov ax,8300h ; read start address
- int 10h ; screen bios
- mov cx,4 ; loop count
- mov si,0000h ; first line (to fourth)
- ; ax has the start address at any time during the loops below
- vroutloop:
- push cx ; save outer loop counter
- mov bx,ax
- mov cx,COLUMN_COUNT*ROW_COUNT*2
- vrinloop:
- not word ptr es:[bx+si] ; reverse the data
- inc bx
- inc bx
- and bx,1fffh ; mask for vram offset
- loop vrinloop ; until the end of the last row
- ;
- add si,2000h ; shift the top address
- pop cx ; restore outer loop conter
- loop vroutloop ; until end of screen
- ;
- pop es
- pop si
- pop cx
- pop bx
- ret
- _v_reverseScreen endp
-
- ;
- ; isSJIS1 : check if the content of AL is SJIS1 code and
- ; if it is returns with CF set, otherwise CF cleared.
- ;
- isSJIS1 proc near
- cmp al,81h
- jl noSJIS1
- cmp al,9fh
- jle yesSJIS1
- cmp al,0e0h
- jl noSJIS1
- cmp al,0fch
- jle yesSJIS1
- noSJIS1:
- clc
- ret
- yesSJIS1:
- stc
- ret
- isSJIS1 endp
-
- ;
- ; isSJIS2 : check if the content of AL is SJIS2 code and
- ; if it is returns with CF set, otherwise CF cleared.
- ;
- isSJIS2 proc near
- cmp al,40h
- jl noSJIS2
- cmp al,7eh
- jle yesSJIS2
- cmp al,80h
- jl noSJIS2
- yesSJIS2:
- stc
- ret
- noSJIS2:
- clc
- ret
- isSJIS2 endp
-
- ;
- ; soft font backing store access routines
- ;
-
- ;
- ; void fillVRAM(at, num, data, attrib)
- ; u_short at; address to fill
- ; u_short num; number to fill
- ; u_short data; fill data
- ; u_short attrib; fill attribute
- ;
- ; put 'num' 'data's at 'at' and put num 'attrib's at attribute area
- ;
- public _fillVRAM
- _fillVRAM proc far
- push bp
- mov bp,sp
- push cx
- push di
- push es
- mov ax,[6+bp]
- mov di,ax ; di := address
- mov ax,_vramSegment
- mov es,ax ; es := VRAM segment
- mov al,[10+bp] ; al := data to fill
- mov ah,[12+bp] ; ah := attribute
- mov cx,[8+bp] ; cx := fill words
- rep stosw ; fill char
- pop es
- pop di
- pop cx
- pop bp
- ret
- _fillVRAM endp
-
- ;
- ; void moveForward(to, from, num, attribFlag)
- ; u_short to; destination address
- ; u_short from; source address
- ; u_short num; words to move
- ; int attribFlag; move attribute too (no meaning)
- ;
- ; move char and attribute 'from' 'to' 'num' chars
- ; direction is from high address to low address
- ; this procedure is used for deleteLine()
- ;
- ; note: rep mov
- ; ds,es vram segment
- ; cx count
- ; di destination address
- ; si source address
- ;
- public _moveForward
- _moveForward proc far
- push bp
- mov bp,sp
- push cx
- push si
- push di
- push ds
- push es
- mov cx,[10+bp] ; cx := count
- mov ax,[8+bp]
- mov si,ax ; si := from
- mov ax,[6+bp]
- mov di,ax ; di := to
- cld ; direction is forward
- mov ax,_vramSegment
- mov ds,ax
- mov es,ax ; es := ds := vram segment
- rep movsw ; move char
- pop es
- pop ds
- pop di
- pop si
- pop cx
- pop bp
- ret
- _moveForward endp
-
- ;
- ; void moveBackward(to, from, num, attribFlag)
- ; u_short to; destination address
- ; u_short from; source address
- ; u_short num; number of words to move
- ; int attribFlag; move attribute too (no meaning)
- ;
- ; move char and attribute 'from' 'to' 'num' chars
- ; direction is low address to high address
- ; this procedure is used in insertLine()
- ;
- public _moveBackward
- _moveBackward proc far
- push bp
- mov bp,sp
- push cx
- push si
- push di
- push ds
- push es
- mov cx,[10+bp]
- shl cx,1 ; cx := count * 2
- mov ax,[8+bp]
- mov si,ax ; si := from
- add si,cx ; si := from + count (last word + 2)
- sub si,2 ; si := last word
- mov ax,[6+bp]
- mov di,ax ; di := to
- add di,cx ; di := to + count (last word + 2)
- sub di,2 ; di := last word
- mov cx,[10+bp] ; cx := words to move
- mov ax,_vramSegment
- mov ds,ax
- mov es,ax ; es := ds := vram segment
- std ; direction is decrimental
- rep movsw ; move char
- cld
- pop es
- pop ds
- pop di
- pop si
- pop cx
- pop bp
- ret
- _moveBackward endp
-
- ;
- ; void moveForByte(to, from, num)
- ; u_short to; destination address
- ; u_short from; source address
- ; u_short num; words to move
- ;
- ; move memory in GRAM 'from' 'to' 'num' bytes
- ; direction is from high address to low address
- ; this procedure is used for softFontDeleteChar()
- ;
- ; note: rep mov
- ; ds,es vram segment
- ; cx count
- ; di destination address
- ; si source address
- ;
- public _moveForByte
- _moveForByte proc far
- push bp
- mov bp,sp
- push cx
- push si
- push di
- push ds
- push es
- mov cx,[10+bp] ; cx := count
- mov ax,[8+bp]
- mov si,ax ; si := from
- mov ax,[6+bp]
- mov di,ax ; di := to
- cld ; direction is forward
- mov ax,_gvramSegment
- mov ds,ax
- mov es,ax ; es := ds := GVRAM segment
- rep movsb ; move char
- pop es
- pop ds
- pop di
- pop si
- pop cx
- pop bp
- ret
- _moveForByte endp
-
- ;
- ; void moveBackByte(to, from, num)
- ; u_short to; destination address
- ; u_short from; source address
- ; u_short num; number of bytes to move
- ;
- ; move GRAM memory 'from' 'to' 'num' bytes
- ; direction is low address to high address
- ; this procedure is used in softFontInsertChar()
- ;
- public _moveBackByte
- _moveBackByte proc far
- push bp
- mov bp,sp
- push cx
- push si
- push di
- push ds
- push es
- mov cx,[10+bp]
- mov ax,[8+bp]
- mov si,ax ; si := from
- add si,cx ; si := from + count (last byte + 1)
- sub si,1 ; si := last word
- mov ax,[6+bp]
- mov di,ax ; di := to
- add di,cx ; di := to + count (last byte + 1)
- sub di,1 ; di := last byte
- mov cx,[10+bp] ; cx := bytes to move
- mov ax,_gvramSegment
- mov ds,ax
- mov es,ax ; es := ds := GVRAM segment
- std ; direction is decrimental
- rep movsb ; move char
- cld
- pop es
- pop ds
- pop di
- pop si
- pop cx
- pop bp
- ret
- _moveBackByte endp
-
- _TEXT ends
- end
-