gp2000
Experienced Member
Here's a bit of code I wrote which does something entirely useless. It's for a Model 4 though only because it's the only TRS-80 where you can change the memory map to all RAM.
Can you figure out what it does? Can you figure out the benefit of the excess code?
Can you figure out what it does? Can you figure out the benefit of the excess code?
Code:
org $8082
start: di
ld bc,$384
out (c),b ; make all memory RAM
ld h,a
ld l,a
ld b,a
cp $cd
jr z,iscall
cp $34
jr z,idhl
cp $35
jr nz,notid
idhl: ld sp,hl
pop de
ld de,$e9d5
inc sp
push de
ld d,e
jr cont
notid: and $c7
cp $c7
jr nz,norst
inc hl
inc hl
iscall: dec hl
dec hl
dec hl
dec hl
norst: ld sp,hl
pop de
ld de,$e9d5
cont: push de
ld a,b
and 8
add $f8
sbc a,a
cpl
and $f5
ld c,a
push bc
pop af
ld c,a
ld d,a
ld e,a
jp (hl)
end start