📄 iop.asm
字号:
;;==============================history================================
;; This is the history of iop source code.This code is coded in 6502
;; assemble language.And after compile,we'll get iopcom.inc.This generated
;; *.inc file is a matrix which named IOPcode[].This matrix contain the
;; machine code for the 6502 cpu.(SUNPLUS huziqin 2003.6.2)
;;
;; (2003.6.2) v1.0.0
;; --add history and start up version control.
;;
;; (2003-6-2 14:38) v1.1.0
;; --delected rVfdtempdata and its related operation.
;; --delected rVfdswdata and its related operation.
;; --delected rVfdswbuf and its related operation.
;; --delected rVfdswindex and its related operation.
;; --delected some 'nop' for reduce code size
;; --add vfd_read_sw_sr to read 16312 sw status.
;; --modify Vfdgetcode subroutine.
;;
;; (2003-6-13 12:46) v1.1.1
;; --recover SettimerB,to compatible with 716.
;;
;; (2003-6-16 14:41) v1.1.2
;; --add INDEPENDENT_GAME_PORT,in order to use extra pin
;; to serve as GAME_STB and GAME_CLK.
;; GAME_STB--718 pin 66,gpio26,drive mode--direct I/O(3.3v)
;; GAME_CLK--718 pin 103,gpio41,drive mode--direct I/O(3.3v)
;;
;; (2003-7-9 10:34) v1.1.3
;; --add FOR_IOPCOM6PN for PHILIPS SERVO.just need define
;; SUPPORT_QCODE_PTOW to 1.
;;
;; (2003-7-10 16:12) v1.1.4
;; --LCD HT1621 can not work well if CLK Voltage is 3.3v,so I change it
;; to 5v.
;; --add SUPPORT_8Mx1_SDRAM for 716,because SQSO is gpio 2(in 718 we use
;; gpio 6);
;;
;; (2003-7-15 18:58) v1.1.5
;; --if no QCODE,ir can not work,fixed.for philips servo.
;;
;; (2003-7-17 15:35) v1.1.6
;; --change INDEPENDENT_GAME_PORT drive mode to pull high
;; GAME_STB--718 pin 66,gpio26,drive mode--pull high(5v)
;; GAME_CLK--718 pin 103,gpio41,drive mode--pull high(5v)
;;
;; (2003-7-17 17:17) v1.1.7
;; --change INDEPENDENT_GAME_PORT STB pin
;; GAME_STB--718 pin 49,gpio8,drive mode--pull high(5v)
;; GAME_CLK--718 pin 103,gpio41,drive mode--pull high(5v)
;;
;; (2003-7-24 17:32) v1.1.8
;; --add FOR_IOPSNHT1622 to support ht1622.For there is not enougth
;; buffer size for ht1622,so I move the buffer to $700--$700+44(d)
;;
;; (2003-7-29 14:00) v1.1.9
;; --add FOR_IOPCOM6SN10.support SPL10.
;;
;; (2003-8-4 14:03) v1.2.0
;; --FOR_IOPSN6311,support uPD16311 VFD driver.
;;
;;========================================================================
;;===============select the corresponding *.inc file=====================
FOR_IOPCOM6SN equ 1 ;; for iopcom6sn.inc
FOR_IOPCOM6SN2 equ 0 ;; for iopcom6sn2.inc
FOR_IOPCOM6SP equ 0 ;; for iopcom6sp.inc
FOR_IOPCOM6PN equ 0 ;; for iopcom6pn.inc
FOR_IOPCOM6SNHT equ 0 ;; for iopcom6snht.inc
FOR_IOPCOM6SNHT64 equ 0 ;; 716 64Mb use gpio2 as SQSO
FOR_IOPSNHT1622 equ 0 ;; for iopsnht1622.inc
FOR_IOPCOM6SN10 equ 0 ;; for iopcom6sn10.inc
FOR_IOPSN6311 equ 0 ;; upd16311
FOR_IOPSN164 equ 0 ;; 74164 LED driver
;;========================================================================
.ifnz FOR_IOPCOM6SN ; for iopcom6sn.inc
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;for iopcom6sn.inc
.ifnz FOR_IOPCOM6SN2 ; for iopcom6sn2.inc
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 1
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;for iopcom6sn2.inc
.ifnz FOR_IOPCOM6SP
IR_NEC equ 0
IR_PHILIPS equ 1
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 1
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;FOR_IOPCOM6SP
;;==========================================================================
.ifnz FOR_IOPCOM6PN ; for iopcom6pn.inc
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 1
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 1
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;for iopcom6pn.inc
.ifnz FOR_IOPCOM6SNHT
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 0
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 1
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;for iopcom6snht.inc
.ifnz FOR_IOPCOM6SNHT64
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 0
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 1
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 1 ;;use gpio2 as cd_sqso instead of gpio 6
.endif
.ifnz FOR_IOPSNHT1622
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 0
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 1
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;for iopcom6snht.inc
.ifnz FOR_IOPCOM6SN10
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 0
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 1
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;FOR_IOPCOM6SN10
.ifnz FOR_IOPSN6311
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 1
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif ;;FOR_IOPSN6311
.ifnz FOR_IOPSN164 ; for iopsn164.inc
IR_NEC equ 1
IR_PHILIPS equ 0
SUPPORT_VFD equ 1
SUPPORT_VFD_SWITCH equ 0
SUPPORT_VFD_ROLL equ 0
SUPPORT_LCD equ 0
SUPPORT_SPL10 equ 0
SUPPORT_QCODE equ 1
SUPPORT_QCODE_PTOW equ 0
SUPPORT_DSA equ 0
SUPPORT_DISCMAN equ 0 ;;if have mcu for dsa communication =1;
SUPPORT_DEMO equ 1 ;;sony small board =1;
SUPPORT_GUANGLING equ 0
SUPPORT_VFD_SW equ 0
INDEPENDENT_GAME_PORT equ 0 ;;use 718 66pin as GAME_STB,103pin as GAME_CLK
SUPPORT_8Mx1_SDRAM equ 0
.endif; for iopsn164.inc
;;;;spca718 system clock is 67.5MHZ
;;;;spca716 system clock is 54MHZ
SYSTEM_81_MHZ equ 0
SYSTEM_67_MHZ equ 1
SYSTEM_54_MHZ equ 0
.ifnz FOR_IOPSNHT1622
VFD_COUNT_BASE equ $700
VFD_BUFFER_BASE equ $701
.else
VFD_COUNT_BASE equ $400
VFD_BUFFER_BASE equ $401
.endif
QCODE_BUFFER equ $420
SPL10_WR_CMD equ a0h
SPL10_RD_CMD equ c0h
SPL10_BUFFER_SIZE equ 0ch
SPL10_BUFFER_BASE equ $404
;;**************************************************************************;;
;; Function : Main program entry ;;
;; Input : NONE ;;
;; Output : NONE ;;
;;**************************************************************************;;
.CHIP R65C02
.SYNTAX 6502
.LINKLIST
.SYMBOLS
.MACFIRST ON
;;**************************************************************************;;
;;include ;;
;;**************************************************************************;;
.include 6502s.inc
.include iop.inc
;;**************************************************************************;;
;;work ram ;;
;;**************************************************************************;;
.PAGE0
RAM_TOP equ $
time10ms ds 1
time1ms ds 1
Vfd_init1 ds 1
;;NEC IR control
.ifnz IR_NEC
rIrNewStatus: ds 1
rIrOldStatus: ds 1
rIrState: ds 1
rIrCountH: ds 1
rIrCountLbuf: ds 1
rIrLoopcount: ds 1
rIrReceiver: ds 4
rIrIncount: ds 1
rIrHeadStatus: ds 1
.endif
.ifnz IR_PHILIPS
rIrOldStatus: ds 1
rIrNewStatus: ds 1
rIrState: ds 1
rIrCountH: ds 1
rIrLoopcount: ds 1
rIrReceiver: ds 2
rIrIncount: ds 1
.endif
;;SUPPORT VFD control
.ifnz SUPPORT_VFD
rVfdstatus: ds 1
rVfdstate: ds 1
rVfdloopcount: ds 1
rVfddata: ds 1
rVfddataold: ds 1
rVfdsendcount: ds 1
rVfdkeydata: ds 1
rVfdscantime: ds 1
rVfdreptime: ds 1
rVfdcmdcount: ds 1
rGamepad1_data: ds 1
rGamepad2_data: ds 1
rGameflag: ds 1
rVfdUpdateTime: ds 1 ;;rbhung for VFD read/write rate
.ifnz SUPPORT_VFD_SW
vfd_sw_data: ds 1
.endif ;SUPPORT_VFD_SW
.endif ;SUPPORT_VFD
.ifnz SUPPORT_LCD
rLcddata: ds 2
rLcdstate: ds 1
rLcdloopcount: ds 1
rLcdscantime: ds 1
rLcdsendcount: ds 1
rLcdtemp: ds 1
rLcdgamecount: ds 1
rGamepad1_data: ds 1
rGamepad2_data: ds 1
.endif
.ifnz SUPPORT_SPL10
spl10_service_status: ds 1
spl10_wr_status: ds 1
spl10_buf_count: ds 1
spl10_rd_status: ds 1
spl10_sync_status: ds 1
write_byte_status: ds 1
spl10_wr_data: ds 1
spl10_write_count: ds 1
read_byte_status: ds 1
spl10_rd_data: ds 1
spl10_read_count: ds 1
spl10_scan_time: ds 1
rd_old_data: ds 1
spl10_rep_time ds 1
spl10_rep_count ds 1
.endif
.ifnz SUPPORT_DSA
rDsastate: ds 1
rDsastatus: ds 1
rDsaloopcount: ds 1
rDsatimeout ds 1
.endif
.ifnz SUPPORT_QCODE
rQcodestatus: ds 1
rQcodecount: ds 1
rQcodebitcount: ds 1
rQcodetimer: ds 1
rQcodedata: ds 10
.ifnz SUPPORT_QCODE_PTOW
rQcodedata1: ds 1
rQcodedata2: ds 1
rQcodecountH: ds 1
rQcodecountL: ds 1
.endif
.endif
RAM_BOTTOM equ $
;;**************************************************************************;;
;; code ;;
;; 1. system have 512 byte SRAM inside ;;
;; 2. $0 ~ $40 -> direct I/O control register (no include in SRAM area) ;;
;; $40 ~ $ff -> zero page free ;;
;; $100 ~ $105 -> each vector ;;
;; $106 ~ 1ff -> page 1 ;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -