|
| 1 | + org 32768 |
| 2 | +.core.__START_PROGRAM: |
| 3 | + di |
| 4 | + push ix |
| 5 | + push iy |
| 6 | + exx |
| 7 | + push hl |
| 8 | + exx |
| 9 | + ld hl, 0 |
| 10 | + add hl, sp |
| 11 | + ld (.core.__CALL_BACK__), hl |
| 12 | + ei |
| 13 | + jp .core.__MAIN_PROGRAM__ |
| 14 | +.core.__CALL_BACK__: |
| 15 | + DEFW 0 |
| 16 | +.core.ZXBASIC_USER_DATA: |
| 17 | + ; Defines USER DATA Length in bytes |
| 18 | +.core.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_END - .core.ZXBASIC_USER_DATA |
| 19 | + .core.__LABEL__.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_LEN |
| 20 | + .core.__LABEL__.ZXBASIC_USER_DATA EQU .core.ZXBASIC_USER_DATA |
| 21 | +_a: |
| 22 | + DEFB 00 |
| 23 | +.core.ZXBASIC_USER_DATA_END: |
| 24 | +.core.__MAIN_PROGRAM__: |
| 25 | + ld a, 1 |
| 26 | + ld hl, (_a - 1) |
| 27 | + cp h |
| 28 | + jp c, .LABEL._BREAK |
| 29 | +.LABEL.__LABEL1: |
| 30 | + ld a, 8 |
| 31 | + call .core.__STOP |
| 32 | + ld hl, 0 |
| 33 | + ld b, h |
| 34 | + ld c, l |
| 35 | +.core.__END_PROGRAM: |
| 36 | + di |
| 37 | + ld hl, (.core.__CALL_BACK__) |
| 38 | + ld sp, hl |
| 39 | + exx |
| 40 | + pop hl |
| 41 | + exx |
| 42 | + pop iy |
| 43 | + pop ix |
| 44 | + ei |
| 45 | + ret |
| 46 | +.LABEL._BREAK: |
| 47 | + ld hl, _a |
| 48 | + inc (hl) |
| 49 | + ld hl, 0 |
| 50 | + ld b, h |
| 51 | + ld c, l |
| 52 | + jp .core.__END_PROGRAM |
| 53 | + ;; --- end of user code --- |
| 54 | +#line 1 "/zxbasic/src/lib/arch/zx48k/runtime/error.asm" |
| 55 | + ; Simple error control routines |
| 56 | +; vim:ts=4:et: |
| 57 | + push namespace core |
| 58 | + ERR_NR EQU 23610 ; Error code system variable |
| 59 | + ; Error code definitions (as in ZX spectrum manual) |
| 60 | +; Set error code with: |
| 61 | + ; ld a, ERROR_CODE |
| 62 | + ; ld (ERR_NR), a |
| 63 | + ERROR_Ok EQU -1 |
| 64 | + ERROR_SubscriptWrong EQU 2 |
| 65 | + ERROR_OutOfMemory EQU 3 |
| 66 | + ERROR_OutOfScreen EQU 4 |
| 67 | + ERROR_NumberTooBig EQU 5 |
| 68 | + ERROR_InvalidArg EQU 9 |
| 69 | + ERROR_IntOutOfRange EQU 10 |
| 70 | + ERROR_NonsenseInBasic EQU 11 |
| 71 | + ERROR_InvalidFileName EQU 14 |
| 72 | + ERROR_InvalidColour EQU 19 |
| 73 | + ERROR_BreakIntoProgram EQU 20 |
| 74 | + ERROR_TapeLoadingErr EQU 26 |
| 75 | + ; Raises error using RST #8 |
| 76 | +__ERROR: |
| 77 | + ld (__ERROR_CODE), a |
| 78 | + rst 8 |
| 79 | +__ERROR_CODE: |
| 80 | + nop |
| 81 | + ret |
| 82 | + ; Sets the error system variable, but keeps running. |
| 83 | + ; Usually this instruction if followed by the END intermediate instruction. |
| 84 | +__STOP: |
| 85 | + ld (ERR_NR), a |
| 86 | + ret |
| 87 | + pop namespace |
| 88 | +#line 31 "label_decl3.bas" |
| 89 | + END |
0 commit comments