| |
| drow | macro | n | |
| defb | [n]/256 | |
| defb | [n]&255 | |
| endm | | |
| |
| org | 00000h | |
| sub00: | di | | |
| ld | hl,0ffh | |
| if | model == 1 | |
| jp | findtop | |
| nop | | |
| endif | | |
| if | model == 3 | |
| findtop: | dec | h | |
| ld | a,(hl) | |
| jr | cont_findtop | |
| endif | | |
| |
| lkchar: | ex | (sp),hl | |
| rst | skipspace | |
| cp | (hl) | |
| jp | cont_lkchar | |
| |
| put_lf: | ld | a,00dh | |
| putch: | | | |
| if | model == 1 | |
| exx | | |
| ex | af,af' | |
| call | gtstat | |
| endif | | |
| if | model == 3 | |
| ex | af,af' | |
| in | a,(0ffh) | |
| and | 002h | |
| endif | | |
| jp | cont_putch | |
| |
| def_skipspace | macro | | |
| skipspace: | ld | a,(de) | |
| cp | 020h | |
| ret | nz | |
| inc | de | |
| jp | skipspace | |
| endm | | |
| |
| if | model == 1 | |
| expr: | call | sub68 | |
| nop | | |
| jp | cont_expr | |
| nop | | |
| call_expr | macro | | |
| rst | expr | |
| endm | | |
| endif | | |
| |
| if | model == 3 | |
| def_skipspace | | |
| call_expr | macro | | |
| call | expr | |
| endm | | |
| endif | | |
| |
| cpHL_DE: | ld | a,h | |
| cp | d | |
| ret | nz | |
| ld | a,l | |
| cp | e | |
| ret | | |
| |
| if | model == 1 | |
| nop | | |
| nop | | |
| def_skipspace | | |
| endif | | |
| |
| if | model == 3 | |
| put_lf2: | ld | a,00dh | |
| vidputc: | push | af | |
| xor | a | |
| ld | (outdev),a | |
| pop | af | |
| jr | putch | |
| endif | | |
| |
| sub07: | pop | af | |
| call | sub84 | |
| jp | say_what_de | |
| |
| nop | | |
| lkvar: | rst | skipspace | |
| sub | 041h | |
| ret | c | |
| cp | 01ah | |
| ccf | | |
| ret | c | |
| inc | de | |
| and | a | |
| jr | nz,getvarA | |
| rst | lkchar | |
| defb | '(',getvars-$-1 | |
| call | sub75 | |
| inc | hl | |
| add | hl,hl | |
| add | hl,hl | |
| jp | c,say_how_de | |
| push | hl | |
| rst | lkchar | |
| defb | ')',say_what_de2-$-1 | |
| |
| lkvar_chunk | macro | | |
| pop | hl | |
| push | de | |
| push | hl | |
| ld | hl,(memtop) | |
| ld | de,(freemem) | |
| xor | a | |
| sbc | hl,de | |
| pop | de | |
| rst | cpHL_DE | |
| endm | | |
| |
| if | model == 1 | |
| lkvar_chunk | | |
| jp | cont_lkvar | |
| endif | | |
| |
| if | model == 3 | |
| jr | cont_lkvar | |
| cont_findtop: | cpl | | |
| ld | (hl),a | |
| cp | (hl) | |
| cpl | | |
| ld | (hl),a | |
| jr | nz,findtop | |
| ld | (memtop),hl | |
| ld | hl,basic_mem | |
| ld | (freemem),hl | |
| endif | | |
| |
| nmi: | di | | |
| ld | sp,basic_mem | |
| xor | a | |
| |
| if | model == 1 | |
| ld | (status),a | |
| out | (0ffh),a | |
| ld | a,00ch | |
| rst | putch | |
| endif | | |
| |
| if | model == 3 | |
| out | (0e0h),a | |
| out | (0ffh),a | |
| out | (0e4h),a | |
| ld | a,020h | |
| out | (0ech),a | |
| ld | a,00ch | |
| rst | vidputc | |
| endif | | |
| |
| jp | ready | |
| |
| cont_lkvar: | | | |
| if | model == 3 | |
| lkvar_chunk | | |
| endif | | |
| |
| jp | c,say_sorry | |
| ld | hl,(memtop) | |
| sbc | hl,de | |
| pop | de | |
| xor | a | |
| ret | | |
| |
| getvars: | xor | a | |
| getvarA: | ld | h,040h | |
| rla | | |
| rla | | |
| ld | l,a | |
| xor | a | |
| ret | | |
| |
| say_what_de2: | jp | say_what_de | |
| |
| getdig: | ld | a,(de) | |
| cp | 030h | |
| ret | c | |
| cp | 03ah | |
| ccf | | |
| ret | c | |
| inc | de | |
| and | 00fh | |
| ret | | |
| |
| cont_lkchar: | inc | hl | |
| jr | z,_2getdig | |
| push | bc | |
| ld | c,(hl) | |
| ld | b,000h | |
| add | hl,bc | |
| pop | bc | |
| dec | de | |
| _2getdig: | inc | de | |
| inc | hl | |
| ex | (sp),hl | |
| ret | | |
| |
| sub10: | call | clr24b | |
| ld | b,000h | |
| ld | c,b | |
| rst | skipspace | |
| _1sub10: | call | sub11 | |
| jr | _1sub10 | |
| |
| sub11: | call | getdig | |
| jr | c,_2sub12 | |
| set | 6,b | |
| bit | 7,b | |
| jr | nz,_1sub12 | |
| call | sub12 | |
| bit | 0,b | |
| ret | z | |
| dec | c | |
| ret | | |
| |
| sub12: | call | shiftdig | |
| ret | z | |
| exx | | |
| ld | h,d | |
| ld | l,e | |
| ex | af,af' | |
| ld | c,a | |
| exx | | |
| set | 7,b | |
| pop | af | |
| _1sub12: | bit | 0,b | |
| ret | nz | |
| inc | c | |
| ret | | |
| |
| _2sub12: | rst | lkchar | |
| defb | '.',_3sub12-$-1 | |
| bit | 0,b | |
| set | 0,b | |
| ret | z | |
| _3sub12: | pop | af | |
| bit | 6,b | |
| ret | z | |
| ld | l,018h | |
| ld | h,000h | |
| push | bc | |
| push | de | |
| exx | | |
| call | normCHL | |
| ld | bc,10 | |
| add | ix,bc | |
| pop | de | |
| ld | bc,_4sub12 | |
| push | bc | |
| push | de | |
| jp | _3sub128 | |
| |
| _4sub12: | pop | bc | |
| push | de | |
| rst | lkchar | |
| defb | 'E',_8sub12-$-1 | |
| rst | lkchar | |
| defb | '+',_5sub12-$-1 | |
| jr | _6sub12 | |
| |
| _5sub12: | rst | lkchar | |
| defb | '-',_6sub12-$-1 | |
| set | 1,b | |
| _6sub12: | call | clear24 | |
| _7sub12: | call | getdig | |
| jr | c,_9sub12 | |
| set | 5,b | |
| call | shiftdig | |
| jp | nz,say_how_de | |
| jr | _7sub12 | |
| |
| _8sub12: | pop | de | |
| xor | a | |
| jr | _10sub12 | |
| |
| _9sub12: | bit | 5,b | |
| jr | z,_8sub12 | |
| pop | af | |
| exx | | |
| ld | a,c | |
| or | h | |
| jr | nz,_15sub12 | |
| ld | a,l | |
| exx | | |
| bit | 7,a | |
| jp | nz,say_how_de | |
| bit | 1,b | |
| jr | z,_10sub12 | |
| neg | | |
| _10sub12: | add | a,c | |
| _11sub12: | and | a | |
| jr | z,_14sub12 | |
| bit | 7,a | |
| jr | z,_12sub12 | |
| inc | a | |
| push | af | |
| call | sub122 | |
| jr | _13sub12 | |
| |
| _12sub12: | dec | a | |
| push | af | |
| call | sub120 | |
| _13sub12: | pop | af | |
| jr | _11sub12 | |
| |
| _14sub12: | bit | 6,b | |
| ret | | |
| |
| _15sub12: | exx | | |
| jp | say_how_de | |
| |
| clr24b: | res | 6,b | |
| clear24: | exx | | |
| ld | l,000h | |
| ld | h,l | |
| ld | c,l | |
| exx | | |
| ret | | |
| |
| shiftdig: | ex | af,af' | |
| exx | | |
| ld | d,h | |
| ld | e,l | |
| ld | a,c | |
| ld | b,000h | |
| push | af | |
| add | hl,hl | |
| rl | c | |
| rl | b | |
| add | hl,hl | |
| rl | c | |
| rl | b | |
| add | hl,de | |
| adc | a,c | |
| ld | c,a | |
| ld | a,000h | |
| adc | a,b | |
| ld | b,a | |
| pop | af | |
| add | hl,hl | |
| rl | c | |
| rl | b | |
| ex | af,af' | |
| add | a,l | |
| ld | l,a | |
| ld | a,000h | |
| adc | a,h | |
| ld | h,a | |
| ld | a,000h | |
| adc | a,c | |
| ld | c,a | |
| ld | a,000h | |
| adc | a,b | |
| ld | b,a | |
| exx | | |
| ret | | |
| |
| if | model == 1 | |
| findtop: | dec | h | |
| ld | a,(hl) | |
| cpl | | |
| ld | (hl),a | |
| xor | (hl) | |
| jr | nz,findtop | |
| ld | (memtop),hl | |
| xor | a | |
| ld | (status),a | |
| ld | sp,basic_mem | |
| jp | _1NEW_ | |
| endif | | |
| |
| say_how_de: | push | de | |
| say_how: | ld | de,msg_HOW | |
| jp | errmsg | |
| |
| msg_HOW: | ascii | 'HOW?',13 | |
| rws_msg | macro | | |
| msg_READY: | ascii | 'READY',13 | |
| msg_WHAT: | ascii | 'WHAT?',13 | |
| msg_SORRY: | ascii | 'SORRY',13 | |
| endm | | |
| if | model == 1 | |
| rws_msg | | |
| endif | | |
| msg_BREAK_AT: | ascii | 'BREAK AT',0 | |
| ready: | ld | sp,basic_mem | |
| call | ctoff | |
| if | model == 1 | |
| call | put_lf | |
| endif | | |
| if | model == 3 | |
| call | put_lf2 | |
| endif | | |
| ld | de,msg_READY | |
| call | print | |
| getcmd: | ld | sp,basic_mem | |
| call | clear | |
| cmdlive: | ld | ix,input_buffer+72 | |
| call | getline | |
| push | de | |
| ld | de,input_buffer | |
| call | getint | |
| ld | a,h | |
| or | l | |
| pop | bc | |
| jp | z,exec | |
| dec | de | |
| ld | a,h | |
| ld | (de),a | |
| dec | de | |
| ld | a,l | |
| ld | (de),a | |
| push | bc | |
| push | de | |
| ld | a,c | |
| sub | e | |
| push | af | |
| call | findline | |
| push | de | |
| jr | nz,insert_line | |
| push | de | |
| call | skipfindHL | |
| pop | bc | |
| ld | hl,(freemem) | |
| call | copyDEtoBC | |
| ld | h,b | |
| ld | l,c | |
| ld | (freemem),hl | |
| insert_line: | pop | bc | |
| ld | hl,(freemem) | |
| pop | af | |
| push | hl | |
| cp | 003h | |
| jr | z,getcmd | |
| add | a,l | |
| ld | l,a | |
| ld | a,000h | |
| adc | a,h | |
| ld | h,a | |
| ld | de,(memtop) | |
| rst | cpHL_DE | |
| jp | nc,say_sorry_de | |
| ld | (freemem),hl | |
| pop | de | |
| call | copyDEtoHL | |
| pop | de | |
| pop | hl | |
| call | copyDEtoBC | |
| jr | getcmd | |
| |
| clear: | ld | b,00ah | |
| push | hl | |
| ld | hl,cont_ptr | |
| _1clear: | ld | (hl),000h | |
| inc | hl | |
| djnz | _1clear | |
| ld | de,basic_mem | |
| pop | hl | |
| all_tok: | ret | | |
| |
| ascii | 'LIST' | |
| drow | LIST_|8000h | |
| if | model == 3 | |
| ascii | 'LLIST' | |
| drow | LLIST_|8000h | |
| endif | | |
| ascii | 'RUN' | |
| drow | RUN_|8000h | |
| ascii | 'NEW' | |
| drow | NEW_|8000h | |
| ascii | 'CONT' | |
| drow | CONT_|8000h | |
| ascii | 'CLOAD' | |
| drow | CLOAD_|8000h | |
| ascii | 'CSAVE' | |
| prog_tok: | drow | CSAVE_|8000h | |
| ascii | 'NEXT' | |
| drow | NEXT_|8000h | |
| ascii | 'LET' | |
| drow | LET_|8000h | |
| ascii | 'INPUT' | |
| drow | INPUT_|8000h | |
| ascii | 'IF' | |
| drow | IF_|8000h | |
| ascii | 'ON' | |
| drow | ON_|8000h | |
| ascii | 'GOTO' | |
| drow | GOTO_|8000h | |
| ascii | 'GOSUB' | |
| drow | GOSUB_|8000h | |
| ascii | 'RESET' | |
| drow | RESET_|8000h | |
| ascii | 'RETURN' | |
| drow | RETURN_|8000h | |
| ascii | 'READ' | |
| drow | READ_|8000h | |
| ascii | 'RESTORE' | |
| drow | RESTORE_|8000h | |
| ascii | 'REM' | |
| drow | REM_|8000h | |
| ascii | 'DATA' | |
| drow | REM_|8000h | |
| ascii | 'FOR' | |
| drow | FOR_|8000h | |
| ascii | 'PRINT' | |
| drow | PRINT_|8000h | |
| ascii | 'SET' | |
| drow | SET_|8000h | |
| ascii | 'STOP' | |
| drow | STOP_|8000h | |
| ascii | 'END' | |
| drow | END_|8000h | |
| ascii | 'CLS' | |
| drow | CLS_|8000h | |
| if | model == 3 | |
| ascii | 'LPRINT' | |
| drow | LPRINT_|8000h | |
| endif | | |
| ong_tok: | drow | assign|8000h | |
| ascii | 'GOTO' | |
| drow | on_goto|8000h | |
| ascii | 'GOSUB' | |
| drow | on_gosub|8000h | |
| func_tok: | drow | say_what_de|8000h | |
| ascii | 'RND' | |
| drow | RND_|8000h | |
| ascii | 'ABS' | |
| drow | ABS_|8000h | |
| ascii | 'MEM' | |
| drow | MEM_|8000h | |
| ascii | 'INT' | |
| drow | INT_|8000h | |
| ascii | 'POINT' | |
| drow | POINT_|8000h | |
| to_tok: | drow | expterm|8000h | |
| ascii | 'TO' | |
| drow | TO_|8000h | |
| step_tok: | drow | say_what_de|8000h | |
| ascii | 'STEP' | |
| drow | STEP_|8000h | |
| drow | for_top|8000h | |
| |
| def_print_tok | macro | | |
| print_tok: | ascii | 'TAB' | |
| drow | TAB_|8000h | |
| ascii | 'AT' | |
| drow | AT_|8000h | |
| ascii | 'A$' | |
| drow | Astr|8000h | |
| ascii | 'B$' | |
| drow | Bstr|8000h | |
| drow | print_lit|8000h | |
| endm | | |
| |
| if | model == 1 | |
| def_print_tok | | |
| endif | | |
| |
| op_tok | equ | $-2 | |
| ascii | '>' | |
| drow | gt_|8000h | |
| ascii | '=' | |
| drow | eq_|8000h | |
| ascii | '<' | |
| drow | lt_|8000h | |
| then_tok: | drow | prog_sn|8000h | |
| ascii | 'THEN' | |
| drow | THEN_|8000h | |
| drow | statement2|8000h | |
| exec: | ld | hl,all_tok | |
| _1exec: | rst | skipspace | |
| push | de | |
| ld | a,(de) | |
| inc | de | |
| inc | hl | |
| cp | (hl) | |
| jr | z,_2exec | |
| bit | 7,(hl) | |
| jr | nz,tokmatches | |
| jr | skiptok | |
| |
| _2exec: | ld | a,(de) | |
| inc | de | |
| inc | hl | |
| cp | (hl) | |
| jr | z,_2exec | |
| bit | 7,(hl) | |
| jr | z,_4exec | |
| tokmatches: | dec | de | |
| jr | runtok | |
| |
| _4exec: | cp | 02eh | |
| jr | z,_6exec | |
| skiptok: | inc | hl | |
| bit | 7,(hl) | |
| jr | z,skiptok | |
| inc | hl | |
| pop | de | |
| jr | _1exec | |
| |
| _6exec: | inc | hl | |
| bit | 7,(hl) | |
| jr | z,_6exec | |
| runtok: | ld | a,(hl) | |
| inc | hl | |
| ld | l,(hl) | |
| and | 07fh | |
| ld | h,a | |
| pop | af | |
| jp | (hl) | |
| |
| NEW_: | call | checkEOL | |
| if | model == 1 | |
| _1NEW_: | ld | a,00ch | |
| rst | putch | |
| ld | hl,basic_mem | |
| ld | (freemem),hl | |
| ready4: | jp | ready | |
| endif | | |
| |
| if | model == 3 | |
| rst | sub00 | |
| endif | | |
| |
| END_: | call | checkEOL | |
| if | model == 1 | |
| jr | ready4 | |
| endif | | |
| if | model == 3 | |
| ready4: | jp | ready | |
| endif | | |
| |
| RUN_: | call | getintEOL | |
| call | clear | |
| jr | _2RUN_ | |
| |
| _1RUN_: | ld | hl,0 | |
| _2RUN_: | call | findlineDE | |
| jr | c,ready4 | |
| _3RUN_: | ld | (cur_line),de | |
| inc | de | |
| inc | de | |
| statement: | call | kbscan | |
| cp | 003h | |
| jr | z,STOP_ | |
| call | ctoff | |
| ld | ix,input_buffer+72 | |
| ld | hl,prog_tok+1 | |
| jr | _1exec | |
| |
| GOTO_: | call | sub141 | |
| push | de | |
| |
| if | model == 1 | |
| call | checkEOL | |
| endif | | |
| |
| _1GOTO_: | call | findline | |
| jp | nz,say_how | |
| pop | af | |
| jr | _3RUN_ | |
| |
| STOP_: | ld | (cont_ptr),de | |
| |
| if | model == 1 | |
| ld | a,00dh | |
| rst | putch | |
| endif | | |
| |
| if | model == 3 | |
| call | put_lf2 | |
| endif | | |
| |
| ld | de,msg_BREAK_AT | |
| call | print | |
| ld | hl,(cur_line) | |
| ld | (cont_line),hl | |
| ld | e,(hl) | |
| inc | hl | |
| ld | d,(hl) | |
| ld | hl,0 | |
| ld | (cur_line),hl | |
| ex | de,hl | |
| call | sub101 | |
| ld | a,00dh | |
| rst | putch | |
| _1STOP_: | jp | cmdlive | |
| |
| CONT_: | call | checkEOL | |
| ld | hl,(cont_ptr) | |
| ld | a,h | |
| or | l | |
| jr | z,ready4 | |
| ex | de,hl | |
| ld | hl,(cont_line) | |
| ld | (cur_line),hl | |
| call | sub84 | |
| _1CONT_: | jr | statement | |
| |
| if | model == 3 | |
| LLIST_: | ld | a,001h | |
| ld | (outdev),a | |
| endif | | |
| |
| LIST_: | call | getintEOL | |
| call | findline | |
| |
| if | model == 1 | |
| ld | c,00ch | |
| _1LIST_: | jr | c,_4LIST_ | |
| dec | c | |
| jr | z,_2LIST_ | |
| push | bc | |
| call | sub104 | |
| pop | bc | |
| call | findlineDE | |
| jr | _1LIST_ | |
| |
| _2LIST_: | call | sub104 | |
| call | findlineDE | |
| jr | c,_4LIST_ | |
| _3LIST_: | call | kbscan | |
| jr | z,_3LIST_ | |
| cp | 01bh | |
| jr | z,_2LIST_ | |
| cp | 00dh | |
| jr | nz,_3LIST_ | |
| _4LIST_: | jr | _1STOP_ | |
| endif | | |
| |
| if | model == 3 | |
| jr | c,_4LIST_ | |
| _1LIST_: | call | sub104 | |
| call | kbscan | |
| jr | z,_3LIST_ | |
| cp | 003h | |
| jr | z,_4LIST_ | |
| _2LIST_: | call | kbscan | |
| jr | z,_2LIST_ | |
| cp | 003h | |
| jr | z,_4LIST_ | |
| _3LIST_: | call | findlineDE | |
| jr | nc,_1LIST_ | |
| _4LIST_: | jr | _1STOP_ | |
| endif | | |
| |
| if | model == 3 | |
| LPRINT_: | ld | a,001h | |
| jr | print_curdev | |
| endif | | |
| |
| PRINT_: | | | |
| if | model == 3 | |
| xor | a | |
| print_curdev: | ld | (outdev),a | |
| endif | | |
| |
| rst | lkchar | |
| defb | '#',pnotdev-$-1 | |
| ld | hl,input_buffer | |
| ld | (pnum_ptr),hl | |
| call | cton | |
| pnotdev: | rst | lkchar | |
| defb | ':',pnotcln-$-1 | |
| call | put_lf | |
| jr | _1CONT_ | |
| |
| pnotcln: | rst | lkchar | |
| defb | 00dh,pnoteol-$-1 | |
| call | put_lf | |
| jp | _1RUN_ | |
| |
| pnoteol: | ld | hl,print_tok-1 | |
| jp | _1exec | |
| |
| print_lit: | call | strlit | |
| jr | _5AT_ | |
| |
| jr | _2Bstr | |
| |
| Astr: | ld | hl,stringA | |
| jr | _1Bstr | |
| |
| Bstr: | ld | hl,stringB | |
| _1Bstr: | call | sub35 | |
| _2Bstr: | rst | lkchar | |
| defb | ',',_2AT_-$-1 | |
| _3Bstr: | ld | a,(cursor) | |
| and | 00fh | |
| jr | z,_3AT_ | |
| ld | a,020h | |
| rst | putch | |
| jr | _3Bstr | |
| |
| AT_: | call | sub73 | |
| ld | bc,(cursor) | |
| ld | a,020h | |
| ld | (bc),a | |
| ld | a,h | |
| or | 0fch | |
| and | 03fh | |
| ld | h,a | |
| ld | (hl),05fh | |
| ld | (cursor),hl | |
| _1AT_: | rst | lkchar | |
| defb | ',',_2AT_-$-1 | |
| jr | _3AT_ | |
| |
| _2AT_: | rst | lkchar | |
| defb | ';',_4AT_-$-1 | |
| _3AT_: | call | sub84 | |
| jr | pnoteol | |
| |
| _4AT_: | call | put_lf | |
| rst | sub07 | |
| _5AT_: | call_expr | | |
| call | sub102 | |
| jr | _2Bstr | |
| |
| TAB_: | call | sub76 | |
| ld | a,l | |
| and | 03fh | |
| ld | l,a | |
| _1TAB_: | ld | a,(cursor) | |
| and | 03fh | |
| cp | l | |
| jr | z,_1AT_ | |
| jr | nc,_1AT_ | |
| ld | a,020h | |
| rst | putch | |
| jr | _1TAB_ | |
| |
| CLS_: | ld | a,00ch | |
| rst | putch | |
| rst | sub07 | |
| sub35: | ld | a,(hl) | |
| inc | hl | |
| and | a | |
| ret | z | |
| rst | putch | |
| ld | a,l | |
| and | 00fh | |
| ret | z | |
| jr | sub35 | |
| |
| GOSUB_: | call | sub108 | |
| call | sub141 | |
| _1GOSUB_: | push | de | |
| call | findline | |
| jp | nz,say_how | |
| ld | hl,(cur_line) | |
| push | hl | |
| ld | hl,(gosub_sp) | |
| push | hl | |
| ld | hl,0 | |
| ld | (for_sp),hl | |
| add | hl,sp | |
| ld | (gosub_sp),hl | |
| jp | _3RUN_ | |
| |
| RETURN_: | call | checkEOL | |
| ld | hl,(gosub_sp) | |
| ld | a,h | |
| or | l | |
| jp | z,say_what_de | |
| ld | sp,hl | |
| pop | hl | |
| ld | (gosub_sp),hl | |
| pop | hl | |
| ld | (cur_line),hl | |
| pop | de | |
| jp | _5NEXT_ | |
| |
| ON_: | call | sub75 | |
| ld | a,h | |
| or | l | |
| jr | z,_1ON_ | |
| push | hl | |
| ld | hl,ong_tok+1 | |
| jr | _1FOR_ | |
| |
| _1ON_: | call | sub42 | |
| rst | sub07 | |
| on_goto: | pop | hl | |
| call | sub41 | |
| _1on_goto: | push | de | |
| jp | _1GOTO_ | |
| |
| on_gosub: | pop | hl | |
| call | sub41 | |
| ld | (tmpish),hl | |
| call | sub108 | |
| ld | hl,(tmpish) | |
| jr | _1GOSUB_ | |
| |
| sub41: | dec | l | |
| jr | z,_2sub41 | |
| _1sub41: | ld | a,(de) | |
| cp | 00dh | |
| jr | z,_1ON_ | |
| cp | 03ah | |
| jr | z,_1ON_ | |
| inc | de | |
| cp | 02ch | |
| jr | z,sub41 | |
| jr | _1sub41 | |
| |
| _2sub41: | call | sub141 | |
| sub42: | ld | a,(de) | |
| cp | 03ah | |
| ret | z | |
| cp | 00dh | |
| ret | z | |
| inc | de | |
| jr | sub42 | |
| |
| FOR_: | call | sub108 | |
| call | sub83 | |
| ld | (for_sp),hl | |
| ld | hl,to_tok+1 | |
| _1FOR_: | jp | _1exec | |
| |
| TO_: | call | sub73 | |
| ld | (for_to),hl | |
| ld | hl,step_tok+1 | |
| jr | _1FOR_ | |
| |
| STEP_: | call | sub73 | |
| jr | _1for_top | |
| |
| for_top: | ld | hl,1 | |
| _1for_top: | ld | (for_a),hl | |
| ld | hl,(cur_line) | |
| ld | (for_b),hl | |
| ex | de,hl | |
| ld | (for_c),hl | |
| ld | bc,10 | |
| ld | hl,(for_sp) | |
| ex | de,hl | |
| ld | h,b | |
| ld | l,b | |
| add | hl,sp | |
| _2for_top: | ld | a,009h | |
| ld | a,(hl) | |
| inc | hl | |
| or | (hl) | |
| jr | z,_3for_top | |
| ld | a,(hl) | |
| dec | hl | |
| cp | d | |
| jr | nz,_2for_top+1 | |
| ld | a,(hl) | |
| cp | e | |
| jr | nz,_2for_top+1 | |
| ex | de,hl | |
| ld | hl,0 | |
| add | hl,sp | |
| ld | b,h | |
| ld | c,l | |
| ld | hl,10 | |
| add | hl,de | |
| call | copyDEtoHL | |
| ld | sp,hl | |
| _3for_top: | ld | hl,(for_c) | |
| ex | de,hl | |
| rst | sub07 | |
| NEXT_: | rst | lkvar | |
| jp | c,say_what_de | |
| ld | (tmpish),hl | |
| _1NEXT_: | push | de | |
| ex | de,hl | |
| ld | hl,(for_sp) | |
| ld | a,h | |
| or | l | |
| jp | z,say_what | |
| rst | cpHL_DE | |
| jr | z,_2NEXT_ | |
| pop | de | |
| call | sub107 | |
| ld | hl,(tmpish) | |
| jr | _1NEXT_ | |
| |
| _2NEXT_: | call | sub113 | |
| call | sub115 | |
| ex | de,hl | |
| ld | hl,(for_a) | |
| push | hl | |
| add | hl,de | |
| push | hl | |
| call | sub117 | |
| ld | hl,(for_sp) | |
| call | sub114 | |
| pop | de | |
| ld | hl,(for_to) | |
| pop | af | |
| or | a | |
| jp | p,_3NEXT_ | |
| ex | de,hl | |
| _3NEXT_: | ld | a,h | |
| xor | d | |
| jp | p,_4NEXT_ | |
| ex | de,hl | |
| _4NEXT_: | rst | cpHL_DE | |
| pop | de | |
| jr | c,_5NEXT_ | |
| ld | hl,(for_b) | |
| ld | (cur_line),hl | |
| jr | _3for_top | |
| |
| _5NEXT_: | call | sub107 | |
| rst | sub07 | |
| REM_: | ld | hl,0 | |
| jr | _1IF_ | |
| |
| IF_: | call | sub73 | |
| _1IF_: | ld | a,h | |
| or | l | |
| jr | nz,_2IF_ | |
| call | eolfindHL | |
| jp | nc,_3RUN_ | |
| jp | ready | |
| |
| _2IF_: | ld | hl,then_tok+1 | |
| jp | _1exec | |
| |
| THEN_: | call | getint | |
| jp | nz,_1on_goto | |
| statement2: | jp | statement | |
| |
| _1statement2: | ld | sp,(tmpish) | |
| pop | hl | |
| ld | (cur_line),hl | |
| pop | de | |
| INPUT_: | rst | lkchar | |
| defb | '#',_1INPUT_-$-1 | |
| call | casloadblock | |
| push | de | |
| ld | hl,(cur_line) | |
| push | hl | |
| jr | _3INPUT_ | |
| |
| _1INPUT_: | push | de | |
| call | strlit | |
| jr | _2INPUT_ | |
| |
| rst | lkchar | |
| defb | ';',_4INPUT_-$-1 | |
| _2INPUT_: | ld | hl,(cur_line) | |
| push | hl | |
| ld | hl,_1INPUT_ | |
| ld | (cur_line),hl | |
| ld | (tmpish),sp | |
| push | de | |
| ld | a,03fh | |
| call | sub93 | |
| pop | de | |
| _3INPUT_: | jp | _1RESTORE_ | |
| |
| _4INPUT_: | pop | af | |
| jr | _3LET_ | |
| |
| sub53: | jp | z,_1sub83 | |
| rst | skipspace | |
| _1sub53: | ld | a,(de) | |
| cp | 00dh | |
| jr | z,_2sub53 | |
| cp | 022h | |
| jr | z,_3sub53 | |
| cp | 02ch | |
| jr | z,_2sub53 | |
| ld | (hl),a | |
| inc | hl | |
| inc | de | |
| ld | a,l | |
| and | 00fh | |
| jr | z,_5sub53 | |
| jr | _1sub53 | |
| |
| _2sub53: | ld | (hl),000h | |
| inc | hl | |
| ld | a,l | |
| and | 00fh | |
| jr | nz,_2sub53 | |
| ret | | |
| |
| _3sub53: | inc | de | |
| _4sub53: | ld | a,(de) | |
| cp | 00dh | |
| jr | z,_2sub53 | |
| inc | de | |
| cp | 022h | |
| jr | z,_2sub53 | |
| ld | (hl),a | |
| inc | hl | |
| ld | a,l | |
| and | 00fh | |
| jr | nz,_4sub53 | |
| _5sub53: | ld | a,(de) | |
| cp | 02ch | |
| ret | z | |
| cp | 00dh | |
| ret | z | |
| inc | de | |
| jr | _5sub53 | |
| |
| sub54: | rst | lkvar | |
| ret | c | |
| dec | de | |
| ld | a,(de) | |
| inc | de | |
| cp | 029h | |
| ret | z | |
| ld | a,(de) | |
| cp | 024h | |
| jr | z,_1sub54 | |
| xor | a | |
| ret | | |
| |
| _1sub54: | ld | a,l | |
| cp | 007h | |
| jp | nc,say_what_de | |
| inc | de | |
| sla | a | |
| sla | a | |
| add | a,070h | |
| ld | l,a | |
| and | a | |
| ret | | |
| |
| assign: | ld | a,(de) | |
| cp | 00dh | |
| jr | z,_1LET_ | |
| LET_: | call | sub54 | |
| jr | c,_3LET_ | |
| push | af | |
| rst | lkchar | |
| defb | '=',_3LET_-$-1 | |
| pop | af | |
| call | sub53 | |
| _1LET_: | rst | sub07 | |
| _2LET_: | pop | hl | |
| ld | (cur_line),hl | |
| _3LET_: | jp | say_what_de | |
| |
| RESTORE_: | ld | hl,0 | |
| ld | (data_ptr),hl | |
| rst | sub07 | |
| _1RESTORE_: | call | sub54 | |
| jr | c,_2LET_ | |
| push | de | |
| ld | de,input_buffer | |
| _2RESTORE_: | call | sub53 | |
| ld | (pnum_ptr),de | |
| pop | de | |
| rst | lkchar | |
| defb | ',',_5READ_-$-1 | |
| call | sub54 | |
| jr | c,_2LET_ | |
| push | de | |
| push | af | |
| ld | de,(pnum_ptr) | |
| rst | lkchar | |
| defb | ',',_7READ_-$-1 | |
| pop | af | |
| jr | _2RESTORE_ | |
| |
| READ_: | call | sub54 | |
| push | de | |
| jr | c,_8READ_ | |
| push | af | |
| ld | de,(data_ptr) | |
| ld | a,d | |
| or | e | |
| jr | nz,_3READ_ | |
| ld | de,basic_mem | |
| _1READ_: | push | hl | |
| call | sub61 | |
| pop | hl | |
| jr | c,_9READ_ | |
| _2READ_: | pop | af | |
| ld | bc,(cur_line) | |
| push | bc | |
| ld | bc,0 | |
| ld | (cur_line),bc | |
| call | sub53 | |
| pop | bc | |
| ld | (cur_line),bc | |
| ld | (data_ptr),de | |
| pop | de | |
| rst | lkchar | |
| defb | ',',_6READ_-$-1 | |
| jr | READ_ | |
| |
| _3READ_: | rst | lkchar | |
| defb | ',',_4READ_-$-1 | |
| jr | _2READ_ | |
| |
| _4READ_: | rst | lkchar | |
| defb | 00dh,_7READ_-$-1 | |
| jr | _1READ_ | |
| |
| _5READ_: | pop | hl | |
| ld | (cur_line),hl | |
| pop | af | |
| _6READ_: | rst | sub07 | |
| _7READ_: | pop | af | |
| _8READ_: | jp | say_what | |
| |
| _9READ_: | pop | af | |
| jp | say_how | |
| |
| DATA_: | xor | a | |
| ret | | |
| |
| find_data: | ld | a,(de) | |
| inc | de | |
| cp | 00dh | |
| jr | nz,find_data | |
| sub61: | inc | de | |
| inc | de | |
| ld | hl,(freemem) | |
| rst | cpHL_DE | |
| ret | c | |
| ld | hl,data_tok-1 | |
| jr | _1sub67 | |
| |
| if | model == 1 | |
| cont_expr: | call | sub67 | |
| jp | sub117 | |
| endif | | |
| |
| if | model == 3 | |
| expr: | call | sub68 | |
| call | sub67 | |
| ld | h,000h | |
| jp | sub117 | |
| endif | | |
| |
| gt_: | rst | lkchar | |
| defb | '=',_1gt-$-1 | |
| call | sub66 | |
| ret | c | |
| jr | _1sub66 | |
| |
| _1gt: | call | sub66 | |
| ret | z | |
| ret | c | |
| jr | _1sub66 | |
| |
| lt_: | rst | lkchar | |
| defb | '=',_1lt-$-1 | |
| call | sub66 | |
| if | model == 1 | |
| ld | hl,1 | |
| ret | z | |
| ret | c | |
| ld | hl,0 | |
| endif | | |
| if | model == 3 | |
| ld | l,001h | |
| ret | z | |
| ret | c | |
| dec | l | |
| endif | | |
| ret | | |
| |
| _1lt: | rst | lkchar | |
| defb | '>',_1eq-$-1 | |
| call | sub66 | |
| ret | z | |
| jr | _1sub66 | |
| |
| eq_: | call | sub66 | |
| ret | nz | |
| jr | _1sub66 | |
| |
| _1eq: | call | sub66 | |
| ret | nc | |
| jr | _1sub66 | |
| |
| prog_sn: | pop | af | |
| ret | | |
| |
| sub66: | call | sub68 | |
| call | sub125 | |
| if | model == 1 | |
| ld | hl,0 | |
| endif | | |
| if | model == 3 | |
| ld | l,000h | |
| endif | | |
| ret | | |
| |
| _1sub66: | | | |
| if | model == 1 | |
| ld | hl,1 | |
| endif | | |
| if | model == 3 | |
| ld | l,001h | |
| endif | | |
| ret | | |
| |
| sub67: | ld | hl,op_tok+1 | |
| _1sub67: | jp | _1exec | |
| |
| sub68: | rst | lkchar | |
| defb | '-',_1sub68-$-1 | |
| ld | hl,0 | |
| call | sub117 | |
| jr | _5sub68 | |
| |
| _1sub68: | rst | lkchar | |
| defb | '+',_2sub68-$-1 | |
| _2sub68: | call | sub69 | |
| _3sub68: | rst | lkchar | |
| defb | '+',_4sub68-$-1 | |
| call | sub69 | |
| call | sub127 | |
| jr | _3sub68 | |
| |
| _4sub68: | rst | lkchar | |
| defb | '-',_1sub72-$-1 | |
| _5sub68: | call | sub69 | |
| call | sub126 | |
| jr | _3sub68 | |
| |
| sub69: | call | sub70 | |
| _1sub69: | rst | lkchar | |
| defb | '*',_2sub69-$-1 | |
| call | sub70 | |
| call | sub121 | |
| jr | _1sub69 | |
| |
| _2sub69: | rst | lkchar | |
| defb | '/',_1sub72-$-1 | |
| call | sub70 | |
| call | sub123 | |
| jr | _1sub69 | |
| |
| sub70: | ld | hl,func_tok+1 | |
| jr | _1sub67 | |
| |
| expterm: | rst | lkvar | |
| jr | c,_1expterm | |
| jp | sub113 | |
| |
| _1expterm: | call | sub10 | |
| ret | nz | |
| sub72: | rst | lkchar | |
| defb | '(',_2sub72-$-1 | |
| call_expr | | |
| rst | lkchar | |
| defb | ')',_2sub72-$-1 | |
| _1sub72: | ret | | |
| |
| _2sub72: | jp | say_what_de | |
| |
| sub73: | call_expr | | |
| sub74: | jp | sub115 | |
| |
| sub75: | call | sub73 | |
| bit | 7,h | |
| jp | nz,say_how_de | |
| ret | | |
| |
| sub76: | call | sub72 | |
| jr | sub74 | |
| |
| ABS_: | call | sub72 | |
| res | 7,(ix-001h) | |
| ret | | |
| |
| MEM_: | push | de | |
| ld | de,(freemem) | |
| ld | hl,(memtop) | |
| xor | a | |
| sbc | hl,de | |
| pop | de | |
| jr | _1INT_ | |
| |
| INT_: | call | sub72 | |
| call | sub74 | |
| _1INT_: | jp | sub117 | |
| |
| RESET_: | ld | a,080h | |
| jr | _1POINT_ | |
| |
| SET_: | ld | a,001h | |
| jr | _1POINT_ | |
| |
| POINT_: | ld | a,000h | |
| _1POINT_: | and | a | |
| push | af | |
| rst | lkchar | |
| defb | '(',_6POINT_-$-1 | |
| call | sub75 | |
| push | hl | |
| rst | lkchar | |
| defb | ',',_6POINT_-$-1 | |
| call | sub75 | |
| rst | lkchar | |
| defb | ')',_6POINT_-$-1 | |
| ld | bc,sub07 | |
| and | a | |
| _2POINT_: | sbc | hl,bc | |
| jr | nc,_2POINT_ | |
| add | hl,bc | |
| ld | a,l | |
| ld | h,0ffh | |
| _3POINT_: | inc | h | |
| sub | 003h | |
| jr | nc,_3POINT_ | |
| add | a,003h | |
| pop | bc | |
| ld | b,h | |
| sla | c | |
| rr | b | |
| rr | c | |
| rr | b | |
| rr | c | |
| rla | | |
| inc | a | |
| scf | | |
| ld | h,000h | |
| _4POINT_: | rl | h | |
| dec | a | |
| jr | nz,_4POINT_ | |
| ld | a,b | |
| or | 0fch | |
| and | 03fh | |
| ld | b,a | |
| ld | a,(bc) | |
| bit | 7,a | |
| jr | nz,_5POINT_ | |
| ld | a,080h | |
| ld | (bc),a | |
| _5POINT_: | pop | af | |
| ld | a,(bc) | |
| jr | z,_7POINT_ | |
| jp | p,_9POINT_ | |
| ld | a,h | |
| cpl | | |
| ld | h,a | |
| ld | a,(bc) | |
| and | h | |
| ld | (bc),a | |
| rst | sub07 | |
| _6POINT_: | jr | say_what_de | |
| |
| _7POINT_: | and | h | |
| ld | hl,0 | |
| jr | z,_8POINT_ | |
| inc | l | |
| _8POINT_: | jp | sub117 | |
| |
| _9POINT_: | or | h | |
| ld | (bc),a | |
| rst | sub07 | |
| sub83: | rst | lkvar | |
| jr | c,say_what_de | |
| rst | lkchar | |
| defb | '=',say_what_de-$-1 | |
| _1sub83: | push | hl | |
| call_expr | | |
| jp | _1sub113 | |
| |
| sub84: | rst | lkchar | |
| defb | ':',_1sub84-$-1 | |
| pop | af | |
| jp | statement | |
| |
| _1sub84: | rst | lkchar | |
| defb | 00dh,_2sub84-$-1 | |
| pop | af | |
| jp | _1RUN_ | |
| |
| _2sub84: | ret | | |
| |
| getintEOL: | call | getint | |
| checkEOL: | rst | skipspace | |
| cp | 00dh | |
| ret | z | |
| say_what_de: | push | de | |
| say_what: | ld | de,msg_WHAT | |
| errmsg: | | | |
| if | model == 3 | |
| xor | a | |
| ld | (outdev),a | |
| endif | | |
| call | print | |
| ld | de,(cur_line) | |
| ld | a,d | |
| or | e | |
| jr | z,ready2 | |
| inc | de | |
| ld | a,(de) | |
| dec | de | |
| or | a | |
| jp | m,_1statement2 | |
| pop | hl | |
| ld | a,(hl) | |
| push | af | |
| sub | a | |
| ld | (hl),a | |
| call | sub104 | |
| dec | de | |
| pop | af | |
| ld | (de),a | |
| ld | a,03fh | |
| rst | putch | |
| sub | a | |
| call | print | |
| ready2: | jp | ready | |
| |
| say_sorry_de: | push | de | |
| say_sorry: | ld | de,msg_SORRY | |
| jr | errmsg | |
| |
| getline: | ld | a,03eh | |
| sub93: | | | |
| if | model == 1 | |
| rst | putch | |
| endif | | |
| if | model == 3 | |
| rst | vidputc | |
| endif | | |
| |
| ld | de,input_buffer | |
| _1sub93: | call | kbscan | |
| jr | z,_1sub93 | |
| cp | 00dh | |
| jr | z,_2sub93 | |
| cp | 01dh | |
| jr | z,_3sub93 | |
| cp | 003h | |
| jr | z,ready2 | |
| cp | 020h | |
| jr | c,_1sub93 | |
| _2sub93: | ld | (de),a | |
| inc | de | |
| cp | 00dh | |
| ret | z | |
| ld | a,e | |
| cp | 0f3h | |
| jr | nz,_1sub93 | |
| ld | a,01dh | |
| rst | putch | |
| _3sub93: | ld | a,e | |
| cp | 0ach | |
| jr | z,getline | |
| dec | de | |
| jr | _1sub93 | |
| |
| findline: | ld | de,basic_mem | |
| findlineDE: | push | hl | |
| ld | a,d | |
| cp | 042h | |
| jr | c,ready2 | |
| ld | hl,(freemem) | |
| dec | hl | |
| rst | cpHL_DE | |
| pop | hl | |
| ret | c | |
| ld | a,(de) | |
| sub | l | |
| ld | b,a | |
| inc | de | |
| ld | a,(de) | |
| sbc | a,h | |
| jr | c,_1skipfindHL | |
| dec | de | |
| or | b | |
| ret | | |
| |
| skipfindHL: | inc | de | |
| _1skipfindHL: | inc | de | |
| eolfindHL: | ld | a,(de) | |
| cp | 00dh | |
| jr | nz,_1skipfindHL | |
| inc | de | |
| jr | findlineDE | |
| |
| print: | xor | a | |
| sub99: | ld | b,a | |
| _1sub99: | ld | a,(de) | |
| inc | de | |
| cp | b | |
| ret | z | |
| rst | putch | |
| cp | 00dh | |
| jr | nz,_1sub99 | |
| ret | | |
| |
| strlit: | rst | lkchar | |
| defb | '"',_1strlit-$-1 | |
| ld | a,022h | |
| call | sub99 | |
| cp | 00dh | |
| pop | hl | |
| jp | z,_1RUN_ | |
| inc | hl | |
| inc | hl | |
| jp | (hl) | |
| |
| _1strlit: | ret | | |
| |
| sub101: | call | sub117 | |
| sub102: | push | de | |
| push | bc | |
| push | hl | |
| ld | a,(ix-002h) | |
| cp | 080h | |
| jr | nz,_1sub102 | |
| ld | a,020h | |
| rst | putch | |
| ld | a,030h | |
| rst | putch | |
| jp | _18sub102 | |
| |
| _1sub102: | ld | a,(ix-001h) | |
| and | a | |
| ld | a,020h | |
| jr | z,_2sub102 | |
| ld | a,02dh | |
| _2sub102: | rst | putch | |
| xor | a | |
| ld | (ix-001h),a | |
| ld | a,0ffh | |
| _3sub102: | push | af | |
| ld | hl,_2rand | |
| call | sub124 | |
| jr | nc,_4sub102 | |
| call | sub120 | |
| pop | af | |
| dec | a | |
| jr | _3sub102 | |
| |
| _4sub102: | ld | hl,_1rand | |
| call | sub124 | |
| jr | c,_5sub102 | |
| call | sub122 | |
| pop | af | |
| inc | a | |
| push | af | |
| jr | _4sub102 | |
| |
| _5sub102: | ld | a,(ix-002h) | |
| neg | | |
| _6sub102: | jr | z,_7sub102 | |
| exx | | |
| srl | c | |
| rr | h | |
| rr | l | |
| exx | | |
| dec | a | |
| jr | _6sub102 | |
| |
| _7sub102: | ld | b,007h | |
| push | ix | |
| pop | hl | |
| ld | (hl),000h | |
| inc | hl | |
| _8sub102: | ld | a,000h | |
| call | shiftdig | |
| exx | | |
| ld | a,b | |
| exx | | |
| ld | (hl),a | |
| inc | hl | |
| djnz | _8sub102 | |
| ld | b,006h | |
| ld | c,000h | |
| dec | hl | |
| ld | a,(hl) | |
| cp | 005h | |
| _9sub102: | ccf | | |
| ld | a,000h | |
| dec | hl | |
| adc | a,(hl) | |
| sla | c | |
| cp | 00ah | |
| jr | c,_10sub102 | |
| ld | a,000h | |
| _10sub102: | ld | (hl),a | |
| push | af | |
| and | a | |
| jr | z,_11sub102 | |
| set | 0,c | |
| _11sub102: | pop | af | |
| djnz | _9sub102 | |
| ld | a,c | |
| pop | bc | |
| jr | c,_12sub102 | |
| inc | b | |
| push | bc | |
| ld | b,001h | |
| jr | _9sub102 | |
| |
| _12sub102: | ld | c,a | |
| ld | a,b | |
| inc | a | |
| jp | m,_13sub102 | |
| cp | 007h | |
| jr | nc,_13sub102 | |
| ld | b,a | |
| call | sub103 | |
| jr | _18sub102 | |
| |
| _13sub102: | push | bc | |
| ld | b,001h | |
| call | sub103 | |
| ld | a,045h | |
| rst | putch | |
| pop | bc | |
| bit | 7,b | |
| ld | a,02bh | |
| jr | z,_14sub102 | |
| ld | a,02dh | |
| rst | putch | |
| ld | a,b | |
| neg | | |
| jr | _15sub102 | |
| |
| _14sub102: | rst | putch | |
| ld | a,b | |
| _15sub102: | ld | b,000h | |
| _16sub102: | cp | 00ah | |
| jr | c,_17sub102 | |
| add | a,0f6h | |
| inc | b | |
| jr | _16sub102 | |
| |
| _17sub102: | or | 030h | |
| ld | c,a | |
| ld | a,b | |
| or | 030h | |
| rst | putch | |
| ld | a,c | |
| rst | putch | |
| _18sub102: | ld | a,020h | |
| rst | putch | |
| pop | hl | |
| pop | bc | |
| pop | de | |
| ld | bc,-5 | |
| add | ix,bc | |
| ret | | |
| |
| sub103: | inc | b | |
| _1sub103: | dec | b | |
| jr | nz,_2sub103 | |
| ld | a,02eh | |
| rst | putch | |
| _2sub103: | ld | a,(hl) | |
| or | 030h | |
| rst | putch | |
| inc | hl | |
| srl | c | |
| jr | nz,_1sub103 | |
| dec | b | |
| dec | b | |
| ret | m | |
| inc | b | |
| jr | sub103 | |
| |
| sub104: | ld | a,(de) | |
| ld | l,a | |
| inc | de | |
| ld | a,(de) | |
| ld | h,a | |
| inc | de | |
| call | sub101 | |
| jp | print | |
| |
| copyDEtoBC: | rst | cpHL_DE | |
| ret | z | |
| ld | a,(de) | |
| ld | (bc),a | |
| inc | de | |
| inc | bc | |
| jr | copyDEtoBC | |
| |
| copyDEtoHL: | ld | a,b | |
| sub | d | |
| jr | nz,_1copyDEtoHL | |
| ld | a,c | |
| sub | e | |
| ret | z | |
| _1copyDEtoHL: | dec | de | |
| dec | hl | |
| ld | a,(de) | |
| ld | (hl),a | |
| jr | copyDEtoHL | |
| |
| sub107: | pop | bc | |
| pop | hl | |
| ld | (for_sp),hl | |
| ld | a,h | |
| or | l | |
| jr | z,_1sub107 | |
| pop | hl | |
| ld | (for_a),hl | |
| pop | hl | |
| ld | (for_to),hl | |
| pop | hl | |
| ld | (for_b),hl | |
| pop | hl | |
| ld | (for_c),hl | |
| _1sub107: | push | bc | |
| ret | | |
| |
| sub108: | ld | hl,input_buffer+212 | |
| ld | a,h | |
| cpl | | |
| ld | h,a | |
| ld | a,l | |
| cpl | | |
| ld | l,a | |
| inc | hl | |
| pop | bc | |
| add | hl,sp | |
| jp | nc,say_sorry_de | |
| ld | hl,(for_sp) | |
| ld | a,h | |
| or | l | |
| jr | z,_1sub108 | |
| ld | hl,(for_c) | |
| push | hl | |
| ld | hl,(for_b) | |
| push | hl | |
| ld | hl,(for_to) | |
| push | hl | |
| ld | hl,(for_a) | |
| push | hl | |
| ld | hl,(for_sp) | |
| _1sub108: | push | hl | |
| push | bc | |
| ret | | |
| |
| cont_putch: | | | |
| if | model == 1 | |
| jr | z,vdchar | |
| endif | | |
| if | model == 3 | |
| exx | | |
| jr | z,not_casputc | |
| endif | | |
| |
| ex | af,af' | |
| ld | de,(pnum_ptr) | |
| ld | (de),a | |
| inc | de | |
| ld | (pnum_ptr),de | |
| cp | 00dh | |
| exx | | |
| ret | nz | |
| push | de | |
| exx | | |
| ld | hl,input_buffer | |
| call | caswriteblock | |
| pop | de | |
| ret | | |
| |
| if | model == 3 | |
| not_casputc: | ld | a,(outdev) | |
| and | a | |
| jr | z,vdchar | |
| lputc: | in | a,(0f8h) | |
| and | 0f0h | |
| cp | 030h | |
| jr | nz,lputc | |
| ex | af,af' | |
| out | (0f8h),a | |
| exx | | |
| ret | | |
| endif | | |
| |
| vdchar: | ld | hl,(cursor) | |
| ex | af,af' | |
| push | af | |
| cp | 020h | |
| jp | m,vdctlchar | |
| ld | (hl),a | |
| inc | hl | |
| checkscroll: | ld | a,h | |
| cp | 040h | |
| jr | nz,showcursor | |
| ld | de,03c00h | |
| ld | hl,03c40h | |
| ld | bc,03c0h | |
| ldir | | |
| ex | de,hl | |
| call | cleartoEOL | |
| ld | hl,03fc0h | |
| showcursor: | ld | (hl),05fh | |
| ld | (cursor),hl | |
| pop | af | |
| exx | | |
| ret | | |
| |
| vdctlchar: | cp | 00dh | |
| jr | nz,not_newline | |
| call | cleartoEOL | |
| jr | checkscroll | |
| |
| not_newline: | cp | 00ch | |
| jr | nz,not_cls | |
| ld | hl,03c00h | |
| linelp: | call | cleartoEOL | |
| ld | a,h | |
| cp | 040h | |
| jr | nz,linelp | |
| ld | hl,03c00h | |
| jr | showcursor | |
| |
| not_cls: | cp | 01dh | |
| jr | nz,showcursor | |
| ld | (hl),020h | |
| dec | hl | |
| jr | showcursor | |
| |
| cleartoEOL: | ld | (hl),020h | |
| inc | hl | |
| ld | a,l | |
| and | 03fh | |
| jr | nz,cleartoEOL | |
| ret | | |
| |
| kbscan: | ld | a,(0387fh) | |
| and | a | |
| ret | z | |
| exx | | |
| call | get_key | |
| exx | | |
| rst | putch | |
| and | a | |
| push | af | |
| wait_release: | ld | a,(0387fh) | |
| and | a | |
| jr | nz,wait_release | |
| pop | af | |
| ret | | |
| |
| get_key: | ld | b,0ffh | |
| delay: | djnz | delay | |
| ld | de,keycolstart | |
| ld | hl,03801h | |
| ld | a,000h | |
| scan_row: | or | (hl) | |
| jr | nz,got_key | |
| inc | e | |
| sla | l | |
| jp | p,scan_row | |
| exx | | |
| pop | af | |
| jr | kbscan | |
| |
| got_key: | ex | de,hl | |
| ld | b,(hl) | |
| scan_column: | inc | b | |
| srl | a | |
| jr | nz,scan_column | |
| ld | a,b | |
| cp | 040h | |
| jr | nc,alpha_key | |
| cp | 03ch | |
| jr | nc,at_key_misc | |
| cp | 030h | |
| jr | nc,digit_colon_semi | |
| ld | hl,specialkeys | |
| find_special: | inc | hl | |
| dec | b | |
| jr | nz,find_special | |
| ld | b,(hl) | |
| call | check_shift | |
| ret | nz | |
| and | 03fh | |
| ret | | |
| |
| alpha_key: | call | check_shift | |
| ret | z | |
| and | 03fh | |
| ret | | |
| |
| digit_colon_semi: | | | |
| call | check_shift | |
| ret | z | |
| maskit: | and | 02fh | |
| ret | | |
| |
| at_key_misc: | call | check_shift | |
| ret | nz | |
| jr | maskit | |
| |
| check_shift: | ld | a,(03880h) | |
| and | a | |
| ld | a,b | |
| ret | | |
| |
| def_keycol | macro | | |
| keycolstart: | ascii | '?' | |
| ascii | 'G' | |
| ascii | 'O' | |
| ascii | 'W' | |
| ascii | '/' | |
| ascii | '7' | |
| specialkeys: | ascii | 0 | |
| ascii | 13 | |
| ascii | 12 | |
| ascii | 3 | |
| ascii | '[' | |
| ascii | 92 | |
| ascii | ']' | |
| ascii | '^' | |
| ascii | ' ' | |
| endm | | |
| |
| if | model == 1 | |
| ret | | |
| |
| def_keycol | | |
| endif | | |
| |
| if | model == 3 | |
| def_print_tok | | |
| endif | | |
| |
| data_tok: | ascii | 'DATA' | |
| drow | DATA_|8000h | |
| drow | find_data|8000h | |
| sub113: | push | de | |
| push | hl | |
| push | af | |
| ld | bc,4 | |
| push | ix | |
| pop | de | |
| ldir | | |
| rl | (ix+002h) | |
| rl | (ix+003h) | |
| ld | a,b | |
| rra | | |
| ld | (ix+004h),a | |
| scf | | |
| rr | (ix+002h) | |
| ld | c,005h | |
| add | ix,bc | |
| pop | af | |
| pop | hl | |
| pop | de | |
| ret | | |
| |
| _1sub113: | pop | hl | |
| sub114: | ld | bc,-5 | |
| add | ix,bc | |
| ld | bc,4 | |
| push | de | |
| push | hl | |
| ex | de,hl | |
| push | ix | |
| pop | hl | |
| ldir | | |
| ex | de,hl | |
| dec | hl | |
| dec | hl | |
| rl | (hl) | |
| inc | hl | |
| ld | a,(ix+004h) | |
| rla | | |
| rr | (hl) | |
| dec | hl | |
| rr | (hl) | |
| pop | hl | |
| pop | de | |
| ret | | |
| |
| sub115: | exx | | |
| ld | bc,-5 | |
| add | ix,bc | |
| ld | de,0 | |
| ld | a,(ix+003h) | |
| ld | c,(ix+004h) | |
| cp | 080h | |
| jr | z,_6sub115 | |
| cp | 001h | |
| jp | m,_1sub115 | |
| cp | 010h | |
| jp | m,_2sub115 | |
| exx | | |
| jp | say_how_de | |
| |
| _1sub115: | ld | a,0ffh | |
| jr | _4sub115 | |
| |
| _2sub115: | ld | b,a | |
| ld | a,(ix+000h) | |
| ld | l,(ix+001h) | |
| ld | h,(ix+002h) | |
| _3sub115: | sla | a | |
| rl | l | |
| rl | h | |
| rl | e | |
| rl | d | |
| djnz | _3sub115 | |
| _4sub115: | sla | c | |
| jr | nc,_6sub115 | |
| or | h | |
| or | l | |
| jr | z,_5sub115 | |
| inc | de | |
| _5sub115: | call | sub119 | |
| _6sub115: | push | de | |
| exx | | |
| pop | hl | |
| ret | | |
| |
| sub116: | ld | hl,10 | |
| sub117: | push | de | |
| ex | de,hl | |
| ld | bc,10 | |
| add | ix,bc | |
| call | sub118 | |
| push | de | |
| ld | h,000h | |
| rr | h | |
| ld | l,010h | |
| exx | | |
| pop | de | |
| ld | l,000h | |
| ld | h,e | |
| ld | c,d | |
| call | normCHL | |
| jr | _1sub123 | |
| |
| sub118: | xor | a | |
| add | a,d | |
| ret | p | |
| sub119: | ld | a,e | |
| neg | | |
| ld | e,a | |
| ld | a,d | |
| cpl | | |
| ccf | | |
| adc | a,000h | |
| ld | d,a | |
| scf | | |
| ret | | |
| |
| sub120: | call | sub116 | |
| sub121: | call | sub136 | |
| jr | z,_2sub126 | |
| cp | e | |
| jp | z,_2sub128 | |
| call | sub129 | |
| jr | _1sub123 | |
| |
| sub122: | call | sub116 | |
| sub123: | call | sub136 | |
| jr | z,_2sub126 | |
| cp | e | |
| jp | z,say_how | |
| call | sub130 | |
| _1sub123: | jr | _3sub128 | |
| |
| sub124: | call | sub113 | |
| call | sub136 | |
| ld | bc,-5 | |
| jr | _1sub125 | |
| |
| sub125: | call | sub136 | |
| ld | bc,-10 | |
| _1sub125: | add | ix,bc | |
| cp | l | |
| call | sub131 | |
| pop | de | |
| ret | | |
| |
| sub126: | call | sub136 | |
| jr | nz,_1sub126 | |
| call | sub128 | |
| jr | _4sub127 | |
| |
| _1sub126: | cp | e | |
| _2sub126: | jr | z,_4sub128 | |
| xor | d | |
| ld | d,a | |
| jr | _1sub127 | |
| |
| if | model == 1 | |
| call | sub113 | |
| endif | | |
| |
| sub127: | call | sub136 | |
| jr | z,_1sub128 | |
| cp | e | |
| jr | z,_4sub128 | |
| _1sub127: | call | sub132 | |
| jr | z,_3sub127 | |
| jr | nc,_2sub127 | |
| ex | de,hl | |
| exx | | |
| ex | de,hl | |
| ld | a,c | |
| ld | c,b | |
| ld | b,a | |
| exx | | |
| _2sub127: | call | sub133 | |
| jr | _3sub128 | |
| |
| _3sub127: | ld | a,h | |
| xor | d | |
| jr | nz,_2sub128 | |
| ld | e,001h | |
| call | sub134 | |
| jr | _3sub128 | |
| |
| _4sub127: | ld | a,(ix-001h) | |
| xor | 080h | |
| ld | (ix-001h),a | |
| pop | de | |
| ret | | |
| |
| sub128: | push | de | |
| _1sub128: | ld | h,d | |
| ld | l,e | |
| exx | | |
| ld | l,e | |
| ld | h,d | |
| ld | c,b | |
| exx | | |
| jr | _3sub128 | |
| |
| _2sub128: | ld | l,080h | |
| _3sub128: | ld | (ix-006h),h | |
| ld | (ix-007h),l | |
| exx | | |
| ld | (ix-00ah),l | |
| ld | (ix-009h),h | |
| ld | (ix-008h),c | |
| exx | | |
| _4sub128: | ld | bc,-5 | |
| add | ix,bc | |
| pop | de | |
| ret | | |
| |
| sub129: | ld | a,h | |
| xor | d | |
| ld | h,a | |
| dec | e | |
| push | hl | |
| push | bc | |
| ld | b,018h | |
| ld | l,(ix-00ah) | |
| ld | h,(ix-009h) | |
| ld | c,(ix-008h) | |
| exx | | |
| xor | a | |
| ld | l,a | |
| ld | h,a | |
| ld | c,a | |
| _1sub129: | exx | | |
| srl | c | |
| rr | h | |
| rr | l | |
| exx | | |
| jr | nc,_2sub129 | |
| add | hl,de | |
| ld | a,c | |
| adc | a,b | |
| ld | c,a | |
| _2sub129: | exx | | |
| djnz | _3sub129 | |
| pop | bc | |
| pop | hl | |
| exx | | |
| jr | _3sub130 | |
| |
| _3sub129: | exx | | |
| rr | c | |
| rr | h | |
| rr | l | |
| jr | _1sub129 | |
| |
| sub130: | ld | a,e | |
| neg | | |
| ld | e,a | |
| ld | a,h | |
| xor | d | |
| ld | h,a | |
| push | hl | |
| push | bc | |
| ld | b,019h | |
| exx | | |
| _1sub130: | sbc | hl,de | |
| ld | a,c | |
| sbc | a,b | |
| ld | c,a | |
| jr | nc,_2sub130 | |
| add | hl,de | |
| adc | a,b | |
| ld | c,a | |
| _2sub130: | exx | | |
| ccf | | |
| adc | hl,hl | |
| rl | c | |
| djnz | _4sub130 | |
| push | hl | |
| push | bc | |
| exx | | |
| pop | bc | |
| pop | hl | |
| exx | | |
| pop | bc | |
| pop | hl | |
| exx | | |
| _3sub130: | jr | _3sub133 | |
| |
| _4sub130: | exx | | |
| add | hl,hl | |
| rl | c | |
| jr | nc,_1sub130 | |
| ccf | | |
| sbc | hl,de | |
| ld | a,c | |
| sbc | a,b | |
| ld | c,a | |
| or | a | |
| jr | _2sub130 | |
| |
| sub131: | jr | z,_1sub131 | |
| cp | e | |
| jr | z,_3sub131 | |
| ld | a,h | |
| xor | d | |
| call | z,sub132 | |
| jr | _2sub131 | |
| |
| _1sub131: | cp | e | |
| ret | z | |
| scf | | |
| bit | 7,d | |
| jr | _4sub131 | |
| |
| _2sub131: | ret | z | |
| _3sub131: | bit | 7,h | |
| _4sub131: | jr | nz,_5sub131 | |
| rra | | |
| scf | | |
| rl | a | |
| ret | | |
| |
| _5sub131: | ccf | | |
| ret | | |
| |
| sub132: | ld | a,l | |
| sub | e | |
| jr | z,_2sub132 | |
| jp | po,_1sub132 | |
| neg | | |
| _1sub132: | rlca | | |
| ret | | |
| |
| _2sub132: | exx | | |
| ld | a,c | |
| cp | b | |
| jr | nz,_3sub132 | |
| ld | a,h | |
| cp | d | |
| jr | nz,_3sub132 | |
| ld | a,l | |
| cp | e | |
| _3sub132: | exx | | |
| ret | | |
| |
| sub133: | ld | a,l | |
| sub | e | |
| jr | z,_2sub133 | |
| cp | 018h | |
| ret | nc | |
| exx | | |
| _1sub133: | srl | b | |
| rr | d | |
| rr | e | |
| dec | a | |
| jr | nz,_1sub133 | |
| exx | | |
| _2sub133: | ld | e,000h | |
| ld | a,h | |
| xor | d | |
| jp | m,_2sub134 | |
| exx | | |
| add | hl,de | |
| ld | a,c | |
| adc | a,b | |
| ld | c,a | |
| _3sub133: | jr | nc,_4sub133 | |
| rr | c | |
| rr | h | |
| rr | l | |
| scf | | |
| _4sub133: | exx | | |
| sub134: | ld | a,l | |
| adc | a,e | |
| _1sub134: | jp | pe,_4normCHL | |
| ld | l,a | |
| ret | | |
| |
| _2sub134: | exx | | |
| sbc | hl,de | |
| ld | a,c | |
| sbc | a,b | |
| ld | c,a | |
| normCHL: | ld | b,018h | |
| xor | a | |
| inc | c | |
| dec | c | |
| _1normCHL: | jp | m,_3normCHL | |
| dec | a | |
| add | hl,hl | |
| rl | c | |
| djnz | _1normCHL | |
| _2normCHL: | ld | l,080h | |
| ret | | |
| |
| _3normCHL: | exx | | |
| add | a,l | |
| jr | _1sub134 | |
| |
| _4normCHL: | ld | a,h | |
| or | a | |
| jp | m,_2normCHL | |
| pop | af | |
| jp | say_how | |
| |
| sub136: | pop | hl | |
| push | de | |
| push | hl | |
| ld | d,(ix-001h) | |
| ld | e,(ix-002h) | |
| exx | | |
| ld | e,(ix-005h) | |
| ld | d,(ix-004h) | |
| ld | b,(ix-003h) | |
| exx | | |
| ld | h,(ix-006h) | |
| ld | l,(ix-007h) | |
| exx | | |
| ld | l,(ix-00ah) | |
| ld | h,(ix-009h) | |
| ld | c,(ix-008h) | |
| exx | | |
| ld | a,080h | |
| cp | l | |
| ret | | |
| |
| RND_: | call | sub76 | |
| ld | a,h | |
| or | l | |
| jp | z,sub138 | |
| bit | 7,h | |
| jp | nz,say_how_de | |
| call | sub117 | |
| call | sub138 | |
| call | sub121 | |
| call | sub115 | |
| inc | hl | |
| jp | sub117 | |
| |
| sub138: | push | de | |
| exx | | |
| ld | hl,rnd_seed | |
| ld | e,(hl) | |
| inc | hl | |
| ld | d,(hl) | |
| inc | hl | |
| ld | b,(hl) | |
| exx | | |
| call | clr24b | |
| ld | hl,rand | |
| ld | c,003h | |
| _1sub138: | ld | b,008h | |
| ld | d,(hl) | |
| _2sub138: | exx | | |
| add | hl,hl | |
| rl | c | |
| exx | | |
| rl | d | |
| jr | nc,_3sub138 | |
| exx | | |
| add | hl,de | |
| ld | a,c | |
| adc | a,b | |
| ld | c,a | |
| exx | | |
| _3sub138: | djnz | _2sub138 | |
| inc | hl | |
| dec | c | |
| jr | nz,_1sub138 | |
| ld | hl,0 | |
| exx | | |
| ld | de,rnd_seed | |
| ld | a,l | |
| add | a,065h | |
| ld | (de),a | |
| inc | de | |
| ld | l,a | |
| ld | a,h | |
| adc | a,0b0h | |
| ld | (de),a | |
| inc | de | |
| ld | h,a | |
| ld | a,c | |
| adc | a,005h | |
| ld | (de),a | |
| ld | c,a | |
| call | normCHL | |
| ld | bc,10 | |
| add | ix,bc | |
| jp | _3sub128 | |
| |
| rand: | defb | 040h | |
| defb | 0e6h | |
| defb | 04dh | |
| _1rand: | defb | 000h | |
| defb | 000h | |
| defb | 080h | |
| defb | 000h | |
| _2rand: | defb | 0cch | |
| defb | 0cch | |
| defb | 0cch | |
| sub140: | ld | a,(hl) | |
| sub141: | call | getint | |
| ret | nz | |
| say_what_de3: | jp | say_what_de | |
| |
| getint: | call | clr24b | |
| ld | hl,0 | |
| ld | b,l | |
| rst | skipspace | |
| _1getint: | call | getdig | |
| jr | c,_3getint | |
| inc | b | |
| call | shiftdig | |
| jr | nc,_1getint | |
| _2getint: | jp | say_how_de | |
| |
| _3getint: | exx | | |
| push | hl | |
| ld | a,c | |
| bit | 7,h | |
| exx | | |
| pop | hl | |
| jr | nz,_2getint | |
| and | a | |
| jr | nz,_2getint | |
| ld | a,b | |
| and | a | |
| ret | | |
| |
| CLOAD_: | call | casloadblock | |
| ld | (freemem),hl | |
| jr | nz,say_what_de3 | |
| ready3: | jp | ready | |
| |
| casloadblock: | call | cton | |
| push | de | |
| xor | a | |
| _1casloadblock: | call | getbit | |
| cp | 0a5h | |
| jr | nz,_1casloadblock | |
| ld | a,02ah | |
| ld | (03c00h),a | |
| ld | (03c01h),a | |
| call | gtbyte | |
| ld | d,a | |
| call | gtbyte | |
| ld | e,a | |
| call | gtbyte | |
| ld | h,a | |
| call | gtbyte | |
| ld | l,a | |
| ld | c,000h | |
| _2casloadblock: | call | gtbyte | |
| ld | (de),a | |
| inc | de | |
| cp | 00dh | |
| jr | nz,_3casloadblock | |
| push | af | |
| ld | a,(03c01h) | |
| xor | 00ah | |
| ld | (03c01h),a | |
| pop | af | |
| _3casloadblock: | add | a,c | |
| ld | c,a | |
| rst | cpHL_DE | |
| jr | nc,_2casloadblock | |
| push | hl | |
| call | ctoff | |
| pop | hl | |
| pop | de | |
| ld | a,c | |
| and | a | |
| ret | | |
| |
| CSAVE_: | call | cton | |
| ld | hl,basic_mem | |
| ld | de,(freemem) | |
| call | caswriteblock | |
| if | model == 1 | |
| jp | ready | |
| endif | | |
| if | model == 3 | |
| jp | ready3 | |
| endif | | |
| |
| if | model == 1 | |
| caswriteblock: | ld | a,080h | |
| push | bc | |
| _1caswriteblock: | | | |
| ex | af,af' | |
| xor | a | |
| call | putbyte | |
| ex | af,af' | |
| dec | a | |
| jr | nz,_1caswriteblock | |
| endif | | |
| |
| if | model == 3 | |
| caswriteblock: | ld | b,080h | |
| _1caswriteblock: | | | |
| xor | a | |
| call | putbyte | |
| djnz | _1caswriteblock | |
| endif | | |
| |
| ld | a,0a5h | |
| call | putbyte | |
| ld | a,h | |
| call | putbyte | |
| ld | a,l | |
| call | putbyte | |
| if | model == 1 | |
| pop | bc | |
| endif | | |
| ld | a,d | |
| call | putbyte | |
| ld | a,e | |
| call | putbyte | |
| ld | c,000h | |
| _2caswriteblock: | | | |
| ld | a,(hl) | |
| call | putbyte | |
| inc | hl | |
| rst | cpHL_DE | |
| jr | nz,_2caswriteblock | |
| ld | a,c | |
| neg | | |
| call | putbyte | |
| if | model == 1 | |
| call | ctoff | |
| ret | | |
| endif | | |
| if | model == 3 | |
| jr | ctoff | |
| endif | | |
| |
| if | model == 1 | |
| getbit: | exx | | |
| ex | af,af' | |
| _1getbit: | in | a,(0ffh) | |
| rla | | |
| jr | nc,_1getbit | |
| ld | b,07ch | |
| _2getbit: | djnz | _2getbit | |
| call | gtstat | |
| ld | b,0f8h | |
| _3getbit: | djnz | _3getbit | |
| in | a,(0ffh) | |
| ld | b,a | |
| ex | af,af' | |
| rl | b | |
| rla | | |
| push | af | |
| call | gtstat | |
| pop | af | |
| exx | | |
| ret | | |
| endif | | |
| |
| if | model == 3 | |
| getbit: | exx | | |
| ld | c,a | |
| _1getbit: | in | a,(0ffh) | |
| rla | | |
| jr | nc,_1getbit | |
| ld | b,0bbh | |
| _2getbit: | djnz | _2getbit | |
| out | (0ffh),a | |
| ld | b,000h | |
| _3getbit: | djnz | _3getbit | |
| in | a,(0ffh) | |
| rla | | |
| ld | a,c | |
| rla | | |
| out | (0ffh),a | |
| exx | | |
| ret | | |
| endif | | |
| |
| gtbyte: | ld | b,008h | |
| _1gtbyte: | call | getbit | |
| djnz | _1gtbyte | |
| ret | | |
| |
| putbyte: | exx | | |
| ld | c,008h | |
| ld | d,a | |
| _1putbyte: | call | putbit | |
| rlc | d | |
| jr | nc,_3putbyte | |
| call | putbit | |
| _2putbyte: | dec | c | |
| jr | nz,_1putbyte | |
| ld | a,d | |
| exx | | |
| add | a,c | |
| ld | c,a | |
| ret | | |
| |
| if | model == 1 | |
| _3putbyte: | ld | b,000h | |
| _4putbyte: | djnz | _4putbyte | |
| jr | _2putbyte | |
| |
| putbit: | ld | hl,0fc01h | |
| call | cstat | |
| ld | b,00ah | |
| _1putbit: | djnz | _1putbit | |
| ld | hl,0fc02h | |
| call | cstat | |
| ld | b,00ah | |
| _2putbit: | djnz | _2putbit | |
| ld | hl,0fc00h | |
| call | cstat | |
| ld | b,0dah | |
| _3putbit: | djnz | _3putbit | |
| ret | | |
| |
| ctoff: | ld | hl,0fb00h | |
| jr | cstat | |
| |
| cton: | ld | hl,0ff04h | |
| call | cstat | |
| ret | | |
| |
| gtstat: | ld | hl,0ff00h | |
| cstat: | ld | a,(status) | |
| and | h | |
| or | l | |
| out | (0ffh),a | |
| ld | (status),a | |
| bit | 2,a | |
| ret | | |
| endif | | |
| |
| if | model == 3 | |
| _3putbyte: | ld | b,034h | |
| _4putbyte: | djnz | _4putbyte | |
| _5putbyte: | djnz | _5putbyte | |
| jr | _2putbyte | |
| |
| putbit: | ld | a,001h | |
| out | (0ffh),a | |
| ld | b,012h | |
| _1putbit: | djnz | _1putbit | |
| inc | a | |
| out | (0ffh),a | |
| ld | b,012h | |
| _2putbit: | djnz | _2putbit | |
| xor | a | |
| out | (0ffh),a | |
| ld | b,00dh | |
| _3putbit: | djnz | _3putbit | |
| _4putbit: | djnz | _4putbit | |
| ret | | |
| |
| nop | | |
| nop | | |
| nop | | |
| def_keycol | | |
| ctoff: | ld | a,020h | |
| jr | _1cton | |
| |
| cton: | ld | a,002h | |
| _1cton: | out | (0ech),a | |
| ret | | |
| rws_msg | | |
| endif | | |
| |
| org | 04000h | |
| vA: | defs | 4 | |
| vB: | defs | 4 | |
| vC: | defs | 4 | |
| vD: | defs | 4 | |
| vE: | defs | 4 | |
| vF: | defs | 4 | |
| vG: | defs | 4 | |
| vH: | defs | 4 | |
| vI: | defs | 4 | |
| vJ: | defs | 4 | |
| vK: | defs | 4 | |
| vL: | defs | 4 | |
| vM: | defs | 4 | |
| vN: | defs | 4 | |
| vO: | defs | 4 | |
| vP: | defs | 4 | |
| vQ: | defs | 4 | |
| vR: | defs | 4 | |
| vS: | defs | 4 | |
| vT: | defs | 4 | |
| vU: | defs | 4 | |
| vV: | defs | 4 | |
| vW: | defs | 4 | |
| vX: | defs | 4 | |
| vY: | defs | 4 | |
| vZ: | defs | 4 | |
| cursor: | defs | 2 | |
| memtop: | defs | 2 | |
| freemem: | defs | 2 | |
| for_to: | defs | 2 | |
| stringA: | defs | 16 | |
| stringB: | defs | 16 | |
| |
| if | model == 1 | |
| status: | defs | 1 | |
| endif | | |
| |
| if | model == 3 | |
| outdev: | defs | 1 | |
| endif | | |
| |
| for_a: | defs | 2 | |
| for_b: | defs | 2 | |
| for_c: | defs | 2 | |
| cont_line: | defs | 2 | |
| pnum_ptr: | defs | 2 | |
| tmpish: | defs | 2 | |
| cont_ptr: | defs | 2 | |
| cur_line: | defs | 2 | |
| data_ptr: | defs | 2 | |
| gosub_sp: | defs | 2 | |
| for_sp: | defs | 2 | |
| rnd_seed: | defs | 3 | |
| |
| org | 040ach | |
| input_buffer: | defs | 72 | |
| basic_mem | equ | 04200h | |
| |
| end | sub00 | |