summaryrefslogtreecommitdiff
path: root/ports.asm
diff options
context:
space:
mode:
Diffstat (limited to 'ports.asm')
-rw-r--r--ports.asm103
1 files changed, 93 insertions, 10 deletions
diff --git a/ports.asm b/ports.asm
index 2eeec3a..2368d54 100644
--- a/ports.asm
+++ b/ports.asm
@@ -8,12 +8,6 @@ port_in:
jmp (a0)
rts
-port_out:
- ;; Fix this to work properly ...
-; movea lut_ports_in(pc,d0),a0
- jmp (a0)
- rts
-
lut_ports_in:
dc.l port_in_00
dc.l port_in_01
@@ -272,6 +266,11 @@ lut_ports_in:
dc.l port_in_fe
dc.l port_in_ff
+port_out:
+ movea lut_ports_out(pc,d0.w),a0
+ jmp (a0)
+ rts
+
lut_ports_out:
dc.l port_out_00
dc.l port_out_01
@@ -572,23 +571,107 @@ port_in_10:
or.b p10_busy(pc),d1
rts
-p10_increment: dc.b 0 ; $01 if in row mode
- ; $00 if in column mode
-p10_row: dc.b 0 ; $02 if in increment mode
+p10_row: dc.b 0 ; $01 if in row mode - x
+ ; $00 if in column mode - y
+p10_increment: dc.b 0 ; $02 if in increment mode
; $00 if in decrement mode
p10_enabled: dc.b 0 ; $20 if screen is blanked
p10_6bit: dc.b 0 ; $40 if in 8 bit mode, $00 if in 6
; bit mode
p10_busy: dc.b 0 ; always 0
- EVEN
+p10_cur_row: dc.b 0
+p10_cur_col: dc.b 0
port_out_10:
;; LCD command
+ tst.b d1
+ beq port_out_10_00
+ subq.b #1,d1
+ beq port_out_10_01
+ subq.b #1,d1
+ beq port_out_10_02
+ subq.b #1,d1
+ beq port_out_10_03
+ subq.b #1,d1
+ beq port_out_10_04
+ subq.b #1,d1
+ beq port_out_10_05
+ subq.b #1,d1
+ beq port_out_10_06
+ subq.b #1,d1
+ beq port_out_10_07
+ addq.b #7,d1
+ cmpi.b #$0b,d1 ; power supply enhancement
+ ble port_out_10_undef
+ cmpi.b #$13,d1 ; power supply level
+ ble port_out_10_undef
+ cmpi.b #$17,d1 ; undefined
+ ble port_out_10_undef
+ cmpi.b #$18,d1 ; cancel test mode
+ beq port_out_10_undef
+ cmpi.b #$1b,d1 ; undefined
+ beq port_out_10_undef
+ cmpi.b #$1f,d1 ; enter test mode
+ ble port_out_10_undef
+ cmpi.b #$3f,d1 ; set column
+ ble port_out_10_set_col
+ cmpi.b #$7f,d1 ; z-addressing
+ ble port_out_10_undef ; XXX?
+ cmpi.b #$df,d1 ; set row
+ ble port_out_10_set_row
+ ;; fallthrough: set contrast (unimplemented)
+ rts
+ ;; ...
+port_out_10_00: ; 6-bit mode
+ move.b #$00,p10_6bit
+ rts
+port_out_10_01: ; 8-bit mode
+ move.b #$40,p10_6bit
+ rts
+port_out_10_02: ; screen off
+ move.b #$20,p10_enabled
+ rts
+port_out_10_03: ; screen on
+ move.b #$00,p10_enabled
+ rts
+port_out_10_04: ; x--
+ move.b #$01,p10_row
+ move.b #$00,p10_increment
+ rts
+port_out_10_05: ; x++
+ move.b #$01,p10_row
+ move.b #$02,p10_increment
+ rts
+port_out_10_06: ; y--
+ move.b #$00,p10_row
+ move.b #$00,p10_increment
+ rts
+port_out_10_07: ; y++
+ move.b #$00,p10_row
+ move.b #$02,p10_increment
+ rts
+port_out_10_undef:
+ rts
+port_out_10_set_col:
+ sub.b #$20,d1
+ move.b d1,p10_cur_col
+ rts
+port_out_10_set_row:
+ sub.b #$80,d1
+ move.b d1,p10_cur_row
+ rts
+
port_in_11:
;; LCD data
+ move.b LCD_MEM,d1
+ rts
+
port_out_11:
;; LCD data
+ move.b d1,LCD_MEM
+ rts
+
port_in_12:
port_out_12:
port_in_13: