diff --git a/libticalcs/trunk/configure.ac b/libticalcs/trunk/configure.ac index 98e24f42a..a96d42992 100644 --- a/libticalcs/trunk/configure.ac +++ b/libticalcs/trunk/configure.ac @@ -205,12 +205,15 @@ AC_ARG_ENABLE([builtin-rom-dumpers], [], [enable_builtin_rom_dumpers=yes]) AC_ARG_VAR([SPASM], [SPASM Z80 assembler]) +AC_ARG_VAR([PASMO], [PASMO Z80 assembler]) AC_ARG_VAR([TIPACK], [Tool for creating TI variable files]) have_spasm=no +have_pasmo=no have_tipack=no have_tigcc=no have_m68klinuxgnu=no : ${SPASM=spasm} +: ${PASMO=pasmo} : ${TIPACK=tipack} if test "x$enable_builtin_rom_dumpers" != "xyes" ; then @@ -226,7 +229,22 @@ EOF fi AC_MSG_RESULT([$have_spasm]) - if test "x$have_spasm" = "xyes" ; then + AC_MSG_CHECKING([whether $PASMO works]) + cat >conftest.asm <&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + have_pasmo=yes + fi + AC_MSG_RESULT([$have_pasmo]) + + if test "x$have_spasm$have_pasmo" = "xyesyes" ; then AC_MSG_CHECKING([whether $TIPACK works]) if "$TIPACK" conftest.bin -p -o conftest.8xp >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then have_tipack=yes @@ -266,12 +284,12 @@ EOF AC_MSG_RESULT([$have_m68klinuxgnu]) fi -if test "x$have_spasm$have_tipack" = "xyesyes" ; then +if test "x$have_spasm$have_pasmo$have_tipack" = "xyesyesyes" ; then build_z80_rom_dumpers=yes else build_z80_rom_dumpers=no if test "x$enable_builtin_rom_dumpers" = "xno" ; then - AC_MSG_FAILURE([spasm and/or tipack are not installed or are not usable.]) + AC_MSG_FAILURE([spasm, pasmo and/or tipack are not installed or are not usable.]) fi fi diff --git a/libticalcs/trunk/src/romdump_84p_usb/Makefile.am b/libticalcs/trunk/src/romdump_84p_usb/Makefile.am index 02433be8c..330c627bd 100644 --- a/libticalcs/trunk/src/romdump_84p_usb/Makefile.am +++ b/libticalcs/trunk/src/romdump_84p_usb/Makefile.am @@ -1,18 +1,21 @@ EXTRA_DIST = romdump.z80 CLEANFILES = *.bin *.lst *.8xp -SPASMFLAGS = -N -T +PASMOFLAGS = +rom_dumpers = dump84p.8xp dump84pcu.8xp if BUILD_Z80_ROM_DUMPERS -all: dump84p.8xp dump84pcu.8xp +all: $(rom_dumpers) endif dump84p.bin: romdump.z80 - $(SPASM) $(SPASMFLAGS) -A -DTI84P $(srcdir)/romdump.z80 dump84p.bin + $(PASMO) $(PASMOFLAGS) -E TI84P $(srcdir)/romdump.z80 dump84p.bin + +dump84pcu.bin: romdump.z80 + $(PASMO) $(PASMOFLAGS) -E TI84PC $(srcdir)/romdump.z80 dump84pcu.bin + dump84p.8xp: dump84p.bin $(TIPACK) -n 'ROMDUMP' dump84p.bin -p -o dump84p.8xp -dump84pcu.bin: romdump.z80 - $(SPASM) $(SPASMFLAGS) -A -DTI84PC $(srcdir)/romdump.z80 dump84pcu.bin dump84pcu.8xp: dump84pcu.bin $(TIPACK) -n 'ROMDUMP' dump84pcu.bin -p -o dump84pcu.8xp diff --git a/libticalcs/trunk/src/romdump_84p_usb/romdump.z80 b/libticalcs/trunk/src/romdump_84p_usb/romdump.z80 index 2f00a40a4..c2a83bd61 100644 --- a/libticalcs/trunk/src/romdump_84p_usb/romdump.z80 +++ b/libticalcs/trunk/src/romdump_84p_usb/romdump.z80 @@ -21,121 +21,158 @@ ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - .nolist -#define bcall(romcallname) rst 28h \ .dw romcallname - -#ifdef TI84P -_LdHLind = 4009h -_cphlde = 400Ch -_PutC = 4504h -_PutS = 450Ah -_clrLCDFull = 4540h -_homeUp = 4558h -_runIndicOff = 4570h -_Mov18B = 47DAh -_getKey = 4972h -_GetBaseVer = 4C6Fh -_GetVariableData = 5092h -_SendUSBData = 50F2h -_KillUSBDevice = 5257h -_GetBootVer = 80B7h -_GetHWVer = 80BAh -_WriteAByteSafe = 80C6h -_KillUSB = 810Eh - -appData = 8000h -ramCode = 8100h -arcInfo = 83EEh -curRow = 844Bh -OP1 = 8478h -iMathPtr5 = 84DBh -flags = 89F0h -pagedCount = 9834h -pagedBuf = 983Ah -appBackUpScreen = 9872h -userMem = 9D95h - -outPageNum = 83EBh -inputBuffer = 9C31h -usbReadCount = 9C80h -usbQueuedCount = 9C27h - -#define SAVE_MEM_PAGE in a,(6) \ push af -#define RESTORE_MEM_PAGE pop af \ out (6),a -#define RESTORE_MEM_PAGE_SAVEF pop bc \ ld a,b \ out (6),a -#define SET_FLASH_PAGE_A out (6), a -#endif - -#ifdef TI84PC -_LdHLind = 4009h -_cphlde = 400Ch -_PutC = 44FBh -_PutS = 4501h -_clrLCDFull = 4537h -_homeUp = 454Fh -_runIndicOff = 4567h -_getKey = 495Dh -_SendUSBData = 50D4h -_KillUSBDevice = 5236h -_KillUSB = 810Eh - -appData = 08000h -curRow = 08459h -OP1 = 084AEh -pagedCount = 09E15h -appBackUpScreen = 0A0B0h ; note: this might be wrong -userMem = 0A60Bh - -outPageNum = appBackUpScreen+50 -usbReadCount = 09F61h -usbQueuedCount = 09F08h - -#define SAVE_MEM_PAGE in a,(0Eh) \ push af \ in a,(6) \ push af -#define RESTORE_MEM_PAGE pop af \ out (6),a \ pop af \ out (0Eh),a -#define RESTORE_MEM_PAGE_SAVEF pop bc \ ld a,b \ out (6),a \ pop bc \ ld a,b \ out (0Eh),a -#define SET_FLASH_PAGE_A rlca \ out (0Eh),a \ srl a \ out (6),a -#endif - -appTextSave = 1 -appFlags = 0Dh - -onInterrupt = 4 -onFlags = 9h -LlBrack = 0C1h - -PACKET_SIZE = 1024 -CMD_READY = 0AA55h -CMD_OK = 0001h -CMD_EXIT = 0002h -CMD_SIZE = 0003h -CMD_GETDATA = 0005h -CMD_DATA = 0006h -CMD_REPEAT = 0007h - .list - -SPbackup = appBackUpScreen -outputBuffer = appBackUpScreen+2 - -.org userMem-2 -#ifdef TI84P - .db 0BBh,6Dh -#endif -#ifdef TI84PC - .db 0EFh,69h - res appTextSave,(iy+appFlags) - ld a,1 - out (20h),a -#endif - bcall(_runIndicOff) + +macro B_CALL, arg + rst 28h + dw arg +endm + +if defined TI84P +_LdHLind equ 4009h +_cphlde equ 400Ch +_PutC equ 4504h +_PutS equ 450Ah +_clrLCDFull equ 4540h +_homeUp equ 4558h +_runIndicOff equ 4570h +_Mov18B equ 47DAh +_getKey equ 4972h +_GetBaseVer equ 4C6Fh +_GetVariableData equ 5092h +_SendUSBData equ 50F2h +_KillUSBDevice equ 5257h +_GetBootVer equ 80B7h +_GetHWVer equ 80BAh +_WriteAByteSafe equ 80C6h +_KillUSB equ 810Eh + +appData equ 8000h +ramCode equ 8100h +arcInfo equ 83EEh +curRow equ 844Bh +OP1 equ 8478h +iMathPtr5 equ 84DBh +flags equ 89F0h +pagedCount equ 9834h +pagedBuf equ 983Ah +appBackUpScreen equ 9872h +userMem equ 9D95h + +outPageNum equ 83EBh +inputBuffer equ 9C31h +usbReadCount equ 9C80h +usbQueuedCount equ 9C27h + +macro SAVE_MEM_PAGE + in a,(6) + push af +endm + +macro RESTORE_MEM_PAGE + pop af + out (6),a +endm +macro RESTORE_MEM_PAGE_SAVEF + pop bc + ld a,b + out (6),a +endm +macro SET_FLASH_PAGE_A + out (6), a +endm +endif + +if defined TI84PC +_LdHLind equ 4009h +_cphlde equ 400Ch +_PutC equ 44FBh +_PutS equ 4501h +_clrLCDFull equ 4537h +_homeUp equ 454Fh +_runIndicOff equ 4567h +_getKey equ 495Dh +_SendUSBData equ 50D4h +_KillUSBDevice equ 5236h +_KillUSB equ 810Eh + +appData equ 08000h +curRow equ 08459h +OP1 equ 084AEh +pagedCount equ 09E15h +appBackUpScreen equ 0A0B0h ; note: this might be wrong +userMem equ 0A60Bh + +outPageNum equ appBackUpScreen+50 +usbReadCount equ 09F61h +usbQueuedCount equ 09F08h + +macro SAVE_MEM_PAGE + in a,(0Eh) + push af + in a,(6) + push af +endm +macro RESTORE_MEM_PAGE + pop af + out (6),a + pop af + out (0Eh),a +endm +macro RESTORE_MEM_PAGE_SAVEF + pop bc + ld a,b + out (6),a + pop bc + ld a,b + out (0Eh),a +endm +macro SET_FLASH_PAGE_A + rlca + out (0Eh),a + srl a + out (6),a +endm +endif + +appTextSave equ 1 +appFlags equ 0Dh + +onInterrupt equ 4 +onFlags equ 9h +LlBrack equ 0C1h + +PACKET_SIZE equ 1024 +CMD_READY equ 0AA55h +CMD_OK equ 0001h +CMD_EXIT equ 0002h +CMD_SIZE equ 0003h +CMD_GETDATA equ 0005h +CMD_DATA equ 0006h +CMD_REPEAT equ 0007h + +SPbackup equ appBackUpScreen +outputBuffer equ appBackUpScreen+2 + +org userMem-2 +if defined TI84P + db 0BBh,6Dh +endif +if defined TI84PC + db 0EFh,69h + res appTextSave,(iy+appFlags) + ld a,1 + out (20h),a +endif + B_CALL _runIndicOff ; Unlock Flash, if possible. ; The purpose is to get an accurate dump of the certificate page (page 3Eh/7Eh). -#ifdef TI84P +if defined TI84P in a,(6) push af call Unlock pop af out (6),a -#endif +endif ld (SPbackup),sp call clearScreen @@ -147,16 +184,16 @@ throwError: ld sp,(SPbackup) call clearScreen ld hl,sError - bcall(_PutS) - bcall(_getKey) + B_CALL _PutS + B_CALL _getKey clearScreen: - bcall(_clrLCDFull) - bcall(_homeUp) + B_CALL _clrLCDFull + B_CALL _homeUp res onInterrupt,(iy+onFlags) ret startDump: ld hl,sMessage - bcall(_PutS) + B_CALL _PutS res 5,(iy+41h) getCommandsLoop: ld hl,appData @@ -165,19 +202,19 @@ getCommandsLoop: ld hl,(appData) ;Exit dumper? ld de,CMD_EXIT - bcall(_cphlde) + B_CALL _cphlde jr z,exitDumper ;Requesting ROM dump size? ld de,CMD_SIZE - bcall(_cphlde) + B_CALL _cphlde jr z,sizeRequested ;Requesting ROM data? ld de,CMD_GETDATA - bcall(_cphlde) + B_CALL _cphlde jr z,dataRequested ;Are we ready? ld de,CMD_READY - bcall(_cphlde) + B_CALL _cphlde jr z,readyReceived jr getCommandsLoop @@ -193,9 +230,9 @@ sizeRequested: inc hl ld (hl),0 inc hl -#ifdef TI84PC +if defined TI84PC ld (hl),40h -#else +else in a,(21h) and 3 ld a,10h @@ -203,7 +240,7 @@ sizeRequested: add a,a srIsNotSE: ld (hl),a -#endif +endif inc hl ld (hl),0 ld a,81h @@ -293,26 +330,26 @@ requestingEmptyPacket: jp getCommandsLoop sMessage: - .db "Dumping",0CEh," " - .db " " - .db " " - .db " " - .db "Press ",LlBrack,"ON] to " - .db "abort.",0 -sError: .db "ERROR! " - .db " " - .db "There was an " - .db "unknown USB " - .db "error. " - .db " " - .db "Press any key to" - .db "quit.",0 + db "Dumping",0CEh," " + db " " + db " " + db " " + db "Press ",LlBrack,"ON] to " + db "abort.",0 +sError: db "ERROR! " + db " " + db "There was an " + db "unknown USB " + db "error. " + db " " + db "Press any key to" + db "quit.",0 SendFlashPacket: -#ifdef TI84PC +if defined TI84PC rlca srl a -#endif +endif SendPacket: ;Sends a TiLP ROM dump packet. ;Inputs: DE: command ID @@ -325,10 +362,10 @@ SendPacket: push bc ld (outPageNum),a SAVE_MEM_PAGE -#ifdef TI84PC +if defined TI84PC sbc a,a out (0Eh),a -#endif +endif ld a,83h out (6),a push hl @@ -463,7 +500,7 @@ vdispha: add a,48 jr vdispd vdhlet: add a,55 -vdispd: bcall(_PutC) +vdispd: B_CALL _PutC ret ;---------------------------------------------------------------------------- @@ -472,7 +509,7 @@ vdispd: bcall(_PutC) ;Inputs: None ;Outputs: Carry flag set if any issues InitializePeriphUSB: - bcall(_KillUSB) + B_CALL _KillUSB ret c ld a,80h out (57h),a @@ -591,7 +628,7 @@ IsUSBAvailable: SendUSBData: set 2,(iy+40h) res 0,(iy+43h) - bcall(_SendUSBData) + B_CALL _SendUSBData res 0,(iy+41h) ret @@ -624,64 +661,64 @@ ReceiveUSBDataWait: ; Carry flag set if any issues ;Make sure you know how much you need to be receiving before calling. ReceiveUSBData: - push bc - push af - xor a - ld (pagedCount),a - jr receive_data_ready + push bc + push af + xor a + ld (pagedCount),a + jr receive_data_ready receive_big_loop: - in a,(4) - bit 3,a - jr z,P2scfRet - bit 5,(iy+41h) - jr nz,receive_data_ready - in a,(84h) - bit 2,a - jr nz,receiving_data - bit 1,a - jr z,restart_receive_loop + in a,(4) + bit 3,a + jr z,P2scfRet + bit 5,(iy+41h) + jr nz,receive_data_ready + in a,(84h) + bit 2,a + jr nz,receiving_data + bit 1,a + jr z,restart_receive_loop receiving_data: - set 5,(iy+41h) - xor a - ld (usbQueuedCount),a - jr receive_data_ready + set 5,(iy+41h) + xor a + ld (usbQueuedCount),a + jr receive_data_ready restart_receive_loop: in a,(86h) - bit 5,a - jr nz,P2scfRet - jr receive_big_loop + bit 5,a + jr nz,P2scfRet + jr receive_big_loop receive_data_ready: - push bc - push hl - ld hl,40h - or a - sbc hl,bc - pop hl - ld b,c + push bc + push hl + ld hl,40h + or a + sbc hl,bc + pop hl + ld b,c jr nc,receiveRest - ld b,40h + ld b,40h receiveRest: - call ReceiveUSBData_small - ex de,hl - pop hl - jr c,P2scfRet - or a - ld b,0 - sbc hl,bc - jr z,P2ret - ld b,h - ld c,l - ex de,hl - jr receive_big_loop -P2ret: pop bc - ld a,b - pop bc - ret + call ReceiveUSBData_small + ex de,hl + pop hl + jr c,P2scfRet + or a + ld b,0 + sbc hl,bc + jr z,P2ret + ld b,h + ld c,l + ex de,hl + jr receive_big_loop +P2ret: pop bc + ld a,b + pop bc + ret P2scfRet: - pop af - pop bc - scf - ret + pop af + pop bc + scf + ret ReceiveUSBData_small: ld a,b or a @@ -791,8 +828,8 @@ calcIsPeripheral: and 0DFh out (94h),a pop af - bcall(_KillUSBDevice) - jr receiveError + B_CALL _KillUSBDevice + jr receiveError startReceive2: ld a,(usbQueuedCount) or a @@ -836,15 +873,15 @@ endReceive: ;---------------------------------------------------------------------------- -#ifdef TI84P - +if defined TI84P + ;;; Table of supported OS and boot code versions VersionTable: - .db 1,19, 1,01 ; TI-83 Plus - .db 1,19, 1,00 ; TI-83 Plus SE - .db 2,55, 1,03 ; TI-84 Plus - .db 2,55, 1,03 ; TI-84 Plus SE (odd versions) - .db 2,56, 1,03 ; Nspire (even versions) + db 1,19, 1,01 ; TI-83 Plus + db 1,19, 1,00 ; TI-83 Plus SE + db 2,55, 1,03 ; TI-84 Plus + db 2,55, 1,03 ; TI-84 Plus SE (odd versions) + db 2,56, 1,03 ; Nspire (even versions) ;; Unlock: ;; @@ -860,130 +897,127 @@ VersionTable: ;; - Interrupt mode set to 1 Unlock: - ;; Check if current OS/boot version is known to be supported - bcall(_GetBaseVer) - ld c, a - bcall(_GetHWVer) - ld l, a - add a, -4 - ret c - inc a - jr nz, Unlock_NotNspire - bit 0, b - jr nz, Unlock_NotNspire - inc l + ;; Check if current OS/boot version is known to be supported + B_CALL _GetBaseVer + ld c, a + B_CALL _GetHWVer + ld l, a + add a, -4 + ret c + inc a + jr nz, Unlock_NotNspire + bit 0, b + jr nz, Unlock_NotNspire + inc l Unlock_NotNspire: - ld h, 0 - add hl, hl - add hl, hl - ld de, VersionTable - add hl, de - ld a, c - call CheckVersion - ret c - inc hl - bcall(_GetBootVer) - call CheckVersion - ret c - - di - push iy - ld de, 7B09h - ld a, e - ld (arcInfo), a - out (6), a - ld a, (de) - ld b, a - push bc - push de - call SetFlashPageD - ld a, e - bcall(_WriteAByteSafe) - ld hl, Unlock_Recover - 2 - ld de, pagedBuf - 2 - bcall(_Mov18B) - ld (pagedBuf + 2), sp - call Unlock_Main - pop af - pop bc - jr Unlock_Done + ld h, 0 + add hl, hl + add hl, hl + ld de, VersionTable + add hl, de + ld a, c + call CheckVersion + ret c + inc hl + B_CALL _GetBootVer + call CheckVersion + ret c + + di + push iy + ld de, 7B09h + ld a, e + ld (arcInfo), a + out (6), a + ld a, (de) + ld b, a + push bc + push de + call SetFlashPageD + ld a, e + B_CALL _WriteAByteSafe + ld hl, Unlock_Recover - 2 + ld de, pagedBuf - 2 + B_CALL _Mov18B + ld (pagedBuf + 2), sp + call Unlock_Main + pop af + pop bc + jr Unlock_Done Unlock_Main: - ld a, (_GetVariableData + 2) - ld d, a - ld hl, ramCode - ld bc, 304 + ld a, (_GetVariableData + 2) + ld d, a + ld hl, ramCode + ld bc, 304 Unlock_Loop1: - ld a, 0EDh - cpir - ret nz - ld a, (hl) - sub 0A0h - jr nz, Unlock_Loop1 - ld c, (hl) - ld b, a - inc hl - ld (iMathPtr5), hl - ld hl, (_GetVariableData) - inc a + ld a, 0EDh + cpir + ret nz + ld a, (hl) + sub 0A0h + jr nz, Unlock_Loop1 + ld c, (hl) + ld b, a + inc hl + ld (iMathPtr5), hl + ld hl, (_GetVariableData) + inc a Unlock_Data: - ld (pagedCount), a - or a - call nz, SetFlashPageD + ld (pagedCount), a + or a + call nz, SetFlashPageD Unlock_Loop2: - ld a, 3Ah - cpir - ret nz - ld de, Unlock_Data + 1 + ld a, 3Ah + cpir + ret nz + ld de, Unlock_Data + 1 Unlock_Loop3: - ld a,(de) - cp (hl) - jr nz, Unlock_Loop2 - inc hl - inc de - cp 0C4h - jr nz, Unlock_Loop3 - bcall(_LdHLind) - ld iy, 56h - 25h + ld a,(de) + cp (hl) + jr nz, Unlock_Loop2 + inc hl + inc de + cp 0C4h + jr nz, Unlock_Loop3 + B_CALL _LdHLind + ld iy, 56h - 25h Unlock_Recover: - jp (hl) - ld sp, 0 - pop hl - pop af - ld (hl), a + jp (hl) + ld sp, 0 + pop hl + pop af + ld (hl), a Unlock_WriteByte: - cp (hl) - jr nz, Unlock_WriteByte - ld (hl), 0F0h + cp (hl) + jr nz, Unlock_WriteByte + ld (hl), 0F0h Unlock_Done: - pop iy - ret + pop iy + ret SetFlashPageD: - in a, (2) - add a, a - ld a, 1Fh - jr nc, SetFlashPage_Mask - in a, (21h) - and 3 - ld a, 7Fh - jr nz, SetFlashPage_Mask - rra + in a, (2) + add a, a + ld a, 1Fh + jr nc, SetFlashPage_Mask + in a, (21h) + and 3 + ld a, 7Fh + jr nz, SetFlashPage_Mask + rra SetFlashPage_Mask: - and d - out (6), a - ret + and d + out (6), a + ret CheckVersion: - cp (hl) - inc hl - ccf - ret nz - ld a, (hl) - cp b - ret - -#endif - -.end -end + cp (hl) + inc hl + ccf + ret nz + ld a, (hl) + cp b + ret + +endif diff --git a/libticalcs/trunk/src/romdump_8x/Makefile.am b/libticalcs/trunk/src/romdump_8x/Makefile.am index 508d8bbeb..5f4e6fe35 100644 --- a/libticalcs/trunk/src/romdump_8x/Makefile.am +++ b/libticalcs/trunk/src/romdump_8x/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = *.asm *.inc CLEANFILES = *.bin *.lst *.73p *.82y *.83p *.8xp *.85s *.86p -SPASMFLAGS = -N -T +PASMOFLAGS = rom_dumpers = dump73.73p dump82.82y dump83.83p dump83p.8xp dump84pc.8xp dump85.85s dump86.86p @@ -11,33 +11,40 @@ endif dump73.bin: romdump.asm romdump.inc ti73defs.inc defs.inc main.asm \ unlock73.asm packet.asm link.asm linksw.asm data.asm - $(SPASM) $(SPASMFLAGS) -A -DTI73 -I $(srcdir) $(srcdir)/romdump.asm dump73.bin + $(PASMO) $(PASMOFLAGS) -E TI73 -E CALC_FLASH -I $(srcdir) $(srcdir)/romdump.asm dump73_.bin + sed -e "s/\xaa\xaa//g" < dump73_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump73.bin dump82.bin: romdump.asm romdump.inc ti82defs.inc defs.inc main.asm \ packet.asm link.asm linksw.asm display.asm display82.asm data.asm \ font.asm - $(SPASM) $(SPASMFLAGS) -A -DTI82 -I $(srcdir) $(srcdir)/romdump.asm dump82.bin + $(PASMO) $(PASMOFLAGS) -E TI82 -E NEED_DISPLAY_ROUTINES -I $(srcdir) $(srcdir)/romdump.asm dump82_.bin + sed -e "s/\xaa\xaa//g" < dump82_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump82.bin dump83.bin: romdump.asm romdump.inc ti83defs.inc defs.inc main.asm \ packet.asm link.asm linksw.asm data.asm - $(SPASM) $(SPASMFLAGS) -A -DTI83 -I $(srcdir) $(srcdir)/romdump.asm dump83.bin + $(PASMO) $(PASMOFLAGS) -E TI83 -I $(srcdir) $(srcdir)/romdump.asm dump83_.bin + sed -e "s/\xaa\xaa//g" < dump83_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump83.bin dump83p.bin: romdump.asm romdump.inc ti83pdefs.inc defs.inc main.asm \ unlock83p.asm packet.asm link.asm link83p.asm data.asm - $(SPASM) $(SPASMFLAGS) -A -DTI83P -I $(srcdir) $(srcdir)/romdump.asm dump83p.bin + $(PASMO) $(PASMOFLAGS) -E TI83P -E CALC_FLASH -E CALC_LINK_ASSIST -I $(srcdir) $(srcdir)/romdump.asm dump83p_.bin + sed -e "s/\xaa\xaa//g" < dump83p_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump83p.bin dump84pc.bin: romdump.asm romdump.inc ti84pcdefs.inc defs.inc main.asm \ packet.asm link.asm link83p.asm data.asm - $(SPASM) $(SPASMFLAGS) -A -DTI84PC -I $(srcdir) $(srcdir)/romdump.asm dump84pc.bin + $(PASMO) $(PASMOFLAGS) -E TI84PC -E CALC_LINK_ASSIST -I $(srcdir) $(srcdir)/romdump.asm dump84pc_.bin + sed -e "s/\xaa\xaa//g" < dump84pc_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump84pc.bin dump85.bin: romdump.asm romdump.inc ti85defs.inc defs.inc main.asm \ packet.asm link.asm linksw.asm display.asm display85.asm data.asm \ font.asm - $(SPASM) $(SPASMFLAGS) -A -DTI85 -I $(srcdir) $(srcdir)/romdump.asm dump85.bin + $(PASMO) $(PASMOFLAGS) -E TI85 -E NEED_DISPLAY_ROUTINES -I $(srcdir) $(srcdir)/romdump.asm dump85_.bin + sed -e "s/\xaa\xaa//g" < dump85_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump85.bin dump86.bin: romdump.asm romdump.inc ti86defs.inc defs.inc main.asm \ packet.asm link.asm linksw.asm data.asm - $(SPASM) $(SPASMFLAGS) -A -DTI86 -I $(srcdir) $(srcdir)/romdump.asm dump86.bin + $(PASMO) $(PASMOFLAGS) -E TI86 -I $(srcdir) $(srcdir)/romdump.asm dump86_.bin + sed -e "s/\xaa\xaa//g" < dump86_.bin | sed -e "s/\xaa\xe9/\xe9/g" > dump86.bin dump73.73p: dump73.bin $(TIPACK) -n 'ROMDUMP' dump73.bin -p -o dump73.73p diff --git a/libticalcs/trunk/src/romdump_8x/data.asm b/libticalcs/trunk/src/romdump_8x/data.asm index 84395675d..0861bfb8e 100644 --- a/libticalcs/trunk/src/romdump_8x/data.asm +++ b/libticalcs/trunk/src/romdump_8x/data.asm @@ -29,26 +29,26 @@ ErrorString: db "Errors:", 0 KString: db "0K of " - #if CALC_ROM_SIZE == 4096 + if CALC_ROM_SIZE = 4096 db "4096K" ROMSize: dw 0000h, 0040h - #endif + endif - #if CALC_ROM_SIZE == 512 + if CALC_ROM_SIZE = 512 db "512K" ROMSize: dw 0000h, 0008h - #endif + endif - #if CALC_ROM_SIZE == 128 + if CALC_ROM_SIZE = 128 db "128K" ROMSize: dw 0000h, 0002h - #endif + endif - #if CALC_ROM_SIZE == 256 + if CALC_ROM_SIZE = 256 db "256K" ROMSize: dw 0000h, 0004h - #endif + endif - #if CALC_ROM_SIZE == 0 + if CALC_ROM_SIZE = 0 ROMSize: dw 0000h, 0008h - #endif + endif diff --git a/libticalcs/trunk/src/romdump_8x/font.asm b/libticalcs/trunk/src/romdump_8x/font.asm index ff083b845..b03d71674 100644 --- a/libticalcs/trunk/src/romdump_8x/font.asm +++ b/libticalcs/trunk/src/romdump_8x/font.asm @@ -23,390 +23,390 @@ db ' ' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00000000b - db 00000000b - db 00000000b - db 00000000b - db 00000000b + db %00000000 + db %00000000 + db %00000000 + db %00000000 + db %00000000 + db %00000000 + db %00000000 db '.' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00000000b - db 00000000b - db 00000000b - db 00001100b - db 00001100b + db %00000000 + db %00000000 + db %00000000 + db %00000000 + db %00000000 + db %00001100 + db %00001100 db ':' ;;;SPRITE 8x7x1 - db 00000000b - db 00001100b - db 00001100b - db 00000000b - db 00001100b - db 00001100b - db 00000000b + db %00000000 + db %00001100 + db %00001100 + db %00000000 + db %00001100 + db %00001100 + db %00000000 db '[' ;;;SPRITE 8x7x1 - db 00001100b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001100b + db %00001100 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001100 db ']' ;;;SPRITE 8x7x1 - db 00011000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00011000b + db %00011000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00011000 db '0' ;;;SPRITE 8x7x1 - db 00011100b - db 00100010b - db 00100110b - db 00101010b - db 00110010b - db 00100010b - db 00011100b + db %00011100 + db %00100010 + db %00100110 + db %00101010 + db %00110010 + db %00100010 + db %00011100 db '1' ;;;SPRITE 8x7x1 - db 00001000b - db 00011000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00011100b + db %00001000 + db %00011000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00011100 db '2' ;;;SPRITE 8x7x1 - db 00011100b - db 00100010b - db 00000010b - db 00000100b - db 00001000b - db 00010000b - db 00111110b + db %00011100 + db %00100010 + db %00000010 + db %00000100 + db %00001000 + db %00010000 + db %00111110 db '3' ;;;SPRITE 8x7x1 - db 00111110b - db 00000100b - db 00001000b - db 00000100b - db 00000010b - db 00100010b - db 00011100b + db %00111110 + db %00000100 + db %00001000 + db %00000100 + db %00000010 + db %00100010 + db %00011100 db '4' ;;;SPRITE 8x7x1 - db 00000100b - db 00001100b - db 00010100b - db 00100100b - db 00111110b - db 00000100b - db 00000100b + db %00000100 + db %00001100 + db %00010100 + db %00100100 + db %00111110 + db %00000100 + db %00000100 db '5' ;;;SPRITE 8x7x1 - db 00111110b - db 00100000b - db 00111100b - db 00000010b - db 00000010b - db 00100010b - db 00011100b + db %00111110 + db %00100000 + db %00111100 + db %00000010 + db %00000010 + db %00100010 + db %00011100 db '6' ;;;SPRITE 8x7x1 - db 00001100b - db 00010000b - db 00100000b - db 00111100b - db 00100010b - db 00100010b - db 00011100b + db %00001100 + db %00010000 + db %00100000 + db %00111100 + db %00100010 + db %00100010 + db %00011100 db '7' ;;;SPRITE 8x7x1 - db 00111110b - db 00000010b - db 00000100b - db 00001000b - db 00010000b - db 00010000b - db 00010000b + db %00111110 + db %00000010 + db %00000100 + db %00001000 + db %00010000 + db %00010000 + db %00010000 db '8' ;;;SPRITE 8x7x1 - db 00011100b - db 00100010b - db 00100010b - db 00011100b - db 00100010b - db 00100010b - db 00011100b + db %00011100 + db %00100010 + db %00100010 + db %00011100 + db %00100010 + db %00100010 + db %00011100 db '9' ;;;SPRITE 8x7x1 - db 00011100b - db 00100010b - db 00100010b - db 00011110b - db 00000010b - db 00000100b - db 00011000b + db %00011100 + db %00100010 + db %00100010 + db %00011110 + db %00000010 + db %00000100 + db %00011000 db 'D' ;;;SPRITE 8x7x1 - db 00111100b - db 00100010b - db 00100010b - db 00100010b - db 00100010b - db 00100010b - db 00111100b + db %00111100 + db %00100010 + db %00100010 + db %00100010 + db %00100010 + db %00100010 + db %00111100 db 'E' ;;;SPRITE 8x7x1 - db 00111110b - db 00100000b - db 00100000b - db 00111100b - db 00100000b - db 00100000b - db 00111110b + db %00111110 + db %00100000 + db %00100000 + db %00111100 + db %00100000 + db %00100000 + db %00111110 db 'I' ;;;SPRITE 8x7x1 - db 00011100b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00011100b + db %00011100 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00011100 db 'K' ;;;SPRITE 8x7x1 - db 00100010b - db 00100100b - db 00101000b - db 00110000b - db 00101000b - db 00100100b - db 00100010b + db %00100010 + db %00100100 + db %00101000 + db %00110000 + db %00101000 + db %00100100 + db %00100010 db 'M' ;;;SPRITE 8x7x1 - db 00100010b - db 00110110b - db 00101010b - db 00101010b - db 00100010b - db 00100010b - db 00100010b + db %00100010 + db %00110110 + db %00101010 + db %00101010 + db %00100010 + db %00100010 + db %00100010 db 'O' ;;;SPRITE 8x7x1 - db 00011100b - db 00100010b - db 00100010b - db 00100010b - db 00100010b - db 00100010b - db 00011100b + db %00011100 + db %00100010 + db %00100010 + db %00100010 + db %00100010 + db %00100010 + db %00011100 db 'R' ;;;SPRITE 8x7x1 - db 00111100b - db 00100010b - db 00100010b - db 00111100b - db 00101000b - db 00100100b - db 00100010b + db %00111100 + db %00100010 + db %00100010 + db %00111100 + db %00101000 + db %00100100 + db %00100010 db 'T' ;;;SPRITE 8x7x1 - db 00111110b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b + db %00111110 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 db 'X' ;;;SPRITE 8x7x1 - db 00100010b - db 00100010b - db 00010100b - db 00001000b - db 00010100b - db 00100010b - db 00100010b + db %00100010 + db %00100010 + db %00010100 + db %00001000 + db %00010100 + db %00100010 + db %00100010 db 'a' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00011100b - db 00000010b - db 00011110b - db 00100010b - db 00011110b + db %00000000 + db %00000000 + db %00011100 + db %00000010 + db %00011110 + db %00100010 + db %00011110 db 'c' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00011100b - db 00100000b - db 00100000b - db 00100010b - db 00011100b + db %00000000 + db %00000000 + db %00011100 + db %00100000 + db %00100000 + db %00100010 + db %00011100 db 'e' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00011100b - db 00100010b - db 00111110b - db 00100000b - db 00011100b + db %00000000 + db %00000000 + db %00011100 + db %00100010 + db %00111110 + db %00100000 + db %00011100 db 'f' ;;;SPRITE 8x7x1 - db 00001100b - db 00010010b - db 00010000b - db 00111000b - db 00010000b - db 00010000b - db 00010000b + db %00001100 + db %00010010 + db %00010000 + db %00111000 + db %00010000 + db %00010000 + db %00010000 db 'g' ;;;SPRITE 8x7x1 - db 00000000b - db 00011110b - db 00100010b - db 00100010b - db 00011110b - db 00000010b - db 00011100b + db %00000000 + db %00011110 + db %00100010 + db %00100010 + db %00011110 + db %00000010 + db %00011100 db 'i' ;;;SPRITE 8x7x1 - db 00001000b - db 00000000b - db 00011000b - db 00001000b - db 00001000b - db 00001000b - db 00011100b + db %00001000 + db %00000000 + db %00011000 + db %00001000 + db %00001000 + db %00001000 + db %00011100 db 'l' ;;;SPRITE 8x7x1 - db 00011000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00001000b - db 00011100b + db %00011000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00001000 + db %00011100 db 'm' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00110100b - db 00101010b - db 00101010b - db 00100010b - db 00100010b + db %00000000 + db %00000000 + db %00110100 + db %00101010 + db %00101010 + db %00100010 + db %00100010 db 'n' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00101100b - db 00110010b - db 00100010b - db 00100010b - db 00100010b + db %00000000 + db %00000000 + db %00101100 + db %00110010 + db %00100010 + db %00100010 + db %00100010 db 'o' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00011100b - db 00100010b - db 00100010b - db 00100010b - db 00011100b + db %00000000 + db %00000000 + db %00011100 + db %00100010 + db %00100010 + db %00100010 + db %00011100 db 'p' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00111100b - db 00100010b - db 00111100b - db 00100000b - db 00100000b + db %00000000 + db %00000000 + db %00111100 + db %00100010 + db %00111100 + db %00100000 + db %00100000 db 'r' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00101100b - db 00110010b - db 00100000b - db 00100000b - db 00100000b + db %00000000 + db %00000000 + db %00101100 + db %00110010 + db %00100000 + db %00100000 + db %00100000 db 's' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00011100b - db 00100000b - db 00011100b - db 00000010b - db 00111100b + db %00000000 + db %00000000 + db %00011100 + db %00100000 + db %00011100 + db %00000010 + db %00111100 db 't' ;;;SPRITE 8x7x1 - db 00010000b - db 00010000b - db 00111000b - db 00010000b - db 00010000b - db 00010010b - db 00001100b + db %00010000 + db %00010000 + db %00111000 + db %00010000 + db %00010000 + db %00010010 + db %00001100 db 'u' ;;;SPRITE 8x7x1 - db 00000000b - db 00000000b - db 00100010b - db 00100010b - db 00100010b - db 00100110b - db 00011010b + db %00000000 + db %00000000 + db %00100010 + db %00100010 + db %00100010 + db %00100110 + db %00011010 diff --git a/libticalcs/trunk/src/romdump_8x/link.asm b/libticalcs/trunk/src/romdump_8x/link.asm index 81b316fea..f22743e13 100644 --- a/libticalcs/trunk/src/romdump_8x/link.asm +++ b/libticalcs/trunk/src/romdump_8x/link.asm @@ -43,12 +43,12 @@ LinkSendBC: ret z dec bc push bc - #ifdef TI83 + if defined TI83 in a, (linkPort) and 10h or LINK_RESET push af - #endif + endif ld a, (de) inc de ld c, a @@ -59,11 +59,11 @@ LinkSendBC: call LinkPutByte pop hl pop de - #ifdef TI83 + if defined TI83 pop bc ld c, linkPort out (c), b - #endif + endif pop bc ret c jr LinkSendBC @@ -85,12 +85,12 @@ LinkSendBC: ;; - AF, BC, DE LinkReceiveB: - #ifdef TI83 + if defined TI83 in a, (linkPort) and 10h or LINK_RESET ld c, a - #endif + endif LinkReceiveB_Loop: push bc push hl @@ -110,10 +110,10 @@ LinkReceiveB_Loop: push bc LinkReceiveB_Error: pop bc - #ifdef TI83 + if defined TI83 ld a, c out (linkPort), a - #endif + endif ret ;; LinkError: @@ -127,27 +127,27 @@ LinkReceiveB_Error: LinkError: ld b, 255 push af - #ifdef CALC_LINK_ASSIST + if defined CALC_LINK_ASSIST in a, (2) and 80h out (8), a - #endif - #ifdef TI83 + endif + if defined TI83 in a, (linkPort) and 10h or LINK_RESET - #else + else ld a, LINK_RESET - #endif + endif out (linkPort), a LinkDelay_Loop: ei halt halt djnz LinkDelay_Loop - #ifdef CALC_LINK_ASSIST + if defined CALC_LINK_ASSIST xor a out (8), a - #endif + endif pop af ret diff --git a/libticalcs/trunk/src/romdump_8x/link83p.asm b/libticalcs/trunk/src/romdump_8x/link83p.asm index b37be2232..c0c8f0838 100644 --- a/libticalcs/trunk/src/romdump_8x/link83p.asm +++ b/libticalcs/trunk/src/romdump_8x/link83p.asm @@ -37,11 +37,11 @@ CheckLinkActivity: cpl and 3 ret nz - #ifndef TI84PC + if ! defined TI84PC in a, (2) and 80h ret z - #endif + endif in a, (9) and 18h ret diff --git a/libticalcs/trunk/src/romdump_8x/linksw.asm b/libticalcs/trunk/src/romdump_8x/linksw.asm index 9d69512a8..8277a333d 100644 --- a/libticalcs/trunk/src/romdump_8x/linksw.asm +++ b/libticalcs/trunk/src/romdump_8x/linksw.asm @@ -23,17 +23,29 @@ BIT_TIMEOUT equ 65535 -#ifndef TI82 - -#define LD_A_LINK_D0L ld a, LINK_D0L -#define LD_A_LINK_D1L ld a, LINK_D1L -#define AND_LINK_STATUS_MASK and LINK_STATUS_MASK - -#else ; TI82 - -#define LD_A_LINK_D0L ld a, (linkD0L) -#define LD_A_LINK_D1L ld a, (linkD1L) -#define AND_LINK_STATUS_MASK call AndLinkStatusMask +if ! defined TI82 + +macro LD_A_LINK_D0L + ld a, LINK_D0L +endm +macro LD_A_LINK_D1L + ld a, LINK_D1L +endm +macro AND_LINK_STATUS_MASK + and LINK_STATUS_MASK +endm + +else ; TI82 + +macro LD_A_LINK_D0L + ld a, (linkD0L) +endm +macro LD_A_LINK_D1L + ld a, (linkD1L) +endm +macro AND_LINK_STATUS_MASK + call AndLinkStatusMask +endm LINK_STATUS_MASK equ 0 @@ -67,7 +79,7 @@ InitializeLink_Old: ld (linkD0L), hl ret -#endif ; TI82 +endif ; TI82 ;; CheckLinkActivity: ;; diff --git a/libticalcs/trunk/src/romdump_8x/main.asm b/libticalcs/trunk/src/romdump_8x/main.asm index d0efa711b..8615dc663 100644 --- a/libticalcs/trunk/src/romdump_8x/main.asm +++ b/libticalcs/trunk/src/romdump_8x/main.asm @@ -25,32 +25,32 @@ Main: res apdRunning, (iy + apdFlags) in a, (memPort) ld (defaultMemPage), a - #ifdef TI83 + if defined TI83 in a, (linkPort) and 10h or LINK_RESET ld (defaultLinkState), a - #endif - #ifdef TI84PC + endif + if defined TI84PC in a, (memExtPort) ld (defaultMemExt), a - #endif + endif - #ifdef TI82 + if defined TI82 call InitializeLink - #endif + endif - #ifdef CALC_USB + if defined CALC_USB call InitializeUSB - #endif + endif - #ifdef CALC_FLASH + if defined CALC_FLASH call Unlock ld a, (defaultMemPage) out (memPort), a - #endif + endif - #ifdef TI83P + if defined TI83P in a, (2) add a, a jr nc, Main_83PlusBE @@ -64,7 +64,7 @@ Main: Main_84PlusBE: ld (ROMSize + 2), a Main_83PlusBE: - #endif + endif ld hl, 0 ld (errorCount), hl @@ -148,14 +148,14 @@ Received_3: ld (curRow), hl ld hl, KString PUT_STRING - #ifdef TI83P + if defined TI83P ld hl, (ROMSize + 1) srl h srl h PUT_DECIMAL ld a, 'K' PUT_CHAR - #endif + endif MainLoop_: jr MainLoop @@ -171,9 +171,9 @@ Main_Error: inc hl ld (errorCount), hl PUT_DECIMAL - #ifndef USB + if ! defined USB call LinkError - #endif + endif MainLoop__: jr MainLoop_ @@ -220,14 +220,14 @@ BlockRequest_SetPacket: call SendPacket ;; Restore original memory page - #ifdef TI83 + if defined TI83 ld a, (defaultLinkState) out (linkPort), a - #endif - #ifdef TI84PC + endif + if defined TI84PC ld a,(defaultMemExt) out (memExtPort), a - #endif + endif ld a, (defaultMemPage) out (memPort), a diff --git a/libticalcs/trunk/src/romdump_8x/romdump.asm b/libticalcs/trunk/src/romdump_8x/romdump.asm index 0ad38b48a..5427a66a2 100644 --- a/libticalcs/trunk/src/romdump_8x/romdump.asm +++ b/libticalcs/trunk/src/romdump_8x/romdump.asm @@ -21,28 +21,28 @@ ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#define equ .equ -#define org .org -#define rorg .org -#define db .db -#define dw .dw +;;.define equ .equ +;.define org .org +;.define rorg .org +;.define db .db +;.define dw .dw -#include "romdump.inc" +include "romdump.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-73 ;;; -#ifdef TI73 +if defined TI73 ;;; This program can be launched from the home screen. -#include "ti73defs.inc" +include "ti73defs.inc" -#define safe_mem appBackUpScreen -#define fixed_exec saveSScreen -#define fixed_size_limit 768 +safe_mem equ appBackUpScreen +fixed_exec equ saveSScreen +fixed_size_limit equ 768 ;; BASIC code to launch assembly stub db "_00001005?" @@ -58,26 +58,26 @@ start: ld bc, 3FD5h res remoteKeyPress, (iy + remoteKeyFlag) -#endif ; TI73 +endif ; TI73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-82 ;;; -#ifdef TI82 +if defined TI82 ;;; This program is launched using a buffer overflow, which jumps ;;; directly to 'start', with HL equal to the address of 'start' and ;;; SP = (onSP). -#include "ti82defs.inc" +include "ti82defs.inc" -#define NEED_DISPLAY_ROUTINES +;#define NEED_DISPLAY_ROUTINES -#define safe_mem saveSScreen -#define fixed_exec (saveSScreen + 128) -#define fixed_size_limit 640 +safe_mem equ saveSScreen +fixed_exec equ (saveSScreen + 128) +fixed_size_limit equ 640 start: ld de, fixed_code - start @@ -112,7 +112,7 @@ start: xor (hl) inc hl xor (hl) - cp 3Eh ^ cxError ^ 0CDh + cp 3Eh xor cxError xor 0CDh jr nz, exit_error ld a, cxCmd jp (hl) @@ -129,22 +129,22 @@ exit_error: ld (errNo), a ret -#endif ; TI82 +endif ; TI82 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-83 / TI-82 STATS / TI-76.fr ;;; -#ifdef TI83 +if defined TI83 ;;; This program can be launched using the command "Send(9prgmROMDUMP". -#include "ti83defs.inc" +include "ti83defs.inc" -#define safe_mem saveSScreen -#define fixed_exec saveSScreen + 128 -#define fixed_size_limit 640 +safe_mem equ saveSScreen +fixed_exec equ saveSScreen + 128 +fixed_size_limit equ 640 db "CD2644" ; call _FindProgSym db "211900" ; ld hl, 25 @@ -160,20 +160,20 @@ start: ld bc, fixed_code_size ldir -#endif ; TI83 +endif ; TI83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-83 Plus / TI-84 Plus ;;; -#ifdef TI83P +if defined TI83P ;;; This program can be launched using the command "Asm(prgmROMDUMP". -#include "ti83pdefs.inc" +include "ti83pdefs.inc" -#define safe_mem saveSScreen +safe_mem equ saveSScreen ;; Header for Asm( org 9d93h @@ -186,20 +186,20 @@ start: res remoteKeyPress, (iy + remoteKeyFlag) -#endif ; TI83P +endif ; TI83P ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-84 Plus C ;;; -#ifdef TI84PC +if defined TI84PC ;;; This program can be launched using the command "Asm(prgmROMDUMP". -#include "ti84pcdefs.inc" +include "ti84pcdefs.inc" -#define safe_mem saveSScreen +safe_mem equ saveSScreen ;; Header for Asm( org 0A609h @@ -211,26 +211,26 @@ start: res appTextSave, (iy + appFlags) res remoteKeyPress, (iy + remoteKeyFlag) -#endif ; TI84PC +endif ; TI84PC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-85 ;;; -#ifdef TI85 +if defined TI85 ;;; This program is launched using a buffer overflow, which jumps ;;; directly to 'start', with HL equal to the address of 'start' and ;;; SP = (onSP). -#include "ti85defs.inc" +include "ti85defs.inc" -#define NEED_DISPLAY_ROUTINES +;#define NEED_DISPLAY_ROUTINES -#define safe_mem plotSScreen -#define fixed_exec plotSScreen + 128 -#define fixed_size_limit 896 +safe_mem equ plotSScreen +fixed_exec equ plotSScreen + 128 +fixed_size_limit equ 896 start: ld de, fixed_code - start @@ -262,20 +262,20 @@ start: ld (errNo), a ret -#endif ; TI85 +endif ; TI85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; TI-86 ;;; -#ifdef TI86 +if defined TI86 -#include "ti86defs.inc" +include "ti86defs.inc" ;;; This program can be launched using the command "Asm(ROMDump". -#define safe_mem 9000h +safe_mem equ 9000h ;; Header for Asm( org 0D746h @@ -283,71 +283,71 @@ start: res remoteKeyPress, (iy + remoteKeyFlag) -#endif ; TI86 +endif ; TI86 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Main program ;;; -#include "defs.inc" -#include "main.asm" +include "defs.inc" +include "main.asm" fixed_code: -#ifdef fixed_exec - rorg fixed_exec -#endif +if defined fixed_exec + org fixed_exec +endif CallHL: jp (hl) -#ifdef TI73 - #include "unlock73.asm" -#endif - -#ifdef TI83P - #include "unlock83p.asm" -#endif - -#include "packet.asm" - -#ifdef USB - #include "usb.asm" -#else - #include "link.asm" - #ifdef TI83P - #include "link83p.asm" - #else - #ifdef TI84PC - #include "link83p.asm" - #else - #include "linksw.asm" - #endif - #endif -#endif - -#ifdef NEED_DISPLAY_ROUTINES - #include "display.asm" - #ifdef TI82 - #include "display82.asm" - #else - #include "display85.asm" - #endif -#endif - -#include "data.asm" - -#ifdef fixed_exec +if defined TI73 + include "unlock73.asm" +endif + +if defined TI83P + include "unlock83p.asm" +endif + +include "packet.asm" + +if defined USB && USB != 0 + ;include "usb.asm" +else + include "link.asm" + if defined TI83P + include "link83p.asm" + else + if defined TI84PC + include "link83p.asm" + else + include "linksw.asm" + endif + endif +endif + +if defined NEED_DISPLAY_ROUTINES + include "display.asm" + if defined TI82 + include "display82.asm" + else + include "display85.asm" + endif +endif + +include "data.asm" + +if defined fixed_exec fixed_code_size equ $ - fixed_exec - #if (fixed_code_size > fixed_size_limit) - #error "Fixed code section too large" - #endif -#endif + if (fixed_code_size > fixed_size_limit) + error "Fixed code section too large" + endif +endif -#ifdef NEED_DISPLAY_ROUTINES - #include "font.asm" -#endif +if defined NEED_DISPLAY_ROUTINES + include "font.asm" +endif -#ifdef TI83 +if defined TI83 db 0D4h, "?0000?", 0D4h -#endif +endif diff --git a/libticalcs/trunk/src/romdump_8x/romdump.inc b/libticalcs/trunk/src/romdump_8x/romdump.inc index 01efc676e..45e4e20b5 100644 --- a/libticalcs/trunk/src/romdump_8x/romdump.inc +++ b/libticalcs/trunk/src/romdump_8x/romdump.inc @@ -21,15 +21,15 @@ ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -CMD_PING .equ 0AA55h -CMD_NOK .equ 0 -CMD_OK .equ 1 -CMD_EOT .equ 2 -CMD_SIZE .equ 3 -CMD_RETRY .equ 4 -CMD_REQ .equ 5 -CMD_DATA .equ 6 -CMD_REPEAT .equ 7 +CMD_PING equ 0AA55h +CMD_NOK equ 0 +CMD_OK equ 1 +CMD_EOT equ 2 +CMD_SIZE equ 3 +CMD_RETRY equ 4 +CMD_REQ equ 5 +CMD_DATA equ 6 +CMD_REPEAT equ 7 -BLOCK_SIZE .equ 1024 -TIMEOUT .equ 65535 +BLOCK_SIZE equ 1024 +TIMEOUT equ 65535 diff --git a/libticalcs/trunk/src/romdump_8x/ti73defs.inc b/libticalcs/trunk/src/romdump_8x/ti73defs.inc index e9f41d938..2776292ab 100644 --- a/libticalcs/trunk/src/romdump_8x/ti73defs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti73defs.inc @@ -63,19 +63,37 @@ _RunIndicOff equ 44D7h ;;; Macros -.addinstr B_CALL * EF 3 NOP 1 - -#define CLEAR_LCD B_CALL _ClrScrnFull -#define GET_CSC B_CALL _GetCSC -#define PUT_CHAR B_CALL _PutC -#define PUT_DECIMAL B_CALL _DispHL -#define PUT_STRING B_CALL _PutS -#define RUN_INDIC_OFF B_CALL _RunIndicOff -#define SET_ROM_PAGE out (memPort), a - -#define EXIT_KEY_STR db 0C1h, "MODE]" +macro B_CALL, arg + db 0EFh + dw arg +endm + +macro CLEAR_LCD + B_CALL _ClrScrnFull +endm +macro GET_CSC + B_CALL _GetCSC +endm +macro PUT_CHAR + B_CALL _PutC +endm +macro PUT_DECIMAL + B_CALL _DispHL +endm +macro PUT_STRING + B_CALL _PutS +endm +macro RUN_INDIC_OFF + B_CALL _RunIndicOff +endm +macro SET_ROM_PAGE + out (memPort), a +endm + +macro EXIT_KEY_STR + db 0C1h, "MODE]" +endm ;;; Miscellaneous -#define CALC_FLASH -#define CALC_ROM_SIZE 512 +CALC_ROM_SIZE equ 512 diff --git a/libticalcs/trunk/src/romdump_8x/ti82defs.inc b/libticalcs/trunk/src/romdump_8x/ti82defs.inc index d478e2be9..93132a831 100644 --- a/libticalcs/trunk/src/romdump_8x/ti82defs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti82defs.inc @@ -58,17 +58,38 @@ cxError equ 52h ;;; Macros -#define CLEAR_LCD call ClearLCD -#define PUT_CHAR call PutC -#define PUT_DECIMAL call DispHL -#define PUT_STRING call PutS - -#define GET_CSC di \ ld hl, kbdScanCode \ ld a, (hl) \ ld (hl), 0 -#define RUN_INDIC_OFF res indicRun, (iy + indicFlags) -#define SET_ROM_PAGE and 7 \ or 88h \ out (memPort), a - -#define EXIT_KEY_STR db "[MODE]" +macro CLEAR_LCD + call ClearLCD +endm +macro PUT_CHAR + call PutC +endm +macro PUT_DECIMAL + call DispHL +endm +macro PUT_STRING + call PutS +endm + +macro GET_CSC + di + ld hl, kbdScanCode + ld a, (hl) + ld (hl), 0 +endm +macro RUN_INDIC_OFF + res indicRun, (iy + indicFlags) +endm +macro SET_ROM_PAGE + and 7 + or 88h + out (memPort), a +endm + +macro EXIT_KEY_STR + db "[MODE]" +endm ;;; Miscellaneous -#define CALC_ROM_SIZE 128 +CALC_ROM_SIZE equ 128 diff --git a/libticalcs/trunk/src/romdump_8x/ti83defs.inc b/libticalcs/trunk/src/romdump_8x/ti83defs.inc index 765430d5a..315cbf8f4 100644 --- a/libticalcs/trunk/src/romdump_8x/ti83defs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti83defs.inc @@ -55,17 +55,41 @@ _RunIndicOff equ 4795h ;;; Macros -#define CLEAR_LCD call _ClrScrnFull -#define GET_CSC call _GetCSC -#define PUT_CHAR call _PutC -#define PUT_DECIMAL call _DispHL -#define PUT_STRING call _PutS -#define RUN_INDIC_OFF call _RunIndicOff - -#define SET_ROM_PAGE push af \ and 8 \ rlca \ or LINK_RESET \ out (linkPort), a \ pop af \ and 7 \ or 88h \ out (2), a - -#define EXIT_KEY_STR db 0C1h, "MODE]" +macro CLEAR_LCD + call _ClrScrnFull +endm +macro GET_CSC + call _GetCSC +endm +macro PUT_CHAR + call _PutC +endm +macro PUT_DECIMAL + call _DispHL +endm +macro PUT_STRING + call _PutS +endm +macro RUN_INDIC_OFF + call _RunIndicOff +endm + +macro SET_ROM_PAGE + push af + and 8 + rlca + or LINK_RESET + out (linkPort), a + pop af + and 7 + or 88h + out (2), a +endm + +macro EXIT_KEY_STR + db 0C1h, "MODE]" +endm ;;; Miscellaneous -#define CALC_ROM_SIZE 256 +CALC_ROM_SIZE equ 256 diff --git a/libticalcs/trunk/src/romdump_8x/ti83pdefs.inc b/libticalcs/trunk/src/romdump_8x/ti83pdefs.inc index b41a074b3..a37645814 100644 --- a/libticalcs/trunk/src/romdump_8x/ti83pdefs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti83pdefs.inc @@ -75,20 +75,37 @@ _WriteAByteSafe equ 80C6h ;;; Macros -.addinstr B_CALL * EF 3 NOP 1 - -#define CLEAR_LCD B_CALL _ClrScrnFull -#define GET_CSC B_CALL _GetCSC -#define PUT_CHAR B_CALL _PutC -#define PUT_DECIMAL B_CALL _DispHL -#define PUT_STRING B_CALL _PutS -#define RUN_INDIC_OFF B_CALL _RunIndicOff -#define SET_ROM_PAGE out (memPort), a - -#define EXIT_KEY_STR db 0C1h, "MODE]" +macro B_CALL, arg + db 0EFh + dw arg +endm + +macro CLEAR_LCD + B_CALL _ClrScrnFull +endm +macro GET_CSC + B_CALL _GetCSC +endm +macro PUT_CHAR + B_CALL _PutC +endm +macro PUT_DECIMAL + B_CALL _DispHL +endm +macro PUT_STRING + B_CALL _PutS +endm +macro RUN_INDIC_OFF + B_CALL _RunIndicOff +endm +macro SET_ROM_PAGE + out (memPort), a +endm + +macro EXIT_KEY_STR + db 0C1h, "MODE]" +endm ;;; Miscellaneous -#define CALC_FLASH -#define CALC_LINK_ASSIST -#define CALC_ROM_SIZE 0 +CALC_ROM_SIZE equ 0 diff --git a/libticalcs/trunk/src/romdump_8x/ti84pcdefs.inc b/libticalcs/trunk/src/romdump_8x/ti84pcdefs.inc index e700a6f22..dee87ce93 100644 --- a/libticalcs/trunk/src/romdump_8x/ti84pcdefs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti84pcdefs.inc @@ -66,19 +66,40 @@ _SendAByte equ 4ECAh ;;; Macros -.addinstr B_CALL * EF 3 NOP 1 - -#define CLEAR_LCD B_CALL _ClrScrnFull -#define GET_CSC B_CALL _GetCSC -#define PUT_CHAR B_CALL _PutC -#define PUT_DECIMAL B_CALL _DispHL -#define PUT_STRING B_CALL _PutS -#define RUN_INDIC_OFF B_CALL _RunIndicOff -#define SET_ROM_PAGE rlca \ out (memExtPort), a \ srl a \ out (memPort), a - -#define EXIT_KEY_STR db 0C1h, "MODE]" +macro B_CALL, arg + db 0EFh + dw arg +endm + +macro CLEAR_LCD + B_CALL _ClrScrnFull +endm +macro GET_CSC + B_CALL _GetCSC +endm +macro PUT_CHAR + B_CALL _PutC +endm +macro PUT_DECIMAL + B_CALL _DispHL +endm +macro PUT_STRING + B_CALL _PutS +endm +macro RUN_INDIC_OFF + B_CALL _RunIndicOff +endm +macro SET_ROM_PAGE + rlca + out (memExtPort), a + srl a + out (memPort), a +endm + +macro EXIT_KEY_STR + db 0C1h, "MODE]" +endm ;;; Miscellaneous -#define CALC_LINK_ASSIST -#define CALC_ROM_SIZE 4096 +CALC_ROM_SIZE equ 4096 diff --git a/libticalcs/trunk/src/romdump_8x/ti85defs.inc b/libticalcs/trunk/src/romdump_8x/ti85defs.inc index 753eaf94c..6743068cb 100644 --- a/libticalcs/trunk/src/romdump_8x/ti85defs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti85defs.inc @@ -56,17 +56,36 @@ indicRun equ 0 ;;; Macros -#define CLEAR_LCD call ClearLCD -#define PUT_CHAR call PutC -#define PUT_DECIMAL call DispHL -#define PUT_STRING call PutS - -#define GET_CSC di \ ld hl, kbdScanCode \ ld a, (hl) \ ld (hl), 0 -#define RUN_INDIC_OFF res indicRun, (iy + indicFlags) -#define SET_ROM_PAGE out (memPort), a - -#define EXIT_KEY_STR db "[EXIT]" +macro CLEAR_LCD + call ClearLCD +endm +macro PUT_CHAR + call PutC +endm +macro PUT_DECIMAL + call DispHL +endm +macro PUT_STRING + call PutS +endm + +macro GET_CSC + di + ld hl, kbdScanCode + ld a, (hl) + ld (hl), 0 +endm +macro RUN_INDIC_OFF + res indicRun, (iy + indicFlags) +endm +macro SET_ROM_PAGE + out (memPort), a +endm + +macro EXIT_KEY_STR + db "[EXIT]" +endm ;;; Miscellaneous -#define CALC_ROM_SIZE 128 +CALC_ROM_SIZE equ 128 diff --git a/libticalcs/trunk/src/romdump_8x/ti86defs.inc b/libticalcs/trunk/src/romdump_8x/ti86defs.inc index 247a7f556..b64d585fe 100644 --- a/libticalcs/trunk/src/romdump_8x/ti86defs.inc +++ b/libticalcs/trunk/src/romdump_8x/ti86defs.inc @@ -57,18 +57,35 @@ _runindicoff equ 4AB1h ;;; Macros -#define CLEAR_LCD call _clrScrn -#define GET_CSC call _get_key -#define PUT_CHAR call _putc -#define PUT_DECIMAL xor a \ call _dispAHL -#define PUT_STRING call _puts -#define RUN_INDIC_OFF call _runindicoff - -#define SET_ROM_PAGE out (memPort), a - -#define EXIT_KEY_STR db "[EXIT]" +macro CLEAR_LCD + call _clrScrn +endm +macro GET_CSC + call _get_key +endm +macro PUT_CHAR + call _putc +endm +macro PUT_DECIMAL + xor a + call _dispAHL +endm +macro PUT_STRING + call _puts +endm +macro RUN_INDIC_OFF + call _runindicoff +endm + +macro SET_ROM_PAGE + out (memPort), a +endm + +macro EXIT_KEY_STR + db "[EXIT]" +endm ;;; Miscellaneous -#define CALC_ROM_SIZE 256 +CALC_ROM_SIZE equ 256