diff --git a/src/cesium.asm b/src/cesium.asm index e56b580..1306f13 100644 --- a/src/cesium.asm +++ b/src/cesium.asm @@ -27,7 +27,7 @@ ; POSSIBILITY OF SUCH DAMAGE. cesium_name := 'Cesium' -cesium_version := '3.5.1' +cesium_version := '3.6.0' cesium_copyright := '(C) 2015-2021 Matt Waltz' include 'include/macros.inc' diff --git a/src/ports.asm b/src/ports.asm index 92a544c..acb9f9a 100644 --- a/src/ports.asm +++ b/src/ports.asm @@ -26,89 +26,65 @@ ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ; POSSIBILITY OF SUCH DAMAGE. -os_num = 0 - -macro ports? v, lock, unlock - match major.mid.minor.build, v - db major, mid, minor - dl build - end match - dl lock - dl unlock - os_num = os_num + 1 -end macro - -os_table: - ports 5.6.1.0012, port_os560.lock, port_os561.unlock - ports 5.6.0.0020, port_os560.lock, port_os560.unlock - ports 5.5.5.0011, port_os560.lock, port_os555.unlock - ports 5.5.2.0044, port_os560.lock, port_os552.unlock - ports 5.5.1.0038, port_os560.lock, port_os551.unlock - port_setup: di - call $21ED4 + ld b,1 + or a,a + sbc hl,hl +.find: + ld a,(hl) + inc hl + cp a,$80 + jq z,.found_80 + cp a,$ed + jq nz,.find + ld a,(hl) + sub a,$41 + jq z,.found_ed41 + cp a,$73 + jq nz,.find + dec b + dec hl + ld (port_new.target),hl + inc hl + jq .find +.found_80: + ld a,(hl) + cp a,$0f + jq nz,.find + and a,b + ret nz + ld hl,port_new.unlock + jq .store_smc +.found_ed41: + dec hl + ld (port_old.target),hl + inc hl push hl pop ix - lea de,ix + 6 - ld a,(de) - cp a,5 - jq nz,.invalid_os - inc de - ld a,(de) - cp a,5 - jq c,.ospre55 - dec de - ld b,os_num - ld ix,os_table -.find: - lea hl,ix - push de,bc - ld b,6 - call ti.StrCmpre - pop bc,de - jq z,.found - lea ix,ix + 12 - djnz .find -.invalid_os: - inc a - ret -.found: - ld de,(ix + 6) - ld hl,(ix + 9) + bit 0,(ix+4) + jq nz,.find + ld hl,port_old.unlock .store_smc: ld (port_unlock.code),hl - ld (port_lock.code),de - xor a,a ret -.ospre55: - ld hl,port_ospre55.unlock - ld de,port_ospre55.lock - jq .store_smc -port_ospre55: +port_old: .unlock: - ld bc,$24 + call .unlockhelper +.unlockfinish: ld a,$8c - call .write - ld bc,$06 - call .read + out0 ($24),a + in0 a,($06) or a,4 - call .write - ld bc,$28 - ld a,$4 - jq .write -.lock: - ld bc,$28 - xor a,a - call .write - ld bc,$06 - call .read - res 2,a - call .write - ld bc,$24 - ld a,$88 - jq .write + out0 ($06),a + ret +.unlockhelper: + call ti._frameset0 + push de + ld bc,$0022 + jp 0 +.target := $-3 .write: ld de,$c979ed ld hl,ti.heapBot - 3 @@ -120,59 +96,34 @@ port_ospre55: ld (hl),de jp (hl) -port_os555: +port_new: .unlock: - ld ix,$b96df - jq port_os560.unlock0 - -port_os552: -.unlock: - ld ix,$bd573 - jq port_os560.unlock0 - -port_os551: -.unlock: - ld ix,$bd55f - jq port_os560.unlock0 - -port_os561: -.unlock: - ld ix,$4a5ac - ld hl,port_os560.unlockhelper - push hl + ld de,$d19881 + push de + or a,a + sbc hl,hl push hl - ld de,ti.flags + ld de,$03d1 push de - ld bc,$22 - ld a,(ix) - cp a,$ed - jr z,.84 -.83: - ld ixl,$8f -.84: - xor a,a - jp (ix) - -port_os560: -.unlock: - ld ix,$b99bb -.unlock0: - ld hl,.unlockhelper push hl - ld hl,$d09466 + call .unlockhelper + ld hl,12 + add hl,sp + ld sp,hl + jq port_old.unlockfinish +.unlockhelper: + push hl + ex (sp),ix + add ix,sp push hl push de - xor a,a - jp (ix) -.unlockhelper: - ld a,$8c - out0 ($24),a - in0 a,($06) - or a,$04 - out0 ($06),a - ld a,$04 - out0 ($28),a - ret + ld de,$887c00 + push de + ld bc,$10de + ld de,$0f22 + add hl,sp + jp 0 +.target := $-3 .lock: xor a,a out0 ($28),a @@ -187,12 +138,12 @@ port_os560: port_read: push de,bc,hl - call port_ospre55.read + call port_old.read jq port_lock.pop port_write: push de,bc,hl - call port_ospre55.write + call port_old.write jq port_lock.pop port_unlock: @@ -203,8 +154,7 @@ port_unlock: port_lock: push de,bc,hl - call 0 -.code := $-3 + call port_new.lock .pop: pop hl,bc,de ret