Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 3092

programming • Re: 11-character filenames?

$
0
0
Here, this should do X-calls on Z80. Untested!!!! Needs a bit of work to allow Carry to be returned.

Code:

   BRKV=&FFFA:FAULT=&FF82      \ xos_call - call inline address, catching any returned error   \ ===========================================================   \ Called with   \   CALL xos_call   \   DEFW dest   \ On entry, registers = entry parameters   \ On exit,  V clear - no error, registers hold return parameters   \           V set   - error, A=ERR, HL=>error block   \   .xos_call   LD (tempHL),HL                    ; SP=>mainline, save HL   POP HL:PUSH DE                    ; SP=>DE,   HL=mainline   LD E,(HL):INC HL:LD D,(HL):INC HL ; DE=dest,  HL=mainline+2   EX (SP),HL:EX DE,HL:PUSH HL       ; SP=>dest, mainline+2   LD HL,(BRKV):EX (SP),HL:PUSH HL   ; SP=>dest, oldBRK, mainline+2   LD HL,(oldSP):EX (SP),HL          ; SP=>oldSP, oldBRK, mainline+2  HL=dest   LD (oldSP),SP:PUSH HL             ; SP=>dest, oldSP, oldBRK, mainline+2   LD HL,error:LD (BRKV),HL          ; Redirect BRKV   LD HL,return:EX (SP),HL:PUSH HL   ; SP=>dest, return, oldSP, oldBRK, mainline+2   LD HL,(tempHL)                    ; Get HL back   RET                               ; Jump to dest via stack   :   .return                           ; Stack holds oldSP, oldBRKV, main   EX (SP),HL:LD (oldSP),HL:POP HL   ; Restore oldSP   EX (SP),HL:LD (BRKV),HL:POP HL    ; Restore BRKV   CP 0:RET                          ; Clear Overflow flag, NB! clears carry flag   :   .error   LD SP,(oldSP)                     ; Restore SP   POP HL:LD (oldSP),HL              ; Restore oldSP   POP HL:LD (BRKV),HL               ; Restore BRKV   LD  L,4:PUSH HL:POP AF            ; Set Overflow flag   LD  HL,(FAULT)                    ; HL=>error block   LD  A,(HL):RET                    ; A=error number   :   .oldSP   DEFW 0                            ; Saved stack pointer   .tempHL   DEFW 0

Statistics: Posted by jgharston — Mon Sep 02, 2024 8:14 pm



Viewing all articles
Browse latest Browse all 3092

Trending Articles