Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; general purpose registers
- ; ax - accumulator
- ; bx - base
- ; cx - count
- ; dx - data register
- ; segment registers
- ; cs - code segment, base location of program code
- ; ds - data segment, base location of variables
- ; ss - stack segment, base location of stack
- ; es - extra segment, additional base locations for variables in memory
- ; index registers
- ; bs - base pointer, offset from SS register to locate variables on the stack
- ; sp - stack pointer, offset from ss register as to the location of the stack's top
- ; si - source index, used for copying strings, segment register varies
- ; di - destination index, used for destination for coping strings
- refresh:
- cld ; clear direction flag (I guess some status register), so that when calling lodsb, we increase SI
- push ax ; save all registers
- push cx ; save all registers
- push dx ; save all registers
- push bx ; save all registers
- push si ; save all registers
- push di ; save all registers
- push ds ; save all registers
- mov si,0 ; clear source index I suppose
- mov ax,0b000h ; $b00 address
- mov ds,ax ;
- mov di,64 ; y = 64
- ref2:
- mov cx,30 ; count = 30, x=30*8 = 240
- mov bx,si ; move si to bx
- mov al,0ah ; move $a in lower
- mov dx,8011h ; $8011 in dx, ah this is the port to the LCD controller
- cli ; disable interrupts
- out dx,al ; send a byte from $a to the port $a -> $8011 (cursor address lower)
- mov al,bl ; move bl lower to al
- dec dx ; dx--; $8010
- out dx,al ; send bte from al to $8010 lower cursor count -> $8010
- sti ; enable interrupts
- mov al,0bh ; $b to lower $b -> $8011 (cursor adddress upper)
- inc dx ; dx++; $8011
- cli ; disable interrupts
- out dx,al ; send byte ($b) from al to $8010
- dec dx ; dx--; $8010
- mov al,bh ; update a-lower with b-higher
- and al,7 ; lower 3 bits
- out dx,al ; upper cursor count -> $8010
- sti ; enable interrupts
- ref1:
- lodsb ; Load byte at address DS:(E)SI into AL. mov al,[DS:SI] so we get a byte of grapics data %01234567
- ; reverse bit order
- ror al,1 ; rotate right 1 bit %70123456
- mov ah,al ; store lower to higher ah= %70123456
- and ah,136 ; 128+8 = %10001000 ah= %7___3___
- ror al,1 ; rotate right 1 bit %67012345
- ror al,1 ; rotate right 1 bit %56701234
- mov bl,al ; al to bl bl= %56701234
- and bl,68 ; 64+4 = %1000100 %_6___2__
- or ah,bl ; %76__32__
- ror al,1 ; rotate right 1 bit %45670123
- ror al,1 ; rotate right 1 bit %34567012
- mov bl,al ; al to bl bl= %34567012
- and bl,34 ; 32+2 = %100010 %__5___1_
- or ah,bl ; %765_321_
- ror al,1 ; rotate right 1 bit %23456701
- ror al,1 ; rotate right 1 bit %12345670
- and al,17 ; 16+1 = %10001 %___4___0
- or al,ah ; %76543210
- mov ah,al ;
- inc dx ; dx = $8011
- mov al,0ch ; al = $c
- cli
- out dx,al ; $c -> $8011 memory write
- mov al,ah
- dec dx ; dx = $8010
- out dx,al ; write byte
- sti
- loop ref1 ; dbra cx, thus 30 times
- dec di ;
- jnz ref2
- pop ds
- pop di
- pop si
- pop bx
- pop dx
- pop cx
- pop ax
- ret
- ;The LCD on the Portfolio is controlled by a HD61830
- ;of Hitachi. The I/O addresses are 8010h and 8011h.
- ;
- ;8010h is the data register
- ;8011h is the control register
- ;
- ;To program:
- ;
- ;1. Write the register number to 8011h
- ;2. Write the data to register 8010h
- ;
- ;For register and data value, see table below.
- ;After the data values the initial values for the
- ;Portfolio are show in hex (set during reset)
- ;
- ;
- ;Reg function Bits init
- ; 7 6 5 4 3 2 1 0
- ; +---+---+---+---+---+---+---+---+
- ; 0 Mode control | 0 | 0 | Mode data | 38
- ; +---+---+-------+---+-----------+
- ; 1 Vertical/horizontal | (Vp-1) | 0 | (Hp-1) | 75
- ; character pitch | | | |
- ; +---+-----------+---+-----------+
- ; 2 Number of characters per | 0 | (HN-1) | 27
- ; line/number of bytes | | |
- ; +---+---------------------------+
- ; 3 Number of vertical dots | | (NX-1) | 3F
- ; +---+---+---+---+---------------+
- ; 4 Cursor position | 0 | 0 | 0 | 0 | (CP-1) | 07
- ; +---+---+---+---+---------------+
- ; 8 Display starting address | Address data | 00
- ; (least significant) (Lower) | |
- ; +---+---+---+---+---------------+
- ; 9 Display starting address | 0 | 0 | 0 | 0 | Address data | 00
- ; (most significant) (Upper) | | | | | |
- ; +---+---+---+---+---------------+
- ; 10 Cursor address | Address data | 00
- ; (least significant) (Lower) | |
- ; +---+---+---+---+---------------+
- ; 11 Cursor address | 0 | 0 | 0 | 0 | Address data | 00
- ; (most significant) (Upper) | | | | | |
- ; +---+---+---+---+---------------+
- ; 12 Refresh memory write | Character code/bit data |
- ; +-------------------------------+
- ; 13 Refresh memory read | Refresh memory data |
- ; +---+---+---+---+---+-----------+
- ; 14 Bit clear | 0 | 0 | 0 | 0 | 0 | (BN) |
- ; +---+---+---+---+---+-----------+
- ; 15 Bit set | 0 | 0 | 0 | 0 | 0 | (BN) |
- ; +---+---+---+---+---+-----------+
- ;
- ;Mode data:
- ;
- ;1 1 1 0 0 0 Initial value for Portfolio
- ;
- ;5 4 3 2 1 0
- ;| | \ / | |
- ;| | | | +--- 0: Internal character generator ROM
- ;| | | | 1: External character generator ROM
- ;| | | |
- ;| | | +----- 0: Character mode
- ;| | | 1: Graphics mode
- ;| | |
- ;| | +-------- 00: Cursor OFF
- ;| | 01: Cursor ON
- ;| | 10: Cursor OFF, character blink
- ;| | 11: Cursor blink
- ;| |
- ;| +----------- 1: Master or slave (when multiple HD61830's)
- ;|
- ;+------------- 0: Display OFF (without clearing refresh memory)
- ; 1: Display ON
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement